v4l2transform: Add "disable-passthrough" property
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 22 Aug 2018 17:51:52 +0000 (17:51 +0000)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 31 Aug 2018 19:43:53 +0000 (15:43 -0400)
This allow forcing going through the transform driver even if there
isn't an conversion happening. This is usedful when the m2m driver can
be used to adapt the type of memory between two drivers.

sys/v4l2/gstv4l2transform.c
sys/v4l2/gstv4l2transform.h

index eb22a3e..eaa8608 100644 (file)
@@ -47,7 +47,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_v4l2_transform_debug);
 enum
 {
   PROP_0,
-  V4L2_STD_OBJECT_PROPS
+  V4L2_STD_OBJECT_PROPS,
+  PROP_DISABLE_PASSTHROUGH
 };
 
 typedef struct
@@ -72,6 +73,9 @@ gst_v4l2_transform_set_property (GObject * object,
       gst_v4l2_object_set_property_helper (self->v4l2capture, prop_id, value,
           pspec);
       break;
+    case PROP_DISABLE_PASSTHROUGH:
+      self->disable_passthrough = g_value_get_boolean (value);
+      break;
 
       /* By default, only set on output */
     default:
@@ -94,6 +98,9 @@ gst_v4l2_transform_get_property (GObject * object,
       gst_v4l2_object_get_property_helper (self->v4l2capture, prop_id, value,
           pspec);
       break;
+    case PROP_DISABLE_PASSTHROUGH:
+      g_value_set_boolean (value, self->disable_passthrough);
+      break;
 
       /* By default read from output */
     default:
@@ -190,6 +197,9 @@ gst_v4l2_transform_set_caps (GstBaseTransform * trans, GstCaps * incaps,
   GstV4l2Error error = GST_V4L2_ERROR_INIT;
   GstV4l2Transform *self = GST_V4L2_TRANSFORM (trans);
 
+  if (self->disable_passthrough)
+    gst_base_transform_set_passthrough (trans, FALSE);
+
   if (self->incaps && self->outcaps) {
     if (gst_caps_is_equal (incaps, self->incaps) &&
         gst_caps_is_equal (outcaps, self->outcaps)) {
@@ -1125,6 +1135,11 @@ gst_v4l2_transform_class_init (GstV4l2TransformClass * klass)
       GST_DEBUG_FUNCPTR (gst_v4l2_transform_change_state);
 
   gst_v4l2_object_install_m2m_properties_helper (gobject_class);
+
+  g_object_class_install_property (gobject_class, PROP_DISABLE_PASSTHROUGH,
+      g_param_spec_boolean ("disable-passthrough", "Disable Passthrough",
+          "Forces passing buffers through the converter", FALSE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
index ea6b9a5..29f3f3c 100644 (file)
@@ -61,6 +61,8 @@ struct _GstV4l2Transform
   /* Selected caps */
   GstCaps *incaps;
   GstCaps *outcaps;
+
+  gboolean disable_passthrough;
 };
 
 struct _GstV4l2TransformClass