diff options
author | Alex Ashley <bugzilla@ashley-family.net> | 2015-02-06 13:22:14 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-07-20 16:04:22 +0100 |
commit | 71a1e3669a743daa5affbdb6d73f6949d4965818 (patch) | |
tree | 1b9fb590c7c370780dac2489b8ec369ae61c9f3b /gst-libs/gst/adaptivedemux | |
parent | f8b7c38bedeecd6a3ef1f484f69eeec09bc93ba4 (diff) | |
download | gstreamer-plugins-bad-71a1e3669a743daa5affbdb6d73f6949d4965818.tar.gz |
dashdemux: add support for generating Protection events from ContentProtection elements
If a ContentProtection element is present in an AdaptationSet element,
send Protection events on the source pad, so that qtdemux can use this
information to correctly generate its source caps for DASH CENC
encrypted streams.
This allows qtdemux to support CENC encrypted DASH streams where the
content protection specific information is carried in the MPD file
rather than in pssh boxes in the initialisation segments.
This commit adds a new function to the adaptivedemux base class to allow
a GstEvent to be queued for a stream. The queue of events are sent the
next time a buffer is pushed for that stream.
https://bugzilla.gnome.org/show_bug.cgi?id=705991
Diffstat (limited to 'gst-libs/gst/adaptivedemux')
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 30 | ||||
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.h | 4 |
2 files changed, 34 insertions, 0 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index 7df1c6359..483d23206 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -657,6 +657,17 @@ gst_adaptive_demux_set_stream_struct_size (GstAdaptiveDemux * demux, demux->stream_struct_size = struct_size; } +static void +gst_adaptive_demux_send_event (gpointer data, gpointer userdata) +{ + GstEvent *event = (GstEvent *) data; + GstPad *pad = (GstPad *) userdata; + + if (!gst_pad_push_event (pad, event)) { + GST_ERROR_OBJECT (pad, "Failed to send pending event"); + } +} + static gboolean gst_adaptive_demux_expose_stream (GstAdaptiveDemux * demux, GstAdaptiveDemuxStream * stream) @@ -877,6 +888,11 @@ gst_adaptive_demux_stream_free (GstAdaptiveDemuxStream * stream) stream->pending_segment = NULL; } + if (stream->pending_events) { + g_list_free_full (stream->pending_events, (GDestroyNotify) gst_event_unref); + stream->pending_events = NULL; + } + if (stream->src_srcpad) { gst_object_unref (stream->src_srcpad); stream->src_srcpad = NULL; @@ -1296,6 +1312,13 @@ gst_adaptive_demux_stream_set_tags (GstAdaptiveDemuxStream * stream, stream->pending_tags = tags; } +void +gst_adaptive_demux_stream_queue_event (GstAdaptiveDemuxStream * stream, + GstEvent * event) +{ + stream->pending_events = g_list_append (stream->pending_events, event); +} + static guint64 _update_average_bitrate (GstAdaptiveDemux * demux, GstAdaptiveDemuxStream * stream, guint64 new_bitrate) @@ -1447,6 +1470,13 @@ gst_adaptive_demux_stream_push_buffer (GstAdaptiveDemuxStream * stream, gst_pad_push_event (stream->pad, gst_event_new_tag (stream->pending_tags)); stream->pending_tags = NULL; } + if (G_UNLIKELY (stream->pending_events)) { + g_list_foreach (stream->pending_events, gst_adaptive_demux_send_event, + stream->pad); + g_list_free (stream->pending_events); + stream->pending_events = NULL; + } + ret = gst_pad_push (stream->pad, buffer); GST_LOG_OBJECT (stream->pad, "Push result: %d %s", ret, diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h index 9303a8434..dc8fabe58 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h @@ -118,6 +118,7 @@ struct _GstAdaptiveDemuxStream GstEvent *pending_segment; GstTagList *pending_tags; gboolean need_header; + GList *pending_events; GstFlowReturn last_ret; GError *last_error; @@ -427,6 +428,9 @@ GstFlowReturn gst_adaptive_demux_stream_push_buffer (GstAdaptiveDemuxStream * st GstFlowReturn gst_adaptive_demux_stream_advance_fragment (GstAdaptiveDemux * demux, GstAdaptiveDemuxStream * stream, GstClockTime duration); +void gst_adaptive_demux_stream_queue_event (GstAdaptiveDemuxStream * stream, + GstEvent * event); + GstFlowReturn gst_adaptive_demux_stream_advance_fragment_unlocked (GstAdaptiveDemux * demux, GstAdaptiveDemuxStream * stream, GstClockTime duration); |