class_docstr: File Decoder based on Gstreamer
  
  Parameters
  ----------
  uri : str
      uri of the media
  start : float, optional
      start time of the segment in seconds
  duration : float, optional
      duration of the segment in seconds
  stack : boolean, optional
      keep decoded data in the stack
  sha1 : boolean, optional
      compute the sha1 hash of the data
  
  
  Examples
  --------
  >>> import timeside
  >>> from timeside.core import get_processor
  >>> from timeside.core.tools.test_samples import samples
  >>> audio_source = samples['sweep.wav']
  >>> FileDecoder = get_processor('file_decoder')  # Get the decoder class
  >>> # Use decoder with default parameters
  >>> decoder = FileDecoder(uri=audio_source)
  >>> analyzer = get_processor('level')()  # Pick a arbitrary analyzer
  >>> pipe =(decoder | analyzer)
  >>> pipe.run()  # Run the pipe for the given audio source
class_docstr_tok: ["File","Decoder","based","on","Gstreamer","Parameters","--","--","--","--","--","uri",":","str","uri","of","the","media","start",":","float",",","optional","start","time","of","the","segment","in","seconds","duration",":","float",",","optional","duration","of","the","segment","in","seconds","stack",":","boolean",",","optional","keep","decoded","data","in","the","stack","sha1",":","boolean",",","optional","compute","the","sha1","hash","of","the","data","Examples","--","--","--","--",">",">",">","import","timeside",">",">",">","from","timeside.core","import","get_processor",">",">",">","from","timeside.core.tools.test_samples","import","samples",">",">",">","audio_source","=","samples","[","'sweep.wav","'","]",">",">",">","FileDecoder","=","get_processor","(","'file_decoder","'",")","#","Get","the","decoder","class",">",">",">","#","Use","decoder","with","default","parameters",">",">",">","decoder","=","FileDecoder","(","uri=audio_source",")",">",">",">","analyzer","=","get_processor","(","'level","'",")","(",")","#","Pick","a","arbitrary","analyzer",">",">",">","pipe","=","(","decoder","|","analyzer",")",">",">",">","pipe.run","(",")","#","Run","the","pipe","for","the","given","audio","source"]
code: def _notify_caps_cb(self, pad, args):
      self.discovered_cond.acquire()
  
      caps = pad.get_current_caps()
      if not caps:
          Gst.info("no negotiated caps available")
          self.discovered = True
          self.discovered_cond.notify()
          self.discovered_cond.release()
          return
      # the caps are fixed
      # We now get the total length of that stream
      q = Gst.Query.new_duration(Gst.Format.TIME)
      Gst.info("sending duration query")
      if pad.get_peer().query(q):
          parsed_format, length = q.parse_duration()
          if parsed_format == Gst.Format.TIME:
              Gst.info(
                  "got duration (time) : %s" % (Gst.TIME_ARGS(length),)
              )
          else:
              Gst.info(
                  "got duration : %d [format:%d]"
                  % (length, parsed_format)
              )
      else:
          length = -1
          Gst.warning("duration query failed")
  
      # We store the caps and length in the proper location
      if "audio" in caps.to_string():
          self.input_samplerate = caps[0]["rate"]
          if not self.output_samplerate:
              self.output_samplerate = self.input_samplerate
          self.input_channels = caps[0]["channels"]
          if not self.output_channels:
              self.output_channels = self.input_channels
          self.input_duration = length / Gst.SECOND
  
          self.input_totalframes = int(
              self.input_duration * self.input_samplerate
          )
          if "x-raw-float" in caps.to_string():
              self.input_width = caps[0]["width"]
          else:
              self.input_width = caps[0]["depth"]
  
      self.discovered = True
      self.discovered_cond.notify()
      self.discovered_cond.release()
  
imports: from __future__ import division
  from timeside.core.decoder import Decoder, IDecoder, implements, interfacedoc
  from timeside.core.tools.gstutils import MainloopThread, GLib, Gst
  from timeside.core.tools.gstutils import gst_buffer_to_numpy_array
  import threading
  from timeside.plugins.decoder.utils import get_uri, get_media_uri_info, stack, get_sha1
  import numpy
label_desc: Use image node_id 5 for calling the FileDecoder obj's underlying member method code with example usage: obj._notify_caps_cb(pad, args) without return types