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

Greetings monks.

I have an installation running wxPerl with Wx::MediaCtrl front-ending GStreamer. The functionality of Wx::MediaCtrl, does not adequately control GStreamer, so I had hoped to use the GStreamer perl api, however, I have belatedly realised that the GStreamer perl api seems to be part of Gtk2-Perl. So I guess GStreamer (perl) and Glib have some fundamental level of interoperation through Gtk2.

For instance if I just use the sample code (Getting the Perl GStreamer api working.) for Gstreamer, a window pops up and it runs easily. This is presumably a Gtk2 window. There is a Glib::MainLoop, which I understand is the Gtk2 event processor.

I would like to use a Wx window and use Wx events as well, since I have a heavy investment in them. How would I do do this? Do I need to learn Gtk2? Is there some sample code around that would help me to understand it.

I guess it's a bit of an overhead to have two event processors (Gtk2 & Wx) but it doesn't sound like the end of the world. The bigger question for me is how do I play the GStreamer perl api through a Wx::Frame or whatever.

Sorry if this post seems a bit intractible.

Your advice is very welcome.

Regards

Steve.

Replies are listed 'Best First'.
Re: Glib & Wx interoperation
by Anonymous Monk on Jun 21, 2011 at 21:07 UTC

      Hi Anon,

      Well I'm a little embarrassed that you pointed me to a post I made myself in 2009, however, I never got that working either. Instead I managed to get Wx::MediaCtrl working as it should. However, I'm still left with three major Wx::MediaCtrl problems on Linux (doesn`t happen on Windows),

      1. Playback crashes at the end of the file;
      2. Segfault on load of a second file;
      3. I can't play a live feed;

      On reflection, something I should do more of, maybe I should try fix the bugs in GStreamerMediaBackend.cpp. This would get Wx::MediaCtrl working and help to maintain wxWidgets and wxPerl.

      So if anyone knows how to tie wxPerl and Gtk2 together, I'm still *really* interested. However, I shall now devote some time to GStreamerMediaBackend.cpp.

      Regards

      Steve

        Its a two parter

        Part one, obtain gstreamer-window-id, then setparent for gstreamer-window-id to your-tk-wx-window-id, Perl/Tk front-end to mplayer shows one way, another is wxWindow::GetHandle +

        my $player = Win32::GuiTest::FindWindowLike... my $SetParent = Win32::API::->new("user32","SetParent","NN","N") $SetParent->( $player, $frame->GetHandle )
        There are equivalent api calls for linux , its probably easier in C-code

        Part two is event loop interaction. You create your own MainLoop which is

        while(1){ $glib->DoOneEvent; $wxapp->Dispatch; }
        POE::..LOOP.. might help with this, at least for finding the equivalent of DoOneEvent :)

        Alternate loop strategy, each event loop is run in separate thread (require Wx; ...) as normal (MainLoop)

        Alternate approach, start working on wxGStreamer , based on GStreamer .... fixing the problems with wxMediaCtrl is probably less work :)