summaryrefslogtreecommitdiff
path: root/gst/mpegtsmux
diff options
context:
space:
mode:
Diffstat (limited to 'gst/mpegtsmux')
-rw-r--r--gst/mpegtsmux/Makefile.am5
-rw-r--r--gst/mpegtsmux/mpegtsmux_opus.c23
2 files changed, 25 insertions, 3 deletions
diff --git a/gst/mpegtsmux/Makefile.am b/gst/mpegtsmux/Makefile.am
index c9944f81b..37fc935de 100644
--- a/gst/mpegtsmux/Makefile.am
+++ b/gst/mpegtsmux/Makefile.am
@@ -11,8 +11,9 @@ libgstmpegtsmux_la_SOURCES = \
libgstmpegtsmux_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstmpegtsmux_la_LIBADD = $(top_builddir)/gst/mpegtsmux/tsmux/libtsmux.la \
- -lgsttag-@GST_API_VERSION@ \
- $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_API_VERSION@ $(GST_BASE_LIBS) $(GST_LIBS)
+ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_API_VERSION@ \
+ -lgstaudio-@GST_API_VERSION@ -lgsttag-@GST_API_VERSION@ \
+ $(GST_BASE_LIBS) $(GST_LIBS)
libgstmpegtsmux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstmpegtsmux_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/gst/mpegtsmux/mpegtsmux_opus.c b/gst/mpegtsmux/mpegtsmux_opus.c
index b64f8f52a..26176b26d 100644
--- a/gst/mpegtsmux/mpegtsmux_opus.c
+++ b/gst/mpegtsmux/mpegtsmux_opus.c
@@ -86,6 +86,7 @@
#include "mpegtsmux_opus.h"
#include <string.h>
+#include <gst/audio/audio.h>
#define GST_CAT_DEFAULT mpegtsmux_debug
@@ -98,9 +99,15 @@ mpegtsmux_prepare_opus (GstBuffer * buf, MpegTsPadData * pad_data,
GstBuffer *outbuf;
GstMapInfo map;
guint n;
+ GstAudioClippingMeta *cmeta = gst_buffer_get_audio_clipping_meta (buf);
+
+ g_assert (!cmeta || cmeta->format == GST_FORMAT_DEFAULT);
- /* TODO: Write start/end trim */
outsize = 2 + insize / 255 + 1;
+ if (cmeta && cmeta->start)
+ outsize += 2;
+ if (cmeta && cmeta->end)
+ outsize += 2;
outbuf = gst_buffer_new_and_alloc (outsize);
gst_buffer_copy_into (outbuf, buf,
@@ -108,6 +115,12 @@ mpegtsmux_prepare_opus (GstBuffer * buf, MpegTsPadData * pad_data,
gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
map.data[0] = 0x7f;
map.data[1] = 0xe0;
+
+ if (cmeta && cmeta->start)
+ map.data[1] |= 0x10;
+ if (cmeta && cmeta->end)
+ map.data[1] |= 0x08;
+
n = 2;
do {
g_assert (n < outsize);
@@ -120,6 +133,14 @@ mpegtsmux_prepare_opus (GstBuffer * buf, MpegTsPadData * pad_data,
n++;
} while (insize >= 0);
+ if (cmeta && cmeta->start) {
+ GST_WRITE_UINT16_BE (&map.data[n], cmeta->start);
+ n += 2;
+ }
+
+ if (cmeta && cmeta->end)
+ GST_WRITE_UINT16_BE (&map.data[n], cmeta->end);
+
gst_buffer_unmap (outbuf, &map);
outbuf = gst_buffer_append (outbuf, gst_buffer_ref (buf));