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

Hi Guys,

I have been developing a cross-platform multi-media medical application in wxPerl. All the original development was done in Windows and I have just ported to Kubuntu 9.10. One of the main components is wxMediaCtrl which uses MS Media Player backend on Windows or GStreamer on Linux.

I've definitely got GStreamer installed because other applications run using it. But I've not got wxMediaCtrl running yet. I'm getting error "Got an invalid playbin (error 0:Success)". So what am I missing here?

I have:

- Kubuntu 9:10

- wxPerl 0.91-1

- GStreamer (libgstreamer-plugins-base0.10-0 - 0.10.25-2ubunbtu1 (amd64), libgstreamer0.10-0 - 0.10.25 (amd64), bluez-gstreamer - 4.51-0ubantu2 (amd64)).

However, there are 54 other GStreamer packages/modules that aren't installed, and maybe I'm just missing one or two.

If I add all the remaining modules, I can even write pieces of code in Perl which call GStreamer directly but in this case, wxMediaCtrl bombs out with no error message at all.

What are your thoughts?

Thanks and regards

Steve

Replies are listed 'Best First'.
Re: wxMediaCtrl running under Kubuntu 9.10
by zentara (Cardinal) on Nov 08, 2009 at 13:51 UTC
    .... you posted a very clear question, and i can only hazard a broad guess, that your library versions for gstreamer just isn't compatible. When i googled for your problem, the 3rd hit was
    Here we use the "playbin" GstElement for ease of use. ... than ST_STAT +E_SUCCESS as newer gstreamer versions return non-success values for r +eturns that are ...... an invalid playbin")); return false; } #if GST +_VERSION_MAJOR == 0 .... and has an error message } NotifyMovieLoaded +(); // Notify the user - all we can do .
    ....sounds awfully similar to your error message..... you might want to ask this on the gstreamer maillist....the last time i checked it was very active

    ...all i can suggest is to build all the libs needed manually, and manually install them.... see what if any error messages they say..... you will probably find which lib it is... or the gstreamer maillist people probably will have a good guess.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku

      Hi Zentara

      I got the same hit. But I don't know that I'm really up to doing a build yet. I've posted this question on the GStreamer mailing list and the wxPerl Mailing list, but no response yet. I'm just not sure that a lot of people use wxMediaCtrl on Linux. Instead I found a peice of code which runs GStreamer directly:

      #!/usr/bin/perl -w -- use strict; use warnings; use GStreamer -init; my $loop = Glib::MainLoop -> new(); # set up my file = "/tmp/foo.avi"; my $play = GStreamer::ElementFactory -> make("playbin", "play"); $play -> set(uri => Glib::filename_to_uri $file, "localhost"); $play -> get_bus() -> add_watch(\&my_bus_callback, $loop); $play -> set_state("playing"); # run $loop -> run(); # clean up $play -> set_state("null"); sub my_bus_callback { my ($bus, $message, $loop) = @_; if ($message -> type & "error") { warn $message -> error; $loop -> quit(); } elsif ($message -> type & "eos") { $loop -> quit(); } # remove message from the queue return 1; }

      I thought maybe I could use something like this in the Linux code. Not very Cross Platform, I know. But I don't know how to embed it in wxPerl. Anyhow both options would give me a working system.

      Update Ah, I've just realised what you mean. Use the compiler to find out which package is missing! Good idea, I'll do that.

      Thanks

      Steve

        ... hi, ...yeah, i was going to make a little ps to my post to try to find an alternate method to your wxMediaCtl dilemma.... usually on linux, you run things directly... and i see you found some good code.

        But I don't know how to embed it in wxPerl.

        ...possibly use Kbuntu's media controller?

        ....i havn't used Wx...i stick with plain Gtk2..... but there should be a way in the Wx design gui to do what is called an Glib idle_add or a timer to launch the code. ....i would launch it in a separate thread, or fork-and-exec the code, get the pid to kill it ... the thread is simpler, but fork-and-exec cleaner memory wise

        on linux, you probably can embed the gstreamer object in one of your current windows, or just pop open a new toplevel window and display the imagery there

        but this is something you should ask on the Wx maillist..... i'm just saying that gstreamer is a big lib, and interfacing is complex

        here is some code that i used to use for experimentation..... it may be outdated as gstreamer is evolving fast

        gst-launch -v ximagesrc ! video/x-raw-rgb,framerate=5/1 ! ffmpegcolors +pace ! mux. avimux name=mux ! filesink location=ztest.avi mencoder -vf scale=640:480 ztest.avi -ovc lavc -o ztest.mpg rm ztest.avi
        something like that can be run in a thread or piped-open....OR... you can try to use the Perl module interface to GStreamer.... but i would stick with the c program run thru ipc, so that memory cleanup is better

        i mean, i have no idea of what your code actually does...these are just general design musings regarding linux guis


        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku
