From f8413f74a1847db161a3443b1740b2659cd48753 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 3 Apr 2015 20:58:20 +0200 Subject: [PATCH 1/3] lavf/mpeg: Support more audio codecs in Hikvision CCTV recordings. Fixes a sample from ticket #4182. --- libavformat/mpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index a0b5738790..dbe5f103f2 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -549,6 +549,8 @@ redo: request_probe = 50; } else { codec_id = AV_CODEC_ID_MP2; + if (m->imkh_cctv) + request_probe = 25; } } else if (startcode >= 0x80 && startcode <= 0x87) { type = AVMEDIA_TYPE_AUDIO; From 036079ce34311547be5940c5d856db5498fae029 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 3 Apr 2015 21:04:43 +0200 Subject: [PATCH 2/3] lavf/mpeg: Support alaw in Hikvision CCTV recordings. Fixes a sample from ticket #4182. --- libavformat/mpeg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index dbe5f103f2..c29291db9f 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -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; From c4367f950d5bc8a3a2979182d5aef7bd94949f93 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 3 Apr 2015 21:07:06 +0200 Subject: [PATCH 3/3] Fix codec fps diplay for very small fps. Fixes codec banner for the sample from ticket #4369. --- libavformat/dump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/dump.c b/libavformat/dump.c index 56b37ff7d8..9a7035c323 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -118,7 +118,9 @@ void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_paylo static void print_fps(double d, const char *postfix) { uint64_t v = lrintf(d * 100); - if (v % 100) + if (!v) + av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix); + else if (v % 100) av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix); else if (v % (100 * 1000)) av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);