Decoder
Object Hierarchy:
Description:
[ GIR ( name = "AudioDecoder" ) ]
public abstract class Decoder : Element
This base class is for audio decoders turning encoded data into raw audio samples.
GstAudioDecoder and subclass should cooperate as follows.
Configuration
* Initially, GstAudioDecoder calls start when the decoder element  is activated, which allows subclass to perform any global 
      setup.  Base class (context) parameters can already be set according to subclass  capabilities (or possibly upon receive more information in 
      subsequent  set_format).  * GstAudioDecoder calls set_format to inform subclass of the format  of input audio data 
      that it is about to receive.  While unlikely, it might be called more than once, if changing input  parameters require reconfiguration.  * 
      GstAudioDecoder calls stop at end of all processing.
As of configuration stage, and throughout processing, GstAudioDecoder provides various (context) parameters, e.g. describing the format of output audio data (valid when output caps have been set) or current parsing state. Conversely, subclass can and should configure context to inform base class of its expectation w.r.t. buffer handling.
Data processing
* Base class gathers input data, and optionally allows subclass  to parse this into subsequently manageable (as defined by subclass)  chunks. 
      Such chunks are subsequently referred to as 'frames',  though they may or may not correspond to 1 (or more) audio format frame.  * Input frame 
      is provided to subclass' handle_frame.  * If codec processing results in decoded data, subclass should call  
        gst_audio_decoder_finish_frame to have decoded data pushed  downstream.  * Just prior to actually pushing a buffer downstream,  it is 
      passed to pre_push. Subclass should either use this callback  to arrange for additional downstream pushing or otherwise ensure such
        custom pushing occurs after at least a method call has finished since  setting src pad caps.  * During the parsing process 
      GstAudioDecoderClass will handle both  srcpad and sinkpad events. Sink events will be passed to subclass  if event callback has 
      been provided.
Shutdown phase
* GstAudioDecoder class calls stop to inform the subclass that data  parsing will be stopped.
Subclass is responsible for providing pad template caps for source and sink pads. The pads need to be named "sink" and "src". It also needs to 
      set the fixed caps on srcpad, when the format is ensured. This is typically when base class calls subclass' set_format function, 
      though it might be delayed until calling gst_audio_decoder_finish_frame.
In summary, above process should have subclass concentrating on codec data processing while leaving other matters to base class, such as most 
      notably timestamp handling. While it may exert more control in this area (see e.g. pre_push), it is very much not recommended.
In particular, base class will try to arrange for perfect output timestamps as much as possible while tracking upstream timestamps. To this end, if deviation between the next ideal expected perfect timestamp and upstream exceeds tolerance, then resync to upstream occurs (which would happen always if the tolerance mechanism is disabled).
In non-live pipelines, baseclass can also (configurably) arrange for output buffer aggregation which may help to redue large(r) numbers of small(er) buffers being pushed and processed downstream. Note that this feature is only available if the buffer layout is interleaved. For planar buffers, the decoder implementation is fully responsible for the output buffer size.
On the other hand, it should be noted that baseclass only provides limited seeking support (upon explicit subclass request), as full-fledged support should rather be left to upstream demuxer, parser or alike. This simple approach caters for seeking and duration reporting using estimated input bitrates.
Things that subclass need to take care of:
* Provide pad templates * Set source pad caps when appropriate * Set user-configurable properties to sane defaults for format and implementing codec at hand, and convey some subclass capabilities and expectations in context.
* Accept data in handle_frame and provide encoded results to  gst_audio_decoder_finish_frame. If it is prepared to 
      perform  PLC, it should also accept NULL data in handle_frame and provide for  data for indicated duration.