[Ffmpeg-devel] avformat/av_seek_frame_binary with growing file
Kenneth Aafløy
kenneth
Thu Jun 9 01:59:15 CEST 2005
Hi,
I'm implementing a server/client which makes use of libavformat/codec to
handle reading and decoding through an abstraction layer. I'm reading files
through the http protocol handling implemented in this abstraction layer,
from files that may or may not be currently recording. I've chosen not to set
the is_streamed flag of urlcontext, since that would limit my options when it
comes to seeking. The http protocol implementation prefers http/1.1 partial
content request/responses, so seeking is relativly easy to implement.
However, in av_seek_frame_binary (which is used with mpeg ts formats) there
is a for (;;) loop which does not care much for a file that is currently
growing in size :
for(;;){
int64_t tmp_pos= pos_max + 1;
int64_t tmp_ts= avif->read_timestamp(s, stream_index, &tmp_pos,
INT64_MAX);
if(tmp_ts == AV_NOPTS_VALUE)
break;
ts_max= tmp_ts;
pos_max= tmp_pos;
}
If I put a 'if (tmp_pos > filesize) break;' after 'int64_t tmp_pos = ....' my
seeks with growing files will happily succeed.
Kennethff
More information about the ffmpeg-devel
mailing list