[MPlayer-cygwin] Slave-mode
Hans-Carl Oberdalhoff
hcoberdalhoff at googlemail.com
Thu Dec 1 11:32:16 CET 2005
Hello List,
I'm playing around, trying to use ruby under windows to control the
mplayer using slave-mode. And I get some problems.
Here is a bit of example code:
-------
#Defs
$MPlayerExe = "x:/video-projekt/mplayer/mplayer.exe"
$VideoFile = "x:/video-projekt/video.mpg"
#start mplayer
$mplayer = IO.popen($MPlayerExe+" -slave -osdlevel 2 -quiet "+$VideoFile,"w+")
#Read its output.
Thread.new {
while true
$mplayer.each {|line|
puts "GOT "+line
}
sleep 0.1
end
}
#send commands to mplayer
puts "get time"
$mplayer.puts "get_time_pos"
puts "try pause"
$mplayer.puts "pause"
-------
I can read mplayers output nicely, as expected. But is does not care
about the input (commands).
(And yes, "puts" sends a newline ;) )
I tried things like flushing, using printf and write.
Can someone help?
While studying the problem I saw the following:
"echo pause | mplayer -slave video.mpg"
does work nicely and pauses the video.
But, if I use ruby (with a script containing for example 'puts "pause"')
"ruby script.rb | mplayer -slave video.mpg"
nothing happens. (video plays on)
What is different here?
Btw, it does also NOT work, if I use these commandsinside an MSYS shell.
Can anyone help?
greetz,
Hans-Carl
More information about the MPlayer-cygwin
mailing list