[MPlayer-dev-eng] Playing growing MPEG files

Doc Holliday doc4holliday at gmail.com
Mon Dec 26 21:14:56 CET 2011


I have a small Qt-based GUI that runs on top of mplayer in -slave mode 
and allows users to navigate to different positions in the file by means 
of a slider (QSlider). The user drags and drops the slider handle and 
the mplayer jumps to the appropriate position in the file and continues 
playing from there.

This all works great until they start playing a growing file, which 
happens regularly and which I am trying to figure out solution for.

Playing growing files with mplayer seems to generally work. However, 
time length of the file is set in demux_mpg_open and is not updated 
after that. So the new part of the file, which has been recorded after 
the file was open is not accessible through the slider. Currently, the 
user has to stop playing the file and start playing it again.

My idear was to do the following:

1. Regularly call demux_get_time_length (eg in from print_status)

2. Which in turn calls demux_mpg_control(DEMUXER_CTRL_GET_TIME_LENGTH)

3. Inside demux_mpg_control I:
     a. Call stream_control(STREAM_CTRL_GET_SIZE)
     b. Update demuxer->stream->end_pos and demuxer->movi_end
     c. Save current stream position
     d. Call read_first_mpeg_pts_at_position( demuxer->movi_end - 
TIMESTAMP_PROBE_LEN )
     e. Update final_pts and first_to_final_pts_len
     f. Restore current stream position

Unfortunately, the above does not seem to work, as I end up with corrupt 
screen and the file not playing. My guess is that there are some 
internal structures/buffers that get messed up and interrupt the "flow" 
through the file.

I am wondering if the above is a workable approach and it's just a 
matter of preserving a few other variables prior to calling 
read_first_mpeg_pts_at_position or if there is another better or more 
proper way of doing this.

Thank you in advance.

-Doc

-- 
There's no normal life, Wyatt, it's just life. Get on with it.


More information about the MPlayer-dev-eng mailing list