avformat/nistshperedec: add support for mu-law as sample-byte-format
authorPaul B Mahol <onemda@gmail.com>
Fri, 8 Apr 2016 20:26:08 +0000 (22:26 +0200)
committerPaul B Mahol <onemda@gmail.com>
Fri, 8 Apr 2016 20:34:38 +0000 (22:34 +0200)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/nistspheredec.c

index 542bcd1..359d9e3 100644 (file)
@@ -62,8 +62,9 @@ static int nist_read_header(AVFormatContext *s)
                 st->codec->bits_per_coded_sample = bps << 3;
 
             if (!av_strcasecmp(coding, "pcm")) {
-                st->codec->codec_id = ff_get_pcm_codec_id(st->codec->bits_per_coded_sample,
-                                                          0, be, 0xFFFF);
+                if (st->codec->codec_id == AV_CODEC_ID_NONE)
+                    st->codec->codec_id = ff_get_pcm_codec_id(st->codec->bits_per_coded_sample,
+                                                              0, be, 0xFFFF);
             } else if (!av_strcasecmp(coding, "alaw")) {
                 st->codec->codec_id = AV_CODEC_ID_PCM_ALAW;
             } else if (!av_strcasecmp(coding, "ulaw") ||
@@ -96,6 +97,8 @@ static int nist_read_header(AVFormatContext *s)
                 be = 0;
             } else if (!av_strcasecmp(format, "10")) {
                 be = 1;
+            } else if (!av_strcasecmp(format, "mu-law")) {
+                st->codec->codec_id = AV_CODEC_ID_PCM_MULAW;
             } else if (av_strcasecmp(format, "1")) {
                 avpriv_request_sample(s, "sample byte format %s", format);
                 return AVERROR_PATCHWELCOME;