[FFmpeg-devel] [PATCH]Allow >2G for skip_initial_bytes

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Jun 5 23:13:37 CEST 2014


Hi!

Attached patch allows larger values for -skip_initial_bytes.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 01c3b75..f3b6614 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1494,10 +1494,9 @@ typedef struct AVFormatContext {
     enum AVDurationEstimationMethod duration_estimation_method;
 
     /**
-     * Skip initial bytes when opening stream
-     * - encoding: unused
-     * - decoding: Set by user via AVOptions (NO direct access)
+     * @deprecated deprecated in favor of skip_initial_bytes2()
      */
+    attribute_deprecated
     unsigned int skip_initial_bytes;
 
     /**
@@ -1649,6 +1648,13 @@ typedef struct AVFormatContext {
      * Muxing: set by user via AVOptions (NO direct access)
      */
     int64_t output_ts_offset;
+
+    /**
+     * Skip initial bytes when opening stream
+     * - encoding: unused
+     * - decoding: Set by user via AVOptions (NO direct access)
+     */
+    int64_t skip_initial_bytes2;
 } AVFormatContext;
 
 int av_format_get_probe_score(const AVFormatContext *s);
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 069edee..9136906 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -83,7 +83,7 @@ static const AVOption avformat_options[] = {
 {"disabled",            "do not change timestamps",                  0, AV_OPT_TYPE_CONST, {.i64 =  0 }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
 {"make_zero",           "shift timestamps so they start at 0",       0, AV_OPT_TYPE_CONST, {.i64 =  2 }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
 {"make_non_negative",   "shift timestamps so they are non negative", 0, AV_OPT_TYPE_CONST, {.i64 =  1 }, INT_MIN, INT_MAX, E, "avoid_negative_ts"},
-{"skip_initial_bytes", "set number of bytes to skip before reading header and frames", OFFSET(skip_initial_bytes), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D},
+{"skip_initial_bytes", "set number of bytes to skip before reading header and frames", OFFSET(skip_initial_bytes2), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX-1, D},
 {"correct_ts_overflow", "correct single timestamp overflows", OFFSET(correct_ts_overflow), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, D},
 {"flush_packets", "enable flushing of the I/O context after each packet", OFFSET(flush_packets), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E},
 {"metadata_header_padding", "set number of bytes to be written as padding in a metadata header", OFFSET(metadata_header_padding), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, E},
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5c646c6..13bbde5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -559,6 +559,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
     if ((ret = init_input(s, filename, &tmp)) < 0)
         goto fail;
     s->probe_score = ret;
+    avio_skip(s->pb, s->skip_initial_bytes2);
     avio_skip(s->pb, s->skip_initial_bytes);
 
     /* Check filename in case an image number is expected. */


More information about the ffmpeg-devel mailing list