Using GstVideoOverlay on Mac

Andy Robinson andy at seventhstring.com
Wed Jan 6 09:33:16 PST 2016


Mac OS 10.10
GStreamer 1.6.1
Xcode 6.4

Hello, can anyone point me to any sample code (C/C++) showing how to 
display video on the Mac, in a window owned by the application (rather 
than GStreamer creating a window for the video)?

I have written code (using wxWidgets as it happens) which works fine on 
Linux/GTK and on Windows.

I have a top-level window containing a child control in which I want the 
video to appear. I get a handle like this:

#ifdef __WXGTK__
    GtkWidget *gtk_widget = m_wxwindow;
    GdkWindow *gdk_window = gtk_widget_get_window(gtk_widget);
    gdk_window_ensure_native(gdk_window));
    m_video_window_handle = GDK_WINDOW_XID(gdk_window);
#endif

#ifdef __WXMSW__
    m_video_window_handle = (gulong)GetHWND();
#endif

#ifdef __WXMAC__
    NSView *nsv = GetPeer()->GetWXWidget();
    m_video_window_handle = (gulong)nsv;
#endif

The wxWidgets people assure me that this will obtain a NSView* on Mac.

Then in the bus_sync_callback I do:
    GstVideoOverlay *overlay = GST_VIDEO_OVERLAY(GST_MESSAGE_SRC(msg));
    gst_video_overlay_set_window_handle(overlay, m_video_window_handle);

As I say, this works on Windows & Linux. But on Mac the place where the 
video should be, is blank.

If I omit the call to gst_video_overlay_set_window_handle then GStreamer 
creates a new window and displays the video in it. But I want the video 
to appear in my already-existing window.

So maybe I am passing the wrong thing to 
gst_video_overlay_set_window_handle. But if so then I don't know what I 
am doing wrong so if anyone can suggest anything, or point me to an 
example which works, I'd be most grateful.

Regards,
Andy Robinson, Seventh String Software, www.seventhstring.com


More information about the gstreamer-devel mailing list