summaryrefslogtreecommitdiff
path: root/libavformat/mpegtsenc.c
diff options
context:
space:
mode:
authorStefan Pöschel <basic.master@gmx.de>2015-12-12 20:26:38 +0100
committerLuca Barbato <lu_zero@gentoo.org>2015-12-14 15:16:33 +0100
commitdbce017913ce04966021a2f72e4f8fae5b4b7190 (patch)
treeb15e38ec3c71e5e5ba9a59620c8ec52661deaa71 /libavformat/mpegtsenc.c
parentcc4c24208159200b7aff5b5c313903c7f23fa345 (diff)
mpegtsenc: add flag to embed an AC-3 ES the DVB way
So far an AC-3 elementary stream is refered to in the PMT according to System A (ATSC). However System B (DVB) has a different way to signal an AC-3 ES within the PMT. This different way can be enabled by a new flag. The flag is more generally named 'system_b' as there are further differences between ATSC and DVB (e.g. the signalling of E-AC-3) which should then also be covered by it in the future. Bug-Id: 73 Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/mpegtsenc.c')
-rw-r--r--libavformat/mpegtsenc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 2522b72dde..8ef8eebc54 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -86,6 +86,7 @@ typedef struct MpegTSWrite {
int pcr_period;
#define MPEGTS_FLAG_REEMIT_PAT_PMT 0x01
#define MPEGTS_FLAG_AAC_LATM 0x02
+#define MPEGTS_FLAG_SYSTEM_B 0x04
int flags;
} MpegTSWrite;
@@ -284,7 +285,9 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
stream_type = STREAM_TYPE_AUDIO_AAC_LATM;
break;
case AV_CODEC_ID_AC3:
- stream_type = STREAM_TYPE_AUDIO_AC3;
+ stream_type = (ts->flags & MPEGTS_FLAG_SYSTEM_B)
+ ? STREAM_TYPE_PRIVATE_DATA
+ : STREAM_TYPE_AUDIO_AC3;
break;
default:
stream_type = STREAM_TYPE_PRIVATE_DATA;
@@ -298,6 +301,12 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
/* write optional descriptors here */
switch (st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
+ if (st->codec->codec_id == AV_CODEC_ID_AC3 && (ts->flags & MPEGTS_FLAG_SYSTEM_B)) {
+ *q++ = 0x6a; /* ETSI EN 300 468 AC-3 descriptor */
+ *q++ = 1;
+ *q++ = 0x00;
+ }
+
if (lang) {
char *p;
char *next = lang->value;
@@ -1252,6 +1261,9 @@ static const AVOption options[] = {
{ "latm", "Use LATM packetization for AAC",
0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_AAC_LATM }, 0, INT_MAX,
AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
+ { "system_b", "Conform to System B (DVB) instead of System A (ATSC)",
+ 0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_SYSTEM_B }, 0, INT_MAX,
+ AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
// backward compatibility
{ "resend_headers", "Reemit PAT/PMT before writing the next packet",
offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT,