[MPlayer-users] Playing Growing Files

Craig Shelley craig at microtron.org.uk
Thu Oct 16 23:09:05 CEST 2003


I am sorry to be rude, but I was wondering if there was any more
information regarding my post on Sunday.

...

Hi,

I have just proved to myself that the problem with my setup is with
mplayer.

Using this program:

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h> 
#include <unistd.h>
 
main()
{
    int fi, fo;
    ssize_t count;
    char buf[10241];
    fi=open("in",O_RDONLY);
    fo=open("out",O_WRONLY);
     
    while(1)
    {
        count=read(fi,buf,2000);
        write(fo,buf, count);
        if(count == 0) exit(0);
        usleep(100);
    }
}

The file 'in' was a known good file (in this case, an episode of
Futurama)

The file out was created first by
echo > out

I calibrated the output of the above program to write to the file at
twice the rate that mplayer reads from it.
This was done simply by letting it run for 10 seconds, and terminating
it. Then by checking the length of the file with mplayer it was found to
be about 20 seconds long.

I then cleared the file again with

echo > out

and started the above program

./a.out

I gave it a 10 second head start
then on another terminal started mplayer

mplayer out

As predicted, the mplayer played for 20 seconds before saying end of
file.

Thus proving mplayer is not playing growing files properly.

-- 
Craig Shelley <craig at microtron.org.uk>

Homepage: <http://www.microtron.org.uk>



More information about the MPlayer-users mailing list