summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-15 18:51:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-15 19:16:57 +0200
commiteacf7d650dfe6e97d6100a232fa6a89592b625b5 (patch)
tree08ac45fefde0eab9e8084743ee5a808f39f77d69 /libavformat
parentbeeb7551d6ab44bc6a1125e6d537508bff3694fc (diff)
parent0c1959b056f6ccaa2eee2c824352ba93c8e36d52 (diff)
Merge commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52'
* commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52': lavf: add AVFMT_FLAG_BITEXACT. Conflicts: doc/APIchanges libavformat/avformat.h libavformat/flacenc.c libavformat/movenc.c libavformat/oggenc.c libavformat/options_table.h libavformat/version.h tests/fate/video.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h7
-rw-r--r--libavformat/flacenc.c2
-rw-r--r--libavformat/matroskaenc.c2
-rw-r--r--libavformat/movenc.c2
-rw-r--r--libavformat/mux.c7
-rw-r--r--libavformat/mxfenc.c4
-rw-r--r--libavformat/oggenc.c10
-rw-r--r--libavformat/options_table.h1
-rw-r--r--libavformat/version.h7
9 files changed, 29 insertions, 13 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d09745acb8..55a3cfbd35 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1252,6 +1252,13 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.
#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted
#define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet.
+/**
+ * When muxing, try to avoid writing any random/volatile data to the output.
+ * This includes any random IDs, real-time timestamps/dates, muxer version, etc.
+ *
+ * This flag is mainly intended for testing.
+ */
+#define AVFMT_FLAG_BITEXACT 0x0400
#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload
#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)
#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted)
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 0eca5aaccb..d92801807e 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -98,7 +98,7 @@ static int flac_write_header(struct AVFormatContext *s)
return ret;
ret = flac_write_block_comment(s->pb, &s->metadata, !padding,
- codec->flags & CODEC_FLAG_BITEXACT);
+ s->flags & AVFMT_FLAG_BITEXACT);
if (ret)
return ret;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 8b19ae3565..17eb318aad 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1160,7 +1160,7 @@ static int mkv_write_header(AVFormatContext *s)
put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000);
if ((tag = av_dict_get(s->metadata, "title", NULL, 0)))
put_ebml_string(pb, MATROSKA_ID_TITLE, tag->value);
- if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
+ if (!(s->flags & AVFMT_FLAG_BITEXACT)) {
uint32_t segment_uid[4];
AVLFG lfg;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b3a7649454..adcbcf2c0f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3872,7 +3872,7 @@ static int mov_write_header(AVFormatContext *s)
}
for (i = 0; i < s->nb_streams; i++)
- if (s->streams[i]->codec->flags & CODEC_FLAG_BITEXACT)
+ if (s->flags & AVFMT_FLAG_BITEXACT)
mov->exact = 1;
/* Set the FRAGMENT flag if any of the fragmentation methods are
diff --git a/libavformat/mux.c b/libavformat/mux.c
index cbe17f5d78..175f157741 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -235,6 +235,11 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
(ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0)
goto fail;
+#if FF_API_LAVF_BITEXACT
+ if (s->nb_streams && s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)
+ s->flags |= AVFMT_FLAG_BITEXACT;
+#endif
+
// some sanity checks
if (s->nb_streams == 0 && !(of->flags & AVFMT_NOSTREAMS)) {
av_log(s, AV_LOG_ERROR, "No streams to mux were specified\n");
@@ -340,7 +345,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
}
/* set muxer identification string */
- if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
+ if (!(s->flags & AVFMT_FLAG_BITEXACT)) {
av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
} else {
av_dict_set(&s->metadata, "encoder", NULL, 0);
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 5e77a3f068..6f3226b968 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -618,7 +618,7 @@ static void mxf_write_identification(AVFormatContext *s)
mxf_write_metadata_key(pb, 0x013000);
PRINT_KEY(s, "identification key", pb->buf_ptr - 16);
- version = s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT ?
+ version = s->flags & AVFMT_FLAG_BITEXACT ?
"0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
length = 84 + (strlen(company)+strlen(product)+strlen(version))*2; // utf-16
klv_encode_ber_length(pb, length);
@@ -1777,7 +1777,7 @@ static int mxf_write_header(AVFormatContext *s)
mxf->essence_container_count = 1;
}
- if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
+ if (!(s->flags & AVFMT_FLAG_BITEXACT))
mxf_gen_umid(s);
for (i = 0; i < s->nb_streams; i++) {
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 4ba6940d10..375abadd44 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -432,7 +432,7 @@ static int ogg_write_header(AVFormatContext *s)
oggstream->page.stream_index = i;
- if (!(st->codec->flags & CODEC_FLAG_BITEXACT))
+ if (!(s->flags & AVFMT_FLAG_BITEXACT))
do {
serial_num = av_get_random_seed();
for (j = 0; j < i; j++) {
@@ -448,7 +448,7 @@ static int ogg_write_header(AVFormatContext *s)
st->priv_data = oggstream;
if (st->codec->codec_id == AV_CODEC_ID_FLAC) {
int err = ogg_build_flac_headers(st->codec, oggstream,
- st->codec->flags & CODEC_FLAG_BITEXACT,
+ s->flags & AVFMT_FLAG_BITEXACT,
&st->metadata);
if (err) {
av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n");
@@ -457,7 +457,7 @@ static int ogg_write_header(AVFormatContext *s)
}
} else if (st->codec->codec_id == AV_CODEC_ID_SPEEX) {
int err = ogg_build_speex_headers(st->codec, oggstream,
- st->codec->flags & CODEC_FLAG_BITEXACT,
+ s->flags & AVFMT_FLAG_BITEXACT,
&st->metadata);
if (err) {
av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n");
@@ -466,7 +466,7 @@ static int ogg_write_header(AVFormatContext *s)
}
} else if (st->codec->codec_id == AV_CODEC_ID_OPUS) {
int err = ogg_build_opus_headers(st->codec, oggstream,
- st->codec->flags & CODEC_FLAG_BITEXACT,
+ s->flags & AVFMT_FLAG_BITEXACT,
&st->metadata);
if (err) {
av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n");
@@ -487,7 +487,7 @@ static int ogg_write_header(AVFormatContext *s)
return -1;
}
- p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT,
+ p = ogg_write_vorbiscomment(7, s->flags & AVFMT_FLAG_BITEXACT,
&oggstream->header_len[1], &st->metadata,
framing_bit);
oggstream->header[1] = p;
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index be5003403c..359b38483a 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -50,6 +50,7 @@ static const AVOption avformat_options[] = {
{"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
{"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
{"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, D},
+{"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
{"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = 1<<20 }, 0, INT_MAX, D},
diff --git a/libavformat/version.h b/libavformat/version.h
index 8905fb5b25..c6667ca7bf 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,8 +30,8 @@
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 55
-#define LIBAVFORMAT_VERSION_MINOR 37
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MINOR 38
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
@@ -51,6 +51,9 @@
#ifndef FF_API_REFERENCE_DTS
#define FF_API_REFERENCE_DTS (LIBAVFORMAT_VERSION_MAJOR < 56)
#endif
+#ifndef FF_API_LAVF_BITEXACT
+#define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 56)
+#endif
#ifndef FF_API_ALLOC_OUTPUT_CONTEXT
#define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 56)