[gst-devel] plugin porting to 0.9

Wim Taymans wim at fluendo.com
Thu May 5 09:51:52 CEST 2005

Hi guys,

Over the last weeks I mostly started doing base classes to help
the base plugins (gst-plugins-base module in CVS).
The goal is there to abstract most of the complicated functionality in a
base class. This would make similar plugins both easier to develop and
uniform in their working.

Some of the base classes are now very functional and have actual plugins
using them. So, for people who would like to port over 0.8 plugins to
HEAD branch, this is the time to get started and help to speed up the 
porting process.

In gstreamer HEAD there is a new directory gst/base that contains a set
support base classes for various types of elements. They implement the 
minimal requirements for such a type of element in a media agnostic way.

Currently the following classes are implemented:

 - GstBaseSink: base class for all sinks, currently alsasink,
      filesink, fakesink. Does all the prerolling, scheduling and state
      change stuff. Not implemented is a generic way to make it operate
      pull mode. Works very well for all chain based sinks.

 - GstBaseSrc: base class for random access sources, currently filesrc,
      gnomevfssrc, fakesrc. Does all the state change stuff and operates
      in push or pull mode automatically. Handles the seeking and the
      queries. Works very well for random sources.

 - GstBaseTransform: base class for simple transform filters, currently
      identity. It handles all state changes and scheduling stuff. Works
      very well for filters that have the same caps on input as on the
      output pads.

There is a small README in gst/base with some more explanations. I
to document the .h files with the API a bit more in the comming days.

In gst-plugins-base are a few more base classes for media specific

 - GstAudioSink: in gst-libs/gst/audio. Provides open/write/delay/close
      for implementing audio sinks. Works very well, exposes a clock,
      state changes and schedules samples for playback. alsasink is
      with this base class.

 - GstBaseAudioSink: in gst-libs/gst/audio. Provides base class for
      DMA based audio sinks. No implementation of this class is done yet
      the simple GstAudioSink subclasses this class.

 - GstVideoSink: in gst-libs/gst/video. A base class for video sinks.
Does not
      do a lot yet. A nice function for it would be to calculate jitter
      other nice stats. xvimagesink extends this class.

Some other plugins are ported too without using a base class. These

 - theoradec/theoraenc: example video decoder/encoder
 - vorbisenc/dec: example audio decoder/encoder
 - oggmux/oggdemux: example demuxer and muxer.
 - adder: example mixer.
 - ffmpecolorspace/audioconvert: example convertors

some pointers to get started on porting plugins:

  - most filter/decoder/encoder plugins are easy to port as the API did
    change that much in 0.9. I'm talking about chain based plugins here
    is of these types of plugins like 95%). The only thing you need to
    is the signature of the chain function and changing the link
functions to
    setcaps functions. Also take care of the return values of the
    function. You also have to install the event function on the sinkpad
    events are not passed in the chain function anymore. Also beware
    data passing already happens in PAUSED now, so make sure the element
    able to handle data in PAUSED. More advanced porting requires adding
    the STREAM_LOCK and handling flushing (see vorbisdec and theoradec).

  - Demuxers are harder to port over as they can typically work pull or
    based. They also need to perform the seeking in the case they
operate pull 
    based, which requires some specific steps (see oggdemux for now).

  - For porting over muxers one can look at oggmux. A nice base object
to use
    for muxers and mixers is the GstCollectPads object that allows you
    do something when data is queued on all sinkpads.

  - For sinks, the GstBaseSink, Gst(Base)AudioSink or GstVideosink base
    are easy to implement. Most audio and video sinks should therefore

  - For sources, the GstBaseSource class can help. Unfortunatly all
    access sources (filesrc, gnomevfssrc) are already ported, only the
    based sources or non random access sources are left. For those
    a GstPushSource base class needs to be written. After that a 
    GstBaseAudioSource, GstBaseVideoSource etc.. This is next on my TODO
    list. Volunteers are welcome to work on this, of course, let me

Happy porting,


Wim Taymans <wim at fluendo.com>

More information about the gstreamer-devel mailing list