From: Sebastian Dröge Date: Sat, 17 Apr 2010 16:01:06 +0000 (+0200) Subject: gamma: Make gamma property controllable X-Git-Tag: RELEASE-0.10.23~226 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18273152b31a4788ad4ab6c69f2cbdfb18852f00;p=platform%2Fupstream%2Fgst-plugins-good.git gamma: Make gamma property controllable ...and properly use liboil. --- diff --git a/gst/videofilter/Makefile.am b/gst/videofilter/Makefile.am index 8779494..32fd41c 100644 --- a/gst/videofilter/Makefile.am +++ b/gst/videofilter/Makefile.am @@ -33,10 +33,14 @@ libgstvideobalance_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideobalance_la_LIBTOOLFLAGS = --tag=disable-static libgstgamma_la_SOURCES = gstgamma.c -libgstgamma_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) +libgstgamma_la_CFLAGS = $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(LIBOIL_CFLAGS) libgstgamma_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ \ - $(GST_BASE_LIBS) $(GST_LIBS) + $(GST_CONTROLLER_LIBS) \ + $(GST_BASE_LIBS) $(GST_LIBS) \ + $(LIBOIL_LIBS) libgstgamma_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM) libgstgamma_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/gst/videofilter/gstgamma.c b/gst/videofilter/gstgamma.c index fe673ed..44b4a09 100644 --- a/gst/videofilter/gstgamma.c +++ b/gst/videofilter/gstgamma.c @@ -45,14 +45,12 @@ #endif #include "gstgamma.h" -#ifdef HAVE_LIBOIL #include -#endif #include #include #include - +#include GST_DEBUG_CATEGORY_STATIC (gamma_debug); #define GST_CAT_DEFAULT gamma_debug @@ -123,7 +121,7 @@ gst_gamma_class_init (GstGammaClass * g_class) g_object_class_install_property (gobject_class, PROP_GAMMA, g_param_spec_double ("gamma", "Gamma", "gamma", 0.01, 10, DEFAULT_PROP_GAMMA, - G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); + GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_gamma_set_caps); trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_gamma_transform_ip); @@ -149,8 +147,10 @@ gst_gamma_set_property (GObject * object, guint prop_id, const GValue * value, GST_DEBUG_OBJECT (gamma, "Changing gamma from %lf to %lf", gamma->gamma, val); + GST_OBJECT_LOCK (gamma); gamma->gamma = val; gst_gamma_calculate_tables (gamma); + GST_OBJECT_UNLOCK (gamma); break; } default: @@ -197,21 +197,6 @@ gst_gamma_calculate_tables (GstGamma * gamma) } } -#ifndef HAVE_LIBOIL -static void -oil_tablelookup_u8 (guint8 * dest, gint dstr, const guint8 * src, gint sstr, - const guint8 * table, gint tstr, gint n) -{ - gint i; - - for (i = 0; i < n; i++) { - *dest = table[*src * tstr]; - dest += dstr; - src += sstr; - } -} -#endif - /* Useful macros */ #define GST_VIDEO_I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width)) #define GST_VIDEO_I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2) @@ -259,6 +244,17 @@ gst_gamma_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) GstGamma *gamma = GST_GAMMA (base); guint8 *data; guint size; + GstClockTime timestamp, stream_time; + + timestamp = GST_BUFFER_TIMESTAMP (outbuf); + stream_time = + gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp); + + GST_DEBUG_OBJECT (gamma, "sync to %" GST_TIME_FORMAT, + GST_TIME_ARGS (timestamp)); + + if (GST_CLOCK_TIME_IS_VALID (stream_time)) + gst_object_sync_values (G_OBJECT (gamma), stream_time); if (base->passthrough) goto done; @@ -269,8 +265,10 @@ gst_gamma_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) if (size != gamma->size) goto wrong_size; + GST_OBJECT_LOCK (gamma); gst_gamma_planar411_ip (gamma, data, gamma->height * GST_VIDEO_I420_Y_ROWSTRIDE (gamma->width)); + GST_OBJECT_UNLOCK (gamma); done: return GST_FLOW_OK; @@ -289,6 +287,9 @@ plugin_init (GstPlugin * plugin) { GST_DEBUG_CATEGORY_INIT (gamma_debug, "gamma", 0, "gamma"); + oil_init (); + gst_controller_init (NULL, NULL); + return gst_element_register (plugin, "gamma", GST_RANK_NONE, GST_TYPE_GAMMA); }