v4l2transform: Add "disable-passthrough" property

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.
This commit is contained in:
Nicolas Dufresne 2018-08-22 17:51:52 +00:00
parent abf2af1a66
commit fe5236be87
2 changed files with 18 additions and 1 deletions

View 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

View file

@ -61,6 +61,8 @@ struct _GstV4l2Transform
/* Selected caps */
GstCaps *incaps;
GstCaps *outcaps;
gboolean disable_passthrough;
};
struct _GstV4l2TransformClass