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 _on_new_buffer_cb(self, sink):
      buf = sink.emit("pull-sample").get_buffer()
      new_array = gst_buffer_to_numpy_array(buf, self.output_channels)
      # print('processing new buffer', new_array.shape)
      if self.last_buffer is None:
          self.last_buffer = new_array
      else:
          self.last_buffer = np.concatenate(
              (self.last_buffer, new_array), axis=0
          )
      while self.last_buffer.shape[0] >= self.output_blocksize:
          new_block = self.last_buffer[: self.output_blocksize]
          self.last_buffer = self.last_buffer[self.output_blocksize :]
          # print('queueing', new_block.shape, 'remaining', self.last_buffer.shape)
          self.queue.put([new_block, False])
  
      return Gst.FlowReturn.OK
  
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 7 for calling the FileDecoder obj's underlying member method code with example usage: obj._on_new_buffer_cb(sink) and returns: Gst