Steve_BZ has asked for the wisdom of the Perl Monks concerning the following question:

Hi Guys,

I'm having difficulty rendering a GStreamer video onto a wxPerl panel.

According to the doc it should be something like this:

my $video_panel=Wx::Panel->new($i_main_menu, wxID_ANY, wxDefaultPositi +on, [800,600],); (... lots of code goes here and the full executable version is here:
http://stackoverflow.com/questions/23547043/gtk-window-pointer-for-a-wxpanel-to-render-a-gstreamer-video
) my $g_window = $video_panel->GetHandle; $message->src->set_window_handle($g_window);
But I don't get a pointer from GetHandle just an integer as explained here (from the doc):
vir tual WXWidget wxWindow::GetHandle() const Returns the platform-specific handle of the physical window. Cast it to an appropriate handle, such as HWND for Windows, Widget for Motif or GtkWidget for GTK. wxPerl Note: This method will return an integer in wxPerl.
and then it errors like this:
The program 'GStreamer_test_6.pl' received an X Window System error. This probably reflects a bug in the program. The error was 'BadWindow (invalid Window parameter)'. (Details: serial 17 error_code 3 request_code 3 minor_code 0) (Note to programmers: normally, X errors are reported asynchronousl +y; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.)

I guess I need to convert the integer to some sort of pointer object that GStreamer recognises.

Does anyone have any idea what the correct code should look like?

Regards

Steve.

Replies are listed 'Best First'.
Re: How to pass a Wx::Panel handle to GStreamer to render a video.
by Anonymous Monk on May 10, 2014 at 06:44 UTC

    I guess I need to convert the integer to some sort of pointer object that GStreamer recognises

    <surprised_chicken> Whaat? </surprised_chicken> There is no guessing :D what do the docs (or source) say? What type of object is this here  $message->src->set_window_handle() what class is involved?

        ... wx ... In the c++ it says: ...

        Look at the source of the accepting end, the source of the GStreamer end :)

        Interesting things I found , I think they're related :)

        The latest GstreamerSDK and gst_x_overlay_set_window_handle (ubuntu)

        https://www.linuxquestions.org/questions/linux-desktop-74/how-can-i-fix-error-badwindow-invalid-window-parameter-575745/

        http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideooverlay.html has stuff like

        static guintptr video_window_handle = 0; ... if (video_window_handle != 0) { GstVideoOverlay *overlay; // GST_MESSAGE_SRC (message) will be the video sink element overlay = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)); gst_video_overlay_set_window_handle (overlay, video_window_handle); } else { g_warning ("Should have obtained video_window_handle by now!"); } ... #ifdef GDK_WINDOWING_X11 { gulong xid = GDK_WINDOW_XID (gtk_widget_get_window (video_window)) +; video_window_handle = xid; } #endif #ifdef GDK_WINDOWING_WIN32 { HWND wnd = GDK_WINDOW_HWND (gtk_widget_get_window (video_window)); video_window_handle = (guintptr) wnd; } #endif }

        So the possibilities are, get newer version of gstreamer .... call set handle at different time (different signal ... do some "casting"

        So I think you're calling set handle at the correct time ... so get latest gstreamer if not have it? call realize something? Or try "casting" result of GetHandle into whatever "guintptr" means to Glib::Object::Introspection (or Glib)

        I'd also try this --sync backtrace debugging option mentioned in the error message ... could be Glib... is truncating this integer somehow or something stupid that... a better error message might be better :)

        last thing thing I'd try is to do the call with Inline::C :)

        If you didn't run the code, ....

        Yup, on win32, sorry :)