[FFmpeg-devel] [PATCH] avformat: support shorten in nistsphere demuxer

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Apr 6 22:34:20 CEST 2016


On Wednesday 06 April 2016 10:01:09 pm Paul B Mahol wrote:
> Hi,
>
> patch attached.

Slightly improved version for nistdec attached.

How is the mu-law change related?

Carl Eugen


-------------- next part --------------
diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
index 2f17f9e..aa42133 100644
--- a/libavformat/nistspheredec.c
+++ b/libavformat/nistspheredec.c
@@ -34,7 +34,7 @@ static int nist_probe(AVProbeData *p)
 
 static int nist_read_header(AVFormatContext *s)
 {
-    char buffer[32], coding[32] = "pcm", format[32] = "01";
+    char buffer[47], coding[32] = "pcm", format[32] = "01";
     int bps = 0, be = 0;
     int32_t header_size = -1;
     AVStream *st;
@@ -67,8 +67,12 @@ static int nist_read_header(AVFormatContext *s)
             } else if (!av_strcasecmp(coding, "alaw")) {
                 st->codec->codec_id = AV_CODEC_ID_PCM_ALAW;
             } else if (!av_strcasecmp(coding, "ulaw") ||
-                       !av_strcasecmp(coding, "mu-law")) {
+                       !memcmp(coding, "mu-law", FFMIN(strlen(coding), 7))) {
                 st->codec->codec_id = AV_CODEC_ID_PCM_MULAW;
+            } else if (!memcmp(coding, "pcm,embedded-shorten-v2.00", FFMIN(strlen(coding), 26))) {
+                st->codec->codec_id = AV_CODEC_ID_SHORTEN;
+                if (ff_alloc_extradata(st->codec, 1))
+                    st->codec->extradata[0] = 1;
             } else {
                 avpriv_request_sample(s, "coding %s", coding);
             }


More information about the ffmpeg-devel mailing list