[Bug 686572] New: metadata is not set for inherited elements in python using pygi

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sun Oct 21 05:34:32 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=686572
  GStreamer | gstreamer (core) | 1.x

           Summary: metadata is not set for inherited elements in python
                    using pygi
    Classification: Platform
           Product: GStreamer
           Version: 1.x
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: jan581984 at web.de
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


I'm using the GObject introspection system to write a filter element in python3
for GStreamer 1.0.1. Apparantly using __gstdetails__ to set the metadata in the
class does not work for PyGI anymore and I haven't found an alternative. The
result is, that the element can not be registered, because it has an invalid
'long-name'.

The following code reproduces the error. It contains a passthrough element
inherited from GstBase.BaseTransform. Here the registration fails.

#!/usr/bin/python3

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

GObject.threads_init()
Gst.init(None)

from gi.repository import GstBase

class TestFilter(GstBase.BaseTransform):

    __gstdetails__ = (
        'Test Filter',
        'Generic',
        'Passthrough for all buffers',
        'jan'
    )

    __gsttemplates__ = (
        Gst.PadTemplate.new('src', Gst.PadDirection.SRC,
Gst.PadPresence.ALWAYS, Gst.caps_from_string('ANY')),
        Gst.PadTemplate.new('sink', Gst.PadDirection.SINK,
Gst.PadPresence.ALWAYS, Gst.caps_from_string('ANY'))
    )

    def __init__(self):
        GstBase.BaseTransform.__init__(self)
        self.set_passthrough(True)

    def transform_ip(self, buf):
        print('I am called!')
        return gst.FLOW_OK

def plugin_init(plugin, userarg):
    TestFilterType = GObject.type_register(TestFilter)
    res = Gst.Element.register(plugin, 'testfilter', 0, TestFilterType)
    print('Registered?', res)
    return True

version = Gst.version()
Gst.Plugin.register_static_full(
    version[0],
    version[1],
    'testfilter',
    'passthrough element',
    plugin_init,
    '1.0',
    'LGPL',
    'testfilter',
    'testfilter',
    'http://',
    None
)

output:
>./plugin-test.py

(python3:24992): GStreamer-WARNING **: Element factory metadata for
'testfilter' has no valid long-name field
Registered? False

In the second example the element is inherited from Gst.Bin. Here the
registration works, but a look at the 'long-name' shows, that the metadata of
the Gst.Bin has been used instead of the intended one, supplied in the code:

#!/usr/bin/python3

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

GObject.threads_init()
Gst.init(None)

class TestFilter(Gst.Bin):

    __gstdetails__ = (
        'Test Filter',
        'Generic',
        'Passthrough for all buffers',
        'jan'
    )

    __gsttemplates__ = (
        Gst.PadTemplate.new('src', Gst.PadDirection.SRC,
Gst.PadPresence.ALWAYS, Gst.caps_from_string('ANY')),
        Gst.PadTemplate.new('sink', Gst.PadDirection.SINK,
Gst.PadPresence.ALWAYS, Gst.caps_from_string('ANY'))
    )

    def __init__(self):
        Gst.Bin.__init__(self)

def plugin_init(plugin, userarg):
    TestFilterType = GObject.type_register(TestFilter)
    res = Gst.Element.register(plugin, 'testfilter', 0, TestFilterType)
    print('Registered?', res)
    return True

version = Gst.version()
Gst.Plugin.register_static_full(
    version[0],
    version[1],
    'testfilter',
    'passthrough element',
    plugin_init,
    '1.0',
    'LGPL',
    'testfilter',
    'testfilter',
    'http://',
    None
)

print(Gst.ElementFactory.find('testfilter').get_metadata('long-name'))


output:
>./plugin-bin-test.py
Registered? True
Generic bin

Is there some new way to set the metadata or is it missing? All tutorials I've
found are examples of the second kind, where simply the metadata of the Gst.Bin
is used.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list