videoaggregator: passthrough interlace mode when update src caps
upstream status: pending
https://bugzilla.gnome.org/show_bug.cgi?id=787819
diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c
index 13a1b59..a97503d 100644
--- a/gst-libs/gst/video/gstvideoaggregator.c
+++ b/gst-libs/gst/video/gstvideoaggregator.c
@@ -679,6 +679,31 @@
return ret;
}
+static gboolean
+gst_video_aggregator_get_sinkpads_interlace_mode (GstVideoAggregator * vagg,
+ GstVideoAggregatorPad * skip_pad, GstVideoInterlaceMode * mode)
+{
+ GList *walk;
+
+ GST_OBJECT_LOCK (vagg);
+ for (walk = GST_ELEMENT (vagg)->sinkpads; walk; walk = g_list_next (walk)) {
+ GstVideoAggregatorPad *vaggpad = walk->data;
+
+ if (skip_pad && vaggpad == skip_pad)
+ continue;
+ if (vaggpad->info.finfo
+ && GST_VIDEO_INFO_FORMAT (&vaggpad->info) != GST_VIDEO_FORMAT_UNKNOWN) {
+ *mode = GST_VIDEO_INFO_INTERLACE_MODE (&vaggpad->info);
+ GST_OBJECT_UNLOCK (vagg);
+ return TRUE;
+ }
+ }
+ GST_OBJECT_UNLOCK (vagg);
+ return FALSE;
+
+}
+
+
static GstFlowReturn
gst_video_aggregator_default_update_src_caps (GstAggregator * agg,
GstCaps * caps, GstCaps ** ret)
@@ -708,6 +733,26 @@
gst_pad_mark_reconfigure (agg->srcpad);
return GST_AGGREGATOR_FLOW_NEED_DATA;
}
+
+ /* configure for interlace mode, we can only pass through interlace mode */
+ {
+ GstVideoInterlaceMode interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
+ gboolean has_mode = FALSE;
+ GstStructure *s;
+ guint i, n;
+ has_mode =
+ gst_video_aggregator_get_sinkpads_interlace_mode (vagg, NULL,
+ &interlace_mode);
+
+ n = gst_caps_get_size (caps);
+ for (i = 0; i < n; i++) {
+ s = gst_caps_get_structure (caps, i);
+
+ if (has_mode)
+ gst_structure_set (s, "interlace-mode", G_TYPE_STRING,
+ gst_video_interlace_mode_to_string (interlace_mode), NULL);
+ }
+ }
g_assert (vagg_klass->update_caps);
@@ -802,29 +847,6 @@
}
static gboolean
-gst_video_aggregator_get_sinkpads_interlace_mode (GstVideoAggregator * vagg,
- GstVideoAggregatorPad * skip_pad, GstVideoInterlaceMode * mode)
-{
- GList *walk;
-
- GST_OBJECT_LOCK (vagg);
- for (walk = GST_ELEMENT (vagg)->sinkpads; walk; walk = g_list_next (walk)) {
- GstVideoAggregatorPad *vaggpad = walk->data;
-
- if (skip_pad && vaggpad == skip_pad)
- continue;
- if (vaggpad->info.finfo
- && GST_VIDEO_INFO_FORMAT (&vaggpad->info) != GST_VIDEO_FORMAT_UNKNOWN) {
- *mode = GST_VIDEO_INFO_INTERLACE_MODE (&vaggpad->info);
- GST_OBJECT_UNLOCK (vagg);
- return TRUE;
- }
- }
- GST_OBJECT_UNLOCK (vagg);
- return FALSE;
-}
-
-static gboolean
gst_video_aggregator_pad_sink_setcaps (GstPad * pad, GstObject * parent,
GstCaps * caps)
{