diff mbox series

[FFmpeg-devel,3/3] mpegts hack

Message ID 20200304222633.12177-3-onemda@gmail.com
State New
Headers show
Series [FFmpeg-devel,RFC,WIP,1/3] avcodec: add AC-4 decoder
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork fail Make fate failed

Commit Message

Paul B Mahol March 4, 2020, 10:26 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavformat/mpegts.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox series

Patch

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 */
         {