[FFmpeg-devel] [PATCH 4/6] MOV: pass key to metadata parse function

David Conrad lessen42
Mon Nov 23 09:46:09 CET 2009


On Nov 22, 2009, at 11:57 PM, Baptiste Coudurier wrote:

> On 11/22/09 8:14 PM, David Conrad wrote:
>> ---
>>  libavformat/mov.c |    8 ++++----
>>  1 files changed, 4 insertions(+), 4 deletions(-)
>> 
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 7ba92ff..8c42a7c 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -80,13 +80,13 @@ typedef struct MOVParseTableEntry {
>> 
>>  static const MOVParseTableEntry mov_default_parse_table[];
>> 
>> -static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len)
>> +static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len, const char *key)
>>  {
>>      char buf[16];
>> 
>>      get_be16(pb); // unknown
>>      snprintf(buf, sizeof(buf), "%d", get_be16(pb));
>> -    av_metadata_set(&c->fc->metadata, "track", buf);
>> +    av_metadata_set(&c->fc->metadata, key, buf);
>> 
>>      get_be16(pb); // total tracks
>> 
>> @@ -101,7 +101,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
>>      char str[1024], key2[16], language[4] = {0};
>>      const char *key = NULL;
>>      uint16_t str_size;
>> -    int (*parse)(MOVContext*, ByteIOContext*, unsigned) = NULL;
>> +    int (*parse)(MOVContext*, ByteIOContext*, unsigned, const char*) = NULL;
>> 
>>      switch (atom.type) {
>>      case MKTAG(0xa9,'n','a','m'): key = "title";     break;
>> @@ -157,7 +157,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
>>      str_size = FFMIN3(sizeof(str)-1, str_size, atom.size);
>> 
>>      if (parse)
>> -        parse(c, pb, str_size);
>> +        parse(c, pb, str_size, key);
>>      else {
>>          get_buffer(pb, str, str_size);
>>          str[str_size] = 0;
> 
> Is that used for something ? If no, rejected, if it will be, it will be ok when it is actually used.

It was needed for #5, a table would probably need something similar too. First 3 applied though.



More information about the ffmpeg-devel mailing list