[mythtv] mythvideo/mplayer hang news
Mark Musone
mmusone at shatterit.com
Mon Jan 27 13:44:40 EST 2003
Attached is my "mplayernetwork" script, which i use with mythvideo.
This is a perl script that runs mplayer, and does a few things:
1. disattaches stdin, so it doesnt hang in weird forking uses
2. becomes a network server listening in on port 20203.
3. redirects the network port to mplayer's stdin.
3. allows you to telnet into port 20203 and type in a command,
such as "pause", fast forward, volume up..etc and it'll pass it
directly to the mplayer process thats running. The commands are passed directly.
so i simply run mplayer in slave mode, and issue the appropriate mplayer slave commands.
Note: it's something i simply hacked together. so theres a good chance nothing will work
for you...but i figured it might help some people.
Oh, also attached is my mythexplorer-settings file that runs mplayernetwork.
also attached is a remote.php file that is a really really bad php script that
essentially acts as a web-based remote control, conneting to port 20203 and
issuing the command based on what you click.
-Mark
On Mon, Jan 27, 2003 at 06:59:36PM +0100, Joel Larsson wrote:
> Too bad this didnt solve it for me :( , anyway I have done some more
> testing on my machine, and it seems like mplayer just stopped working in
> X, no matter which output im using it always hang. I tested and put
> mplayer in the xinitrc so it shoudl start up when i run startx but it
> actually hangs. But when starting mplayer on the console it works. Its
> pretty strange.
>
> //Joel
>
> Drew Bernat wrote:
>
> >Now this is weird.
> >
> >I'd previously had the same problem with mythvideo and mplayer --
> >selecting a movie resulted in a hang in mplayer. However, that problem has
> >gone away, at least temporarily.
> >
> >I rebooted.
> >
> >Anyone know why a reboot would fix mplayer? As before, running it from
> >within mythvideo hung, but running from the command line worked.
> >
> >Very odd.
> >
> >Drew
> >
> >
> >
>
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at snowman.net
> http://www.snowman.net/mailman/listinfo/mythtv-dev
-------------- next part --------------
#!/usr/bin/perl
package MyPackage;
use FileHandle;
#use strict;
# use vars qw(@ISA);
use Net::Server::Fork; # any personality will do
$| = 1;
sub CHLD_handler
{
print "got handler!\n";
exit(0);
}
$SIG{'CHLD'} = 'CHLD_handler';
$SIG{'PIPE'} = 'CHLD_handler';
$pid = open(WRITEME, "| /usr/local/bin/mplayer -nolirc -display :0.0 -slave '$ARGV[0]' ");
#$pid = open(WRITEME, "| cat ");
WRITEME->autoflush(1);
@ISA = qw(Net::Server::Fork);
MyPackage->run();
exit;
### over-ridden subs below
sub process_request {
my $self = shift;
eval {
## local $SIG{ALRM} = sub { die "Timed Out!\n" };
local $SIG{PIPE} = sub { $self->server_close() };
local $SIG{CHLD} = sub { $self->server_close() };
my $timeout = 30; # give the user 30 seconds to type a line
my $previous_alarm = alarm($timeout);
WRITEME->autoflush(1);
while( <STDIN> ){
s/\r$//;
$status = print WRITEME $_;
if(!$status || $_ =~ /quit$/)
{
print "closeing server\n";
{
close(WRITEME);
system("killall mplayer");
$self->server_close();
}
}
return;
alarm($timeout);
}
alarm($previous_alarm);
};
if( $@=~/timed out/i ){
print STDOUT "Timed Out.\r\n";
return;
}
}
1;
#--------------- file test.pl ---------------
-------------- next part --------------
str default_helper=/usr/local/bin/mplayernetwork %s
str profile_default=movies
str StartDir=/videos
str LoadProfile=profile_default
str wav_helper=/usr/local/bin/mplayernetwork %s
str avi_helper=/usr/local/bin/mplayernetwork %s
str mpg_helper=/usr/local/bin/mplayernetwork %s
str mp3_helper=/usr/local/bin/mplayernetwork %s
str wma_helper=/usr/local/bin/mplayernetwork %s
str divx_helper=/usr/local/bin/mplayernetwork %s
str pl_helper=/usr/local/bin/mplayernetworkplaylist %s
str profile_movies=avi mpg mpeg divx mp3 wma pl
-------------- next part --------------
<?php echo "$hi";?>
<?php
{
$fp=fsockopen("localhost",20203);
if(!$fp) echo "no connetions";
if($seek)
fputs($fp,"seek $seek\r\n");
if($pause) fputs($fp,"pause\r\n");
if($mute) fputs($fp,"mute\r\n");
if($volume) fputs($fp,"volume $volume\r\n");
if($contrast) fputs($fp,"contrast $contrast\r\n");
if($brightness) fputs($fp,"brightness $brightness\r\n");
if($hue) fputs($fp,"hue $hue\r\n");
if($saturation) fputs($fp,"saturation $saturation\r\n");
fclose($fp);
}
?>
<form action="remote.php">
Seek
<input type="submit" name="seek" value="-240 0">
<input type="submit" name="seek" value="240 0">
<br>
Pause
<input type="submit" name="pause" value="1">
Mute
<input type="submit" name="mute" value="1">
<br>
Volume
<input type="submit" name="volume" value="-10">
<input type="submit" name="volume" value="10">
<br>
Contrast
<input type="submit" name="contrast" value="-10">
<input type="submit" name="contrast" value="10">
<br>
Brightness
<input type="submit" name="brightness" value="-10">
<input type="submit" name="brightness" value="10">
<br>
Hue
<input type="submit" name="hue" value="-10">
<input type="submit" name="hue" value="10">
<br>
Saturation
<input type="submit" name="saturation" value="-10">
<input type="submit" name="saturation" value="10">
</form>
<a href="files.php">Files</a>
<pre>
seek Integer [Integer]
audio_delay Float
quit
pause
grab_frames
pt_step Integer [Integer]
pt_up_step Integer [Integer]
alt_src_step Integer
sub_delay Float [Integer]
sub_step Integer [Integer]
osd [Integer]
volume Integer [Integer]
use_master
mute
contrast Integer [Integer]
gamma Integer [Integer]
brightness Integer [Integer]
hue Integer [Integer]
saturation Integer [Integer]
frame_drop [Integer]
sub_pos Integer [Integer]
sub_visibility
vobsub_lang
get_percent_pos
get_time_length
tv_step_channel Integer
tv_step_norm
tv_step_chanlist
vo_fullscreen
screenshot
panscan Float [Integer]
loadfile String
loadlist String
change_rectangle Integer Integer
</pre>
More information about the mythtv-dev
mailing list