[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
implement
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
more
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
the
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
of
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,
xvimagesink,
      filesink, fakesink. Does all the prerolling, scheduling and state
      change stuff. Not implemented is a generic way to make it operate
in
      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
intend
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
elements.

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

 - GstBaseAudioSink: in gst-libs/gst/audio. Provides base class for
implementing
      DMA based audio sinks. No implementation of this class is done yet
but
      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
and
      other nice stats. xvimagesink extends this class.

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

 - 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
not
    change that much in 0.9. I'm talking about chain based plugins here
(which
    is of these types of plugins like 95%). The only thing you need to
change
    is the signature of the chain function and changing the link
functions to
    setcaps functions. Also take care of the return values of the
_push()
    function. You also have to install the event function on the sinkpad
as
    events are not passed in the chain function anymore. Also beware
that
    data passing already happens in PAUSED now, so make sure the element
is
    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
chain
    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
to
    do something when data is queued on all sinkpads.

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

  - For sources, the GstBaseSource class can help. Unfortunatly all
random
    access sources (filesrc, gnomevfssrc) are already ported, only the
block
    based sources or non random access sources are left. For those
sources
    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
know.


Happy porting,

Wim



-- 
Wim Taymans <wim at fluendo.com>





More information about the gstreamer-devel mailing list