summaryrefslogtreecommitdiff
path: root/gst-libs/gst/video
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2015-01-20 19:53:09 +0530
committerSebastian Dröge <sebastian@centricular.com>2015-03-12 09:47:50 +0000
commit74a9cd58cd28bb401efad72399e64320b6139192 (patch)
treeaf16b1d14e9a5b45d7519a9c4fbb2de7e3311022 /gst-libs/gst/video
parent49b00e44edcf91acfdfd019579b0d3664aa7d959 (diff)
downloadgstreamer-plugins-bad-74a9cd58cd28bb401efad72399e64320b6139192.tar.gz
videoaggregator: While aggregating, sync values for all pads before converting frames
Diffstat (limited to 'gst-libs/gst/video')
-rw-r--r--gst-libs/gst/video/gstvideoaggregator.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c
index 71458ed9d..24ab93f47 100644
--- a/gst-libs/gst/video/gstvideoaggregator.c
+++ b/gst-libs/gst/video/gstvideoaggregator.c
@@ -1136,33 +1136,38 @@ gst_videoaggregator_fill_queues (GstVideoAggregator * vagg,
}
static gboolean
-prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
+sync_pad_values (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
{
GstAggregatorPad *bpad = GST_AGGREGATOR_PAD (pad);
- GstVideoAggregatorPadClass *vaggpad_class =
- GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad);
+ GstClockTime timestamp;
+ gint64 stream_time;
- if (pad->buffer != NULL) {
- GstClockTime timestamp;
- gint64 stream_time;
+ if (pad->buffer == NULL)
+ return TRUE;
- timestamp = GST_BUFFER_TIMESTAMP (pad->buffer);
+ timestamp = GST_BUFFER_TIMESTAMP (pad->buffer);
+ GST_OBJECT_LOCK (bpad);
+ stream_time = gst_segment_to_stream_time (&bpad->segment, GST_FORMAT_TIME,
+ timestamp);
+ GST_OBJECT_UNLOCK (bpad);
- GST_OBJECT_LOCK (bpad);
- stream_time = gst_segment_to_stream_time (&bpad->segment, GST_FORMAT_TIME,
- timestamp);
- GST_OBJECT_UNLOCK (bpad);
+ /* sync object properties on stream time */
+ if (GST_CLOCK_TIME_IS_VALID (stream_time))
+ gst_object_sync_values (GST_OBJECT (pad), stream_time);
- /* sync object properties on stream time */
- if (GST_CLOCK_TIME_IS_VALID (stream_time))
- gst_object_sync_values (GST_OBJECT (pad), stream_time);
+ return TRUE;
+}
- if (vaggpad_class->prepare_frame) {
- return vaggpad_class->prepare_frame (pad, vagg);
- }
- }
+static gboolean
+prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
+{
+ GstVideoAggregatorPadClass *vaggpad_class =
+ GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad);
- return TRUE;
+ if (pad->buffer == NULL || !vaggpad_class->prepare_frame)
+ return TRUE;
+
+ return vaggpad_class->prepare_frame (pad, vagg);
}
static gboolean
@@ -1199,8 +1204,11 @@ gst_videoaggregator_do_aggregate (GstVideoAggregator * vagg,
GST_BUFFER_TIMESTAMP (*outbuf) = output_start_time;
GST_BUFFER_DURATION (*outbuf) = output_end_time - output_start_time;
- /* Here we convert all the frames the subclass will have to aggregate
- * and also sync pad properties to the stream time */
+ /* Sync pad properties to the stream time */
+ gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (vagg),
+ (GstAggregatorPadForeachFunc) sync_pad_values, NULL);
+
+ /* Convert all the frames the subclass has before aggregating */
gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (vagg),
(GstAggregatorPadForeachFunc) prepare_frames, NULL);