summaryrefslogtreecommitdiffstats
path: root/gst/videofilter
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit5d25c00e4b613b9cdf2c04fa3a68dffa03834a68 (patch)
tree74a5b1eaf3a324b520e64e87404fd0b3018a7829 /gst/videofilter
parent1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff)
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/videofilter')
-rw-r--r--gst/videofilter/gstgamma.c242
-rw-r--r--gst/videofilter/gstvideobalance.c313
-rw-r--r--gst/videofilter/gstvideobalance.h15
-rw-r--r--gst/videofilter/gstvideofilter.c346
-rw-r--r--gst/videofilter/gstvideofilter.h43
-rw-r--r--gst/videofilter/gstvideoflip.c272
-rw-r--r--gst/videofilter/gstvideoflip.h15
-rw-r--r--gst/videofilter/gstvideotemplate.c132
8 files changed, 708 insertions, 670 deletions
diff --git a/gst/videofilter/gstgamma.c b/gst/videofilter/gstgamma.c
index 8f4ff28f..7cc2b0fd 100644
--- a/gst/videofilter/gstgamma.c
+++ b/gst/videofilter/gstgamma.c
@@ -49,7 +49,8 @@
typedef struct _GstGamma GstGamma;
typedef struct _GstGammaClass GstGammaClass;
-struct _GstGamma {
+struct _GstGamma
+{
GstVideofilter videofilter;
double gamma;
@@ -60,18 +61,21 @@ struct _GstGamma {
guint8 gamma_table_b[256];
};
-struct _GstGammaClass {
+struct _GstGammaClass
+{
GstVideofilterClass parent_class;
};
/* GstGamma signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_GAMMA,
ARG_GAMMA_R,
@@ -80,18 +84,23 @@ enum {
/* FILL ME */
};
-static void gst_gamma_base_init (gpointer g_class);
-static void gst_gamma_class_init (gpointer g_class, gpointer class_data);
-static void gst_gamma_init (GTypeInstance *instance, gpointer g_class);
+static void gst_gamma_base_init (gpointer g_class);
+static void gst_gamma_class_init (gpointer g_class, gpointer class_data);
+static void gst_gamma_init (GTypeInstance * instance, gpointer g_class);
-static void gst_gamma_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_gamma_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_gamma_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_gamma_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_gamma_planar411(GstVideofilter *videofilter, void *dest, void *src);
-static void gst_gamma_rgb24(GstVideofilter *videofilter, void *dest, void *src);
-static void gst_gamma_rgb32(GstVideofilter *videofilter, void *dest, void *src);
-static void gst_gamma_setup(GstVideofilter *videofilter);
-static void gst_gamma_calculate_tables (GstGamma *gamma);
+static void gst_gamma_planar411 (GstVideofilter * videofilter, void *dest,
+ void *src);
+static void gst_gamma_rgb24 (GstVideofilter * videofilter, void *dest,
+ void *src);
+static void gst_gamma_rgb32 (GstVideofilter * videofilter, void *dest,
+ void *src);
+static void gst_gamma_setup (GstVideofilter * videofilter);
+static void gst_gamma_calculate_tables (GstGamma * gamma);
GType
gst_gamma_get_type (void)
@@ -100,47 +109,46 @@ gst_gamma_get_type (void)
if (!gamma_type) {
static const GTypeInfo gamma_info = {
- sizeof(GstGammaClass),
+ sizeof (GstGammaClass),
gst_gamma_base_init,
NULL,
gst_gamma_class_init,
NULL,
NULL,
- sizeof(GstGamma),
+ sizeof (GstGamma),
0,
gst_gamma_init,
};
- gamma_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
- "GstGamma", &gamma_info, 0);
+ gamma_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
+ "GstGamma", &gamma_info, 0);
}
return gamma_type;
}
static GstVideofilterFormat gst_gamma_formats[] = {
- { "I420", 12, gst_gamma_planar411, },
- { "RGB ", 24, gst_gamma_rgb24, 24, G_BIG_ENDIAN, 0xff0000, 0xff00, 0xff },
- { "RGB ", 32, gst_gamma_rgb32, 24, G_BIG_ENDIAN, 0x00ff00, 0xff0000, 0xff000000 },
+ {"I420", 12, gst_gamma_planar411,},
+ {"RGB ", 24, gst_gamma_rgb24, 24, G_BIG_ENDIAN, 0xff0000, 0xff00, 0xff},
+ {"RGB ", 32, gst_gamma_rgb32, 24, G_BIG_ENDIAN, 0x00ff00, 0xff0000,
+ 0xff000000},
};
-
+
static void
gst_gamma_base_init (gpointer g_class)
{
- static GstElementDetails gamma_details = GST_ELEMENT_DETAILS (
- "Video Gamma Correction",
- "Filter/Effect/Video",
- "Adjusts gamma on a video stream",
- "Arwed v. Merkatz <v.merkatz@gmx.net"
- );
+ static GstElementDetails gamma_details =
+ GST_ELEMENT_DETAILS ("Video Gamma Correction",
+ "Filter/Effect/Video",
+ "Adjusts gamma on a video stream",
+ "Arwed v. Merkatz <v.merkatz@gmx.net");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
int i;
-
+
gst_element_class_set_details (element_class, &gamma_details);
- for(i=0;i<G_N_ELEMENTS(gst_gamma_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
- gst_gamma_formats + i);
+ for (i = 0; i < G_N_ELEMENTS (gst_gamma_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class, gst_gamma_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
@@ -155,18 +163,18 @@ gst_gamma_class_init (gpointer g_class, gpointer class_data)
gobject_class = G_OBJECT_CLASS (g_class);
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
- g_object_class_install_property(gobject_class, ARG_GAMMA,
- g_param_spec_double("gamma", "Gamma", "gamma",
- 0.01, 10, 1, G_PARAM_READWRITE));
- g_object_class_install_property(gobject_class, ARG_GAMMA_R,
- g_param_spec_double("redgamma", "Gamma_r", "gamma value for the red channel",
- 0.01, 10, 1, G_PARAM_READWRITE));
- g_object_class_install_property(gobject_class, ARG_GAMMA_G,
- g_param_spec_double("greengamma", "Gamma_g", "gamma value for the green channel",
- 0.01, 10, 1, G_PARAM_READWRITE));
- g_object_class_install_property(gobject_class, ARG_GAMMA_B,
- g_param_spec_double("bluegamma", "Gamma_b", "gamma value for the blue channel",
- 0.01, 10, 1, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_GAMMA,
+ g_param_spec_double ("gamma", "Gamma", "gamma",
+ 0.01, 10, 1, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_GAMMA_R,
+ g_param_spec_double ("redgamma", "Gamma_r",
+ "gamma value for the red channel", 0.01, 10, 1, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_GAMMA_G,
+ g_param_spec_double ("greengamma", "Gamma_g",
+ "gamma value for the green channel", 0.01, 10, 1, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_GAMMA_B,
+ g_param_spec_double ("bluegamma", "Gamma_b",
+ "gamma value for the blue channel", 0.01, 10, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_gamma_set_property;
gobject_class->get_property = gst_gamma_get_property;
@@ -175,14 +183,14 @@ gst_gamma_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_gamma_init (GTypeInstance *instance, gpointer g_class)
+gst_gamma_init (GTypeInstance * instance, gpointer g_class)
{
GstGamma *gamma = GST_GAMMA (instance);
GstVideofilter *videofilter;
- GST_DEBUG("gst_gamma_init");
+ GST_DEBUG ("gst_gamma_init");
- videofilter = GST_VIDEOFILTER(gamma);
+ videofilter = GST_VIDEOFILTER (gamma);
/* do stuff */
gamma->gamma = 1;
@@ -193,15 +201,16 @@ gst_gamma_init (GTypeInstance *instance, gpointer g_class)
}
static void
-gst_gamma_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_gamma_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstGamma *gamma;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_GAMMA(object));
- gamma = GST_GAMMA(object);
+ g_return_if_fail (GST_IS_GAMMA (object));
+ gamma = GST_GAMMA (object);
- GST_DEBUG("gst_gamma_set_property");
+ GST_DEBUG ("gst_gamma_set_property");
switch (prop_id) {
case ARG_GAMMA:
gamma->gamma = g_value_get_double (value);
@@ -225,13 +234,14 @@ gst_gamma_set_property (GObject *object, guint prop_id, const GValue *value, GPa
}
static void
-gst_gamma_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_gamma_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstGamma *gamma;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_GAMMA(object));
- gamma = GST_GAMMA(object);
+ g_return_if_fail (GST_IS_GAMMA (object));
+ gamma = GST_GAMMA (object);
switch (prop_id) {
case ARG_GAMMA:
@@ -252,50 +262,42 @@ gst_gamma_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
}
}
-static gboolean plugin_init (GstPlugin *plugin)
+static gboolean
+plugin_init (GstPlugin * plugin)
{
- if(!gst_library_load("gstvideofilter"))
+ if (!gst_library_load ("gstvideofilter"))
return FALSE;
- return gst_element_register (plugin, "gamma", GST_RANK_NONE,
- GST_TYPE_GAMMA);
+ return gst_element_register (plugin, "gamma", GST_RANK_NONE, GST_TYPE_GAMMA);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gamma",
- "Changes gamma on video images",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gamma",
+ "Changes gamma on video images",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
-static void gst_gamma_setup(GstVideofilter *videofilter)
+ static void gst_gamma_setup (GstVideofilter * videofilter)
{
GstGamma *gamma;
- g_return_if_fail(GST_IS_GAMMA(videofilter));
- gamma = GST_GAMMA(videofilter);
+ g_return_if_fail (GST_IS_GAMMA (videofilter));
+ gamma = GST_GAMMA (videofilter);
/* if any setup needs to be done, do it here */
}
static void
-gst_gamma_calculate_tables (GstGamma *gamma)
+gst_gamma_calculate_tables (GstGamma * gamma)
{
int n;
double val;
double exp;
- if (gamma->gamma == 1.0 &&
- gamma->gamma_r == 1.0 &&
- gamma->gamma_g == 1.0 &&
- gamma->gamma_b == 1.0) {
+ if (gamma->gamma == 1.0 &&
+ gamma->gamma_r == 1.0 && gamma->gamma_g == 1.0 && gamma->gamma_b == 1.0) {
GST_VIDEOFILTER (gamma)->passthru = TRUE;
return;
}
@@ -303,77 +305,80 @@ gst_gamma_calculate_tables (GstGamma *gamma)
exp = 1.0 / gamma->gamma;
for (n = 0; n < 256; n++) {
- val = n/255.0;
- val = pow(val, exp);
+ val = n / 255.0;
+ val = pow (val, exp);
val = 255.0 * val;
- gamma->gamma_table[n] = (unsigned char) floor(val + 0.5);
+ gamma->gamma_table[n] = (unsigned char) floor (val + 0.5);
}
exp = 1.0 / gamma->gamma_r;
for (n = 0; n < 256; n++) {
- val = n/255.0;
- val = pow(val, exp);
+ val = n / 255.0;
+ val = pow (val, exp);
val = 255.0 * val;
- gamma->gamma_table_r[n] = (unsigned char) floor(val + 0.5);
+ gamma->gamma_table_r[n] = (unsigned char) floor (val + 0.5);
}
exp = 1.0 / gamma->gamma_g;
for (n = 0; n < 256; n++) {
- val = n/255.0;
- val = pow(val, exp);
+ val = n / 255.0;
+ val = pow (val, exp);
val = 255.0 * val;
- gamma->gamma_table_g[n] = (unsigned char) floor(val + 0.5);
+ gamma->gamma_table_g[n] = (unsigned char) floor (val + 0.5);
}
exp = 1.0 / gamma->gamma_b;
for (n = 0; n < 256; n++) {
- val = n/255.0;
- val = pow(val, exp);
+ val = n / 255.0;
+ val = pow (val, exp);
val = 255.0 * val;
- gamma->gamma_table_b[n] = (unsigned char) floor(val + 0.5);
+ gamma->gamma_table_b[n] = (unsigned char) floor (val + 0.5);
}
}
-static void gst_gamma_planar411(GstVideofilter *videofilter,
- void *dest, void *src)
+static void
+gst_gamma_planar411 (GstVideofilter * videofilter, void *dest, void *src)
{
GstGamma *gamma;
- int width = gst_videofilter_get_input_width(videofilter);
- int height = gst_videofilter_get_input_height(videofilter);
+ int width = gst_videofilter_get_input_width (videofilter);
+ int height = gst_videofilter_get_input_height (videofilter);
- g_return_if_fail(GST_IS_GAMMA(videofilter));
- gamma = GST_GAMMA(videofilter);
+ g_return_if_fail (GST_IS_GAMMA (videofilter));
+ gamma = GST_GAMMA (videofilter);
- memcpy(dest,src,width * height + (width/2) * (height/2) * 2);
+ memcpy (dest, src, width * height + (width / 2) * (height / 2) * 2);
if (gamma->gamma != 1.0) {
{
guint8 *cdest = dest;
guint8 *csrc = src;
- int x,y;
- for (y=0; y < height; y++) {
- for (x=0; x < width; x++) {
- cdest[y*width + x] = gamma->gamma_table[(unsigned char)csrc[y*width + x]];
- }
+ int x, y;
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ cdest[y * width + x] =
+ gamma->gamma_table[(unsigned char) csrc[y * width + x]];
+ }
}
}
}
}
-static void gst_gamma_rgb24(GstVideofilter *videofilter, void *dest, void *src)
+static void
+gst_gamma_rgb24 (GstVideofilter * videofilter, void *dest, void *src)
{
GstGamma *gamma;
int i;
int width, height;
guint8 *csrc = src;
guint8 *cdest = dest;
-
- g_return_if_fail(GST_IS_GAMMA(videofilter));
- gamma = GST_GAMMA(videofilter);
- width = gst_videofilter_get_input_width(videofilter);
- height = gst_videofilter_get_input_height(videofilter);
+ g_return_if_fail (GST_IS_GAMMA (videofilter));
+ gamma = GST_GAMMA (videofilter);
+
+ width = gst_videofilter_get_input_width (videofilter);
+ height = gst_videofilter_get_input_height (videofilter);
if (gamma->gamma == 1.0) {
i = 0;
- while ( i < width * height * 3) {
+ while (i < width * height * 3) {
*cdest++ = gamma->gamma_table_r[*csrc++];
*cdest++ = gamma->gamma_table_g[*csrc++];
*cdest++ = gamma->gamma_table_b[*csrc++];
@@ -388,22 +393,23 @@ static void gst_gamma_rgb24(GstVideofilter *videofilter, void *dest, void *src)
}
}
-static void gst_gamma_rgb32(GstVideofilter *videofilter, void *dest, void *src)
+static void
+gst_gamma_rgb32 (GstVideofilter * videofilter, void *dest, void *src)
{
GstGamma *gamma;
int i;
int width, height;
guint8 *csrc = src;
guint8 *cdest = dest;
-
- g_return_if_fail(GST_IS_GAMMA(videofilter));
- gamma = GST_GAMMA(videofilter);
- width = gst_videofilter_get_input_width(videofilter);
- height = gst_videofilter_get_input_height(videofilter);
+ g_return_if_fail (GST_IS_GAMMA (videofilter));
+ gamma = GST_GAMMA (videofilter);
+
+ width = gst_videofilter_get_input_width (videofilter);
+ height = gst_videofilter_get_input_height (videofilter);
if (gamma->gamma == 1.0) {
i = 0;
- while ( i < width * height * 4) {
+ while (i < width * height * 4) {
*cdest++ = gamma->gamma_table_b[*csrc++];
*cdest++ = gamma->gamma_table_g[*csrc++];
*cdest++ = gamma->gamma_table_r[*csrc++];
@@ -415,10 +421,10 @@ static void gst_gamma_rgb32(GstVideofilter *videofilter, void *dest, void *src)
i = 0;
while (i < width * height * 4) {
if ((i % 4) != 3)
- *cdest++ = gamma->gamma_table[*csrc++];
+ *cdest++ = gamma->gamma_table[*csrc++];
else {
- cdest++;
- csrc++;
+ cdest++;
+ csrc++;
}
i++;
}
diff --git a/gst/videofilter/gstvideobalance.c b/gst/videofilter/gstvideobalance.c
index ddbf76b9..2acad7c3 100644
--- a/gst/videofilter/gstvideobalance.c
+++ b/gst/videofilter/gstvideobalance.c
@@ -38,37 +38,43 @@
#include <gst/colorbalance/colorbalance.h>
/* GstVideobalance signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_CONTRAST,
ARG_BRIGHTNESS,
ARG_HUE,
ARG_SATURATION
- /* FILL ME */
+ /* FILL ME */
};
static GstVideofilterClass *parent_class = NULL;
-static void gst_videobalance_base_init (gpointer g_class);
-static void gst_videobalance_class_init (gpointer g_class, gpointer class_data);
-static void gst_videobalance_init (GTypeInstance *instance, gpointer g_class);
+static void gst_videobalance_base_init (gpointer g_class);
+static void gst_videobalance_class_init (gpointer g_class, gpointer class_data);
+static void gst_videobalance_init (GTypeInstance * instance, gpointer g_class);
-static void gst_videobalance_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_videobalance_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_videobalance_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_videobalance_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_videobalance_planar411(GstVideofilter *videofilter, void *dest, void *src);
-static void gst_videobalance_setup(GstVideofilter *videofilter);
+static void gst_videobalance_planar411 (GstVideofilter * videofilter,
+ void *dest, void *src);
+static void gst_videobalance_setup (GstVideofilter * videofilter);
-static void gst_videobalance_interface_init (GstImplementsInterfaceClass *klass);
-static void gst_videobalance_colorbalance_init (GstColorBalanceClass *iface);
+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);
+static void gst_videobalance_dispose (GObject * object);
+static void gst_videobalance_update_properties (GstVideobalance * videobalance);
GType
gst_videobalance_get_type (void)
@@ -77,62 +83,61 @@ gst_videobalance_get_type (void)
if (!videobalance_type) {
static const GTypeInfo videobalance_info = {
- sizeof(GstVideobalanceClass),
+ sizeof (GstVideobalanceClass),
gst_videobalance_base_init,
NULL,
gst_videobalance_class_init,
NULL,
NULL,
- sizeof(GstVideobalance),
+ sizeof (GstVideobalance),
0,
gst_videobalance_init,
};
-
+
static const GInterfaceInfo iface_info = {
(GInterfaceInitFunc) gst_videobalance_interface_init,
NULL,
NULL,
};
-
+
static const GInterfaceInfo colorbalance_info = {
(GInterfaceInitFunc) gst_videobalance_colorbalance_init,
NULL,
NULL,
};
-
- videobalance_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
- "GstVideobalance", &videobalance_info, 0);
-
- g_type_add_interface_static (videobalance_type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &iface_info);
+
+ videobalance_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
+ "GstVideobalance", &videobalance_info, 0);
+
+ g_type_add_interface_static (videobalance_type,
+ GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
g_type_add_interface_static (videobalance_type, GST_TYPE_COLOR_BALANCE,
- &colorbalance_info);
+ &colorbalance_info);
}
return videobalance_type;
}
static GstVideofilterFormat gst_videobalance_formats[] = {
- { "I420", 12, gst_videobalance_planar411, },
+ {"I420", 12, gst_videobalance_planar411,},
};
-
+
static void
gst_videobalance_base_init (gpointer g_class)
{
- static GstElementDetails videobalance_details = GST_ELEMENT_DETAILS (
- "Video Balance Control",
- "Filter/Effect/Video",
- "Adjusts brightness, contrast, hue, saturation on a video stream",
- "David Schleef <ds@schleef.org>"
- );
+ static GstElementDetails videobalance_details =
+ GST_ELEMENT_DETAILS ("Video Balance Control",
+ "Filter/Effect/Video",
+ "Adjusts brightness, contrast, hue, saturation on a video stream",
+ "David Schleef <ds@schleef.org>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
int i;
-
+
gst_element_class_set_details (element_class, &videobalance_details);
- for(i=0;i<G_N_ELEMENTS(gst_videobalance_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_videobalance_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_videobalance_formats + i);
}
@@ -140,7 +145,7 @@ gst_videobalance_base_init (gpointer g_class)
}
static void
-gst_videobalance_dispose (GObject *object)
+gst_videobalance_dispose (GObject * object)
{
GList *channels = NULL;
GstVideobalance *balance;
@@ -155,19 +160,19 @@ gst_videobalance_dispose (GObject *object)
g_free (balance->tabley);
g_free (balance->tableu);
g_free (balance->tablev);
-
+
channels = balance->channels;
-
- while (channels)
- {
- GstColorBalanceChannel *channel = channels->data;
- g_object_unref (channel);
- channels = g_list_next (channels);
- }
-
+
+ while (channels) {
+ GstColorBalanceChannel *channel = channels->data;
+
+ g_object_unref (channel);
+ channels = g_list_next (channels);
+ }
+
if (balance->channels)
g_list_free (balance->channels);
-
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -181,19 +186,18 @@ gst_videobalance_class_init (gpointer g_class, gpointer class_data)
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
parent_class = g_type_class_ref (GST_TYPE_VIDEOFILTER);
-
- g_object_class_install_property(gobject_class, ARG_CONTRAST,
- g_param_spec_double("contrast","Contrast","contrast",
- 0, 2, 1, G_PARAM_READWRITE));
- g_object_class_install_property(gobject_class, ARG_BRIGHTNESS,
- g_param_spec_double("brightness","Brightness","brightness",
- -1, 1, 0, G_PARAM_READWRITE));
- g_object_class_install_property(gobject_class, ARG_HUE,
- g_param_spec_double("hue","Hue","hue",
- -1, 1, 0, G_PARAM_READWRITE));
- g_object_class_install_property(gobject_class, ARG_SATURATION,
- g_param_spec_double("saturation","Saturation","saturation",
- 0, 2, 1, G_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class, ARG_CONTRAST,
+ g_param_spec_double ("contrast", "Contrast", "contrast",
+ 0, 2, 1, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_BRIGHTNESS,
+ g_param_spec_double ("brightness", "Brightness", "brightness",
+ -1, 1, 0, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_HUE,
+ g_param_spec_double ("hue", "Hue", "hue", -1, 1, 0, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_SATURATION,
+ g_param_spec_double ("saturation", "Saturation", "saturation",
+ 0, 2, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_videobalance_set_property;
gobject_class->get_property = gst_videobalance_get_property;
@@ -202,28 +206,29 @@ gst_videobalance_class_init (gpointer g_class, gpointer class_data)
videofilter_class->setup = gst_videobalance_setup;
#ifdef HAVE_LIBOIL
- oil_init();
+ oil_init ();
#endif
}
static void
-gst_videobalance_init (GTypeInstance *instance, gpointer g_class)
+gst_videobalance_init (GTypeInstance * instance, gpointer g_class)
{
GstVideobalance *videobalance = GST_VIDEOBALANCE (instance);
GstVideofilter *videofilter;
char *channels[4] = { "HUE", "SATURATION",
- "BRIGHTNESS", "CONTRAST" };
+ "BRIGHTNESS", "CONTRAST"
+ };
gint i;
-
- GST_DEBUG("gst_videobalance_init");
- videofilter = GST_VIDEOFILTER(videobalance);
+ GST_DEBUG ("gst_videobalance_init");
+
+ videofilter = GST_VIDEOFILTER (videobalance);
/* do stuff */
- videobalance->contrast = 1.0;
+ videobalance->contrast = 1.0;
videobalance->brightness = 0.0;
videobalance->saturation = 1.0;
- videobalance->hue = 0.0;
+ videobalance->hue = 0.0;
videobalance->needupdate = FALSE;
videofilter->passthru = TRUE;
@@ -235,60 +240,58 @@ gst_videobalance_init (GTypeInstance *instance, gpointer g_class)
videobalance->tableu[i] = g_new (guint8, 256);
videobalance->tablev[i] = g_new (guint8, 256);
}
-
+
/* Generate the channels list */
- for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++)
- {
- GstColorBalanceChannel *channel;
-
- channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
- channel->label = g_strdup (channels[i]);
- channel->min_value = -1000;
- channel->max_value = 1000;
-
- videobalance->channels = g_list_append (videobalance->channels,
- channel);
- }
+ for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++) {
+ GstColorBalanceChannel *channel;
+
+ channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
+ channel->label = g_strdup (channels[i]);
+ channel->min_value = -1000;
+ channel->max_value = 1000;
+
+ videobalance->channels = g_list_append (videobalance->channels, channel);
+ }
}
static gboolean
-gst_videobalance_interface_supported (GstImplementsInterface *iface, GType type)
+gst_videobalance_interface_supported (GstImplementsInterface * iface,
+ GType type)
{
g_assert (type == GST_TYPE_COLOR_BALANCE);
return TRUE;
}
static void
-gst_videobalance_interface_init (GstImplementsInterfaceClass *klass)
+gst_videobalance_interface_init (GstImplementsInterfaceClass * klass)
{
klass->supported = gst_videobalance_interface_supported;
}
static const GList *
-gst_videobalance_colorbalance_list_channels (GstColorBalance *balance)
+gst_videobalance_colorbalance_list_channels (GstColorBalance * balance)
{
GstVideobalance *videobalance = GST_VIDEOBALANCE (balance);
-
+
g_return_val_if_fail (videobalance != NULL, NULL);
g_return_val_if_fail (GST_IS_VIDEOBALANCE (videobalance), NULL);
-
+
return videobalance->channels;
}
static void
-gst_videobalance_colorbalance_set_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value)
+gst_videobalance_colorbalance_set_value (GstColorBalance * balance,
+ GstColorBalanceChannel * channel, gint value)
{
GstVideobalance *vb = GST_VIDEOBALANCE (balance);
GstVideofilter *vf = GST_VIDEOFILTER (vb);
-
+
g_return_if_fail (vb != NULL);
g_return_if_fail (GST_IS_VIDEOBALANCE (vb));
g_return_if_fail (GST_IS_VIDEOFILTER (vf));
g_return_if_fail (channel->label != NULL);
-
+
if (!g_ascii_strcasecmp (channel->label, "HUE")) {
vb->hue = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
} else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
@@ -298,21 +301,21 @@ gst_videobalance_colorbalance_set_value (GstColorBalance *balance,
} else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
vb->contrast = (value + 1000.0) * 2.0 / 2000.0;
}
-
+
gst_videobalance_update_properties (vb);
}
static gint
-gst_videobalance_colorbalance_get_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel)
+gst_videobalance_colorbalance_get_value (GstColorBalance * balance,
+ GstColorBalanceChannel * channel)
{
GstVideobalance *vb = GST_VIDEOBALANCE (balance);
gint value = 0;
-
+
g_return_val_if_fail (vb != NULL, 0);
g_return_val_if_fail (GST_IS_VIDEOBALANCE (vb), 0);
g_return_val_if_fail (channel->label != NULL, 0);
-
+
if (!g_ascii_strcasecmp (channel->label, "HUE")) {
value = (vb->hue + 1) * 2000.0 / 2.0 - 1000.0;
} else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
@@ -322,12 +325,12 @@ gst_videobalance_colorbalance_get_value (GstColorBalance *balance,
} else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
value = vb->contrast * 2000.0 / 2.0 - 1000.0;
}
-
+
return value;
}
static void
-gst_videobalance_colorbalance_init (GstColorBalanceClass *iface)
+gst_videobalance_colorbalance_init (GstColorBalanceClass * iface)
{
GST_COLOR_BALANCE_TYPE (iface) = GST_COLOR_BALANCE_SOFTWARE;
iface->list_channels = gst_videobalance_colorbalance_list_channels;
@@ -336,7 +339,7 @@ gst_videobalance_colorbalance_init (GstColorBalanceClass *iface)
}
static void
-gst_videobalance_update_properties (GstVideobalance *videobalance)
+gst_videobalance_update_properties (GstVideobalance * videobalance)
{
GstVideofilter *vf = GST_VIDEOFILTER (videobalance);
@@ -344,8 +347,7 @@ gst_videobalance_update_properties (GstVideobalance *videobalance)
if (videobalance->contrast == 1.0 &&
videobalance->brightness == 0.0 &&
- videobalance->hue == 0.0 &&
- videobalance->saturation == 1.0) {
+ videobalance->hue == 0.0 && videobalance->saturation == 1.0) {
vf->passthru = TRUE;
} else {
vf->passthru = FALSE;
@@ -353,15 +355,16 @@ gst_videobalance_update_properties (GstVideobalance *videobalance)
}
static void
-gst_videobalance_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_videobalance_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstVideobalance *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOBALANCE(object));
- src = GST_VIDEOBALANCE(object);
+ g_return_if_fail (GST_IS_VIDEOBALANCE (object));
+ src = GST_VIDEOBALANCE (object);
- GST_DEBUG("gst_videobalance_set_property");
+ GST_DEBUG ("gst_videobalance_set_property");
switch (prop_id) {
case ARG_CONTRAST:
src->contrast = g_value_get_double (value);
@@ -383,13 +386,14 @@ gst_videobalance_set_property (GObject *object, guint prop_id, const GValue *val
}
static void
-gst_videobalance_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_videobalance_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstVideobalance *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOBALANCE(object));
- src = GST_VIDEOBALANCE(object);
+ g_return_if_fail (GST_IS_VIDEOBALANCE (object));
+ src = GST_VIDEOBALANCE (object);
switch (prop_id) {
case ARG_CONTRAST:
@@ -410,33 +414,28 @@ gst_videobalance_get_property (GObject *object, guint prop_id, GValue *value, GP
}
}
-static gboolean plugin_init (GstPlugin *plugin)
+static gboolean
+plugin_init (GstPlugin * plugin)
{
- if(!gst_library_load("gstvideofilter"))
+ if (!gst_library_load ("gstvideofilter"))
return FALSE;
return gst_element_register (plugin, "videobalance", GST_RANK_NONE,
GST_TYPE_VIDEOBALANCE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videobalance",
- "Changes hue, saturation, brightness etc. on video images",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
-
-static void gst_videobalance_setup(GstVideofilter *videofilter)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "videobalance",
+ "Changes hue, saturation, brightness etc. on video images",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
+
+ static void gst_videobalance_setup (GstVideofilter * videofilter)
{
GstVideobalance *videobalance;
- g_return_if_fail(GST_IS_VIDEOBALANCE(videofilter));
- videobalance = GST_VIDEOBALANCE(videofilter);
+ g_return_if_fail (GST_IS_VIDEOBALANCE (videofilter));
+ videobalance = GST_VIDEOBALANCE (videofilter);
/* if any setup needs to be done, do it here */
@@ -447,7 +446,7 @@ static void gst_videobalance_setup(GstVideofilter *videofilter)
*/
static void
-gst_videobalance_update_tables_planar411 (GstVideobalance *vb)
+gst_videobalance_update_tables_planar411 (GstVideobalance * vb)
{
gint i, j;
gdouble y, u, v, hue_cos, hue_sin;
@@ -471,28 +470,30 @@ gst_videobalance_update_tables_planar411 (GstVideobalance *vb)
* separately. */
for (i = -128; i < 128; i++) {
for (j = -128; j < 128; j++) {
- u = 128 + (( i * hue_cos + j * hue_sin) * vb->saturation);
+ u = 128 + ((i * hue_cos + j * hue_sin) * vb->saturation);
v = 128 + ((-i * hue_sin + j * hue_cos) * vb->saturation);
- if(u < 0)
- u = 0;
+ if (u < 0)
+ u = 0;
else if (u > 255)
- u = 255;
+ u = 255;
if (v < 0)
- v = 0;
+ v = 0;
else if (v > 255)
- v = 255;
- vb->tableu[i+128][j+128] = rint (u);
- vb->tablev[i+128][j+128] = rint (v);
+ v = 255;
+ vb->tableu[i + 128][j + 128] = rint (u);
+ vb->tablev[i + 128][j + 128] = rint (v);
}
}
}
#ifndef HAVE_LIBOIL
-void tablelookup_u8 (guint8 *dest, int dstr, guint8 *src, int sstr,
- guint8 *table, int tstr, int n)
+void
+tablelookup_u8 (guint8 * dest, int dstr, guint8 * src, int sstr,
+ guint8 * table, int tstr, int n)
{
int i;
- for(i=0;i<n;i++){
+
+ for (i = 0; i < n; i++) {
*dest = table[*src * tstr];
dest += dstr;
src += sstr;
@@ -500,16 +501,16 @@ void tablelookup_u8 (guint8 *dest, int dstr, guint8 *src, int sstr,
}
#endif
-static void gst_videobalance_planar411(GstVideofilter *videofilter,
- void *dest, void *src)
+static void
+gst_videobalance_planar411 (GstVideofilter * videofilter, void *dest, void *src)
{
GstVideobalance *videobalance;
int width;
int height;
- int x,y;
+ int x, y;
- g_return_if_fail(GST_IS_VIDEOBALANCE(videofilter));
- videobalance = GST_VIDEOBALANCE(videofilter);
+ g_return_if_fail (GST_IS_VIDEOBALANCE (videofilter));
+ videobalance = GST_VIDEOBALANCE (videofilter);
if (videobalance->needupdate) {
gst_videobalance_update_tables_planar411 (videobalance);
@@ -523,9 +524,9 @@ static void gst_videobalance_planar411(GstVideofilter *videofilter,
guint8 *cdest = dest;
guint8 *csrc = src;
- for(y=0;y<height;y++) {
- tablelookup_u8 (cdest + y*width, 1, csrc + y*width, 1,
- videobalance->tabley, 1, width);
+ for (y = 0; y < height; y++) {
+ tablelookup_u8 (cdest + y * width, 1, csrc + y * width, 1,
+ videobalance->tabley, 1, width);
}
}
@@ -534,17 +535,17 @@ static void gst_videobalance_planar411(GstVideofilter *videofilter,
guint8 *usrc, *vsrc;
guint8 *udest, *vdest;
- usrc = src + width*height;
- udest = dest + width*height;
- vsrc = src + width*height + (width/2)*(height/2);
- vdest = dest + width*height + (width/2)*(height/2);
-
- for(y=0;y<height/2;y++){
- for(x=0;x<width/2;x++){
- u1 = usrc[y*(width/2) + x];
- v1 = vsrc[y*(width/2) + x];
- udest[y*(width/2) + x] = videobalance->tableu[u1][v1];
- vdest[y*(width/2) + x] = videobalance->tablev[u1][v1];
+ usrc = src + width * height;
+ udest = dest + width * height;
+ vsrc = src + width * height + (width / 2) * (height / 2);
+ vdest = dest + width * height + (width / 2) * (height / 2);
+
+ for (y = 0; y < height / 2; y++) {
+ for (x = 0; x < width / 2; x++) {
+ u1 = usrc[y * (width / 2) + x];
+ v1 = vsrc[y * (width / 2) + x];
+ udest[y * (width / 2) + x] = videobalance->tableu[u1][v1];
+ vdest[y * (width / 2) + x] = videobalance->tablev[u1][v1];
}
}
}
diff --git a/gst/videofilter/gstvideobalance.h b/gst/videofilter/gstvideobalance.h
index 45aab910..03a3d066 100644
--- a/gst/videofilter/gstvideobalance.h
+++ b/gst/videofilter/gstvideobalance.h
@@ -28,7 +28,6 @@
G_BEGIN_DECLS
-
#define GST_TYPE_VIDEOBALANCE \
(gst_videobalance_get_type())
#define GST_VIDEOBALANCE(obj) \
@@ -39,30 +38,30 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEOBALANCE))
#define GST_IS_VIDEOBALANCE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEOBALANCE))
-
typedef struct _GstVideobalance GstVideobalance;
typedef struct _GstVideobalanceClass GstVideobalanceClass;
-struct _GstVideobalance {
+struct _GstVideobalance
+{
GstVideofilter videofilter;
- guint8 *tabley, **tableu, **tablev;
+ guint8 *tabley, **tableu, **tablev;
gboolean needupdate;
gdouble contrast;
gdouble brightness;
gdouble hue;
gdouble saturation;
-
+
GList *channels;
};
-struct _GstVideobalanceClass {
+struct _GstVideobalanceClass
+{
GstVideofilterClass parent_class;
};
-GType gst_videobalance_get_type(void);
+GType gst_videobalance_get_type (void);
G_END_DECLS
-
#endif /* __GST_VIDEOBALANCE_H__ */
diff --git a/gst/videofilter/gstvideofilter.c b/gst/videofilter/gstvideofilter.c
index 7ef18e4a..590616bc 100644
--- a/gst/videofilter/gstvideofilter.c
+++ b/gst/videofilter/gstvideofilter.c
@@ -29,27 +29,31 @@
/* GstVideofilter signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_METHOD,
/* FILL ME */
};
-static void gst_videofilter_base_init (gpointer g_class);
-static void gst_videofilter_class_init (gpointer g_class, gpointer class_data);
-static void gst_videofilter_init (GTypeInstance *instance, gpointer g_class);
+static void gst_videofilter_base_init (gpointer g_class);
+static void gst_videofilter_class_init (gpointer g_class, gpointer class_data);
+static void gst_videofilter_init (GTypeInstance * instance, gpointer g_class);
-static void gst_videofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_videofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_videofilter_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_videofilter_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_videofilter_chain (GstPad *pad, GstData *_data);
-GstCaps * gst_videofilter_class_get_capslist(GstVideofilterClass *klass);
-static void gst_videofilter_setup(GstVideofilter *videofilter);
+static void gst_videofilter_chain (GstPad * pad, GstData * _data);
+GstCaps *gst_videofilter_class_get_capslist (GstVideofilterClass * klass);
+static void gst_videofilter_setup (GstVideofilter * videofilter);
static GstElementClass *parent_class = NULL;
@@ -60,23 +64,24 @@ gst_videofilter_get_type (void)
if (!videofilter_type) {
static const GTypeInfo videofilter_info = {
- sizeof(GstVideofilterClass),
+ sizeof (GstVideofilterClass),
gst_videofilter_base_init,
NULL,
gst_videofilter_class_init,
NULL,
NULL,
- sizeof(GstVideofilter),
+ sizeof (GstVideofilter),
0,
gst_videofilter_init,
};
- videofilter_type = g_type_register_static(GST_TYPE_ELEMENT,
+ videofilter_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstVideofilter", &videofilter_info, G_TYPE_FLAG_ABSTRACT);
}
return videofilter_type;
}
-static void gst_videofilter_base_init (gpointer g_class)
+static void
+gst_videofilter_base_init (gpointer g_class)
{
static GstElementDetails videofilter_details = {
"Video scaler",
@@ -87,38 +92,42 @@ static void gst_videofilter_base_init (gpointer g_class)
GstVideofilterClass *klass = (GstVideofilterClass *) g_class;
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- klass->formats = g_ptr_array_new();
+ klass->formats = g_ptr_array_new ();
gst_element_class_set_details (element_class, &videofilter_details);
}
-static void gst_videofilter_class_init (gpointer g_class, gpointer class_data)
+static void
+gst_videofilter_class_init (gpointer g_class, gpointer class_data)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstVideofilterClass *klass;
- klass = (GstVideofilterClass *)g_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ klass = (GstVideofilterClass *) g_class;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_videofilter_set_property;
gobject_class->get_property = gst_videofilter_get_property;
}
-static GstStructure *gst_videofilter_format_get_structure(GstVideofilterFormat *format)
+static GstStructure *
+gst_videofilter_format_get_structure (GstVideofilterFormat * format)
{
unsigned int fourcc;
GstStructure *structure;
- if(format->filter_func==NULL)
+ if (format->filter_func == NULL)
return NULL;
- fourcc = GST_MAKE_FOURCC(format->fourcc[0],format->fourcc[1],format->fourcc[2],format->fourcc[3]);
+ fourcc =
+ GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2],
+ format->fourcc[3]);
- if(format->depth){
+ if (format->depth) {
structure = gst_structure_new ("video/x-raw-rgb",
"depth", G_TYPE_INT, format->depth,
"bpp", G_TYPE_INT, format->bpp,
@@ -126,29 +135,31 @@ static GstStructure *gst_videofilter_format_get_structure(GstVideofilterFormat *
"red_mask", G_TYPE_INT, format->red_mask,
"green_mask", G_TYPE_INT, format->green_mask,
"blue_mask", G_TYPE_INT, format->blue_mask, NULL);
- }else{
+ } else {
structure = gst_structure_new ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, fourcc, NULL);
}
- gst_structure_set(structure,
+ gst_structure_set (structure,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
- NULL);
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
return structure;
}
-GstCaps * gst_videofilter_class_get_capslist(GstVideofilterClass *klass)
+GstCaps *
+gst_videofilter_class_get_capslist (GstVideofilterClass * klass)
{
GstCaps *caps;
GstStructure *structure;
int i;
- caps = gst_caps_new_empty();
- for(i=0;i<klass->formats->len;i++){
- structure = gst_videofilter_format_get_structure(g_ptr_array_index(klass->formats,i));
+ caps = gst_caps_new_empty ();
+ for (i = 0; i < klass->formats->len; i++) {
+ structure =
+ gst_videofilter_format_get_structure (g_ptr_array_index (klass->formats,
+ i));
gst_caps_append_structure (caps, structure);
}
@@ -156,22 +167,24 @@ GstCaps * gst_videofilter_class_get_capslist(GstVideofilterClass *klass)
}
static GstCaps *
-gst_videofilter_getcaps (GstPad *pad)
+gst_videofilter_getcaps (GstPad * pad)
{
GstVideofilter *videofilter;
GstVideofilterClass *klass;
+
//GstCaps *caps;
GstCaps *othercaps;
GstPad *otherpad;
+
//int i;
- GST_DEBUG("gst_videofilter_getcaps");
+ GST_DEBUG ("gst_videofilter_getcaps");
videofilter = GST_VIDEOFILTER (gst_pad_get_parent (pad));
-
- klass = GST_VIDEOFILTER_CLASS(G_OBJECT_GET_CLASS(videofilter));
+
+ klass = GST_VIDEOFILTER_CLASS (G_OBJECT_GET_CLASS (videofilter));
otherpad = (pad == videofilter->srcpad) ? videofilter->sinkpad :
- videofilter->srcpad;
+ videofilter->srcpad;
othercaps = gst_pad_get_allowed_caps (otherpad);
@@ -183,20 +196,22 @@ gst_videofilter_getcaps (GstPad *pad)
* the peer's formats. Create a list of them. */
/* FIXME optimize if peercaps == NULL */
caps = gst_caps_new_empty ();
- for(i=0;i<klass->formats->len;i++){
+ for (i = 0; i < klass->formats->len; i++) {
GstCaps *icaps;
GstCaps *fromcaps;
-
- fromcaps = gst_caps_new_full (gst_videofilter_format_get_structure (
- g_ptr_array_index (klass->formats,i)), NULL);
+
+ fromcaps =
+ gst_caps_new_full (gst_videofilter_format_get_structure
+ (g_ptr_array_index (klass->formats, i)), NULL);
icaps = gst_caps_intersect (fromcaps, peercaps);
- if(icaps != NULL){
+ if (icaps != NULL) {
gst_caps_append (caps, fromcaps);
} else {
gst_caps_free (fromcaps);
}
- if(icaps) gst_caps_free (icaps);
+ if (icaps)
+ gst_caps_free (icaps);
}
gst_caps_free (peercaps);
@@ -205,7 +220,7 @@ gst_videofilter_getcaps (GstPad *pad)
}
static GstPadLinkReturn
-gst_videofilter_link (GstPad *pad, const GstCaps *caps)
+gst_videofilter_link (GstPad * pad, const GstCaps * caps)
{
GstVideofilter *videofilter;
GstStructure *structure;
@@ -215,28 +230,30 @@ gst_videofilter_link (GstPad *pad, const GstCaps *caps)
GstPadLinkReturn lret;
GstPad *otherpad;
- GST_DEBUG("gst_videofilter_src_link");
+ GST_DEBUG ("gst_videofilter_src_link");
videofilter = GST_VIDEOFILTER (gst_pad_get_parent (pad));
otherpad = (pad == videofilter->srcpad) ? videofilter->sinkpad :
- videofilter->srcpad;
+ videofilter->srcpad;
structure = gst_caps_get_structure (caps, 0);
- videofilter->format = gst_videofilter_find_format_by_structure (
- videofilter, structure);
- g_return_val_if_fail(videofilter->format, GST_PAD_LINK_REFUSED);
+ videofilter->format =
+ gst_videofilter_find_format_by_structure (videofilter, structure);
+ g_return_val_if_fail (videofilter->format, GST_PAD_LINK_REFUSED);
ret = gst_structure_get_int (structure, "width", &width);
ret &= gst_structure_get_int (structure, "height", &height);
ret &= gst_structure_get_double (structure, "framerate", &framerate);
- if (!ret) return GST_PAD_LINK_REFUSED;
+ if (!ret)
+ return GST_PAD_LINK_REFUSED;
lret = gst_pad_try_set_caps (otherpad, caps);
- if (GST_PAD_LINK_FAILED (lret)) return lret;
+ if (GST_PAD_LINK_FAILED (lret))
+ return lret;
- GST_DEBUG("width %d height %d",width,height);
+ GST_DEBUG ("width %d height %d", width, height);
#if 0
if (pad == videofilter->srcpad) {
@@ -253,41 +270,41 @@ gst_videofilter_link (GstPad *pad, const GstCaps *caps)
videofilter->from_height = height;
videofilter->framerate = framerate;
- gst_videofilter_setup(videofilter);
+ gst_videofilter_setup (videofilter);
return GST_PAD_LINK_OK;
}
static void
-gst_videofilter_init (GTypeInstance *instance, gpointer g_class)
+gst_videofilter_init (GTypeInstance * instance, gpointer g_class)
{
GstVideofilter *videofilter = GST_VIDEOFILTER (instance);
GstPadTemplate *pad_template;
- GST_DEBUG("gst_videofilter_init");
-
- pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
- "sink");
- g_return_if_fail(pad_template != NULL);
- videofilter->sinkpad = gst_pad_new_from_template(pad_template, "sink");
- gst_element_add_pad(GST_ELEMENT(videofilter),videofilter->sinkpad);
- gst_pad_set_chain_function(videofilter->sinkpad,gst_videofilter_chain);
- gst_pad_set_link_function(videofilter->sinkpad,gst_videofilter_link);
- gst_pad_set_getcaps_function(videofilter->sinkpad,gst_videofilter_getcaps);
-
- pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
- "src");
- g_return_if_fail(pad_template != NULL);
- videofilter->srcpad = gst_pad_new_from_template(pad_template, "src");
- gst_element_add_pad(GST_ELEMENT(videofilter),videofilter->srcpad);
- gst_pad_set_link_function(videofilter->srcpad,gst_videofilter_link);
- gst_pad_set_getcaps_function(videofilter->srcpad,gst_videofilter_getcaps);
+ GST_DEBUG ("gst_videofilter_init");
+
+ pad_template =
+ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink");
+ g_return_if_fail (pad_template != NULL);
+ videofilter->sinkpad = gst_pad_new_from_template (pad_template, "sink");
+ gst_element_add_pad (GST_ELEMENT (videofilter), videofilter->sinkpad);
+ gst_pad_set_chain_function (videofilter->sinkpad, gst_videofilter_chain);
+ gst_pad_set_link_function (videofilter->sinkpad, gst_videofilter_link);
+ gst_pad_set_getcaps_function (videofilter->sinkpad, gst_videofilter_getcaps);
+
+ pad_template =
+ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
+ g_return_if_fail (pad_template != NULL);
+ videofilter->srcpad = gst_pad_new_from_template (pad_template, "src");
+ gst_element_add_pad (GST_ELEMENT (videofilter), videofilter->srcpad);
+ gst_pad_set_link_function (videofilter->srcpad, gst_videofilter_link);
+ gst_pad_set_getcaps_function (videofilter->srcpad, gst_videofilter_getcaps);
videofilter->inited = FALSE;
}
static void
-gst_videofilter_chain (GstPad *pad, GstData *_data)
+gst_videofilter_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstVideofilter *videofilter;
@@ -304,62 +321,63 @@ gst_videofilter_chain (GstPad *pad, GstData *_data)
videofilter = GST_VIDEOFILTER (gst_pad_get_parent (pad));
//g_return_if_fail (videofilter->inited);
- data = GST_BUFFER_DATA(buf);
- size = GST_BUFFER_SIZE(buf);
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
- if(videofilter->passthru){
- gst_pad_push(videofilter->srcpad, GST_DATA (buf));
+ if (videofilter->passthru) {
+ gst_pad_push (videofilter->srcpad, GST_DATA (buf));
return;
}
- GST_DEBUG ("gst_videofilter_chain: got buffer of %ld bytes in '%s'",size,
- GST_OBJECT_NAME (videofilter));
-
- GST_DEBUG("size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d",
- size,
- videofilter->from_width, videofilter->from_height,
- videofilter->to_width, videofilter->to_height,
- size, videofilter->from_buf_size,
- videofilter->to_buf_size);
+ GST_DEBUG ("gst_videofilter_chain: got buffer of %ld bytes in '%s'", size,
+ GST_OBJECT_NAME (videofilter));
+
+ GST_DEBUG
+ ("size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d",
+ size, videofilter->from_width, videofilter->from_height,
+ videofilter->to_width, videofilter->to_height, size,
+ videofilter->from_buf_size, videofilter->to_buf_size);
g_return_if_fail (size >= videofilter->from_buf_size);
if (size > videofilter->from_buf_size) {
- GST_INFO("buffer size %ld larger than expected (%d)",
- size, videofilter->from_buf_size);
+ GST_INFO ("buffer size %ld larger than expected (%d)",
+ size, videofilter->from_buf_size);
}
- outbuf = gst_pad_alloc_buffer(videofilter->srcpad, GST_BUFFER_OFFSET_NONE,
+ outbuf = gst_pad_alloc_buffer (videofilter->srcpad, GST_BUFFER_OFFSET_NONE,
videofilter->to_buf_size);
- GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf);
- GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(buf);
+ GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
+ GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
- g_return_if_fail(videofilter->format);
- GST_DEBUG ("format %s",videofilter->format->fourcc);
+ g_return_if_fail (videofilter->format);
+ GST_DEBUG ("format %s", videofilter->format->fourcc);
videofilter->in_buf = buf;
videofilter->out_buf = outbuf;
- videofilter->format->filter_func(videofilter, GST_BUFFER_DATA(outbuf), data);
+ videofilter->format->filter_func (videofilter, GST_BUFFER_DATA (outbuf),
+ data);
- GST_DEBUG ("gst_videofilter_chain: pushing buffer of %d bytes in '%s'",GST_BUFFER_SIZE(outbuf),
- GST_OBJECT_NAME (videofilter));
+ GST_DEBUG ("gst_videofilter_chain: pushing buffer of %d bytes in '%s'",
+ GST_BUFFER_SIZE (outbuf), GST_OBJECT_NAME (videofilter));
- gst_pad_push(videofilter->srcpad, GST_DATA (outbuf));
+ gst_pad_push (videofilter->srcpad, GST_DATA (outbuf));
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
}
static void
-gst_videofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_videofilter_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstVideofilter *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOFILTER(object));
- src = GST_VIDEOFILTER(object);
+ g_return_if_fail (GST_IS_VIDEOFILTER (object));
+ src = GST_VIDEOFILTER (object);
- GST_DEBUG("gst_videofilter_set_property");
+ GST_DEBUG ("gst_videofilter_set_property");
switch (prop_id) {
default:
break;
@@ -367,13 +385,14 @@ gst_videofilter_set_property (GObject *object, guint prop_id, const GValue *valu
}
static void
-gst_videofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_videofilter_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstVideofilter *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOFILTER(object));
- src = GST_VIDEOFILTER(object);
+ g_return_if_fail (GST_IS_VIDEOFILTER (object));
+ src = GST_VIDEOFILTER (object);
switch (prop_id) {
default:
@@ -382,36 +401,39 @@ gst_videofilter_get_property (GObject *object, guint prop_id, GValue *value, GPa
}
}
-int gst_videofilter_get_input_width(GstVideofilter *videofilter)
+int
+gst_videofilter_get_input_width (GstVideofilter * videofilter)
{
- g_return_val_if_fail(GST_IS_VIDEOFILTER(videofilter),0);
+ g_return_val_if_fail (GST_IS_VIDEOFILTER (videofilter), 0);
return videofilter->from_width;
}
-int gst_videofilter_get_input_height(GstVideofilter *videofilter)
+int
+gst_videofilter_get_input_height (GstVideofilter * videofilter)
{
- g_return_val_if_fail(GST_IS_VIDEOFILTER(videofilter),0);
+ g_return_val_if_fail (GST_IS_VIDEOFILTER (videofilter), 0);
return videofilter->from_height;
}
-void gst_videofilter_set_output_size(GstVideofilter *videofilter,
+void
+gst_videofilter_set_output_size (GstVideofilter * videofilter,
int width, int height)
{
int ret;
GstCaps *srccaps;
GstStructure *structure;
- g_return_if_fail(GST_IS_VIDEOFILTER(videofilter));
+ g_return_if_fail (GST_IS_VIDEOFILTER (videofilter));
videofilter->to_width = width;
videofilter->to_height = height;
videofilter->to_buf_size = (videofilter->to_width * videofilter->to_height
- * videofilter->format->bpp)/8;
+ * videofilter->format->bpp) / 8;
- srccaps = gst_caps_copy (gst_pad_get_negotiated_caps(videofilter->srcpad));
+ srccaps = gst_caps_copy (gst_pad_get_negotiated_caps (videofilter->srcpad));
structure = gst_caps_get_structure (srccaps, 0);
gst_structure_set (structure, "width", G_TYPE_INT, width,
@@ -424,60 +446,66 @@ void gst_videofilter_set_output_size(GstVideofilter *videofilter,
}
}
-static void gst_videofilter_setup(GstVideofilter *videofilter)
+static void
+gst_videofilter_setup (GstVideofilter * videofilter)
{
GstVideofilterClass *klass;
- klass = GST_VIDEOFILTER_CLASS(G_OBJECT_GET_CLASS(videofilter));
+ klass = GST_VIDEOFILTER_CLASS (G_OBJECT_GET_CLASS (videofilter));
- if(klass->setup){
- klass->setup(videofilter);
+ if (klass->setup) {
+ klass->setup (videofilter);
}
- if(videofilter->to_width == 0){
+ if (videofilter->to_width == 0) {
videofilter->to_width = videofilter->from_width;
}
- if(videofilter->to_height == 0){
+ if (videofilter->to_height == 0) {
videofilter->to_height = videofilter->from_height;
}
- g_return_if_fail(videofilter->format != NULL);
- g_return_if_fail(videofilter->from_width > 0);
- g_return_if_fail(videofilter->from_height > 0);
- g_return_if_fail(videofilter->to_width > 0);
- g_return_if_fail(videofilter->to_height > 0);
+ g_return_if_fail (videofilter->format != NULL);
+ g_return_if_fail (videofilter->from_width > 0);
+ g_return_if_fail (videofilter->from_height > 0);
+ g_return_if_fail (videofilter->to_width > 0);
+ g_return_if_fail (videofilter->to_height > 0);
- videofilter->from_buf_size = (videofilter->from_width * videofilter->from_height *
+ videofilter->from_buf_size =
+ (videofilter->from_width * videofilter->from_height *
videofilter->format->bpp) / 8;
- videofilter->to_buf_size = (videofilter->to_width * videofilter->to_height *
+ videofilter->to_buf_size =
+ (videofilter->to_width * videofilter->to_height *
videofilter->format->bpp) / 8;
videofilter->inited = TRUE;
}
-GstVideofilterFormat *gst_videofilter_find_format_by_structure (
- GstVideofilter *videofilter, const GstStructure *structure)
+GstVideofilterFormat *
+gst_videofilter_find_format_by_structure (GstVideofilter * videofilter,
+ const GstStructure * structure)
{
int i;
GstVideofilterClass *klass;
GstVideofilterFormat *format;
gboolean ret;
- klass = GST_VIDEOFILTER_CLASS(G_OBJECT_GET_CLASS(videofilter));
+ klass = GST_VIDEOFILTER_CLASS (G_OBJECT_GET_CLASS (videofilter));
- g_return_val_if_fail(structure != NULL, NULL);
+ g_return_val_if_fail (structure != NULL, NULL);
if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0) {
guint32 fourcc;
ret = gst_structure_get_fourcc (structure, "format", &fourcc);
- if (!ret) return NULL;
- for(i=0;i<klass->formats->len;i++){
+ if (!ret)
+ return NULL;
+ for (i = 0; i < klass->formats->len; i++) {
guint32 format_fourcc;
- format = g_ptr_array_index(klass->formats,i);
+
+ format = g_ptr_array_index (klass->formats, i);
format_fourcc = GST_STR_FOURCC (format->fourcc);
if (format->depth == 0 && format_fourcc == fourcc) {
- return format;
+ return format;
}
}
} else if (strcmp (gst_structure_get_name (structure), "video/x-raw-rgb")
@@ -495,13 +523,14 @@ GstVideofilterFormat *gst_videofilter_find_format_by_structure (
ret &= gst_structure_get_int (structure, "red_mask", &red_mask);
ret &= gst_structure_get_int (structure, "green_mask", &green_mask);
ret &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
- if (!ret) return NULL;
- for(i=0;i<klass->formats->len;i++){
- format = g_ptr_array_index(klass->formats,i);
+ if (!ret)
+ return NULL;
+ for (i = 0; i < klass->formats->len; i++) {
+ format = g_ptr_array_index (klass->formats, i);
if (format->bpp == bpp && format->depth == depth &&
- format->endianness == endianness && format->red_mask == red_mask &&
- format->green_mask == green_mask && format->blue_mask == blue_mask) {
- return format;
+ format->endianness == endianness && format->red_mask == red_mask &&
+ format->green_mask == green_mask && format->blue_mask == blue_mask) {
+ return format;
}
}
}
@@ -509,39 +538,36 @@ GstVideofilterFormat *gst_videofilter_find_format_by_structure (
return NULL;
}
-void gst_videofilter_class_add_format(GstVideofilterClass *videofilterclass,
- GstVideofilterFormat *format)
+void
+gst_videofilter_class_add_format (GstVideofilterClass * videofilterclass,
+ GstVideofilterFormat * format)
{
- g_ptr_array_add(videofilterclass->formats, format);
+ g_ptr_array_add (videofilterclass->formats, format);
}
-void gst_videofilter_class_add_pad_templates (GstVideofilterClass *videofilter_class)
+void
+gst_videofilter_class_add_pad_templates (GstVideofilterClass *
+ videofilter_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (videofilter_class);
gst_element_class_add_pad_template (element_class,
- gst_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_videofilter_class_get_capslist (videofilter_class)));
+ gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_videofilter_class_get_capslist (videofilter_class)));
gst_element_class_add_pad_template (element_class,
- gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- gst_videofilter_class_get_capslist (videofilter_class)));
+ gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_videofilter_class_get_capslist (videofilter_class)));
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gstvideofilter",
- "Video filter parent class",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstvideofilter",
+ "Video filter parent class",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/videofilter/gstvideofilter.h b/gst/videofilter/gstvideofilter.h
index e6c346c0..2c10a211 100644
--- a/gst/videofilter/gstvideofilter.h
+++ b/gst/videofilter/gstvideofilter.h
@@ -25,18 +25,17 @@
#include <gst/gst.h>
-G_BEGIN_DECLS
-
-typedef struct _GstVideofilter GstVideofilter;
+G_BEGIN_DECLS typedef struct _GstVideofilter GstVideofilter;
typedef struct _GstVideofilterClass GstVideofilterClass;
-typedef void (*GstVideofilterFilterFunc)(GstVideofilter *filter,
+typedef void (*GstVideofilterFilterFunc) (GstVideofilter * filter,
void *out_data, void *in_data);
-typedef void (*GstVideofilterSetupFunc)(GstVideofilter *filter);
+typedef void (*GstVideofilterSetupFunc) (GstVideofilter * filter);
typedef struct _GstVideofilterFormat GstVideofilterFormat;
-struct _GstVideofilterFormat {
+struct _GstVideofilterFormat
+{
char *fourcc;
int bpp;
GstVideofilterFilterFunc filter_func;
@@ -58,10 +57,11 @@ struct _GstVideofilterFormat {
#define GST_IS_VIDEOFILTER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEOFILTER))
-struct _GstVideofilter {
+struct _GstVideofilter
+{
GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
/* video state */
gboolean inited;
@@ -81,28 +81,29 @@ struct _GstVideofilter {
GstBuffer *out_buf;
};
-struct _GstVideofilterClass {
+struct _GstVideofilterClass
+{
GstElementClass parent_class;
GPtrArray *formats;
GstVideofilterSetupFunc setup;
};
-GType gst_videofilter_get_type(void);
+GType gst_videofilter_get_type (void);
-int gst_videofilter_get_input_width(GstVideofilter *videofilter);
-int gst_videofilter_get_input_height(GstVideofilter *videofilter);
-void gst_videofilter_set_output_size(GstVideofilter *videofilter,
+int gst_videofilter_get_input_width (GstVideofilter * videofilter);
+int gst_videofilter_get_input_height (GstVideofilter * videofilter);
+void gst_videofilter_set_output_size (GstVideofilter * videofilter,
int width, int height);
-GstVideofilterFormat *gst_videofilter_find_format_by_structure (GstVideofilter *filter,
- const GstStructure *structure);
-GstCaps *gst_videofilter_class_get_capslist(GstVideofilterClass *videofilterclass);
+GstVideofilterFormat *gst_videofilter_find_format_by_structure (GstVideofilter *
+ filter, const GstStructure * structure);
+GstCaps *gst_videofilter_class_get_capslist (GstVideofilterClass *
+ videofilterclass);
-void gst_videofilter_class_add_format(GstVideofilterClass *videofilterclass,
- GstVideofilterFormat *format);
-void gst_videofilter_class_add_pad_templates (GstVideofilterClass *videofilterclass);
+void gst_videofilter_class_add_format (GstVideofilterClass * videofilterclass,
+ GstVideofilterFormat * format);
+void gst_videofilter_class_add_pad_templates (GstVideofilterClass *
+ videofilterclass);
G_END_DECLS
-
#endif /* __GST_VIDEOFILTER_H__ */
-
diff --git a/gst/videofilter/gstvideoflip.c b/gst/videofilter/gstvideoflip.c
index 3ba70ee8..32157b61 100644
--- a/gst/videofilter/gstvideoflip.c
+++ b/gst/videofilter/gstvideoflip.c
@@ -32,47 +32,54 @@
#include <string.h>
/* GstVideoflip signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_METHOD,
/* FILL ME */
};
-static void gst_videoflip_base_init (gpointer g_class);
-static void gst_videoflip_class_init (gpointer g_class, gpointer class_data);
-static void gst_videoflip_init (GTypeInstance *instance, gpointer g_class);
+static void gst_videoflip_base_init (gpointer g_class);
+static void gst_videoflip_class_init (gpointer g_class, gpointer class_data);
+static void gst_videoflip_init (GTypeInstance * instance, gpointer g_class);
-static void gst_videoflip_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_videoflip_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_videoflip_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_videoflip_planar411(GstVideofilter *videofilter, void *dest, void *src);
-static void gst_videoflip_setup(GstVideofilter *videofilter);
+static void gst_videoflip_planar411 (GstVideofilter * videofilter, void *dest,
+ void *src);
+static void gst_videoflip_setup (GstVideofilter * videofilter);
#define GST_TYPE_VIDEOFLIP_METHOD (gst_videoflip_method_get_type())
static GType
-gst_videoflip_method_get_type(void)
+gst_videoflip_method_get_type (void)
{
static GType videoflip_method_type = 0;
static GEnumValue videoflip_methods[] = {
- { GST_VIDEOFLIP_METHOD_IDENTITY, "0", "Identity (no rotation)" },
- { GST_VIDEOFLIP_METHOD_90R, "1", "Rotate clockwise 90 degrees" },
- { GST_VIDEOFLIP_METHOD_180, "2", "Rotate 180 degrees" },
- { GST_VIDEOFLIP_METHOD_90L, "3", "Rotate counter-clockwise 90 degrees" },
- { GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally" },
- { GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically" },
- { GST_VIDEOFLIP_METHOD_TRANS, "6", "Flip across upper left/lower right diagonal" },
- { GST_VIDEOFLIP_METHOD_OTHER, "7", "Flip across upper right/lower left diagonal" },
- { 0, NULL, NULL },
+ {GST_VIDEOFLIP_METHOD_IDENTITY, "0", "Identity (no rotation)"},
+ {GST_VIDEOFLIP_METHOD_90R, "1", "Rotate clockwise 90 degrees"},
+ {GST_VIDEOFLIP_METHOD_180, "2", "Rotate 180 degrees"},
+ {GST_VIDEOFLIP_METHOD_90L, "3", "Rotate counter-clockwise 90 degrees"},
+ {GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally"},
+ {GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically"},
+ {GST_VIDEOFLIP_METHOD_TRANS, "6",
+ "Flip across upper left/lower right diagonal"},
+ {GST_VIDEOFLIP_METHOD_OTHER, "7",
+ "Flip across upper right/lower left diagonal"},
+ {0, NULL, NULL},
};
- if(!videoflip_method_type){
- videoflip_method_type = g_enum_register_static("GstVideoflipMethod",
- videoflip_methods);
+ if (!videoflip_method_type) {
+ videoflip_method_type = g_enum_register_static ("GstVideoflipMethod",
+ videoflip_methods);
}
return videoflip_method_type;
}
@@ -84,46 +91,45 @@ gst_videoflip_get_type (void)
if (!videoflip_type) {
static const GTypeInfo videoflip_info = {
- sizeof(GstVideoflipClass),
+ sizeof (GstVideoflipClass),
gst_videoflip_base_init,
NULL,
gst_videoflip_class_init,
NULL,
NULL,
- sizeof(GstVideoflip),
+ sizeof (GstVideoflip),
0,
gst_videoflip_init,
};
- videoflip_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
- "GstVideoflip", &videoflip_info, 0);
+ videoflip_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
+ "GstVideoflip", &videoflip_info, 0);
}
return videoflip_type;
}
static GstVideofilterFormat gst_videoflip_formats[] = {
/* planar */
- { "YV12", 12, gst_videoflip_planar411, },
- { "I420", 12, gst_videoflip_planar411, },
- { "IYUV", 12, gst_videoflip_planar411, },
+ {"YV12", 12, gst_videoflip_planar411,},
+ {"I420", 12, gst_videoflip_planar411,},
+ {"IYUV", 12, gst_videoflip_planar411,},
};
static void
gst_videoflip_base_init (gpointer g_class)
{
- static GstElementDetails videoflip_details = GST_ELEMENT_DETAILS (
- "Video Flipper",
- "Filter/Effect/Video",
- "Flips and rotates video",
- "David Schleef <ds@schleef.org>"
- );
+ static GstElementDetails videoflip_details =
+ GST_ELEMENT_DETAILS ("Video Flipper",
+ "Filter/Effect/Video",
+ "Flips and rotates video",
+ "David Schleef <ds@schleef.org>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
int i;
-
+
gst_element_class_set_details (element_class, &videoflip_details);
- for(i=0;i<G_N_ELEMENTS(gst_videoflip_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_videoflip_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_videoflip_formats + i);
}
@@ -139,10 +145,10 @@ gst_videoflip_class_init (gpointer g_class, gpointer class_data)
gobject_class = G_OBJECT_CLASS (g_class);
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
- g_object_class_install_property(gobject_class, ARG_METHOD,
- g_param_spec_enum("method","method","method",
- GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
- G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_METHOD,
+ g_param_spec_enum ("method", "method", "method",
+ GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
+ G_PARAM_READWRITE));
gobject_class->set_property = gst_videoflip_set_property;
gobject_class->get_property = gst_videoflip_get_property;
@@ -151,33 +157,34 @@ gst_videoflip_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_videoflip_init (GTypeInstance *instance, gpointer g_class)
+gst_videoflip_init (GTypeInstance * instance, gpointer g_class)
{
GstVideoflip *videoflip = GST_VIDEOFLIP (instance);
GstVideofilter *videofilter;
- GST_DEBUG("gst_videoflip_init");
+ GST_DEBUG ("gst_videoflip_init");
- videofilter = GST_VIDEOFILTER(videoflip);
+ videofilter = GST_VIDEOFILTER (videoflip);
/* do stuff */
}
static void
-gst_videoflip_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_videoflip_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstVideoflip *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOFLIP(object));
- src = GST_VIDEOFLIP(object);
+ g_return_if_fail (GST_IS_VIDEOFLIP (object));
+ src = GST_VIDEOFLIP (object);
- GST_DEBUG("gst_videoflip_set_property");
+ GST_DEBUG ("gst_videoflip_set_property");
switch (prop_id) {
case ARG_METHOD:
src->method = g_value_get_enum (value);
/* FIXME is this ok? (threading issues) */
- gst_videoflip_setup(GST_VIDEOFILTER(src));
+ gst_videoflip_setup (GST_VIDEOFILTER (src));
break;
default:
break;
@@ -185,13 +192,14 @@ gst_videoflip_set_property (GObject *object, guint prop_id, const GValue *value,
}
static void
-gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_videoflip_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstVideoflip *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOFLIP(object));
- src = GST_VIDEOFLIP(object);
+ g_return_if_fail (GST_IS_VIDEOFLIP (object));
+ src = GST_VIDEOFLIP (object);
switch (prop_id) {
case ARG_METHOD:
@@ -203,87 +211,83 @@ gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GPara
}
}
-static gboolean plugin_init (GstPlugin *plugin)
+static gboolean
+plugin_init (GstPlugin * plugin)
{
- if(!gst_library_load("gstvideofilter"))
+ if (!gst_library_load ("gstvideofilter"))
return FALSE;
return gst_element_register (plugin, "videoflip", GST_RANK_NONE,
GST_TYPE_VIDEOFLIP);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videoflip",
- "Flips and rotates video",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "videoflip",
+ "Flips and rotates video",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
-static void gst_videoflip_flip(GstVideoflip *videoflip, unsigned char *dest,
- unsigned char *src, int sw, int sh, int dw, int dh);
+ static void gst_videoflip_flip (GstVideoflip * videoflip,
+ unsigned char *dest, unsigned char *src, int sw, int sh, int dw, int dh);
-static void gst_videoflip_setup (GstVideofilter *videofilter)
+ static void gst_videoflip_setup (GstVideofilter * videofilter)
{
int from_width, from_height;
GstVideoflip *videoflip;
- GST_DEBUG("gst_videoflip_setup");
+ GST_DEBUG ("gst_videoflip_setup");
- videoflip = GST_VIDEOFLIP(videofilter);
+ videoflip = GST_VIDEOFLIP (videofilter);
- from_width = gst_videofilter_get_input_width(videofilter);
- from_height = gst_videofilter_get_input_height(videofilter);
+ from_width = gst_videofilter_get_input_width (videofilter);
+ from_height = gst_videofilter_get_input_height (videofilter);
- if(from_width==0 || from_height==0){
+ if (from_width == 0 || from_height == 0) {
return;
}
- switch(videoflip->method){
+ switch (videoflip->method) {
case GST_VIDEOFLIP_METHOD_90R:
case GST_VIDEOFLIP_METHOD_90L:
case GST_VIDEOFLIP_METHOD_TRANS:
case GST_VIDEOFLIP_METHOD_OTHER:
- gst_videofilter_set_output_size(videofilter, from_height, from_width);
+ gst_videofilter_set_output_size (videofilter, from_height, from_width);
break;
case GST_VIDEOFLIP_METHOD_IDENTITY:
case GST_VIDEOFLIP_METHOD_180:
case GST_VIDEOFLIP_METHOD_HORIZ:
case GST_VIDEOFLIP_METHOD_VERT:
- gst_videofilter_set_output_size(videofilter, from_width, from_height);
+ gst_videofilter_set_output_size (videofilter, from_width, from_height);
break;
default:
- g_assert_not_reached();
+ g_assert_not_reached ();
break;
}
GST_DEBUG ("format=%p \"%s\" from %dx%d to %dx%d",
- videofilter->format, videofilter->format->fourcc,
- from_width, from_height,
- videofilter->to_width, videofilter->to_height);
+ videofilter->format, videofilter->format->fourcc,
+ from_width, from_height, videofilter->to_width, videofilter->to_height);
- if(videoflip->method == GST_VIDEOFLIP_METHOD_IDENTITY){
+ if (videoflip->method == GST_VIDEOFLIP_METHOD_IDENTITY) {
GST_DEBUG ("videoflip: using passthru");
videofilter->passthru = TRUE;
- }else{
+ } else {
videofilter->passthru = FALSE;
}
- videofilter->from_buf_size = (videofilter->from_width * videofilter->from_height
- * videofilter->format->depth) / 8;
- videofilter->to_buf_size = (videofilter->to_width * videofilter->to_height
- * videofilter->format->depth) / 8;
+ videofilter->from_buf_size =
+ (videofilter->from_width * videofilter->from_height *
+ videofilter->format->depth) / 8;
+ videofilter->to_buf_size =
+ (videofilter->to_width * videofilter->to_height *
+ videofilter->format->depth) / 8;
videofilter->inited = TRUE;
}
-static void gst_videoflip_planar411(GstVideofilter *videofilter,
- void *dest, void *src)
+static void
+gst_videoflip_planar411 (GstVideofilter * videofilter, void *dest, void *src)
{
GstVideoflip *videoflip;
int sw;
@@ -291,8 +295,8 @@ static void gst_videoflip_planar411(GstVideofilter *videofilter,
int dw;
int dh;
- g_return_if_fail(GST_IS_VIDEOFLIP(videofilter));
- videoflip = GST_VIDEOFLIP(videofilter);
+ g_return_if_fail (GST_IS_VIDEOFLIP (videofilter));
+ videoflip = GST_VIDEOFLIP (videofilter);
sw = videofilter->from_width;
sh = videofilter->from_height;
@@ -301,78 +305,78 @@ static void gst_videoflip_planar411(GstVideofilter *videofilter,
GST_DEBUG ("videoflip: scaling planar 4:1:1 %dx%d to %dx%d", sw, sh, dw, dh);
- gst_videoflip_flip(videoflip, dest, src, sw, sh, dw, dh);
+ gst_videoflip_flip (videoflip, dest, src, sw, sh, dw, dh);
- src += sw*sh;
- dest += dw*dh;
+ src += sw * sh;
+ dest += dw * dh;
- dh = dh>>1;
- dw = dw>>1;
- sh = sh>>1;
- sw = sw>>1;
+ dh = dh >> 1;
+ dw = dw >> 1;
+ sh = sh >> 1;
+ sw = sw >> 1;
- gst_videoflip_flip(videoflip, dest, src, sw, sh, dw, dh);
+ gst_videoflip_flip (videoflip, dest, src, sw, sh, dw, dh);
- src += sw*sh;
- dest += dw*dh;
+ src += sw * sh;
+ dest += dw * dh;
- gst_videoflip_flip(videoflip, dest, src, sw, sh, dw, dh);
+ gst_videoflip_flip (videoflip, dest, src, sw, sh, dw, dh);
}
static void
-gst_videoflip_flip(GstVideoflip *videoflip, unsigned char *dest,
+gst_videoflip_flip (GstVideoflip * videoflip, unsigned char *dest,
unsigned char *src, int sw, int sh, int dw, int dh)
{
- int x,y;
+ int x, y;
- switch(videoflip->method){
+ switch (videoflip->method) {
case GST_VIDEOFLIP_METHOD_90R:
- for(y=0;y<dh;y++){
- for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - x)*sw + y];
- }
+ for (y = 0; y < dh; y++) {
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - x) * sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_90L:
- for(y=0;y<dh;y++){
- for(x=0;x<dw;x++){
- dest[y*dw + x] = src[x*sw + (sw - 1 - y)];
- }
+ for (y = 0; y < dh; y++) {
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[x * sw + (sw - 1 - y)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_180:
- for(y=0;y<dh;y++){
- for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - y)*sw + (sw - 1 - x)];
- }
+ for (y = 0; y < dh; y++) {
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_HORIZ:
- for(y=0;y<dh;y++){
- for(x=0;x<dw;x++){
- dest[y*dw + x] = src[y*sw + (sw - 1 - x)];
- }
+ for (y = 0; y < dh; y++) {
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[y * sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_VERT:
- for(y=0;y<dh;y++){
- for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - y)*sw + x];
- }
+ for (y = 0; y < dh; y++) {
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - y) * sw + x];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_TRANS:
- for(y=0;y<dh;y++){
- for(x=0;x<dw;x++){
- dest[y*dw + x] = src[x*sw + y];
- }
+ for (y = 0; y < dh; y++) {
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[x * sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_OTHER:
- for(y=0;y<dh;y++){
- for(x=0;x<dw;x++){
- dest[y*dw + x] = src[(sh - 1 - x)*sw + (sw - 1 - y)];
- }
+ for (y = 0; y < dh; y++) {
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)];
+ }
}
break;
default:
@@ -380,5 +384,3 @@ gst_videoflip_flip(GstVideoflip *videoflip, unsigned char *dest,
break;
}
}
-
-
diff --git a/gst/videofilter/gstvideoflip.h b/gst/videofilter/gstvideoflip.h
index 83b37718..a43d2b4c 100644
--- a/gst/videofilter/gstvideoflip.h
+++ b/gst/videofilter/gstvideoflip.h
@@ -27,9 +27,8 @@
#include "gstvideofilter.h"
-G_BEGIN_DECLS
-
-typedef enum {
+G_BEGIN_DECLS typedef enum
+{
GST_VIDEOFLIP_METHOD_IDENTITY,
GST_VIDEOFLIP_METHOD_90R,
GST_VIDEOFLIP_METHOD_180,
@@ -54,19 +53,19 @@ typedef enum {
typedef struct _GstVideoflip GstVideoflip;
typedef struct _GstVideoflipClass GstVideoflipClass;
-struct _GstVideoflip {
+struct _GstVideoflip
+{
GstVideofilter videofilter;
GstVideoflipMethod method;
};
-struct _GstVideoflipClass {
+struct _GstVideoflipClass
+{
GstVideofilterClass parent_class;
};
-GType gst_videoflip_get_type(void);
+GType gst_videoflip_get_type (void);
G_END_DECLS
-
#endif /* __GST_VIDEOFLIP_H__ */
-
diff --git a/gst/videofilter/gstvideotemplate.c b/gst/videofilter/gstvideotemplate.c
index d4424774..abe699fe 100644
--- a/gst/videofilter/gstvideotemplate.c
+++ b/gst/videofilter/gstvideotemplate.c
@@ -47,36 +47,44 @@
typedef struct _GstVideotemplate GstVideotemplate;
typedef struct _GstVideotemplateClass GstVideotemplateClass;
-struct _GstVideotemplate {
+struct _GstVideotemplate
+{
GstVideofilter videofilter;
};
-struct _GstVideotemplateClass {
+struct _GstVideotemplateClass
+{
GstVideofilterClass parent_class;
};
/* GstVideotemplate signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static void gst_videotemplate_base_init (gpointer g_class);
-static void gst_videotemplate_class_init (gpointer g_class, gpointer class_data);
-static void gst_videotemplate_init (GTypeInstance *instance, gpointer g_class);
+static void gst_videotemplate_base_init (gpointer g_class);
+static void gst_videotemplate_class_init (gpointer g_class,
+ gpointer class_data);
+static void gst_videotemplate_init (GTypeInstance * instance, gpointer g_class);
-static void gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_videotemplate_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_videotemplate_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_videotemplate_planar411(GstVideofilter *videofilter, void *dest, void *src);
-static void gst_videotemplate_setup(GstVideofilter *videofilter);
+static void gst_videotemplate_planar411 (GstVideofilter * videofilter,
+ void *dest, void *src);
+static void gst_videotemplate_setup (GstVideofilter * videofilter);
GType
gst_videotemplate_get_type (void)
@@ -85,44 +93,43 @@ gst_videotemplate_get_type (void)
if (!videotemplate_type) {
static const GTypeInfo videotemplate_info = {
- sizeof(GstVideotemplateClass),
+ sizeof (GstVideotemplateClass),
gst_videotemplate_base_init,
NULL,
gst_videotemplate_class_init,
NULL,
NULL,
- sizeof(GstVideotemplate),
+ sizeof (GstVideotemplate),
0,
gst_videotemplate_init,
};
- videotemplate_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
- "GstVideotemplate", &videotemplate_info, 0);
+ videotemplate_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
+ "GstVideotemplate", &videotemplate_info, 0);
}
return videotemplate_type;
}
static GstVideofilterFormat gst_videotemplate_formats[] = {
- { "I420", 12, gst_videotemplate_planar411, },
+ {"I420", 12, gst_videotemplate_planar411,},
};
-
+
static void
gst_videotemplate_base_init (gpointer g_class)
{
- static GstElementDetails videotemplate_details = GST_ELEMENT_DETAILS (
- "Video Filter Template",
- "Filter/Effect/Video",
- "Template for a video filter",
- "David Schleef <ds@schleef.org>"
- );
+ static GstElementDetails videotemplate_details =
+ GST_ELEMENT_DETAILS ("Video Filter Template",
+ "Filter/Effect/Video",
+ "Template for a video filter",
+ "David Schleef <ds@schleef.org>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
int i;
-
+
gst_element_class_set_details (element_class, &videotemplate_details);
- for(i=0;i<G_N_ELEMENTS(gst_videotemplate_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_videotemplate_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_videotemplate_formats + i);
}
@@ -139,10 +146,10 @@ gst_videotemplate_class_init (gpointer g_class, gpointer class_data)
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
#if 0
- g_object_class_install_property(gobject_class, ARG_METHOD,
- g_param_spec_enum("method","method","method",
- GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
- G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_METHOD,
+ g_param_spec_enum ("method", "method", "method",
+ GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
+ G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_videotemplate_set_property;
@@ -152,28 +159,29 @@ gst_videotemplate_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_videotemplate_init (GTypeInstance *instance, gpointer g_class)
+gst_videotemplate_init (GTypeInstance * instance, gpointer g_class)
{
GstVideotemplate *videotemplate = GST_VIDEOTEMPLATE (instance);
GstVideofilter *videofilter;
- GST_DEBUG("gst_videotemplate_init");
+ GST_DEBUG ("gst_videotemplate_init");
- videofilter = GST_VIDEOFILTER(videotemplate);
+ videofilter = GST_VIDEOFILTER (videotemplate);
/* do stuff */
}
static void
-gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_videotemplate_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstVideotemplate *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
- src = GST_VIDEOTEMPLATE(object);
+ g_return_if_fail (GST_IS_VIDEOTEMPLATE (object));
+ src = GST_VIDEOTEMPLATE (object);
- GST_DEBUG("gst_videotemplate_set_property");
+ GST_DEBUG ("gst_videotemplate_set_property");
switch (prop_id) {
#if 0
case ARG_METHOD:
@@ -186,13 +194,14 @@ gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *va
}
static void
-gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_videotemplate_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstVideotemplate *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
- src = GST_VIDEOTEMPLATE(object);
+ g_return_if_fail (GST_IS_VIDEOTEMPLATE (object));
+ src = GST_VIDEOTEMPLATE (object);
switch (prop_id) {
#if 0
@@ -206,50 +215,45 @@ gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, G
}
}
-static gboolean plugin_init (GstPlugin *plugin)
+static gboolean
+plugin_init (GstPlugin * plugin)
{
- if(!gst_library_load("gstvideofilter"))
+ if (!gst_library_load ("gstvideofilter"))
return FALSE;
return gst_element_register (plugin, "videotemplate", GST_RANK_NONE,
GST_TYPE_VIDEOTEMPLATE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videotemplate",
- "Template for a video filter",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
-
-static void gst_videotemplate_setup(GstVideofilter *videofilter)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "videotemplate",
+ "Template for a video filter",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
+
+ static void gst_videotemplate_setup (GstVideofilter * videofilter)
{
GstVideotemplate *videotemplate;
- g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
- videotemplate = GST_VIDEOTEMPLATE(videofilter);
+ g_return_if_fail (GST_IS_VIDEOTEMPLATE (videofilter));
+ videotemplate = GST_VIDEOTEMPLATE (videofilter);
/* if any setup needs to be done, do it here */
}
-static void gst_videotemplate_planar411(GstVideofilter *videofilter,
+static void
+gst_videotemplate_planar411 (GstVideofilter * videofilter,
void *dest, void *src)
{
GstVideotemplate *videotemplate;
- int width = gst_videofilter_get_input_width(videofilter);
- int height = gst_videofilter_get_input_height(videofilter);
+ int width = gst_videofilter_get_input_width (videofilter);
+ int height = gst_videofilter_get_input_height (videofilter);
- g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
- videotemplate = GST_VIDEOTEMPLATE(videofilter);
+ g_return_if_fail (GST_IS_VIDEOTEMPLATE (videofilter));
+ videotemplate = GST_VIDEOTEMPLATE (videofilter);
/* do something interesting here. This simply copies the source
* to the destination. */
- memcpy(dest,src,width * height + (width/2) * (height/2) * 2);
+ memcpy (dest, src, width * height + (width / 2) * (height / 2) * 2);
}
-