With GStreamer you actually don't need sockets to do IPC: the whole stream framework runs in a separate thread that you can access using method calls/messages.

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:

# 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;
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.


In reply to Re: Creating a video player frontend in Perl - what are my options? by Joost
in thread Creating a video player frontend in Perl - what are my options? by rocklee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.