]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sol.c
imgconvert: Drop outdated comment block
[ffmpeg] / libavformat / sol.c
index da846002e83617e7a74d48f7256dacfbd56336ec..30f0547d1d72268c3c4f2adce03b2d998fabae98 100644 (file)
@@ -23,6 +23,7 @@
  * Based on documents from Game Audio Player and own research
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -49,18 +50,15 @@ static int sol_probe(AVProbeData *p)
 
 static enum AVCodecID sol_codec_id(int magic, int type)
 {
-    if (magic == 0x0B8D)
-    {
-        if (type & SOL_DPCM) return AV_CODEC_ID_SOL_DPCM;
-        else return AV_CODEC_ID_PCM_U8;
-    }
     if (type & SOL_DPCM)
-    {
-        if (type & SOL_16BIT) return AV_CODEC_ID_SOL_DPCM;
-        else if (magic == 0x0C8D) return AV_CODEC_ID_SOL_DPCM;
-        else return AV_CODEC_ID_SOL_DPCM;
-    }
-    if (type & SOL_16BIT) return AV_CODEC_ID_PCM_S16LE;
+        return AV_CODEC_ID_SOL_DPCM;
+
+    if (magic == 0x0B8D)
+        return AV_CODEC_ID_PCM_U8;
+
+    if (type & SOL_16BIT)
+        return AV_CODEC_ID_PCM_S16LE;
+
     return AV_CODEC_ID_PCM_U8;
 }
 
@@ -116,6 +114,8 @@ static int sol_read_header(AVFormatContext *s)
     st->codec->codec_tag = id;
     st->codec->codec_id = codec;
     st->codec->channels = channels;
+    st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
+                                                AV_CH_LAYOUT_STEREO;
     st->codec->sample_rate = rate;
     avpriv_set_pts_info(st, 64, 1, rate);
     return 0;