[Ffmpeg-devel] [PATCH] waveformatetensible support

Baptiste Coudurier baptiste.coudurier
Thu Jan 25 22:55:52 CET 2007


Michael Niedermayer wrote:
> Hi
> 
> On Thu, Jan 25, 2007 at 07:02:40PM +0100, Baptiste Coudurier wrote:
>> Michael Niedermayer wrote:
>>> Hi
>>>
>>> On Sun, Jan 14, 2007 at 10:44:34PM +0100, Baptiste Coudurier wrote:
>>>> Michael Niedermayer wrote:
>>>>> Hi
>>>>>
>>>>> On Sun, Jan 14, 2007 at 01:51:29PM +0100, Baptiste Coudurier wrote:
>>>>>> Hi
>>>>>>
>>>>>> Michael Niedermayer wrote:
>>>>>>> Hi
>>>>>>>
>>>>>>> On Sun, Jan 14, 2007 at 01:39:27AM +0100, Baptiste Coudurier wrote:
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> Here is a patch to support waveformatextensible header.
>>>>>>>> Only four first byte of GUID are needed, and they seem to match twocc.
>>>>>>> [...]
>>>>>>>
>>>>>>> cosmetics must be in seperate patches
>>>>>>>
>>>>>> Ok. Here it is.
>>>>> [...]
>>>>>
>>>>>> -    codec->codec_id = wav_codec_get_id(id, codec->bits_per_sample);
>>>>>> -
>>>>>>      if (size > 16) {  /* We're obviously dealing with WAVEFORMATEX */
>>>>>> -        codec->extradata_size = get_le16(pb);
>>>>>> +        int cbSize = get_le16(pb);
>>>>>> +        if (id == 0xfffe) {
>>>>>> +            codec->bits_per_sample = get_le16(pb);
>>>>>> +            get_le32(pb); /* dwChannelMask */
>>>>>> +            id = get_le32(pb); /* 4 first bytes of GUID */
>>>>>> +            cbSize = 10; /* skip remaining bytes */
>>>>> why? why not read them in extradata?
>>>>>
>>>> What would you do with 12 last bytes of GUID in extradata ?
>>> nothing but maybe i want the 13th and later bytes
>>>
>> Like that ?
>>
>> -- 
>> Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
>> SMARTJOG S.A.                                    http://www.smartjog.com
>> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
>> Phone: +33 1 49966312
> 
>> Index: libavformat/riff.c
>> ===================================================================
>> --- libavformat/riff.c	(revision 7707)
>> +++ libavformat/riff.c	(working copy)
>> @@ -422,22 +422,32 @@
>>          codec->bits_per_sample = 8;
>>      }else
>>          codec->bits_per_sample = get_le16(pb);
>> -    codec->codec_id = wav_codec_get_id(id, codec->bits_per_sample);
>> -
>>      if (size > 16) {  /* We're obviously dealing with WAVEFORMATEX */
>> -        codec->extradata_size = get_le16(pb);
>> -        if (codec->extradata_size > 0) {
>> -            if (codec->extradata_size > size - 18)
>> -                codec->extradata_size = size - 18;
>> +        int cbSize = get_le16(pb); /* cbSize */
>> +        size -= 18;
> 
> is the >16 / -18 intended? shouldnt that be >=18 ?
> 
> 
>> +        if (cbSize > size)
>> +            cbSize = size;
> 
> cbSize= FFMIN(cbSize, size);
> 
> 
>> +        if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
>> +            codec->bits_per_sample = get_le16(pb);
>> +            get_le32(pb); /* dwChannelMask */
>> +            id = get_le32(pb); /* 4 first bytes of GUID */
>> +            url_fskip(pb, 12); /* skip end of GUID */
>> +            cbSize -= 22;
>> +            size -= 22;
>> +        }
>> +        if (cbSize > 0) {
>> +            codec->extradata_size = cbSize;
>>              codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
>>              get_buffer(pb, codec->extradata, codec->extradata_size);
>> +            size -= cbSize;
>>          } else
>>              codec->extradata_size = 0;
> 
> codec->extradata_size= cbSize; before the if() should work too
> 
> except these the patch looks ok
> 

Done and applied.


-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list