From 2082d618f99327f27a76a2296c2846923c1bddf2 Mon Sep 17 00:00:00 2001 From: vanista Date: Mon, 24 Nov 2008 10:46:01 +0000 Subject: [PATCH] gst/mpegtsmux/: Add initial support for muxing AC3/DTS/LPCM into MPEG TS. Original commit message from CVS: Patch by: vanista * gst/mpegtsmux/mpegtsmux.c: (mpegtsmux_create_stream): * gst/mpegtsmux/tsmux/tsmuxstream.c: (tsmux_stream_new): Add initial support for muxing AC3/DTS/LPCM into MPEG TS. Fixes bug #550613. --- ChangeLog | 9 +++++++++ gst/mpegtsmux/mpegtsmux.c | 28 +++++++++++++++++++++++++--- gst/mpegtsmux/tsmux/tsmuxstream.c | 23 ++++++++++++++++++++--- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95d6df467b..6c8ec605a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-24 Sebastian Dröge + + Patch by: vanista + + * gst/mpegtsmux/mpegtsmux.c: (mpegtsmux_create_stream): + * gst/mpegtsmux/tsmux/tsmuxstream.c: (tsmux_stream_new): + Add initial support for muxing AC3/DTS/LPCM into MPEG TS. + Fixes bug #550613. + 2008-11-24 Sebastian Dröge * gst/mxf/mxfdemux.c: (gst_mxf_demux_pull_klv_packet), diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 81757c63a3..53306c3da7 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -103,11 +103,20 @@ static GstStaticPadTemplate mpegtsmux_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d", GST_PAD_SINK, GST_PAD_REQUEST, - GST_STATIC_CAPS ("video/mpeg, mpegversion=(int) { 1, 2, 4 }, " + GST_STATIC_CAPS ("video/mpeg, " + "mpegversion = (int) { 1, 2, 4 }, " "systemstream = (boolean) false; " "video/x-dirac;" - "video/x-h264;" "audio/mpeg, mpegversion = (int) { 1, 2, 4 }") - ); + "video/x-h264;" + "audio/mpeg, " + "mpegversion = (int) { 1, 2, 4 };" + "audio/x-lpcm, " + "width = (int) { 16, 20, 24 }, " + "rate = (int) { 48000, 96000 }, " + "channels = (int) [ 1, 8 ], " + "dynamic_range = (int) [ 0, 255 ], " + "emphasis = (boolean) { FALSE, TRUE }, " + "mute = (boolean) { FALSE, TRUE }; " "audio/x-ac3;" "audio/x-dts")); static GstStaticPadTemplate mpegtsmux_src_factory = GST_STATIC_PAD_TEMPLATE ("src", @@ -285,6 +294,19 @@ mpegtsmux_create_stream (MpegTsMux * mux, MpegTsPadData * ts_data, GstPad * pad) ts_data->pid); ts_data->stream = tsmux_create_stream (mux->tsmux, TSMUX_ST_VIDEO_DIRAC, ts_data->pid); + } else if (gst_structure_has_name (s, "audio/x-ac3")) { + GST_DEBUG_OBJECT (pad, "Creating AC3 stream with PID 0x%04x", ts_data->pid); + ts_data->stream = tsmux_create_stream (mux->tsmux, TSMUX_ST_PS_AUDIO_AC3, + ts_data->pid); + } else if (gst_structure_has_name (s, "audio/x-dts")) { + GST_DEBUG_OBJECT (pad, "Creating DTS stream with PID 0x%04x", ts_data->pid); + ts_data->stream = tsmux_create_stream (mux->tsmux, TSMUX_ST_PS_AUDIO_DTS, + ts_data->pid); + } else if (gst_structure_has_name (s, "audio/x-lpcm")) { + GST_DEBUG_OBJECT (pad, "Creating LPCM stream with PID 0x%04x", + ts_data->pid); + ts_data->stream = tsmux_create_stream (mux->tsmux, TSMUX_ST_PS_AUDIO_LPCM, + ts_data->pid); } else if (gst_structure_has_name (s, "video/x-h264")) { const GValue *value; GST_DEBUG_OBJECT (pad, "Creating H264 stream with PID 0x%04x", diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.c b/gst/mpegtsmux/tsmux/tsmuxstream.c index 342bb9ea57..0c2127107e 100644 --- a/gst/mpegtsmux/tsmux/tsmuxstream.c +++ b/gst/mpegtsmux/tsmux/tsmuxstream.c @@ -143,14 +143,31 @@ tsmux_stream_new (guint16 pid, TsMuxStreamType stream_type) stream->pi.flags |= TSMUX_PACKET_FLAG_PES_FULL_HEADER; break; case TSMUX_ST_VIDEO_DIRAC: + case TSMUX_ST_PS_AUDIO_LPCM: + case TSMUX_ST_PS_AUDIO_AC3: + case TSMUX_ST_PS_AUDIO_DTS: stream->id = 0xFD; /* FIXME: assign sequential extended IDs? */ - stream->id_extended = 0x60; - + switch (stream_type) { + case TSMUX_ST_VIDEO_DIRAC: + stream->id_extended = 0x60; + stream->is_video_stream = TRUE; + break; + case TSMUX_ST_PS_AUDIO_LPCM: + stream->id_extended = 0x80; + break; + case TSMUX_ST_PS_AUDIO_AC3: + stream->id_extended = 0x81; + break; + case TSMUX_ST_PS_AUDIO_DTS: + stream->id_extended = 0x82; + break; + default: + break; + } stream->pi.flags |= TSMUX_PACKET_FLAG_PES_FULL_HEADER | TSMUX_PACKET_FLAG_PES_EXT_STREAMID; - stream->is_video_stream = TRUE; break; default: g_critical ("Stream type 0x%0x not yet implemented", stream_type); -- 2.34.1