GStreamer1.0

Differences between revisions 15 and 16
Revision 15 as of 2012-06-21 05:02:19
Size: 4234
Editor: 173-14-15-225-Colorado
Comment:
Revision 16 as of 2012-06-21 05:11:07
Size: 4327
Editor: 173-14-15-225-Colorado
Comment:
Deletions are marked like this. Additions are marked like this.
Line 180: Line 180:
And so on. And so on. Some search-and-replace is helpful here, basically:

 {{{
gst.STATE_* => Gst.State.*
}}}

Novacut Wiki Home > GStreamer 1.0

GStreamer 1.0 packages are now available in Ubuntu Quantal. For Ubuntu Precise (12.04 LTS) users, there are back-ported packages available in the GStreamer developers PPA.

Note that GnonLin and GES packages are not yet available for GStreamer 1.0.

Although GStreamer 1.0 is not backward compatible with the GStreamer 0.10 series, it is parallel-installable. So you can safely install GStreamer 1.0 without effect on the many applications using GStreamer 0.10.

Adding PPA for Ubuntu Precise

To use the back-ported packages for Ubuntu 12.04 LTS, add the GStreamer developers PPA like this:

  • sudo apt-add-repository ppa:gstreamer-developers/ppa
    sudo apt-get update

Installing GStreamer 1.0 packages

This should give you all the packages you likely want:

  • sudo apt-get install gstreamer1.0-tools \
        gir1.2-gstreamer-1.0 \
        gir1.2-gst-plugins-base-1.0 \
        gstreamer1.0-plugins-good \
        gstreamer1.0-plugins-ugly \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-libav

Using GStreamer 1.0 from Python

You can use GStreamer 1.0 from Python (2 or 3) using PyGI like this:

  • >>> import gi
    >>> gi.require_version('Gst', '1.0')
    >>> from gi.repository import Gst
    >>> Gst.version()
    (1, 0, 0, 0)

Although currently the default will be Gst 1.0 if available, it's still a good idea to gi.require_version('Gst', '1.0') so that the code will clearly fail if Gst 1.0 isn't available.

The biggest change for Python users will be using the introspected API rather than the static python-gst bindings. However, there are also API changes in the GStreamer itself, although these changes are generally more subtle.

Python Porting Guide

debian/control

You'll have to update your debian/control, of course. So replace:

  • Depends: python-gst0.10

With:

  • Depends: python-gi, gir1.2-gstreamer-1.0, gir1.2-gst-plugins-base-1.0

Imports

Replace:

  • import gobject
    import gst

With:

  • import gi
    gi.require_version('Gst', '1.0')
    from gi.repository import GObject, Gst

After that a bit of search and replace (used with care) can help. Basically:

  • gobject.* => GObject.*
    gst.* => Gst.*

Gst.init()

You should call GObject.threads_init() in your module-scope, right after your imports. Unlike the static bindings, you also need to call Gst.init(). So replace:

  • gobject.threads_init()

With:

  • GObject.threads_init()
    Gst.init(None)

element_factory_make()

Replace:

  • src = gst.element_factory_make('filesrc')

With:

  • src = Gst.ElementFactory.make('filesrc', None)

There is no equivalent to gst.element_link_many(), so replace:

  • gst.element_link_many(one, two, three)

With:

  • one.link(two)
    two.link(three)

pipeline.add(one, two)

Bin.add() can't be overloaded to add multiple elements at once. So replace:

  • pipeline = gst.Pipeline()
    pipeline.add(one, two)

With:

  • pipeline = Gst.Pipeline()
    pipeline.add(one)
    pipeline.add(two)

one.link(two, mycaps)

Replace:

  • one.link(two, mycaps)

With:

  • one.link_filtered(two, mycaps)

STATE_PLAYING

Replace:

  • pipeline.set_state(gst.STATE_PLAYING)

With:

  • pipeline.set_state(Gst.State.PLAYING)

And so on. Some search-and-replace is helpful here, basically:

  • gst.STATE_* => Gst.State.*

GhostPad

You've got to use GhostPad.new(). So replace:

  • ghost = gst.GhostPad('sink', mysinkpad)

With:

  • ghost = Gst.GhostPad.new('sink', mysinkpad)

GStreamer 1.0 Porting Guide

Here's a few general GStreamer 1.0 porting issues, which will be the same regardless which language you use GStreamer from.

decodebin2

The "decodebin2" element has been renamed to "decodebin", and the old "decodebin" element has been removed.

Novacut/GStreamer1.0 (last edited 2014-03-14 20:16:15 by 173-14-15-225-Colorado)