summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-11-20 22:04:14 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-11-20 22:04:14 +0100
commitd513fb1c753292fc9f43b9e6fbd6997af85d19c6 (patch)
tree95620863941d6728bdc5d58b0e2b919f972e83bb /libavformat
parentb1e190d0fddbad800a8b89f9ea840e73257bf6e5 (diff)
Add -skip_initial_bytes option.
Fixes ticket #1909.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h7
-rw-r--r--libavformat/options_table.h1
-rw-r--r--libavformat/utils.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 8f18604085..85f052ec8c 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1162,6 +1162,13 @@ 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)
+ */
+ unsigned int skip_initial_bytes;
+
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavformat and can be changed and
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 778c740f92..3394706dc8 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -72,6 +72,7 @@ static const AVOption options[]={
{"aggressive", "consider things that a sane encoder shouldnt do as an error", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, D, "err_detect"},
{"use_wallclock_as_timestamps", "use wallclock as timestamps", OFFSET(use_wallclock_as_timestamps), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D},
{"avoid_negative_ts", "avoid negative timestamps", OFFSET(avoid_negative_ts), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, E},
+{"skip_initial_bytes", "skip initial bytes", OFFSET(skip_initial_bytes), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D},
{NULL},
};
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4760f455e1..400623149c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -561,6 +561,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
if ((ret = init_input(s, filename, &tmp)) < 0)
goto fail;
+ avio_skip(s->pb, s->skip_initial_bytes);
/* check filename in case an image number is expected */
if (s->iformat->flags & AVFMT_NEEDNUMBER) {