]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/iss.c
mov: Make sure the read sample count is nonnegative
[ffmpeg] / libavformat / iss.c
index c2ba1f0eb530668960e20f5a07a3d309f4da3795..3f7f4feff2102950f7837e2a9e4831716e0e7620 100644 (file)
@@ -26,6 +26,7 @@
  * @see http://wiki.multimedia.cx/index.php?title=FunCom_ISS
  */
 
+#include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "internal.h"
 #include "libavutil/avstring.h"
@@ -93,8 +94,14 @@ static av_cold int iss_read_header(AVFormatContext *s)
     if (!st)
         return AVERROR(ENOMEM);
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_ADPCM_IMA_ISS;
-    st->codec->channels = stereo ? 2 : 1;
+    st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_ISS;
+    if (stereo) {
+        st->codec->channels       = 2;
+        st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+    } else {
+        st->codec->channels       = 1;
+        st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+    }
     st->codec->sample_rate = 44100;
     if(rate_divisor > 0)
          st->codec->sample_rate /= rate_divisor;
@@ -123,11 +130,10 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
 }
 
 AVInputFormat ff_iss_demuxer = {
-    .name           = "ISS",
-    .long_name      = NULL_IF_CONFIG_SMALL("Funcom ISS format"),
+    .name           = "iss",
+    .long_name      = NULL_IF_CONFIG_SMALL("Funcom ISS"),
     .priv_data_size = sizeof(IssDemuxContext),
     .read_probe     = iss_probe,
     .read_header    = iss_read_header,
     .read_packet    = iss_read_packet,
 };
-