[FFmpeg-devel] [PATCH] Store Major brand, Minor version and compatible brands of a mov file using the metadata API

haim alon haim.alter
Wed Sep 23 08:39:23 CEST 2009


Hi,

On Tue, Sep 22, 2009 at 8:51 PM, Baptiste Coudurier <
baptiste.coudurier at gmail.com> wrote:

> Hi,
>
>
>> [...]
>>
>> Index: libavformat/mov.c
>> ===================================================================
>> --- libavformat/mov.c   (revision 19958)
>> +++ libavformat/mov.c   (working copy)
>> @@ -490,15 +490,32 @@
>>      return 0; /* now go for moov */
>>  }
>>
>> +/* read major brand, minor version and compatible brands and store them
>> as metadata */
>>  static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
>>  {
>> -    uint32_t type = get_le32(pb);
>> +    uint32_t minor_ver;
>> +    int comp_brand_size;
>> +    char major_brand_str[5]; /* 4 characters + null */
>> +    char minor_ver_str[11]; /* 32 bit integer ->  10 digits + null */
>> +    char* comp_brands_str;
>> +    uint8_t type[5] = {0};
>>
>> -    if (type != MKTAG('q','t',' ',' '))
>> +    get_buffer(pb, type, 4);
>> +    if (strcmp(type, "qt, "))
>>          c->isom = 1;
>>      av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand:
>> %.4s\n",(char *)&type);
>> -    get_be32(pb); /* minor version */
>> -    url_fskip(pb, atom.size - 8);
>> +    av_strlcpy(major_brand_str, type, 5); /* set major version to
>> major_brand_str */
>> +    av_metadata_set(&c->fc->metadata, "major_brand", major_brand_str);
>>
>
> You don't need the copy and major_brand_str, use type.
>
>
Right


>  +    minor_ver = get_be32(pb); /* minor version */
>> +    snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver);
>> +    av_metadata_set(&c->fc->metadata, "minor_version", minor_ver_str);
>> +
>> +    comp_brand_size = atom.size - 8;
>> +    comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null
>> terminator */
>>
>
> Check for malloc return.
>
>
Done


> [...]
>
> --
> Baptiste COUDURIER
> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> FFmpeg maintainer                                  http://www.ffmpeg.org
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>

Update attached.
Thanks,
Haim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.compatible.patch
Type: text/x-patch
Size: 1562 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090923/4ba985c1/attachment.bin>



More information about the ffmpeg-devel mailing list