[FFmpeg-devel] [PATCH] lavf: add AVFMT_FLAG_SEEK2ANY to force seeking to non keyframes via AVOptions

Michael Niedermayer michaelni at gmx.at
Mon Aug 6 01:37:02 CEST 2012


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/avformat.h      |    1 +
 libavformat/options_table.h |    1 +
 libavformat/utils.c         |    3 +++
 libavformat/version.h       |    4 ++--
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 58b02a6..215db60 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -365,6 +365,7 @@ typedef struct AVProbeData {
                                         still be monotonic */
 
 #define AVFMT_SEEK_TO_PTS   0x4000000 /**< Seeking is based on PTS */
+#define AVFMT_FLAG_SEEK2ANY 0x10000000 /**< force AVSEEK_FLAG_ANY on all seeks*/
 
 /**
  * @addtogroup lavf_encoding
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 9bc0329..7ed1ba0 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -48,6 +48,7 @@ static const AVOption options[]={
 {"keepside", "dont merge side data", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
 {"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
 {"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
+{"seek2any", "forces seeking to enable seek to any mode", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_SEEK2ANY }, 0, INT_MAX, D, "fflags"},
 {"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.dbl = 5*AV_TIME_BASE }, 0, INT_MAX, D},
 {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D},
 {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.dbl = 1<<20 }, 0, INT_MAX, D},
diff --git a/libavformat/utils.c b/libavformat/utils.c
index af2575a..1235109 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2006,6 +2006,9 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
     if(min_ts > ts || max_ts < ts)
         return -1;
 
+    if(s->flags & AVFMT_FLAG_SEEK2ANY)
+        flags |= AVSEEK_FLAG_ANY;
+
     if (s->iformat->read_seek2) {
         int ret;
         ff_read_frame_flush(s);
diff --git a/libavformat/version.h b/libavformat/version.h
index 4cda247..99a8ddf 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,8 +30,8 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 54
-#define LIBAVFORMAT_VERSION_MINOR 22
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 23
+#define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list