From 4ac1a134ec275406f72ab4660d793e1cd387ded7 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 16 Jan 2004 23:52:53 +0000 Subject: gst/videofilter/gstvideobalance.c: Fix regression; changing a property affects the video stream. Original commit message from CVS: * gst/videofilter/gstvideobalance.c: Fix regression; changing a property affects the video stream. * sys/xvimage/xvimagesink.c: * sys/xvimage/xvimagesink.h: Add synchronous property for debugging. Should probably be disabled in non-CVS builds. Make sure that the Xv attribute exists before we set it (crash!). Fix a silly float bug that caused colorbalance to just not work. --- gst/videofilter/gstvideobalance.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'gst') diff --git a/gst/videofilter/gstvideobalance.c b/gst/videofilter/gstvideobalance.c index 5a863184..029d7d3e 100644 --- a/gst/videofilter/gstvideobalance.c +++ b/gst/videofilter/gstvideobalance.c @@ -65,6 +65,7 @@ static void gst_videobalance_interface_init (GstImplementsInterfaceClass *klass) static void gst_videobalance_colorbalance_init (GstColorBalanceClass *iface); static void gst_videobalance_dispose (GObject *object); +static void gst_videobalance_update_properties (GstVideobalance *videobalance); GType gst_videobalance_get_type (void) @@ -275,17 +276,7 @@ gst_videobalance_colorbalance_set_value (GstColorBalance *balance, else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) vb->contrast = (value + 1000.0) * 2.0 / 2000.0; - /* Maybe we should narrow values which are around median to trigger passthru - more often */ - if (vb->contrast == 1 && vb->brightness == 0 && - vb->hue == 0 && vb->saturation == 1) - { - vf->passthru = TRUE; - } - else - { - vf->passthru = FALSE; - } + gst_videobalance_update_properties (vb); } static gint @@ -320,6 +311,17 @@ gst_videobalance_colorbalance_init (GstColorBalanceClass *iface) iface->get_value = gst_videobalance_colorbalance_get_value; } +static void +gst_videobalance_update_properties (GstVideobalance *videobalance) +{ + if (videobalance->contrast == 1.0 && videobalance->brightness == 0.0 && + videobalance->hue == 0.0 && videobalance->saturation == 1.0) { + GST_VIDEOFILTER (videobalance)->passthru = TRUE; + } else { + GST_VIDEOFILTER (videobalance)->passthru = FALSE; + } +} + static void gst_videobalance_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { @@ -346,6 +348,8 @@ gst_videobalance_set_property (GObject *object, guint prop_id, const GValue *val default: break; } + + gst_videobalance_update_properties (src); } static void -- cgit