aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-02 22:00:02 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-02 22:13:20 +0100
commit781a5a392c4d0da5250c28a153c14f88aad09a73 (patch)
tree880b27be8532207156741ac4fc5c89a4a5feeec3
parent302ed9c43f2d2a0764a9f9d2a4b2e512d2c9592f (diff)
parente352b293712ff7cbde67eba3ce3f8510b037de09 (diff)
downloadffmpeg-781a5a392c4d0da5250c28a153c14f88aad09a73.tar.gz
Merge commit 'e352b293712ff7cbde67eba3ce3f8510b037de09'
* commit 'e352b293712ff7cbde67eba3ce3f8510b037de09': mov: Add an option for exporting all metadata Conflicts: libavformat/isom.h libavformat/mov.c libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/isom.h3
-rw-r--r--libavformat/mov.c20
-rw-r--r--libavformat/version.h2
3 files changed, 12 insertions, 13 deletions
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 52da1a3217..074837f028 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -164,7 +164,7 @@ typedef struct MOVStreamContext {
} MOVStreamContext;
typedef struct MOVContext {
- AVClass *avclass;
+ const AVClass *class; ///< class for private options
AVFormatContext *fc;
int time_scale;
int64_t duration; ///< duration of the longest track
@@ -181,6 +181,7 @@ typedef struct MOVContext {
int use_absolute_path;
int ignore_editlist;
int64_t next_root_atom; ///< offset of the next root atom
+ int export_all;
int *bitrates; ///< bitrates read before streams creation
int bitrates_count;
int moov_retry;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index e18050a99f..73178c94c9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -27,8 +27,6 @@
#include <limits.h>
#include <stdint.h>
-//#define MOV_EXPORT_ALL_METADATA
-
#include "libavutil/attributes.h"
#include "libavutil/channel_layout.h"
#include "libavutil/display.h"
@@ -260,9 +258,7 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
-#ifdef MOV_EXPORT_ALL_METADATA
char tmp_key[5];
-#endif
char key2[32], language[4] = {0};
char *str = NULL;
const char *key = NULL;
@@ -349,12 +345,10 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
} else
str_size = atom.size;
-#ifdef MOV_EXPORT_ALL_METADATA
- if (!key) {
+ if (c->export_all && !key) {
snprintf(tmp_key, 5, "%.4s", (char*)&atom.type);
key = tmp_key;
}
-#endif
if (!key)
return 0;
@@ -4199,7 +4193,9 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
return 0;
}
-static const AVOption options[] = {
+#define OFFSET(x) offsetof(MOVContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+static const AVOption mov_options[] = {
{"use_absolute_path",
"allow using absolute path when opening alias, this is a possible security issue",
offsetof(MOVContext, use_absolute_path), FF_OPT_TYPE_INT, {.i64 = 0},
@@ -4217,19 +4213,22 @@ static const AVOption options[] = {
AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM, "use_mfra_for" },
{"pts", "pts", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_PTS}, 0, 0,
AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM, "use_mfra_for" },
- {NULL}
+ { "export_all", "Export unrecognized metadata entries", OFFSET(export_all),
+ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS },
+ { NULL },
};
static const AVClass mov_class = {
.class_name = "mov,mp4,m4a,3gp,3g2,mj2",
.item_name = av_default_item_name,
- .option = options,
+ .option = mov_options,
.version = LIBAVUTIL_VERSION_INT,
};
AVInputFormat ff_mov_demuxer = {
.name = "mov,mp4,m4a,3gp,3g2,mj2",
.long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
+ .priv_class = &mov_class,
.priv_data_size = sizeof(MOVContext),
.extensions = "mov,mp4,m4a,3gp,3g2,mj2",
.read_probe = mov_probe,
@@ -4237,6 +4236,5 @@ AVInputFormat ff_mov_demuxer = {
.read_packet = mov_read_packet,
.read_close = mov_read_close,
.read_seek = mov_read_seek,
- .priv_class = &mov_class,
.flags = AVFMT_NO_BYTE_SEEK,
};
diff --git a/libavformat/version.h b/libavformat/version.h
index 206b265574..72884145a7 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 15
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \