[MPlayer-dev-eng] HTML OSD

Dion Rasmussen dion.rasmussen at gmail.com
Sun Apr 13 17:44:14 CEST 2008


Hello again,

Now my intelligent library for movies as well as documentation and photos is
quite ready and as an example I've written a HTML OSD mechanism in perl
utilizing firefox which is following:

-snip-


#!/usr/bin/perl -w
# csmplayer
# CutSys extension for mplayer
# (c) dion.rasmussen at gmail.com

use IO::Handle;

# fork a player control process to write
my $info_pipe_pid = open IPR, '-|';

IPR->autoflush();

die "can't open stdout" unless defined $info_pipe_pid;
if(!$info_pipe_pid) {
        system("killall gmplayer");
        system("gmplayer -user Mandrake -passwd
mandrake\@gangsterfreak.com-skin Terminator3 -vo xv -prefer-ipv4
-quiet -playlist $ARGV[0]");
        exit;
}


open IPW, '>test-pipe' or die "can't open test-pipe $!...";
IPW->autoflush();
print IPW "New session:\n";
my $cut_id;
my $ssh_pid;
while(<IPR>){
        print;
        if( /^Playing/ ){
                # append to the player_log ;)
                print IPW;
                # kill the screensaver hold
                if ($ssh_pid) {
                        kill 15, $ssh_pid;
                        wait;
                        undef $ssh_pid;
                }
                # open firefox/osd for CutSys info
                if( /(http:\/\/[^\/]+)\/cut\/(\d+)/ && (!defined $cut_id
||$2 != $cut_id) && `pidof firefox-bin`) {
                        $cut_id = $2;
                        system "firefox $1/uf/$cut_id";
                }
        } if (/^VIDEO/) {
                die "couldn't fork" unless defined ($ssh_pid = fork);
                if(!$ssh_pid) {
                        close IPW;
                        close IPR;
                        # deactivate the screensaver
                        system 'gnome-screensaver-command -d';
                        # hold the screensaver
                        exec 'gnome-screensaver-command -i';
                        die "couldn't exec";
                }
        }
}
print IPW "Lost the pipe...\n";
close IPW;
wait;
close IPR;
if ($ssh_pid) {
        kill 15, $ssh_pid;
        wait;
}
print "done";


-snip-

The killall is a problem when that patch I posted earlier ain't applied, but
it's showing a quite delicious representation of the current album or series
domain which is currently playing. Apropos GUI talk earlier I thought of
using libgtkhtml with some perl-hooks or whatever for retrieving track-info
and showing it in a HTML-rendered part of the GUI instead of firefox.

Just a thought!

Regards,

Dion



More information about the MPlayer-dev-eng mailing list