[FFmpeg-devel] [PATCH 1/2] avformat/utils: remove always true if()
Zhao Zhili
quinkblack at foxmail.com
Wed Aug 5 18:16:51 EEST 2020
Ping for the trivial patch.
> On Jul 29, 2020, at 1:02 AM, Zhao Zhili <quinkblack at foxmail.com> wrote:
>
> ---
> libavformat/utils.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 807d9f10cb..af1cca0c7d 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2543,6 +2543,8 @@ int av_seek_frame(AVFormatContext *s, int stream_index,
> int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
> int64_t ts, int64_t max_ts, int flags)
> {
> + int ret;
> + int dir;
> if (min_ts > ts || max_ts < ts)
> return -1;
> if (stream_index < -1 || stream_index >= (int)s->nb_streams)
> @@ -2553,7 +2555,6 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
> flags &= ~AVSEEK_FLAG_BACKWARD;
>
> if (s->iformat->read_seek2) {
> - int ret;
> ff_read_frame_flush(s);
>
> if (stream_index == -1 && s->nb_streams == 1) {
> @@ -2582,19 +2583,14 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
>
> // Fall back on old API if new is not implemented but old is.
> // Note the old API has somewhat different semantics.
> - if (s->iformat->read_seek || 1) {
> - int dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0);
> - int ret = av_seek_frame(s, stream_index, ts, flags | dir);
> + dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0);
> + 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
> - return -1; //unreachable
> }
>
> int avformat_flush(AVFormatContext *s)
> --
> 2.25.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list