mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
aggregator: Simplify clip function
The return value was ignored anyway https://bugzilla.gnome.org/show_bug.cgi?id=781673
This commit is contained in:
parent
20aee5f575
commit
4d408ea920
3 changed files with 23 additions and 22 deletions
|
@ -183,8 +183,8 @@ static GstFlowReturn gst_audio_aggregator_flush (GstAggregator * agg);
|
||||||
|
|
||||||
static GstBuffer *gst_audio_aggregator_create_output_buffer (GstAudioAggregator
|
static GstBuffer *gst_audio_aggregator_create_output_buffer (GstAudioAggregator
|
||||||
* aagg, guint num_frames);
|
* aagg, guint num_frames);
|
||||||
static GstFlowReturn gst_audio_aggregator_do_clip (GstAggregator * agg,
|
static GstBuffer *gst_audio_aggregator_do_clip (GstAggregator * agg,
|
||||||
GstAggregatorPad * bpad, GstBuffer * buffer, GstBuffer ** outbuf);
|
GstAggregatorPad * bpad, GstBuffer * buffer);
|
||||||
static GstFlowReturn gst_audio_aggregator_aggregate (GstAggregator * agg,
|
static GstFlowReturn gst_audio_aggregator_aggregate (GstAggregator * agg,
|
||||||
gboolean timeout);
|
gboolean timeout);
|
||||||
static gboolean sync_pad_values (GstAudioAggregator * aagg,
|
static gboolean sync_pad_values (GstAudioAggregator * aagg,
|
||||||
|
@ -741,22 +741,21 @@ gst_audio_aggregator_flush (GstAggregator * agg)
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstBuffer *
|
||||||
gst_audio_aggregator_do_clip (GstAggregator * agg,
|
gst_audio_aggregator_do_clip (GstAggregator * agg,
|
||||||
GstAggregatorPad * bpad, GstBuffer * buffer, GstBuffer ** out)
|
GstAggregatorPad * bpad, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (bpad);
|
GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (bpad);
|
||||||
gint rate, bpf;
|
gint rate, bpf;
|
||||||
|
|
||||||
|
|
||||||
rate = GST_AUDIO_INFO_RATE (&pad->info);
|
rate = GST_AUDIO_INFO_RATE (&pad->info);
|
||||||
bpf = GST_AUDIO_INFO_BPF (&pad->info);
|
bpf = GST_AUDIO_INFO_BPF (&pad->info);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (bpad);
|
GST_OBJECT_LOCK (bpad);
|
||||||
*out = gst_audio_buffer_clip (buffer, &bpad->clip_segment, rate, bpf);
|
buffer = gst_audio_buffer_clip (buffer, &bpad->clip_segment, rate, bpf);
|
||||||
GST_OBJECT_UNLOCK (bpad);
|
GST_OBJECT_UNLOCK (bpad);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called with the object lock for both the element and pad held,
|
/* Called with the object lock for both the element and pad held,
|
||||||
|
|
|
@ -2141,7 +2141,6 @@ static GstFlowReturn
|
||||||
gst_aggregator_pad_chain_internal (GstAggregator * self,
|
gst_aggregator_pad_chain_internal (GstAggregator * self,
|
||||||
GstAggregatorPad * aggpad, GstBuffer * buffer, gboolean head)
|
GstAggregatorPad * aggpad, GstBuffer * buffer, gboolean head)
|
||||||
{
|
{
|
||||||
GstBuffer *actual_buf = buffer;
|
|
||||||
GstAggregatorClass *aggclass = GST_AGGREGATOR_GET_CLASS (self);
|
GstAggregatorClass *aggclass = GST_AGGREGATOR_GET_CLASS (self);
|
||||||
GstFlowReturn flow_return;
|
GstFlowReturn flow_return;
|
||||||
GstClockTime buf_pts;
|
GstClockTime buf_pts;
|
||||||
|
@ -2161,15 +2160,15 @@ gst_aggregator_pad_chain_internal (GstAggregator * self,
|
||||||
PAD_UNLOCK (aggpad);
|
PAD_UNLOCK (aggpad);
|
||||||
|
|
||||||
if (aggclass->clip && head) {
|
if (aggclass->clip && head) {
|
||||||
aggclass->clip (self, aggpad, buffer, &actual_buf);
|
buffer = aggclass->clip (self, aggpad, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actual_buf == NULL) {
|
if (buffer == NULL) {
|
||||||
GST_LOG_OBJECT (actual_buf, "Buffer dropped by clip function");
|
GST_LOG_OBJECT (aggpad, "Buffer dropped by clip function");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf_pts = GST_BUFFER_PTS (actual_buf);
|
buf_pts = GST_BUFFER_PTS (buffer);
|
||||||
|
|
||||||
aggpad->priv->first_buffer = FALSE;
|
aggpad->priv->first_buffer = FALSE;
|
||||||
|
|
||||||
|
@ -2180,12 +2179,12 @@ gst_aggregator_pad_chain_internal (GstAggregator * self,
|
||||||
if (gst_aggregator_pad_has_space (self, aggpad)
|
if (gst_aggregator_pad_has_space (self, aggpad)
|
||||||
&& aggpad->priv->flow_return == GST_FLOW_OK) {
|
&& aggpad->priv->flow_return == GST_FLOW_OK) {
|
||||||
if (head)
|
if (head)
|
||||||
g_queue_push_head (&aggpad->priv->buffers, actual_buf);
|
g_queue_push_head (&aggpad->priv->buffers, buffer);
|
||||||
else
|
else
|
||||||
g_queue_push_tail (&aggpad->priv->buffers, actual_buf);
|
g_queue_push_tail (&aggpad->priv->buffers, buffer);
|
||||||
apply_buffer (aggpad, actual_buf, head);
|
apply_buffer (aggpad, buffer, head);
|
||||||
aggpad->priv->num_buffers++;
|
aggpad->priv->num_buffers++;
|
||||||
actual_buf = buffer = NULL;
|
buffer = NULL;
|
||||||
SRC_BROADCAST (self);
|
SRC_BROADCAST (self);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,9 +155,13 @@ struct _GstAggregator
|
||||||
* stops have been received. Flush pad-specific data in
|
* stops have been received. Flush pad-specific data in
|
||||||
* #GstAggregatorPad->flush.
|
* #GstAggregatorPad->flush.
|
||||||
* @clip: Optional.
|
* @clip: Optional.
|
||||||
* Called when a buffer is received on a sink pad, the task
|
* Called when a buffer is received on a sink pad, the task of
|
||||||
* of clipping it and translating it to the current segment
|
* clipping it and translating it to the current segment falls
|
||||||
* falls on the subclass.
|
* on the subclass. The function should use the segment of data
|
||||||
|
* and the negotiated media type on the pad to perform
|
||||||
|
* clipping of inbuffer. This function takes ownership of
|
||||||
|
* buf and should output a buffer or return NULL in
|
||||||
|
* if the buffer should be dropped.
|
||||||
* @sink_event: Optional.
|
* @sink_event: Optional.
|
||||||
* Called when an event is received on a sink pad, the subclass
|
* Called when an event is received on a sink pad, the subclass
|
||||||
* should always chain up.
|
* should always chain up.
|
||||||
|
@ -211,10 +215,9 @@ struct _GstAggregatorClass {
|
||||||
|
|
||||||
GstFlowReturn (*flush) (GstAggregator * aggregator);
|
GstFlowReturn (*flush) (GstAggregator * aggregator);
|
||||||
|
|
||||||
GstFlowReturn (*clip) (GstAggregator * aggregator,
|
GstBuffer * (*clip) (GstAggregator * aggregator,
|
||||||
GstAggregatorPad * aggregator_pad,
|
GstAggregatorPad * aggregator_pad,
|
||||||
GstBuffer * buf,
|
GstBuffer * buf);
|
||||||
GstBuffer ** outbuf);
|
|
||||||
|
|
||||||
/* sinkpads virtual methods */
|
/* sinkpads virtual methods */
|
||||||
gboolean (*sink_event) (GstAggregator * aggregator,
|
gboolean (*sink_event) (GstAggregator * aggregator,
|
||||||
|
|
Loading…
Reference in a new issue