videoaggregator: Add class property to disable caps scaling
authorJan Schmidt <jan@centricular.com>
Sun, 10 May 2015 08:55:16 +0000 (18:55 +1000)
committerJan Schmidt <jan@centricular.com>
Fri, 29 May 2015 15:33:49 +0000 (01:33 +1000)
Add preserve_update_caps_result boolean on the class to allow
sub-classes to disable videoaggregator removing sizes and framerate
from the update_caps() return result.

gst-libs/gst/video/gstvideoaggregator.c
gst-libs/gst/video/gstvideoaggregator.h

index 2f720f3..6c154bd 100644 (file)
@@ -28,7 +28,7 @@
  * biggest incoming video stream and the framerate of the fastest incoming one.
  *
  * VideoAggregator will do colorspace conversion.
- * 
+ *
  * Zorder for each input stream can be configured on the
  * #GstVideoAggregatorPad.
  *
@@ -674,6 +674,7 @@ gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
     GstCaps *caps, *peercaps, *info_caps;
     GstStructure *s;
     GstVideoInfo info;
+    int i;
 
     if (GST_VIDEO_INFO_FPS_N (&vagg->info) != best_fps_n ||
         GST_VIDEO_INFO_FPS_D (&vagg->info) != best_fps_d) {
@@ -711,11 +712,8 @@ gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
       caps = info_caps;
     }
 
-    peercaps = gst_pad_peer_query_caps (agg->srcpad, NULL);
-    if (peercaps) {
-      GstCaps *tmp;
-      int i;
-
+    /* If the sub-class allows it, allow size/framerate changes */
+    if (!vagg_klass->preserve_update_caps_result) {
       s = gst_caps_get_structure (caps, 0);
       gst_structure_get (s, "width", G_TYPE_INT, &best_width, "height",
           G_TYPE_INT, &best_height, NULL);
@@ -726,6 +724,12 @@ gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
             "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, "framerate",
             GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
       }
+    }
+
+    peercaps = gst_pad_peer_query_caps (agg->srcpad, caps);
+    if (peercaps) {
+      GstCaps *tmp;
+
 
       tmp = gst_caps_intersect (caps, peercaps);
       GST_DEBUG_OBJECT (vagg, "intersecting %" GST_PTR_FORMAT
index 2be7eb6..b3c5c53 100644 (file)
@@ -17,7 +17,7 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+
 #ifndef __GST_VIDEO_AGGREGATOR_H__
 #define __GST_VIDEO_AGGREGATOR_H__
 
@@ -86,6 +86,9 @@ struct _GstVideoAggregator
  *                            Notifies subclasses what caps format has been negotiated
  * @find_best_format:         Optional.
  *                            Lets subclasses decide of the best common format to use.
+ * @preserve_update_caps_result: Sub-classes should set this to true if the return result
+ *                               of the update_caps() method should not be further modified
+ *                               by GstVideoAggregator by removing fields.
  **/
 struct _GstVideoAggregatorClass
 {
@@ -105,6 +108,9 @@ struct _GstVideoAggregatorClass
                                                    GstCaps            *  downstream_caps,
                                                    GstVideoInfo       *  best_info,
                                                    gboolean           *  at_least_one_alpha);
+
+  gboolean           preserve_update_caps_result;
+
   /* < private > */
   gpointer            _gst_reserved[GST_PADDING_LARGE];
 };