creating custom sink in python fails

Jan Spurný JSpurny at
Tue Oct 27 06:45:10 PDT 2015


I have problem with (probably) python binding for gstreamer-1.0 ( - I was porting some code from gstreamer-0.10 (pygst) to new gstreamer-1.0 and I'm not able to get elements written in python to work. This is minimal working example (python2.7):

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


class MySink(GstBase.BaseSink):
    __gstmetadata__ = ('My Sink', 'Sink', 'Sink', 'foo bar')
    __gsttemplates__  = ("sink",
            Gst.PadDirection.SINK, Gst.PadPresence.ALWAYS,

def plugin_init(plugin, userarg):
    t = GObject.type_register(MySink)
    Gst.Element.register(plugin, 'my_sink', 0, t)
    return True

version = Gst.version()
r = Gst.Plugin.register_static_full(
    version[0], version[1], 'my_plugin', 'my plugin desc',
    plugin_init, '1.0', 'Proprietary', 'abc', 'def', 'ghi', None)

s = MySink()

and it throws a CRITICAL error:

$ ./
(python2:18618): GStreamer-WARNING **: Element factory metadata for 'my_sink' has no valid long-name field
** (python2:18618): CRITICAL **: gst_base_sink_init: assertion 'pad_template != NULL' failedI'm not that worried about the warning, but that CRITICAL error means the element has no sinkpad and can't be linked.

And worst thing - if I remove __gsttemplates__ and __gstmetadata__ completely, NOTHING changes. It seems to me that BaseSink.__init__() doesn't see it.

Does anyone have any idea what I'm doing wrong? Also I would greatly appreciate any documentation, examples or tutorials on python binding for gstreamer-1.0, because I wasn't able to find much

Jan Spurny

More information about the gstreamer-devel mailing list