Merge commit '174c5fde90060faab67796a5eaef742630f1db6e'
* commit '174c5fde90060faab67796a5eaef742630f1db6e': mov: parse @PRM and @PRQ metadata tags Conflicts: libavformat/mov.c See: f540851ce320bc69621ea70b89857c54129c82c2 Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
420aebf0c5
@ -265,8 +265,11 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
uint16_t langcode = 0;
|
||||
uint32_t data_type = 0, str_size, str_size_alloc;
|
||||
int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL;
|
||||
int raw = 0;
|
||||
|
||||
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( 'a','A','R','T'): key = "album_artist"; break;
|
||||
case MKTAG( 'c','p','i','l'): key = "compilation";
|
||||
parse = mov_metadata_int8_no_padding; break;
|
||||
@ -283,10 +286,6 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
return mov_metadata_loci(c, pb, atom.size);
|
||||
case MKTAG( 'p','g','a','p'): key = "gapless_playback";
|
||||
parse = mov_metadata_int8_no_padding; break;
|
||||
case MKTAG( '@','P','R','M'):
|
||||
return mov_metadata_raw(c, pb, atom.size, "premiere_version");
|
||||
case MKTAG( '@','P','R','Q'):
|
||||
return mov_metadata_raw(c, pb, atom.size, "quicktime_version");
|
||||
case MKTAG( 's','t','i','k'): key = "media_type";
|
||||
parse = mov_metadata_int8_no_padding; break;
|
||||
case MKTAG( 't','r','k','n'): key = "track";
|
||||
@ -337,7 +336,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
return ret;
|
||||
}
|
||||
} else return 0;
|
||||
} else if (atom.size > 4 && key && !c->itunes_metadata) {
|
||||
} else if (atom.size > 4 && key && !c->itunes_metadata && !raw) {
|
||||
str_size = avio_rb16(pb); // string length
|
||||
langcode = avio_rb16(pb);
|
||||
ff_mov_lang_to_iso639(langcode, language);
|
||||
@ -355,7 +354,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
if (atom.size < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
str_size_alloc = str_size << 1; // worst-case requirement for output string in case of utf8 coded input
|
||||
// worst-case requirement for output string in case of utf8 coded input
|
||||
str_size_alloc = raw ? str_size + 1 : str_size * 2;
|
||||
str = av_malloc(str_size_alloc);
|
||||
if (!str)
|
||||
return AVERROR(ENOMEM);
|
||||
@ -363,7 +363,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
if (parse)
|
||||
parse(c, pb, str_size, key);
|
||||
else {
|
||||
if (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff))) { // MAC Encoded
|
||||
if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) { // MAC Encoded
|
||||
mov_read_mac_string(c, pb, str_size, str, str_size_alloc);
|
||||
} else {
|
||||
int ret = avio_read(pb, str, str_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user