Hi!

Attached patch intends to fix ticket #7731.

Please comment, Carl Eugen
From bf68eb44a9a27ca8c9e832e8f0cbd08a0d0b5281 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffm...@gmail.com>
Date: Tue, 12 Feb 2019 12:15:02 +0100
Subject: [PATCH] lavf/spdifenc: Automatically insert truehd_core bitstream
 filter.

Fixes ticket #7731.
---
 libavformat/spdifenc.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 9514ff8..ecfe28c 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -49,6 +49,7 @@
 #include "avformat.h"
 #include "avio_internal.h"
 #include "spdif.h"
+#include "internal.h"
 #include "libavcodec/ac3.h"
 #include "libavcodec/adts_parser.h"
 #include "libavcodec/dca.h"
@@ -546,6 +547,18 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
+static int spdif_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+    int ret = 1;
+    AVStream *st = s->streams[pkt->stream_index];
+
+    if (st->codecpar->codec_id == AV_CODEC_ID_TRUEHD) {
+        ret = ff_stream_add_bitstream_filter(st, "truehd_core", NULL);
+    }
+
+    return ret;
+}
+
 AVOutputFormat ff_spdif_muxer = {
     .name              = "spdif",
     .long_name         = NULL_IF_CONFIG_SMALL("IEC 61937 (used on S/PDIF - IEC958)"),
@@ -556,6 +569,7 @@ AVOutputFormat ff_spdif_muxer = {
     .write_header      = spdif_write_header,
     .write_packet      = spdif_write_packet,
     .write_trailer     = spdif_write_trailer,
+    .check_bitstream   = spdif_check_bitstream,
     .flags             = AVFMT_NOTIMESTAMPS,
     .priv_class        = &spdif_class,
 };
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to