in reply to Creating a video player frontend in Perl - what are my options?
If you use the standard playbin plugin as a base, you can probably set up a complete audio/video player in something like 10 lines of code (a couple more if you want to hook in custom audio/video processing).
Gst works fine with Tk at least for audio playing (I haven't tried video), as long as you make sure you're syncing the Tk and Glib event loops. I devised a fairly hackish way of doing that, by polling the Tk events from within the Glib mainloop:
This appears to be more than sufficient to run Tk and Gstreamer with good responsiveness, and you can probably reduce the interval for tk_loop if that takes up too much CPU resources.# setup glib loop our $loop = Glib::MainLoop->new(undef,0); # handle tk events sub tk_loop { my $c = Tk::MainWindow->Count; if ($c) { 1 while (DoOneEvent(ALL_EVENTS | DONT_WAIT)); } else { $loop->quit; # quit glib loop if GUI is closed } $c; } Glib::Timeout->add(5,\&tk_loop); # call tk_loop every 5 ms $loop->run;
|
|---|