[MPlayer-users] Playing files that are increasing in size

Craig Shelley craig at microtron.ath.cx
Sun Oct 12 20:42:30 CEST 2003


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 rat 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.

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

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



More information about the MPlayer-users mailing list