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

Ryan Martell rdm4
Wed Jan 10 01:19:13 CET 2007


On Jan 9, 2007, at 5:55 PM, Michael Niedermayer wrote:

> Hi
>
> On Fri, Jan 05, 2007 at 01:42:40PM -0600, 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.
> [...]
>> Index: libavformat/asf.h
>> ===================================================================
>> --- libavformat/asf.h	(revision 7407)
>> +++ libavformat/asf.h	(working copy)
>> @@ -85,6 +85,7 @@
>>      int is_streamed;
>>      int asfid2avid[128];        /* conversion table from asf ID 2  
>> AVStream ID */
>>      ASFStream streams[128];     /* it's max number and it's not  
>> that big */
>> +    uint32_t stream_bitrates[128]; /* The above streams is used  
>> by asf_enc.c; my bad. this is a fair trade (and much smaller) */
>>      /* non streamed additonnal info */
>
> exporting the bitrates like this makes them invissible to the user
> application so the user app cannot setup AVStream.discard
>
> AVStream.codec.bit_rate seems like its the more ideal place where this
> could be stored

Okay, I can echo them into there, but the bitrate properties come  
before the streams are setup, so I will still need a temporary place  
to hold them.

I can either leave this like it is, but then when the streams are  
setup, copy the bitrate parameters from this location int  
AVStream.codec.bit_rate if they have been set.

Alternatively I would need an array of 128 ints in asf_read_header to  
store them on the stack.  Either one works for me.

Thanks,
-R




More information about the ffmpeg-devel mailing list