Custom Gst.Element in GTK3

Jan Alexander Steffens jan.steffens at gmail.com
Thu Jul 17 03:39:18 PDT 2014


BaseTransform is in GstBase, not Gst. VideoFilter is in GstVideo.

On Thu, Jul 17, 2014 at 12:24 PM, Manuel <manuel at wenns-um-email-geht.de> wrote:
> Hey,
>
> it seems that Gst 1.0 shipped with Ubuntu 14.04 does not include the
> BaseTransform/VideoFilter classes:
>         AttributeError: 'gi.repository.Gst' object has no attribute 'BaseTransform'
>
> It would be nice if I could stick with the Gst-code/version shipped with
> Ubuntu :)
>
> Is there some documentation about the pool negotiation in python?
> As mentioned I just need to get the timestamp of the buffers, for
> example to show the current position in a label and show some text using
> textoverlay (like subtitles). And then the buffers should just be
> forwarded to the next element in the pipeline. I don't need to modify
> buffers etc..
> Maybe I don't even need to implement my own Gst.Element. :) I just need
> the "ticks" to show the subtitles as soon as possible as the video
> reaches say position 00:04.140 . Any ideas? :)
>
> Best regards
>
>
> 17.07.2014 11:37 AM, Thibault Saunier:
>> Hello,
>>
>> I tried the example. But it seems to be broken. For example it uses
>>> set_chain_function, which IMHO should be set_chain_function_full.
>>> (According to
>>>
>>> http://lazka.github.io/pgi-docs/Gst-1.0/classes/Pad.html#Gst.Pad.set_chain_function_full
>>> ).
>>>
>>
>> It is overriden:
>> http://cgit.freedesktop.org/gstreamer/gst-python/tree/gi/overrides/Gst.py#n109
>> it can thus be used like it is in the example (this override has not been
>> released yet)
>>
>>
>> It looks like you should use Gst.BaseTransform (maybe Gst.VideoFilter)
>> instead of using Gst.Element as a baseclass for your element, it would
>> handle more things for you (and I guess pool negotation is one of those
>> things).
>>
>> Regards,
>>
>> Thibault
>>
>>
>> But I noticed two things:
>>> 1.
>>> When changing the function names to set_chain_function_full and
>>> set_event_function_full and adding a source-pad it almost looks like my
>>> TestFilter-class.
>>>
>>> One difference:
>>> In my code the chain-function tries to push the buffer to the next
>>> element (self.srcpad.push(buffer)). The example instead just returns
>>> Gst.FlowReturn.OK. This is where my code produces the error ("We don't
>>> have a bufferpool negotiated") and the example doesn't. Do I have to do
>>> something more to be able to push the buffer to the next element?
>>>
>>
>> Why don't you implement
>>
>>
>>> 2.
>>> In my last email I mentioned that I even didn't get it (my GTK3-example)
>>> playing with textoverlay and autovideosink in the Bin (without my custom
>>> element).
>>> But when I change the GhostPad's name in my GTK3-example to 'sink'
>>> (instead of 'video_sink' like in my GTK2-example) and remove the
>>> TestFilter from the Bin then the video is playing fine. I updated the
>>> example at pastebin. Now I just need to get my filter to work :)
>>>
>>> Best regards
>>>
>>>
>>> 17.07.2014 09:29 AM, Thibault Saunier:
>>>> Hello,
>>>>
>>>> I think when you say Gtk3 you mean GStreamer 1.0 with PyGObject.
>>>>
>>>> Do you have gst-python installed? It is necessary to be able to create
>>>> GstElement subclasses.
>>>>
>>>> You can have a look at that example:
>>>>
>>> http://cgit.freedesktop.org/gstreamer/gst-python/tree/examples/plugins/python/sinkelement.py
>>>>
>>>> Regards,
>>>>
>>>> Thibault Saunier
>>>>
>>>>
>>>> On Thu, Jul 17, 2014 at 12:07 AM, Manuel <manuel at wenns-um-email-geht.de>
>>>> wrote:
>>>>
>>>>> Custom Gst.Element in GTK3
>>>>> --------------------------
>>>>> Hi all,
>>>>>
>>>>> I wrote a gst.Element (GTK2), which is a simple filter that just
>>>>> forwards all buffers it receives on the sink-pad to the src-pad. Later I
>>>>> will grab some information from the buffer before forwarding it. (More
>>>>> precisely I will grab the timestamps and show some text based on the
>>>>> time, like subtitles). The GTK2-version works fine.
>>>>>
>>>>> Today I tried to change my code so that it uses the GTK3
>>>>> gi.repository-package.
>>>>> Although the new class looks almost the same it doesn't work.
>>>>>
>>>>> This is the error printed on the console:
>>>>> Error: Internal error: can't allocate images xvimagesink.c(979):
>>>>> gst_xvimagesink_show_frame ():
>>>>>
>>>>>
>>> /GstPlayBin:MultimediaPlayer/GstPlaySink:playsink/GstBin:vbin/GstBin:timed-video-bin/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage:
>>>>> We don't have a bufferpool negotiated
>>>>>
>>>>> Here is my GTK2-version: http://pastebin.com/J2gHfvS4
>>>>> And here the GTK3-version: http://pastebin.com/9u8zzcTk
>>>>>
>>>>> This is a scenario:
>>>>> A video-file is played using playbin. The playbin's video-sink is set to
>>>>> a Gtk.Bin that combines my own Gst.Element with textoverlay and an
>>>>> autovideosink.
>>>>>
>>>>> NOTE: If you remove the textoverlay from the GTK3 example then at least
>>>>> the audio is playing ;)
>>>>>
>>>>> I would be very grateful for your help. :)
>>>>>
>>>>> Best Regards
>>>>> _______________________________________________
>>>>> gstreamer-devel mailing list
>>>>> gstreamer-devel at lists.freedesktop.org
>>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> gstreamer-devel mailing list
>>>> gstreamer-devel at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>>
>>>
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>
>>
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list