Commit 627bc1ca authored by michael's avatar michael

avformat/av_seek_frame_binary with growing file patch by (Kenneth Aafløy: kenneth, aafloy net)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4423 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent ed16ef8f
...@@ -1198,7 +1198,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts ...@@ -1198,7 +1198,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
AVInputFormat *avif= s->iformat; AVInputFormat *avif= s->iformat;
int64_t pos_min, pos_max, pos, pos_limit; int64_t pos_min, pos_max, pos, pos_limit;
int64_t ts_min, ts_max, ts; int64_t ts_min, ts_max, ts;
int64_t start_pos; int64_t start_pos, filesize;
int index, no_change; int index, no_change;
AVStream *st; AVStream *st;
...@@ -1256,7 +1256,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts ...@@ -1256,7 +1256,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
if(ts_max == AV_NOPTS_VALUE){ if(ts_max == AV_NOPTS_VALUE){
int step= 1024; int step= 1024;
pos_max = url_fsize(&s->pb) - 1; filesize = url_fsize(&s->pb);
pos_max = filesize - 1;
do{ do{
pos_max -= step; pos_max -= step;
ts_max = avif->read_timestamp(s, stream_index, &pos_max, pos_max + step); ts_max = avif->read_timestamp(s, stream_index, &pos_max, pos_max + step);
...@@ -1272,6 +1273,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts ...@@ -1272,6 +1273,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
break; break;
ts_max= tmp_ts; ts_max= tmp_ts;
pos_max= tmp_pos; pos_max= tmp_pos;
if(tmp_pos >= filesize)
break;
} }
pos_limit= pos_max; pos_limit= pos_max;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment