[MPlayer-users] states of mplayer

Dennis Aristow _den at bk.ru
Fri Sep 22 21:53:58 CEST 2006


Thank you for this tip.
I also thought about it...
But i don't know how i can implement it more efficiently.
Here is the small part of my code:

...
while ((line = player.stdout.readLine()) != null) {
  if (line.startsWith(Marks.STARTING_PLAYBACK)) { // begin playback
    player.informAboutState(Marks.STARTING_PLAYBACK);
  } 
  else if (line.startsWith(Marks.PAUSE)) { // paused
    player.informAboutState(Marks.PAUSE);
  }
  else if (line.startsWith(Marks.END_OF_FILE)) { // end of file reached
    player.informAboutState(Marks.END_OF_FILE);
  } 
  else if (line.startsWith(Marks.QUIT)) { // quit
    player.informAboutState(Marks.QUIT);
  }
}
...

After some state of mplayer is occured the information
about new state must be delivered only one time 
(until the another state occurs)
More exactly: While the player playing video, each line 
of the output is analyzed by this thread. 
I will recognize "resumed-state" if possible with not
too costly operations.

P.S. I know, this is more programming issue. 
But if you or somebody else have already implemented this thing,
I would be grateful for explaining or posting code here.

Cheers,
Dennis



More information about the MPlayer-users mailing list