OpenGL renderer window..

Matthew Waters ystreet00 at gmail.com
Thu Feb 8 09:21:06 UTC 2018


Mac OS X is special in that a CFRunLoop is required to be running on the
main thread in order for glimagesink (and other UI operations) to
perform correctly.

That either means you need to run one yourself, use a toolkit that runs
one or run a GMainLoop.

Running your gst-launch-1.0 command with GST_DEBUG=gl*:7 would give you
more information about what GStreamer is attempting to do, specifically
around
https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m#n105.

On 08/02/18 06:49, Hans Hony wrote:
> I have a question about launching a simple video pipeline using
> 'glimagesink' with the python3 gi.repository.Gst.ElementFactory..
>
> On Mac OSX I can launch my pipeline with custom plugin:
> gst-launch-1.0 filesrc <avi> ! decodebin ! queue ! my_custom_plugin
> <props> ! autovideosink
>
> The output a default window titled 'OpenGL renderer'.. which I assume
> is gstglwindow_cocoa.m
> <https://github.com/GStreamer/gst-plugins-bad/blob/1.12/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m#L466> from
> gst-plugins-bad.. ?
>
> Likewise, 'glimagesink' will also open the 'OpenGL renderer' window
> when used in a bash gst-launch-1.0 command in the same way as
> 'autovideosink'. Also I notice when I launch the pipeline under bash,
> I can see:
>
>     Setting pipeline to PAUSED ...
>
>     Pipeline is PREROLLING ...
>
>     Got context from element 'sink': gst.gl.GLDisplay=context,
> gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayCocoa\)\ gldisplaycocoa0";
>
>
>
> However, when I launch the pipeline for
> gi.repository.Gst.ElementFactory (in python3) I have issues:
>
>  1. It fails horribly for ElementFactory.make('autovideosink') with
>     /Illegal instruction: 4/ when NULL to READY is propagated.. so to
>     fix that I just didn't use 'autovideosink'..
>
>  2. It will propagate PLAY for ElementFactory.make('glimagesink')..
>     but nothing actually plays.. probably because the chain isn't correct
>
>  3. I cannot figure out how to hook the 'sync_message' to an OSX
>     window object with glimagesink from python?!? I see information in
>     gst-inspect-1.0 glimagesink.. but I can't find any examples to do
>     this specifically.
>
>  4. Secondarily, I see that I can use
>     gi.repository.GstGL.GLDisplay().new() to create:
>         <__gi__.GstGLDisplayCocoa object at 0x10e05eb88
>     (GstGLDisplayCocoa at 0x7fc7ba9439c0)>
>     .. which is seemingly what I want!
>
>  5. How to do hook this object up to 'glimagesink' ??
>

You don't need to hook this up to GStreamer, it will create that
automatically.

>  1. Finally, do I need to add:
>       pipeline.get_bus().connect('sync-message::element',
>     on_sync_message) with a function on_sync_message(bus, msg) ?
>

This shouldn't be needed.

> From the Gtk examples I found there was a function which would update
> the GUI.. I assume that I would need to do this as well.. but the
> syntax is not clear immediately.
> More specifically:
> defon_sync_message(bus, msg): ifmsg.get_structure().get_name()
> =='prepare-window-handle':
> sink =msg.src
> sink.set_window_handle(<window_handle>)
> sink.set_render_rectangle(0, 0, <window.width>, <window.height>)

This is for embedding glimagesink's output inside another application.

> Overall, I want to know:
>
>  1. How is it that gst-launch-1.0 works so well?
>

Because, glimagesink is generally created and set to READY on the main
thread. Otherwise, happy accident.

>  1. How can I use that functionality in my python3 gi code?
>

Run a CFRunLoop/GMainLoop on the main thread.

>  1. How can I add another element to trigger that force-aspect-ratio
>     window magic?
>

I'm not sure what you mean by this.

Cheers
-Matt

> $ brew list --versions | grep gst
>
> gst-plugins-bad 1.12.3
>
> gst-plugins-base 1.12.3
>
> gst-plugins-good 1.12.3
>
> gst-plugins-ugly 1.12.3
>
> gst-python 1.12.3
>
> gst-rtsp-server 1.12.3
>
> gstreamer 1.12.3
>
>
> Thanks,
> Hans
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180208/bf0d7c4e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 516 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180208/bf0d7c4e/attachment-0001.sig>


More information about the gstreamer-devel mailing list