[FFmpeg-devel] [PATCH] fix the SAMPLE_FMT_NONE case in ffmdec.c

Ronald S. Bultje rsbultje
Tue Mar 16 17:29:25 CET 2010


Hi,

2010/3/16 M?ns Rullg?rd <mans at mansr.com>:
> "Ronald S. Bultje" <rsbultje at gmail.com> writes:
>> On Tue, Mar 16, 2010 at 2:34 AM, Peter Ross <pross at xvid.org> wrote:
>>> On Mon, Mar 15, 2010 at 04:15:10PM -0400, Ronald S. Bultje wrote:
>>>> --- libavformat/ffmdec.c ? ? ?(revision 22550)
>>>> +++ libavformat/ffmdec.c ? ? ?(working copy)
>>>> @@ -355,6 +355,8 @@
>>>> ? ? ? ? ? ? ?codec->channels = get_le16(pb);
>>>> ? ? ? ? ? ? ?codec->frame_size = get_le16(pb);
>>>
>>>> ? ? ? ? ? ? ?codec->sample_fmt = get_le16(pb);
>>>> + ? ? ? ? ? ?if (codec->sample_fmt == (1 << 16) - 1)
>>>> + ? ? ? ? ? ? ? ?codec->sample_fmt = -1;
>>>
>>> why not read it as a signed 16-bit integer? e.g.
>>> ? ? ? ?codec->sample_fmt = sign_extend( get_le16(), 16 )
>>
>> True, I didn't know it existed, thanks for the pointer. New patch
>> attached (works the same as previous).
>>
>> Ronald
>>
>> Index: libavformat/ffmdec.c
>> ===================================================================
>> --- libavformat/ffmdec.c ? ? ?(revision 22565)
>> +++ libavformat/ffmdec.c ? ? ?(working copy)
>> @@ -21,6 +21,7 @@
>>
>> ?#include "libavutil/intreadwrite.h"
>> ?#include "avformat.h"
>> +#include "libavcodec/get_bits.h"
>> ?#include "ffm.h"
>> ?#if CONFIG_FFSERVER
>> ?#include <unistd.h>
>> @@ -354,7 +355,7 @@
>> ? ? ? ? ? ? ?codec->sample_rate = get_be32(pb);
>> ? ? ? ? ? ? ?codec->channels = get_le16(pb);
>> ? ? ? ? ? ? ?codec->frame_size = get_le16(pb);
>> - ? ? ? ? ? ?codec->sample_fmt = get_le16(pb);
>> + ? ? ? ? ? ?codec->sample_fmt = sign_extend(get_le16(pb), 16);
>> ? ? ? ? ? ? ?break;
>> ? ? ? ? ?default:
>> ? ? ? ? ? ? ?goto fail;
>
> sign_extend() is in mathops.h, not get_bits.h

Hm, indeed. New patch again.

Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-ffm-no_sample_fmt.patch
Type: text/x-patch
Size: 683 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100316/b73961ab/attachment.bin>



More information about the ffmpeg-devel mailing list