diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-08 22:33:38 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-08 22:59:16 +0100 |
commit | 0dcebe26209fbda0bac54789406e0a30c3a08247 (patch) | |
tree | 1d3fde22f4313ced12e038f1617d6a86fc86e79b /libavformat | |
parent | 420aebf0c585e54468e631460065448c9bb6ccb5 (diff) | |
parent | b704b648f9ecb830874627db958a37e004107d1b (diff) | |
download | ffmpeg-0dcebe26209fbda0bac54789406e0a30c3a08247.tar.gz |
Merge commit 'b704b648f9ecb830874627db958a37e004107d1b'
* commit 'b704b648f9ecb830874627db958a37e004107d1b':
mov: parse XMP metadata on demand
Conflicts:
libavformat/isom.h
libavformat/version.h
See: 054c506e3da35471ea92dbedcaaf720d0754f04e
The default is left unchanged at enabled
We can change the default if people prefer but i do not want to do that
in a merge.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/isom.h | 1 | ||||
-rw-r--r-- | libavformat/mov.c | 17 | ||||
-rw-r--r-- | libavformat/version.h | 2 |
3 files changed, 6 insertions, 14 deletions
diff --git a/libavformat/isom.h b/libavformat/isom.h index e3160d00f8..f8e398b886 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -182,6 +182,7 @@ typedef struct MOVContext { int ignore_editlist; int64_t next_root_atom; ///< offset of the next root atom int export_all; + int export_xmp; int *bitrates; ///< bitrates read before streams creation int bitrates_count; int moov_retry; diff --git a/libavformat/mov.c b/libavformat/mov.c index 7a32d132cf..386371043c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -207,17 +207,6 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) return 0; } -static int mov_metadata_raw(MOVContext *c, AVIOContext *pb, - unsigned len, const char *key) -{ - char *value = av_malloc(len + 1); - if (!value) - return AVERROR(ENOMEM); - avio_read(pb, value, len); - value[len] = 0; - return av_dict_set(&c->fc->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); -} - static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len) { char language[4] = { 0 }; @@ -270,6 +259,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) switch (atom.type) { case MKTAG( '@','P','R','M'): key = "premiere_version"; raw = 1; break; case MKTAG( '@','P','R','Q'): key = "quicktime_version"; raw = 1; break; + case MKTAG( 'X','M','P','_'): + if (c->export_xmp) { key = "xmp"; raw = 1; } break; case MKTAG( 'a','A','R','T'): key = "album_artist"; break; case MKTAG( 'c','p','i','l'): key = "compilation"; parse = mov_metadata_int8_no_padding; break; @@ -297,8 +288,6 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) case MKTAG( 't','v','s','h'): key = "show"; break; case MKTAG( 't','v','s','n'): key = "season_number"; parse = mov_metadata_int8_bypass_padding; break; - case MKTAG( 'X','M','P','_'): - return mov_metadata_raw(c, pb, atom.size, "xmp"); case MKTAG(0xa9,'A','R','T'): key = "artist"; break; case MKTAG(0xa9,'a','l','b'): key = "album"; break; case MKTAG(0xa9,'a','u','t'): key = "artist"; break; @@ -4214,6 +4203,8 @@ static const AVOption mov_options[] = { AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM, "use_mfra_for" }, { "export_all", "Export unrecognized metadata entries", OFFSET(export_all), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS }, + { "export_xmp", "Export full XMP metadata", OFFSET(export_xmp), + AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, .flags = FLAGS }, { NULL }, }; diff --git a/libavformat/version.h b/libavformat/version.h index 72884145a7..f3de8ac6ad 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 102 +#define LIBAVFORMAT_VERSION_MICRO 103 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ |