From adc3d127414ca56e50b440a71dc9e95daf76a94e Mon Sep 17 00:00:00 2001 From: yychao Date: Mon, 9 Mar 2020 17:00:01 +0800 Subject: tsdemux: Add support for AC4 According to following two specs, add support for AC4 in tsdemux. 1. ETSI TS 103 190-2 V1.2.1 (2018-02) : Annex D (normative): AC-4 in MPEG-2 transport streams 2. ETSI EN 300 468 V1.16.1 (2019-08) : Annex D (normative):Service information implementation of AC-3, EnhancedAC-3, and AC-4 audio in DVB systems --- gst/mpegtsdemux/gstmpegdefs.h | 2 ++ gst/mpegtsdemux/tsdemux.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'gst/mpegtsdemux') diff --git a/gst/mpegtsdemux/gstmpegdefs.h b/gst/mpegtsdemux/gstmpegdefs.h index 5336286ef..c0debcd7d 100644 --- a/gst/mpegtsdemux/gstmpegdefs.h +++ b/gst/mpegtsdemux/gstmpegdefs.h @@ -46,6 +46,7 @@ #define ST_VIDEO_DIRAC 0xd1 /* private stream types */ +#define ST_PS_AUDIO_AC4 0x06 #define ST_PS_VIDEO_MPEG2_DCII 0x80 #define ST_PS_AUDIO_AC3 0x81 #define ST_PS_AUDIO_EAC3 0x87 @@ -55,6 +56,7 @@ #define ST_PS_DVD_SUBPICTURE 0xff /* Blu-ray related (registration: 'HDMV'*/ +#define ST_BD_AUDIO_AC4 0x06 #define ST_BD_AUDIO_LPCM 0x80 #define ST_BD_AUDIO_AC3 0x81 #define ST_BD_AUDIO_DTS 0x82 diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 822100b07..5db3f54b5 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -252,6 +252,7 @@ struct _TSDemuxStream "emphasis = (boolean) { FALSE, TRUE }, " \ "mute = (boolean) { FALSE, TRUE }; " \ "audio/x-ac3; audio/x-eac3;" \ + "audio/x-ac4;" \ "audio/x-dts;" \ "audio/x-opus;" \ "audio/x-private-ts-lpcm" \ @@ -1189,6 +1190,10 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, is_audio = TRUE; caps = gst_caps_new_empty_simple ("audio/x-eac3"); break; + case ST_BD_AUDIO_AC4: + is_audio = TRUE; + caps = gst_caps_new_empty_simple ("audio/x-ac4"); + break; case ST_BD_AUDIO_AC3_TRUE_HD: is_audio = TRUE; caps = gst_caps_new_empty_simple ("audio/x-true-hd"); @@ -1250,6 +1255,17 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, /* FIXME: Move all of this into a common method (there might be other * types also, depending on registratino descriptors also */ + + desc = + mpegts_get_descriptor_from_stream (bstream, + GST_MTS_DESC_DVB_EXTENSION); + if (desc != NULL && desc->tag_extension == GST_MTS_DESC_EXT_DVB_AC4) { + GST_LOG ("ac4 audio"); + is_audio = TRUE; + caps = gst_caps_new_empty_simple ("audio/x-ac4"); + break; + } + desc = mpegts_get_descriptor_from_stream (bstream, GST_MTS_DESC_DVB_AC3); if (desc) { GST_LOG ("ac3 audio"); -- cgit v1.2.1