diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-04 16:58:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-04 17:10:48 +0200 |
commit | 30db867cb7be54fd8e756640b4e18cb20a70a64a (patch) | |
tree | 9ee4a1cde3d846a3704ac25a21d34d576c6b3757 | |
parent | c7a7605656633e52ade8a5d32a7c2497b37faef8 (diff) | |
parent | fa245e432bdc3b28081d8fcaa90dced6c6fbf566 (diff) | |
download | ffmpeg-30db867cb7be54fd8e756640b4e18cb20a70a64a.tar.gz |
Merge remote-tracking branch 'cigaes/master'
* cigaes/master:
lavf/matroskaenc: return an error for unsupported types.
lavf/concatdec: remove invalid check for AVSEEK_FLAG_BACKWARD.
lavf: filter out AVSEEK_FLAG_BACKWARD in new API.
lavf: call the new seek API from the old.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/avformat.h | 1 | ||||
-rw-r--r-- | libavformat/concatdec.c | 2 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 15 |
4 files changed, 17 insertions, 3 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f21dd90305..a9ea1d8e1f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1687,6 +1687,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, * or if stream_index is -1, in AV_TIME_BASE units. * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as * keyframes (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_BACKWARD, it is ignored. * * @param stream_index index of the stream which is used as time base reference * @param min_ts smallest acceptable timestamp diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 5359ad149d..78362e2c65 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -341,7 +341,7 @@ static int real_seek(AVFormatContext *avf, int stream, return ret; ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); - if (ret < 0 && !(flags & AVSEEK_FLAG_BACKWARD) && + if (ret < 0 && left < cat->nb_files - 1 && cat->files[left + 1].start_time < max_ts) { if ((ret = open_file(avf, left + 1)) < 0) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index da34ea7677..371b9d0bf2 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -705,7 +705,7 @@ static int mkv_write_tracks(AVFormatContext *s) break; default: av_log(s, AV_LOG_ERROR, "Only audio, video, and subtitles are supported for Matroska.\n"); - break; + return AVERROR(EINVAL); } ret = mkv_write_codecprivate(s, pb, codec, native_id, qt_id); if (ret < 0) return ret; diff --git a/libavformat/utils.c b/libavformat/utils.c index 71246a9db2..89a5105063 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2135,7 +2135,19 @@ static int seek_frame_internal(AVFormatContext *s, int stream_index, int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { - int ret = seek_frame_internal(s, stream_index, timestamp, flags); + int ret; + + if (s->iformat->read_seek2 && !s->iformat->read_seek) { + int64_t min_ts = INT64_MIN, max_ts = INT64_MAX; + if ((flags & AVSEEK_FLAG_BACKWARD)) + max_ts = timestamp; + else + min_ts = timestamp; + return avformat_seek_file(s, stream_index, min_ts, timestamp, max_ts, + flags & ~AVSEEK_FLAG_BACKWARD); + } + + ret = seek_frame_internal(s, stream_index, timestamp, flags); if (ret >= 0) ret = avformat_queue_attached_pictures(s); @@ -2152,6 +2164,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int if(s->seek2any>0) flags |= AVSEEK_FLAG_ANY; + flags &= ~AVSEEK_FLAG_BACKWARD; if (s->iformat->read_seek2) { int ret; |