[MPlayer-dev-eng] Architect: follow mode
Sam Liddicott
sam at liddicott.com
Fri Jun 28 21:48:48 CEST 2002
I'm slowly modifying mplayer for a follow mode as part of my
introduction to it's internals, and I think it advisable to consult here
from time to time so I don't make any major errors.
I want a mode where if mplayer is playing a file and the file grows
while playing mplayer doesn't stop early.
I figure the first stage is for mplayer to know when it has such a
stream that is follow-able.
I reckon around line 467 of libmpdemux/open.c we see STREAMTYPE_FILE - I
guess these are the only grow-able seek-able streams anyway.
Now a few things refer to stream->end_pos from time to time, but most
things cache it like:
demuxer->movi_end=stream->end_pos;
So I guess periodically on of the demuxer functions is going to want to
call a new stream function to get a new end_pos, using:
len-lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
If I'm not too far out then I'll start to look for a suitable demuxer
function into which I can put the check-if-stream-has-grown code. I
would think in the read-blocks but only if so long has passed since last
time, or so much K has been read or we are near what we think is the
end; ftell() should be cheap enough?
What say you guys?
Later I would like for it to also record in the stream struct whether or
not the file is observed to be growing;
for if the file has been observed to grow recently (or maybe if file
mod_time is less than 20 seconds?) at the point we seem to reach the
real end of file we might wait a bit to see if it does grow a bit more
and also if we are doing a user-seek we can choose not to quit beause
the file is quite likely to grow.
Even later-later I want to implement stretchable-circular buffers for
tivo like buffering, but much later.
More information about the MPlayer-dev-eng
mailing list