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

Måns Rullgård mans
Wed Mar 17 01:17:46 CET 2010


Bobby Bingham <uhmmmm at gmail.com> writes:

> On Tue, 16 Mar 2010 16:38:44 +0000
> M?ns Rullg?rd <mans at mansr.com> wrote:
> [...]
>> >>              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);
>> >
>> > a simple cast to int16_t seems simpler
>> 
>> Strictly speaking, that is undefined, but I don't think we care,
>
> Could you explain why is this undefined?  My initial guess was that
> you're not guaranteed that signed integers two's complement,

Correct.

> but I thought you were guaranteed that for the fixed-width C99 int
> types.

No, you're not.  There are requirements on the range of values they
can hold, but no requirements on implementation.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list