From 84385bdd860885f5894f01b4d41ddd3b8490320d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 7 Aug 2020 09:30:55 +0300 Subject: [PATCH] aggregator: Add optional GstStructure info parameter to "samples-selected" signal Subclasses can use this to provide more information, for example audioaggregator could provide the offset into the output buffer where the next data is going to be filled. See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/805 Part-of: --- libs/gst/base/gstaggregator.c | 12 ++++++++---- libs/gst/base/gstaggregator.h | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c index d7a6e3629a..7f99985ccb 100644 --- a/libs/gst/base/gstaggregator.c +++ b/libs/gst/base/gstaggregator.c @@ -2739,6 +2739,7 @@ gst_aggregator_class_init (GstAggregatorClass * klass) * @pts: The presentation timestamp of the next output buffer * @dts: The decoding timestamp of the next output buffer * @duration: The duration of the next output buffer + * @info: (nullable): a #GstStructure containing additional information * * Signals that the #GstAggregator subclass has selected the next set * of input samples it will aggregate. Handlers may call @@ -2748,9 +2749,10 @@ gst_aggregator_class_init (GstAggregatorClass * klass) */ gst_aggregator_signals[SIGNAL_SAMPLES_SELECTED] = g_signal_new ("samples-selected", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 4, + G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 5, GST_TYPE_SEGMENT | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_CLOCK_TIME, - GST_TYPE_CLOCK_TIME, GST_TYPE_CLOCK_TIME); + GST_TYPE_CLOCK_TIME, GST_TYPE_CLOCK_TIME, + GST_TYPE_STRUCTURE | G_SIGNAL_TYPE_STATIC_SCOPE); } static inline gpointer @@ -3615,6 +3617,7 @@ gst_aggregator_update_segment (GstAggregator * self, const GstSegment * segment) * @pts: The presentation timestamp of the next output buffer * @dts: The decoding timestamp of the next output buffer * @duration: The duration of the next output buffer + * @info: (nullable): a #GstStructure containing additional information * * Subclasses should call this when they have prepared the * buffers they will aggregate for each of their sink pads, but @@ -3629,13 +3632,14 @@ gst_aggregator_update_segment (GstAggregator * self, const GstSegment * segment) */ void gst_aggregator_selected_samples (GstAggregator * self, - GstClockTime pts, GstClockTime dts, GstClockTime duration) + GstClockTime pts, GstClockTime dts, GstClockTime duration, + GstStructure * info) { g_return_if_fail (GST_IS_AGGREGATOR (self)); if (self->priv->emit_signals) { g_signal_emit (self, gst_aggregator_signals[SIGNAL_SAMPLES_SELECTED], 0, - &GST_AGGREGATOR_PAD (self->srcpad)->segment, pts, dts, duration); + &GST_AGGREGATOR_PAD (self->srcpad)->segment, pts, dts, duration, info); } self->priv->selected_samples_called_or_warned = TRUE; diff --git a/libs/gst/base/gstaggregator.h b/libs/gst/base/gstaggregator.h index 5d870609d0..86fc70ff6d 100644 --- a/libs/gst/base/gstaggregator.h +++ b/libs/gst/base/gstaggregator.h @@ -421,7 +421,8 @@ GST_BASE_API void gst_aggregator_selected_samples (GstAggregator * self, GstClockTime pts, GstClockTime dts, - GstClockTime duration); + GstClockTime duration, + GstStructure * info); /** * GstAggregatorStartTimeSelection: