diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-21 20:45:00 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-21 20:45:00 +0200 |
commit | 27f7589ab1ad0f6d2694d713e176dfa234662e60 (patch) | |
tree | 19b3d253d6f9a856a6ba5edb75985127b530e53b /libavformat/utils.c | |
parent | 7846280d1da5e4929bb8fb5adcc4b0c017535bea (diff) | |
download | ffmpeg-27f7589ab1ad0f6d2694d713e176dfa234662e60.tar.gz |
seek: Fix av_gen_search() so that seeks outside max/min do not successfully seek to random
points but rather seek to the min/max.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index a788eefc34..b931f77bb5 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1621,6 +1621,11 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i return -1; } + if(ts_min >= target_ts){ + *ts_ret= ts_min; + return pos_min; + } + if(ts_max == AV_NOPTS_VALUE){ int step= 1024; filesize = avio_size(s->pb); @@ -1646,6 +1651,11 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i pos_limit= pos_max; } + if(ts_max <= target_ts){ + *ts_ret= ts_max; + return pos_max; + } + if(ts_min > ts_max){ return -1; }else if(ts_min == ts_max){ |