After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772853 - example of python identity element for 1.0
example of python identity element for 1.0
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
1.x
Other Linux
: Normal enhancement
: 1.10.0
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-13 11:24 UTC by Marianna S. Buschle
Modified: 2016-10-31 14:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch adding the identity example (2.13 KB, patch)
2016-10-17 07:44 UTC, Marianna S. Buschle
committed Details | Review

Description Marianna S. Buschle 2016-10-13 11:24:13 UTC
Right now you only have an example for a sink in:
https://cgit.freedesktop.org/gstreamer/gst-python/tree/examples/plugins/python

Here is one for a transform, a simple identity (if of interest):

#!/usr/bin/env python
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

import gi
gi.require_version('GstBase', '1.0')

from gi.repository import Gst, GObject, GstBase
Gst.init(None)

#
# Simple Identity element created entirely in python
#
class Identity(GstBase.BaseTransform):
    __gstmetadata__ = ('Identity Python','Transform', \
                      'Simple identity element written in python', 'Marianna S. Buschle')

    __gsttemplates__ = (Gst.PadTemplate.new("src",
                                           Gst.PadDirection.SRC,
                                           Gst.PadPresence.ALWAYS,
                                           Gst.Caps.new_any()),
                       Gst.PadTemplate.new("sink",
                                           Gst.PadDirection.SINK,
                                           Gst.PadPresence.ALWAYS,
                                           Gst.Caps.new_any()))

    def do_transform_ip(self, buffer):
        Gst.info("timestamp(buffer):%s" % (Gst.TIME_ARGS(buffer.pts)))
        return Gst.FlowReturn.OK

GObject.type_register(Identity)
__gstelementfactory__ = ("identity_py", Gst.Rank.NONE, Identity)
Comment 1 Sebastian Dröge (slomo) 2016-10-13 11:28:52 UTC
Seems interesting but keep in mind that the Python GIL will generally cause bad performance whenever you hook into the streaming threads (like here).
Comment 2 Thibault Saunier 2016-10-13 14:34:20 UTC
Could you prepare a `git format` patch so we can add it to the example directory?

Thanks
Comment 3 Marianna S. Buschle 2016-10-17 07:44:03 UTC
Created attachment 337814 [details] [review]
patch adding the identity example