[FFmpeg-devel] [PATCH] fix the SAMPLE_FMT_NONE case in ffmdec.c
Michael Niedermayer
michaelni
Tue Mar 16 17:25:21 CET 2010
On Tue, Mar 16, 2010 at 12:19:13PM -0400, Ronald S. Bultje wrote:
> Hi Peter,
>
> 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
> ffmdec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 7cc27b8582019e48a0d33b3ee9efbea70e2eb46e fix-ffm-no_sample_fmt.patch
> 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);
a simple cast to int16_t seems simpler
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100316/ed8276b8/attachment.pgp>
More information about the ffmpeg-devel
mailing list