[FFmpeg-devel] [PATCH 3/3] mpegts hack

Paul B Mahol onemda at gmail.com
Thu Mar 5 00:26:33 EET 2020


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/mpegts.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 7f56bacb2c..782f13fe4f 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -955,8 +955,8 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
             (st->request_probe > 0 && st->request_probe < AVPROBE_SCORE_STREAM_RETRY / 5)) &&
         st->probe_packets > 0 &&
         stream_type == STREAM_TYPE_PRIVATE_DATA) {
-        st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
-        st->codecpar->codec_id   = AV_CODEC_ID_BIN_DATA;
+        st->codecpar->codec_type = pes->stream_type == 6 ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_DATA;
+        st->codecpar->codec_id   = pes->stream_type == 6 ? AV_CODEC_ID_AC4 : AV_CODEC_ID_BIN_DATA;
         st->request_probe = AVPROBE_SCORE_STREAM_RETRY / 5;
     }
 
@@ -2062,6 +2062,13 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
                     av_dict_set(&st->metadata, "language", language, 0);
             }
         }
+        if (ext_desc_tag == 0x15) { /* AC-4 descriptor */
+            st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+            st->codecpar->codec_id = AV_CODEC_ID_AC4;
+            st->request_probe = 0;
+
+            st->internal->need_context_update = 1;
+        }
         break;
     case 0x6a: /* ac-3_descriptor */
         {
-- 
2.17.1



More information about the ffmpeg-devel mailing list