[Ffmpeg-devel] [PATCH] ASF Stream bitrate GUID parsing....

Ryan Martell rdm4
Tue Jan 9 21:23:57 CET 2007


On Jan 5, 2007, at 1:42 PM, Ryan Martell wrote:

> Hi--
>
> On Jan 4, 2007, at 9:27 PM, Ryan Martell wrote:
>
>> Hi...
>>
>> On Jan 4, 2007, at 6:59 PM, Michael Niedermayer wrote:
>>
>>> Hi
>>>
>>> On Thu, Jan 04, 2007 at 04:45:22PM -0600, Ryan Martell wrote:
>>>> Hi--
>>>>
>>>> To support my native mms code, I need to parse the bitrate GUID
>>>> header of the ASF file if it's present.  This small patch adds that
>>>> information to the ASFContext.
>>>>
>>>> A couple of quick notes:
>>>>
>>>> 1) The indentation is actually correct now (the block below is
>>>> indented incorrectly) on the lines:
>>>> -       } else if (!memcmp(&g, &extended_content_header, sizeof
>>>> (GUID))) {
>>>> +        } else if (!memcmp(&g, &stream_bitrate_guid, sizeof 
>>>> (GUID))) {
>>>>
>>>> 2) I removed:
>>>>  ASFStream streams[128];     /* it's max number and it's not that
>>>> big */
>>>>> from the ASFContext, as it was unused (and big).  I replaced it  
>>>>> with
>>>> a 128 uint32_t array, which seems fair.
>
> Attached is another patch; I couldn't remove streams, as it was  
> used by asf_enc.c, and I the deps aren't quite right, so I didn't  
> catch it until I did a full rebuild.
>
>>> [...]
>>>> +        } else if (!memcmp(&g, &stream_bitrate_guid, sizeof 
>>>> (GUID))) {
>>>> +            uint16_t streams = get_le16(pb);
>>>> +            int j;
>>>> +
>>>> +#ifdef DEBUG
>>>> +            av_log(NULL, AV_LOG_ERROR, "stream bitrate  
>>>> properties\n");
>>>> +            av_log(NULL, AV_LOG_ERROR, "streams %d\n", streams);
>>>> +#endif
>>>> +
>>>> +            for(j = 0; j < streams; j++) {
>>>> +                uint16_t flags;
>>>> +                uint32_t bitrate;
>>>> +                int stream_id;
>>>> +
>>>> +                flags= get_le16(pb);
>>>> +                bitrate= get_le32(pb);
>>>> +                stream_id= (flags & 0x7f);
>>>> +#ifdef DEBUG
>>>> +                av_log(NULL, AV_LOG_ERROR, "flags: 0x%x stream  
>>>> id %d, bitrate %d\n", flags, stream_id, bitrate);
>>>> +#endif
>>>> +                asf->stream_bitrates[stream_id-1]= bitrate;
>>>
>>> the -1 causes a possible write prior to the array
>>
>> stream_id of zero is invalid; attached patch ignores bitrate if  
>> the stream id is zero.
>
> <asf_patch.txt>

If the patch is okay, could someone apply it?  Thanks!
-Ryan




More information about the ffmpeg-devel mailing list