Cast sample_fmt (as read from bitstream as a 16-bit value) to int16, so that
authorRonald S. Bultje <rsbultje@gmail.com>
Wed, 17 Mar 2010 15:14:18 +0000 (15:14 +0000)
committerRonald S. Bultje <rsbultje@gmail.com>
Wed, 17 Mar 2010 15:14:18 +0000 (15:14 +0000)
negative values, e.g. SAMPLE_FMT_NONE (-1), are read correctly also.

Originally committed as revision 22585 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/ffmdec.c

index ff61f21..b39836a 100644 (file)
@@ -354,7 +354,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
             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 = (int16_t) get_le16(pb);
             break;
         default:
             goto fail;