|
|
@ -1819,8 +1819,16 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int |
|
|
|
//Fallback to old API if new is not implemented but old is
|
|
|
|
//Fallback to old API if new is not implemented but old is
|
|
|
|
//Note the old has somewat different sematics
|
|
|
|
//Note the old has somewat different sematics
|
|
|
|
AV_NOWARN_DEPRECATED( |
|
|
|
AV_NOWARN_DEPRECATED( |
|
|
|
if(s->iformat->read_seek || 1) |
|
|
|
if (s->iformat->read_seek || 1) { |
|
|
|
return av_seek_frame(s, stream_index, ts, flags | (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0)); |
|
|
|
int dir = (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0); |
|
|
|
|
|
|
|
int ret = av_seek_frame(s, stream_index, ts, flags | dir); |
|
|
|
|
|
|
|
if (ret<0 && ts != min_ts && max_ts != ts) { |
|
|
|
|
|
|
|
ret = av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir); |
|
|
|
|
|
|
|
if (ret >= 0) |
|
|
|
|
|
|
|
ret = av_seek_frame(s, stream_index, ts, flags | (dir^AVSEEK_FLAG_BACKWARD)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// try some generic seek like seek_frame_generic() but with new ts semantics
|
|
|
|
// try some generic seek like seek_frame_generic() but with new ts semantics
|
|
|
|