Show video on Windows

Manuel manuel at wenns-um-email-geht.de
Tue Jul 28 11:36:33 PDT 2015


Hi Marwin,

thank you for your your reply.
I would try that, but I noticed, that my on_sync_message-method is never
called on Windows. How did you handle that?

I noticed, that you are using Stackoverflow, too. ;)
You can find my current code here:
http://stackoverflow.com/questions/25823541/get-the-window-handle-in-pygi/31555784

Best regards
Manuel


Marwin Schmitt:
> Hi,
> 
> I had the same problem and reported the bug to the gnome bugtracker quite a while ago .. but since it is still not fixed, I used a dirty hack, accessing the gdk_win32_window_get_handle via ctypes (and it took me forever no experience with that).
> 
> Here is the code:
> 
> def on_sync_message(bus, message):
>         if message.get_structure() is None:
>             return
>         if GstVideo.is_video_overlay_prepare_window_handle_message(message):#                                    
>             Gdk.threads_enter()
>             #get the gdk window and the corresponding c gpointer
>             drawingareawnd = drawingarea.get_property("window")            
>             if not drawingareawnd.has_native():#ensure_native should be called before, e.g. on realize
>                 print("Error - drawing does not have a native window - this window will freeze when moved or resized")
>             ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p
>             ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object]
>             drawingarea_gpointer = ctypes.pythonapi.PyCapsule_GetPointer(drawingareawnd.__gpointer__, None)
> 
>             #get the win32 handle
>             gdkdll = ctypes.CDLL ("libgdk-3-0.dll")
>             hnd = gdkdll.gdk_win32_window_get_handle(drawingarea_gpointer)
>             #pass it to the sink
>             sink.set_window_handle(hnd)
>             Gdk.threads_leave()
> 
> Cheers
> Marwin
> 
> ----- Original Message -----
> To: gstreamer-devel at lists.freedesktop.org
> Sent: Friday, September 26, 2014 7:48:32 PM
> Subject: Show video on Windows
> 
> Hi all,
> 
> in my program I use PyGObject/PyGI and GStreamer to show a video in my
> GUI. The video is shown in a Gtk.DrawingArea and therefore I need to get
> it's window-handle in the realize-signal-handler. On Linux I get that
> handle using:
> 
> drawing_area.get_property('window').get_xid()
> But how do I get the handle on Windows?
> 
> I searched on the internet but found only examples for PyGtk using
> window.handle which does not work using PyGI.
> 
> The GStreamer documentation provides an example which uses the
> GDK_WINDOW_HWND macro to get the handle. This macro uses AFAIK
> gdk_win32_drawable_get_handle. But how to do it in Python using PyGI?
> 
> Best regards
> _______________________________________________
> 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