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
#endif
#include "gstgamma.h"
-#ifdef HAVE_LIBOIL
#include <liboil/liboil.h>
-#endif
#include <string.h>
#include <math.h>
#include <gst/video/video.h>
-
+#include <gst/controller/gstcontroller.h>
GST_DEBUG_CATEGORY_STATIC (gamma_debug);
#define GST_CAT_DEFAULT gamma_debug
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);
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:
}
}
-#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)
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;
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;
{
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);
}