From e614bd037e829cd10bed516516e7810cd373fb91 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 7 Feb 2013 15:42:54 -0800 Subject: yadif: Add mode property Copy mode from deinterlace element. Isn't actually implemented in yadif, every frame is deinterlaced, so effectively mode=1. --- gst/yadif/gstyadif.c | 42 +++++++++++++++++++++++++++++++++++++++--- gst/yadif/gstyadif.h | 8 +++++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/gst/yadif/gstyadif.c b/gst/yadif/gstyadif.c index cde918432..bf2e89dae 100644 --- a/gst/yadif/gstyadif.c +++ b/gst/yadif/gstyadif.c @@ -100,9 +100,12 @@ static GstFlowReturn gst_yadif_transform_ip (GstBaseTransform * trans, enum { - PROP_0 + PROP_0, + PROP_MODE }; +#define DEFAULT_MODE GST_DEINTERLACE_MODE_AUTO + /* pad templates */ static GstStaticPadTemplate gst_yadif_sink_template = @@ -121,6 +124,26 @@ GST_STATIC_PAD_TEMPLATE ("src", ",interlace-mode=(string)progressive") ); +#define GST_TYPE_DEINTERLACE_MODES (gst_deinterlace_modes_get_type ()) +static GType +gst_deinterlace_modes_get_type (void) +{ + static GType deinterlace_modes_type = 0; + + static const GEnumValue modes_types[] = { + {GST_DEINTERLACE_MODE_AUTO, "Auto detection", "auto"}, + {GST_DEINTERLACE_MODE_INTERLACED, "Force deinterlacing", "interlaced"}, + {GST_DEINTERLACE_MODE_DISABLED, "Run in passthrough mode", "disabled"}, + {0, NULL, NULL}, + }; + + if (!deinterlace_modes_type) { + deinterlace_modes_type = + g_enum_register_static ("GstYadifModes", modes_types); + } + return deinterlace_modes_type; +} + /* class initialization */ @@ -198,6 +221,13 @@ gst_yadif_class_init (GstYadifClass * klass) base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_yadif_transform_ip); + g_object_class_install_property (gobject_class, PROP_MODE, + g_param_spec_enum ("mode", "Deinterlace Mode", + "Deinterlace mode", + GST_TYPE_DEINTERLACE_MODES, + DEFAULT_MODE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); + } static void @@ -215,9 +245,12 @@ void gst_yadif_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - /* GstYadif *yadif = GST_YADIF (object); */ + GstYadif *yadif = GST_YADIF (object); switch (property_id) { + case PROP_MODE: + yadif->mode = g_value_get_enum (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -228,9 +261,12 @@ void gst_yadif_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - /* GstYadif *yadif = GST_YADIF (object); */ + GstYadif *yadif = GST_YADIF (object); switch (property_id) { + case PROP_MODE: + g_value_set_enum (value, yadif->mode); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; diff --git a/gst/yadif/gstyadif.h b/gst/yadif/gstyadif.h index 118f5010d..eb92cbe8d 100644 --- a/gst/yadif/gstyadif.h +++ b/gst/yadif/gstyadif.h @@ -35,6 +35,12 @@ G_BEGIN_DECLS typedef struct _GstYadif GstYadif; typedef struct _GstYadifClass GstYadifClass; +typedef enum { + GST_DEINTERLACE_MODE_AUTO, + GST_DEINTERLACE_MODE_INTERLACED, + GST_DEINTERLACE_MODE_DISABLED +} GstDeinterlaceMode; + struct _GstYadif { GstBaseTransform base_yadif; @@ -42,7 +48,7 @@ struct _GstYadif GstPad *sinkpad; GstPad *srcpad; - int mode; + GstDeinterlaceMode mode; GstVideoInfo video_info; -- cgit v1.2.3