From 07584eaf4a95db3f11d3bc411f9786932829e82b Mon Sep 17 00:00:00 2001
From: Christian Schmidt <schmidt@digadd.de>
Date: Thu, 6 Sep 2012 16:43:24 +0200
Subject: [PATCH] mpegts: check substreams before discarding

Allow to extract the AC3 core from TrueHD with the "copy" codec.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
---
 libavformat/mpegts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 40a983baeb0..a3d5e8e835c 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -784,7 +784,8 @@ static int mpegts_push_data(MpegTSFilter *filter,
                     code = pes->header[3] | 0x100;
                     av_dlog(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
 
-                    if ((pes->st && pes->st->discard == AVDISCARD_ALL) ||
+                    if ((pes->st && pes->st->discard == AVDISCARD_ALL &&
+                         (!pes->sub_st || pes->sub_st->discard == AVDISCARD_ALL)) ||
                         code == 0x1be) /* padding_stream */
                         goto skip;
 
-- 
GitLab