lavf/mpeg: Support alaw in Hikvision CCTV recordings.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Fri, 3 Apr 2015 19:04:43 +0000 (21:04 +0200)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Fri, 3 Apr 2015 19:13:50 +0000 (21:13 +0200)
Fixes a sample from ticket #4182.

libavformat/mpeg.c

index dbe5f10..c29291d 100644 (file)
@@ -547,6 +547,9 @@ redo:
             codec_id = AV_CODEC_ID_ADPCM_ADX;
             // Auto-detect AC-3
             request_probe = 50;
+        } else if (m->imkh_cctv && startcode == 0x1c0) {
+            codec_id = AV_CODEC_ID_PCM_ALAW;
+            request_probe = 50;
         } else {
             codec_id = AV_CODEC_ID_MP2;
             if (m->imkh_cctv)
@@ -593,7 +596,8 @@ skip:
     st->id                = startcode;
     st->codec->codec_type = type;
     st->codec->codec_id   = codec_id;
-    if (st->codec->codec_id == AV_CODEC_ID_PCM_MULAW) {
+    if (   st->codec->codec_id == AV_CODEC_ID_PCM_MULAW
+        || st->codec->codec_id == AV_CODEC_ID_PCM_ALAW) {
         st->codec->channels = 1;
         st->codec->channel_layout = AV_CH_LAYOUT_MONO;
         st->codec->sample_rate = 8000;