Merge commit 'b704b648f9ecb830874627db958a37e004107d1b'

* commit 'b704b648f9ecb830874627db958a37e004107d1b':
  mov: parse XMP metadata on demand

Conflicts:
	libavformat/isom.h
	libavformat/version.h

See: 054c506e3d

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>
pull/101/head
Michael Niedermayer 10 years ago
commit 0dcebe2620
  1. 1
      libavformat/isom.h
  2. 17
      libavformat/mov.c
  3. 2
      libavformat/version.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;

@ -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 },
};

@ -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, \

Loading…
Cancel
Save