[MPlayer-users] Writing a frontend with slave mode

Ben Nemec nemebe01 at luther.edu
Mon Dec 26 23:34:03 CET 2005


On Thursday 22 December 2005 11:49, Alexandre CONRAD wrote:

> Also, I've only worked with mpeg2 and mpeg4 files. So I don't know if
> ID_LENGHT actually works for all the video formats.

It doesn't, or at least didn't.  Some file types still don't report a length
correctly (usually 0 in these cases) and a fair number of MP3s that I've
played using MPlayer are reported to have incorrect lengths (which I realize
is not the intended use for MPlayer, but it does happen).  The situation has
improved though.  I used to get 0 for all Quicktime videos, and now they seem
to be reported correctly so this may not always be true.

My solution is to put every file that I'm going to play into a playlist with
only two entries: the file to be played and a dummy file.  When I see a
message from MPlayer indicating that it has started playing the dummy file I
know that the file I wanted to play has completed.  It works pretty well for
me.  Plus this way I don't have to spawn a new MPlayer process for each file.
The dummy file is non-zero length so I have time to load a new playlist with
the next file I want to play before the process exits.  I don't even have to
use -idle (although I probably should anyway).

> There's been a discussion about how to catch the EOF using the -idle
> command on the mplayer-dev-eng mailing list, about adding some extra
> SLAVE messages for making it easier for frontend writers to know what's
> going on with mplayer. Seach for "slave" in the december's 2005 archive:
>
> http://mplayerhq.hu/pipermail/mplayer-dev-eng/2005-December/thread.html
>
> Apparently, it's been dropped for now. But it would be really great if a
> bunch of extra easealy parsable messages could be added to make frontend
> writer's life easier. :-) Not only informational messages
> (SLAVE_FILE_STARTED=file.mpg, SLAVE_FILE_STOPPED=file.mpg), but also
> error messages and so on (SLAVE_FILE_NOT_FOUND=file.mpg - even if this
> sould be checked by the frontend itself before sending the "loadfile"
> command to mplayer).

Too bad this got dropped.  I for one would have liked to have seen it happen.

-Ben




More information about the MPlayer-users mailing list