[Ffmpeg-devel] [PATCH] ASF Stream bitrate GUID parsing....
Ryan Martell
rdm4
Fri Jan 5 04:27:45 CET 2007
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.
> [...]
>> + } 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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asf_patch.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070104/2512139b/attachment.txt>
-------------- next part --------------
Thanks!
-Ryan
More information about the ffmpeg-devel
mailing list