Re: wxMediaCtrl running under Kubuntu 9.10
by Steve_BZ (Chaplain) on Nov 12, 2009 at 21:13 UTC

    Well it looks as though the bomb-out was caused by something else. The list of files needed to Gstreamer from wxMediaCtrl *or* Perl seems to be:

    gstreamer0.10-ffmpeg libgstreamer0.10-0 libgstreamer-perl libgstreamer-plugins-base0.10-0 gstreamer0.10-x gstreamer0.10-plugins-good gstreamer0.10-plugins-base

    The following code then runs on Windows and Linux:

    #!/usr/bin/perl -w -- use Wx 0.15 qw[:allclasses]; use strict; package MyFrame; use Wx qw[:everything]; use base qw(Wx::Frame); use strict; sub new { my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $style = wxDEFAULT_FRAME_STYLE unless defined $style; $self = $self->SUPER::new( undef, wxID_ANY, "Draw/Video Controls", + wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, "" ); $self->SetTitle("Draw/Video Controls"); # Define parents of split $self->{Ctl_Post_Exam_Videos_Sizer_2} = Wx::BoxSizer->new(wxVERTIC +AL); # Top-level left-hand sizer (contains media) # wxMEDIABACKEND_DIRECTSHOW Use ActiveMovie/DirectShow. Requires w +xUSE_DIRECTSHOW to be enabled, requires linkage with the static libra +ry strmiids.lib, and is available on Windows Only. # wxMEDIABACKEND_QUICKTIME Use QuickTime. Windows and Mac Only. NO +TE: On Mac Systems lower than OSX 10.2 this defaults to emulating win +dow positioning and suffers from several bugs, including not working +correctly embedded in a wxNotebook. # wxMEDIABACKEND_MCI Use Media Command Interface. Windows Only +. # wxMEDIABACKEND_GSTREAMER Use GStreamer. Unix Only. # wxMEDIABACKEND_WMP10 Windows Media Player 9 or 10 # wxMEDIABACKEND_REALPLAYER Realplayer # Blank Allow to choose own player $self->{Ctl_Videos_Media}= Wx::MediaCtrl->new( $self, wxID_ANY, '' +, wxDefaultPosition, wxDefaultSize,0, ); $self->{Ctl_Videos_Media}->Show( 1 ); $self->{Ctl_Videos_Media}->ShowPlayerControls(wxMEDIACTRLPLAYERCON +TROLS_DEFAULT); # or wxMEDIACTRLPLAYERCONTROLS_NONE # wxMEDIACTRLPLAYERCONTROLS_STEP # wxMEDIACTRLPLAYERCONTROLS_VOLUME # wxMEDIACTRLPLAYERCONTROLS_DEFAULT $self->{Ctl_Post_Exam_Videos_Sizer_2}->Add( $self->{Ctl_Videos_Med +ia}, 1, wxEXPAND|wxALL, 5 ); $self->{button} = Wx::Button->new( $self, -1, 'Load a media file' +); $self->{Ctl_Post_Exam_Videos_Sizer_2}->Add($self->{button}, 0, 0, +0); $self->SetSizer($self->{Ctl_Post_Exam_Videos_Sizer_2}); $self->Layout(); Wx::Event::EVT_MEDIA_LOADED( $self, $self->{Ctl_Videos_Media}, \&o +n_media_loaded ); Wx::Event::EVT_BUTTON( $self, $self->{button}, \&on_media_load ); return $self; } sub on_media_loaded { my( $self, $event ) = @_; Wx::LogMessage( 'Media loaded, start playback' ); $self->{Ctl_Videos_Media}->Play; } sub on_media_load { my( $self, $event ) = @_; my $file = Wx::FileSelector( 'Choose a media file' ); if( length( $file ) ) { $self->{Ctl_Videos_Media}->LoadFile( $file ); } } package main; unless(caller){ local *Wx::App::OnInit = sub{1}; my $app = Wx::App->new(); Wx::InitAllImageHandlers(); my $frame_1 = MyFrame->new(); $app->SetTopWindow($frame_1); $frame_1->Show(1); $app->MainLoop(); }

    Regards

    Steve