summaryrefslogtreecommitdiffstats
path: root/gst/effectv
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/effectv
parent1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff)
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/effectv')
-rw-r--r--gst/effectv/gstaging.c155
-rw-r--r--gst/effectv/gstdice.c222
-rw-r--r--gst/effectv/gstedge.c72
-rw-r--r--gst/effectv/gsteffectv.c62
-rw-r--r--gst/effectv/gstquark.c153
-rw-r--r--gst/effectv/gstrev.c83
-rw-r--r--gst/effectv/gstshagadelic.c114
-rw-r--r--gst/effectv/gstvertigo.c147
-rw-r--r--gst/effectv/gstwarp.c199
9 files changed, 637 insertions, 570 deletions
diff --git a/gst/effectv/gstaging.c b/gst/effectv/gstaging.c
index b6739f42..44683546 100644
--- a/gst/effectv/gstaging.c
+++ b/gst/effectv/gstaging.c
@@ -62,13 +62,14 @@ typedef struct _scratch
gint init;
} scratch;
-static int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1};
-static int dy[8] = { 0, -1, -1, -1, 0, 1, 1, 1};
+static int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
+static int dy[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
typedef struct _GstAgingTV GstAgingTV;
typedef struct _GstAgingTVClass GstAgingTVClass;
-struct _GstAgingTV {
+struct _GstAgingTV
+{
GstVideofilter videofilter;
gint width, height;
@@ -82,29 +83,34 @@ struct _GstAgingTV {
};
-struct _GstAgingTVClass {
+struct _GstAgingTVClass
+{
GstVideofilterClass parent_class;
};
/* GstAgingTV signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static void gst_agingtv_base_init (gpointer g_class);
-static void gst_agingtv_class_init (gpointer g_class, gpointer class_data);
-static void gst_agingtv_init (GTypeInstance *instance, gpointer g_class);
-static void gst_agingtv_setup (GstVideofilter *videofilter);
+static void gst_agingtv_base_init (gpointer g_class);
+static void gst_agingtv_class_init (gpointer g_class, gpointer class_data);
+static void gst_agingtv_init (GTypeInstance * instance, gpointer g_class);
+static void gst_agingtv_setup (GstVideofilter * videofilter);
-static void gst_agingtv_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_agingtv_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void gst_agingtv_rgb32 (GstVideofilter *videofilter, void *d, void *s);
+static void gst_agingtv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_agingtv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void gst_agingtv_rgb32 (GstVideofilter * videofilter, void *d, void *s);
GType
gst_agingtv_get_type (void)
@@ -113,43 +119,42 @@ gst_agingtv_get_type (void)
if (!agingtv_type) {
static const GTypeInfo agingtv_info = {
- sizeof(GstAgingTVClass),
+ sizeof (GstAgingTVClass),
gst_agingtv_base_init,
NULL,
gst_agingtv_class_init,
NULL,
NULL,
- sizeof(GstAgingTV),
+ sizeof (GstAgingTV),
0,
gst_agingtv_init,
};
- agingtv_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
- "GstAgingTV", &agingtv_info, 0);
+ agingtv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
+ "GstAgingTV", &agingtv_info, 0);
}
return agingtv_type;
}
static GstVideofilterFormat gst_agingtv_formats[] = {
- { "RGB ", 32, gst_agingtv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 }
+ {"RGB ", 32, gst_agingtv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000}
};
-
+
static void
gst_agingtv_base_init (gpointer g_class)
{
- static GstElementDetails agingtv_details = GST_ELEMENT_DETAILS (
- "AgingTV",
- "Filter/Effect/Video",
- "AgingTV adds age to video input using scratches and dust",
- "Sam Lantinga <slouken@devolution.com>"
- );
+ static GstElementDetails agingtv_details = GST_ELEMENT_DETAILS ("AgingTV",
+ "Filter/Effect/Video",
+ "AgingTV adds age to video input using scratches and dust",
+ "Sam Lantinga <slouken@devolution.com>");
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, &agingtv_details);
- for(i=0;i<G_N_ELEMENTS(gst_agingtv_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_agingtv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_agingtv_formats + i);
}
@@ -166,10 +171,9 @@ gst_agingtv_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_AGINGTV_METHOD, GST_AGINGTV_METHOD_1,
- G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_METHOD,
+ g_param_spec_enum ("method", "method", "method",
+ GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_agingtv_set_property;
@@ -179,26 +183,27 @@ gst_agingtv_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_agingtv_init (GTypeInstance *instance, gpointer g_class)
+gst_agingtv_init (GTypeInstance * instance, gpointer g_class)
{
GstAgingTV *agingtv = GST_AGINGTV (instance);
GstVideofilter *videofilter;
- GST_DEBUG("gst_agingtv_init");
+ GST_DEBUG ("gst_agingtv_init");
- videofilter = GST_VIDEOFILTER(agingtv);
+ videofilter = GST_VIDEOFILTER (agingtv);
/* do stuff */
}
-static void gst_agingtv_setup(GstVideofilter *videofilter)
+static void
+gst_agingtv_setup (GstVideofilter * videofilter)
{
GstAgingTV *agingtv;
- 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_AGINGTV(videofilter));
- agingtv = GST_AGINGTV(videofilter);
+ g_return_if_fail (GST_IS_AGINGTV (videofilter));
+ agingtv = GST_AGINGTV (videofilter);
/* if any setup needs to be done, do it here */
@@ -206,7 +211,7 @@ static void gst_agingtv_setup(GstVideofilter *videofilter)
agingtv->height = height;
}
-static unsigned int
+static unsigned int
fastrand (void)
{
static unsigned int fastrand_val;
@@ -215,8 +220,8 @@ fastrand (void)
}
-static void
-coloraging (guint32 *src, guint32 *dest, gint video_area)
+static void
+coloraging (guint32 * src, guint32 * dest, gint video_area)
{
guint32 a, b;
gint i;
@@ -229,8 +234,9 @@ coloraging (guint32 *src, guint32 *dest, gint video_area)
}
-static void
-scratching (scratch *scratches, gint scratch_lines, guint32 *dest, gint width, gint height)
+static void
+scratching (scratch * scratches, gint scratch_lines, guint32 * dest, gint width,
+ gint height)
{
gint i, y, y1, y2;
guint32 *p, a, b;
@@ -241,7 +247,7 @@ scratching (scratch *scratches, gint scratch_lines, guint32 *dest, gint width, g
if (scratch->life) {
scratch->x = scratch->x + scratch->dx;
-
+
if (scratch->x < 0 || scratch->x > width * 256) {
scratch->life = 0;
break;
@@ -277,8 +283,9 @@ scratching (scratch *scratches, gint scratch_lines, guint32 *dest, gint width, g
}
}
-static void
-dusts (guint32 *dest, gint width, gint height, gint dust_interval, gint area_scale)
+static void
+dusts (guint32 * dest, gint width, gint height, gint dust_interval,
+ gint area_scale)
{
int i, j;
int dnum;
@@ -291,8 +298,8 @@ dusts (guint32 *dest, gint width, gint height, gint dust_interval, gint area_sca
}
return;
}
- dnum = area_scale * 4 + (fastrand() >> 27);
-
+ dnum = area_scale * 4 + (fastrand () >> 27);
+
for (i = 0; i < dnum; i++) {
x = fastrand () % width;
y = fastrand () % height;
@@ -303,7 +310,8 @@ dusts (guint32 *dest, gint width, gint height, gint dust_interval, gint area_sca
y += dy[d];
x += dx[d];
- if (y >= height || x >= width) break;
+ if (y >= height || x >= width)
+ break;
d = (d + fastrand () % 3 - 1) & 7;
}
@@ -311,8 +319,9 @@ dusts (guint32 *dest, gint width, gint height, gint dust_interval, gint area_sca
dust_interval--;
}
-static void
-pits (guint32 *dest, gint width, gint height, gint area_scale, gint pits_interval)
+static void
+pits (guint32 * dest, gint width, gint height, gint area_scale,
+ gint pits_interval)
{
int i, j;
int pnum, size, pnumscale;
@@ -340,46 +349,50 @@ pits (guint32 *dest, gint width, gint height, gint area_scale, gint pits_interva
x = x + fastrand () % 3 - 1;
y = y + fastrand () % 3 - 1;
- if (y >= height || x >= width) break;
+ if (y >= height || x >= width)
+ break;
dest[y * width + x] = 0xc0c0c0;
}
}
}
-static void
-gst_agingtv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
+static void
+gst_agingtv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
{
GstAgingTV *agingtv;
- 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);
int video_size = width * height;
guint32 *src = s;
guint32 *dest = d;
gint area_scale = width * height / 64 / 480;
- if (area_scale <= 0) area_scale = 1;
- g_return_if_fail(GST_IS_AGINGTV(videofilter));
- agingtv = GST_AGINGTV(videofilter);
+ if (area_scale <= 0)
+ area_scale = 1;
+
+ g_return_if_fail (GST_IS_AGINGTV (videofilter));
+ agingtv = GST_AGINGTV (videofilter);
coloraging (src, dest, video_size);
scratching (agingtv->scratches, agingtv->scratch_lines, dest, width, height);
pits (dest, width, height, area_scale, agingtv->pits_interval);
- if(area_scale > 1)
+ if (area_scale > 1)
dusts (dest, width, height, agingtv->dust_interval, area_scale);
-
+
}
static void
-gst_agingtv_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_agingtv_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstAgingTV *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_AGINGTV(object));
- src = GST_AGINGTV(object);
+ g_return_if_fail (GST_IS_AGINGTV (object));
+ src = GST_AGINGTV (object);
- GST_DEBUG("gst_agingtv_set_property");
+ GST_DEBUG ("gst_agingtv_set_property");
switch (prop_id) {
#if 0
case ARG_METHOD:
@@ -392,13 +405,14 @@ gst_agingtv_set_property (GObject *object, guint prop_id, const GValue *value, G
}
static void
-gst_agingtv_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_agingtv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstAgingTV *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_AGINGTV(object));
- src = GST_AGINGTV(object);
+ g_return_if_fail (GST_IS_AGINGTV (object));
+ src = GST_AGINGTV (object);
switch (prop_id) {
#if 0
@@ -411,4 +425,3 @@ gst_agingtv_get_property (GObject *object, guint prop_id, GValue *value, GParamS
break;
}
}
-
diff --git a/gst/effectv/gstdice.c b/gst/effectv/gstdice.c
index ba2d1d6c..a7cbbc36 100644
--- a/gst/effectv/gstdice.c
+++ b/gst/effectv/gstdice.c
@@ -35,12 +35,12 @@ typedef struct _GstDiceTVClass GstDiceTVClass;
#define MAX_CUBE_BITS 5
#define MIN_CUBE_BITS 0
-typedef enum _dice_dir
+typedef enum _dice_dir
{
- DICE_UP = 0,
- DICE_RIGHT = 1,
- DICE_DOWN = 2,
- DICE_LEFT = 3
+ DICE_UP = 0,
+ DICE_RIGHT = 1,
+ DICE_DOWN = 2,
+ DICE_LEFT = 3
} DiceDir;
struct _GstDiceTV
@@ -48,7 +48,7 @@ struct _GstDiceTV
GstVideofilter videofilter;
gint width, height;
- gchar* dicemap;
+ gchar *dicemap;
gint g_cube_bits;
gint g_cube_size;
@@ -60,7 +60,7 @@ struct _GstDiceTVClass
{
GstVideofilterClass parent_class;
- void (*reset) (GstElement *element);
+ void (*reset) (GstElement * element);
};
/* Filter signals and args */
@@ -77,29 +77,30 @@ enum
ARG_CUBE_BITS,
};
-static void gst_dicetv_base_init (gpointer g_class);
-static void gst_dicetv_class_init (gpointer g_class, gpointer class_data);
-static void gst_dicetv_init (GTypeInstance *instance, gpointer g_class);
+static void gst_dicetv_base_init (gpointer g_class);
+static void gst_dicetv_class_init (gpointer g_class, gpointer class_data);
+static void gst_dicetv_init (GTypeInstance * instance, gpointer g_class);
-static void gst_dicetv_reset_handler (GstElement *elem);
-static void gst_dicetv_create_map (GstDiceTV *filter);
+static void gst_dicetv_reset_handler (GstElement * elem);
+static void gst_dicetv_create_map (GstDiceTV * filter);
-static void gst_dicetv_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_dicetv_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_dicetv_setup (GstVideofilter *videofilter);
-static void gst_dicetv_draw (GstVideofilter *videofilter, void *d, void *s);
+static void gst_dicetv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_dicetv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void gst_dicetv_setup (GstVideofilter * videofilter);
+static void gst_dicetv_draw (GstVideofilter * videofilter, void *d, void *s);
static guint gst_dicetv_signals[LAST_SIGNAL] = { 0 };
-GType gst_dicetv_get_type (void)
+GType
+gst_dicetv_get_type (void)
{
static GType dicetv_type = 0;
if (!dicetv_type) {
static const GTypeInfo dicetv_info = {
- sizeof (GstDiceTVClass),
+ sizeof (GstDiceTVClass),
gst_dicetv_base_init,
NULL,
(GClassInitFunc) gst_dicetv_class_init,
@@ -110,37 +111,41 @@ GType gst_dicetv_get_type (void)
(GInstanceInitFunc) gst_dicetv_init,
};
- dicetv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info, 0);
+ dicetv_type =
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info,
+ 0);
}
return dicetv_type;
}
static GstVideofilterFormat gst_dicetv_formats[] = {
- { "RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0x00ff0000, 0x0000ff00, 0x000000ff },
- { "RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0xff000000, 0x00ff0000, 0x0000ff00 },
- { "RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0x000000ff, 0x0000ff00, 0x00ff0000 },
- { "RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 },
+ {"RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0x00ff0000, 0x0000ff00,
+ 0x000000ff},
+ {"RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0xff000000, 0x00ff0000,
+ 0x0000ff00},
+ {"RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0x000000ff, 0x0000ff00,
+ 0x00ff0000},
+ {"RGB ", 32, gst_dicetv_draw, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000},
};
static void
gst_dicetv_base_init (gpointer g_class)
{
/* elementfactory information */
- static GstElementDetails gst_dicetv_details = GST_ELEMENT_DETAILS (
- "DiceTV",
- "Filter/Effect/Video",
- "'Dices' the screen up into many small squares",
- "Wim Taymans <wim.taymans@chello.be>"
- );
+ static GstElementDetails gst_dicetv_details = GST_ELEMENT_DETAILS ("DiceTV",
+ "Filter/Effect/Video",
+ "'Dices' the screen up into many small squares",
+ "Wim Taymans <wim.taymans@chello.be>");
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, &gst_dicetv_details);
- for(i=0; i < G_N_ELEMENTS(gst_dicetv_formats); i++) {
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_dicetv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_dicetv_formats + i);
}
@@ -159,19 +164,17 @@ gst_dicetv_class_init (gpointer g_class, gpointer class_data)
dicetv_class = GST_DICETV_CLASS (g_class);
gst_dicetv_signals[RESET_SIGNAL] =
- g_signal_new ("reset",
- G_TYPE_FROM_CLASS (g_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstDiceTVClass, reset),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new ("reset",
+ G_TYPE_FROM_CLASS (g_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstDiceTVClass, reset),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
dicetv_class->reset = gst_dicetv_reset_handler;
-
+
g_object_class_install_property (gobject_class, ARG_CUBE_BITS,
- g_param_spec_int ("square_bits","Square Bits","The size of the Squares",
- MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE));
+ g_param_spec_int ("square_bits", "Square Bits", "The size of the Squares",
+ MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE));
gobject_class->set_property = gst_dicetv_set_property;
gobject_class->get_property = gst_dicetv_get_property;
@@ -180,7 +183,7 @@ gst_dicetv_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_dicetv_setup (GstVideofilter *videofilter)
+gst_dicetv_setup (GstVideofilter * videofilter)
{
GstDiceTV *dicetv;
@@ -191,12 +194,13 @@ gst_dicetv_setup (GstVideofilter *videofilter)
dicetv->height = gst_videofilter_get_input_height (videofilter);
g_free (dicetv->dicemap);
- dicetv->dicemap = (gchar *) g_malloc (dicetv->height * dicetv->width * sizeof(char));
+ dicetv->dicemap =
+ (gchar *) g_malloc (dicetv->height * dicetv->width * sizeof (char));
gst_dicetv_create_map (dicetv);
}
static void
-gst_dicetv_init (GTypeInstance *instance, gpointer g_class)
+gst_dicetv_init (GTypeInstance * instance, gpointer g_class)
{
GstDiceTV *filter = GST_DICETV (instance);
@@ -208,7 +212,7 @@ gst_dicetv_init (GTypeInstance *instance, gpointer g_class)
}
static void
-gst_dicetv_reset_handler (GstElement *element)
+gst_dicetv_reset_handler (GstElement * element)
{
GstDiceTV *filter = GST_DICETV (element);
@@ -217,14 +221,14 @@ gst_dicetv_reset_handler (GstElement *element)
static unsigned int
fastrand (void)
-{
+{
static unsigned int fastrand_val;
return (fastrand_val = fastrand_val * 1103515245 + 12345);
}
-static void
-gst_dicetv_draw (GstVideofilter *videofilter, void *d, void *s)
+static void
+gst_dicetv_draw (GstVideofilter * videofilter, void *d, void *s)
{
GstDiceTV *filter;
guint32 *src;
@@ -236,10 +240,10 @@ gst_dicetv_draw (GstVideofilter *videofilter, void *d, void *s)
gint video_width = filter->width;
gint g_cube_bits = filter->g_cube_bits;
gint g_cube_size = filter->g_cube_size;
-
+
filter = GST_DICETV (videofilter);
- src = (guint32 *)s;
- dest = (guint32 *)d;
+ src = (guint32 *) s;
+ dest = (guint32 *) d;
video_width = filter->width;
g_cube_bits = filter->g_cube_bits;
@@ -248,64 +252,64 @@ gst_dicetv_draw (GstVideofilter *videofilter, void *d, void *s)
map_i = 0;
for (map_y = 0; map_y < filter->g_map_height; map_y++) {
for (map_x = 0; map_x < filter->g_map_width; map_x++) {
- base = (map_y << g_cube_bits) * video_width + (map_x << g_cube_bits);
-
- switch (filter->dicemap[map_i]) {
- case DICE_UP:
- for (dy = 0; dy < g_cube_size; dy++) {
- i = base + dy * video_width;
- for (dx = 0; dx < g_cube_size; dx++) {
- dest[i] = src[i];
- i++;
- }
- }
- break;
- case DICE_LEFT:
- for (dy = 0; dy < g_cube_size; dy++) {
- i = base + dy * video_width;
-
- for (dx = 0; dx < g_cube_size; dx++) {
- di = base + (dx * video_width) + (g_cube_size - dy - 1);
- dest[di] = src[i];
- i++;
- }
- }
- break;
- case DICE_DOWN:
- for (dy = 0; dy < g_cube_size; dy++) {
- di = base + dy * video_width;
- i = base + (g_cube_size - dy - 1) * video_width + g_cube_size;
- for (dx = 0; dx < g_cube_size; dx++) {
- i--;
- dest[di] = src[i];
- di++;
- }
- }
- break;
- case DICE_RIGHT:
- for (dy = 0; dy < g_cube_size; dy++) {
- i = base + (dy * video_width);
- for (dx = 0; dx < g_cube_size; dx++) {
- di = base + dy + (g_cube_size - dx - 1) * video_width;
- dest[di] = src[i];
- i++;
- }
- }
- break;
- default:
- g_assert_not_reached ();
- break;
+ base = (map_y << g_cube_bits) * video_width + (map_x << g_cube_bits);
+
+ switch (filter->dicemap[map_i]) {
+ case DICE_UP:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ i = base + dy * video_width;
+ for (dx = 0; dx < g_cube_size; dx++) {
+ dest[i] = src[i];
+ i++;
+ }
+ }
+ break;
+ case DICE_LEFT:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ i = base + dy * video_width;
+
+ for (dx = 0; dx < g_cube_size; dx++) {
+ di = base + (dx * video_width) + (g_cube_size - dy - 1);
+ dest[di] = src[i];
+ i++;
+ }
+ }
+ break;
+ case DICE_DOWN:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ di = base + dy * video_width;
+ i = base + (g_cube_size - dy - 1) * video_width + g_cube_size;
+ for (dx = 0; dx < g_cube_size; dx++) {
+ i--;
+ dest[di] = src[i];
+ di++;
+ }
+ }
+ break;
+ case DICE_RIGHT:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ i = base + (dy * video_width);
+ for (dx = 0; dx < g_cube_size; dx++) {
+ di = base + dy + (g_cube_size - dx - 1) * video_width;
+ dest[di] = src[i];
+ i++;
+ }
+ }
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
}
map_i++;
}
}
}
-static void
-gst_dicetv_create_map (GstDiceTV *filter)
+static void
+gst_dicetv_create_map (GstDiceTV * filter)
{
gint x, y, i;
-
+
filter->g_map_height = filter->height >> filter->g_cube_bits;
filter->g_map_width = filter->width >> filter->g_cube_bits;
filter->g_cube_size = 1 << filter->g_cube_bits;
@@ -313,16 +317,17 @@ gst_dicetv_create_map (GstDiceTV *filter)
i = 0;
for (y = 0; y < filter->g_map_height; y++) {
- for(x = 0; x < filter->g_map_width; x++) {
+ for (x = 0; x < filter->g_map_width; x++) {
// dicemap[i] = ((i + y) & 0x3); /* Up, Down, Left or Right */
- filter->dicemap[i] = (fastrand() >> 24) & 0x03;
+ filter->dicemap[i] = (fastrand () >> 24) & 0x03;
i++;
}
}
}
static void
-gst_dicetv_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_dicetv_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstDiceTV *filter;
@@ -341,7 +346,8 @@ gst_dicetv_set_property (GObject * object, guint prop_id, const GValue * value,
}
static void
-gst_dicetv_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_dicetv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstDiceTV *filter;
diff --git a/gst/effectv/gstedge.c b/gst/effectv/gstedge.c
index 26bf2696..1e9002bf 100644
--- a/gst/effectv/gstedge.c
+++ b/gst/effectv/gstedge.c
@@ -69,27 +69,28 @@ enum
ARG_0,
};
-static void gst_edgetv_base_init (gpointer g_class);
-static void gst_edgetv_class_init (gpointer g_class, gpointer class_data);
-static void gst_edgetv_init (GTypeInstance *instance, gpointer g_class);
+static void gst_edgetv_base_init (gpointer g_class);
+static void gst_edgetv_class_init (gpointer g_class, gpointer class_data);
+static void gst_edgetv_init (GTypeInstance * instance, gpointer g_class);
-static void gst_edgetv_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_edgetv_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
+static void gst_edgetv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_edgetv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_edgetv_setup (GstVideofilter *videofilter);
-static void gst_edgetv_rgb32 (GstVideofilter *videofilter, void *d, void *s);
+static void gst_edgetv_setup (GstVideofilter * videofilter);
+static void gst_edgetv_rgb32 (GstVideofilter * videofilter, void *d, void *s);
/*static guint gst_edgetv_signals[LAST_SIGNAL] = { 0 }; */
-GType gst_edgetv_get_type (void)
+GType
+gst_edgetv_get_type (void)
{
static GType edgetv_type = 0;
if (!edgetv_type) {
static const GTypeInfo edgetv_info = {
- sizeof (GstEdgeTVClass),
+ sizeof (GstEdgeTVClass),
gst_edgetv_base_init,
NULL,
(GClassInitFunc) gst_edgetv_class_init,
@@ -100,34 +101,35 @@ GType gst_edgetv_get_type (void)
(GInstanceInitFunc) gst_edgetv_init,
};
- edgetv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info, 0);
+ edgetv_type =
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info,
+ 0);
}
return edgetv_type;
}
static GstVideofilterFormat gst_edgetv_formats[] = {
- { "RGB ", 32, gst_edgetv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 }
+ {"RGB ", 32, gst_edgetv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000}
};
static void
gst_edgetv_base_init (gpointer g_class)
{
/* elementfactory information */
- static GstElementDetails gst_edgetv_details = GST_ELEMENT_DETAILS (
- "EdgeTV",
- "Filter/Effect/Video",
- "Apply edge detect on video",
- "Wim Taymans <wim.taymans@chello.be>"
- );
+ static GstElementDetails gst_edgetv_details = GST_ELEMENT_DETAILS ("EdgeTV",
+ "Filter/Effect/Video",
+ "Apply edge detect on video",
+ "Wim Taymans <wim.taymans@chello.be>");
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, &gst_edgetv_details);
- for(i=0; i < G_N_ELEMENTS(gst_edgetv_formats); i++) {
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_edgetv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_edgetv_formats + i);
}
@@ -150,14 +152,15 @@ gst_edgetv_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_edgetv_init (GTypeInstance *instance, gpointer g_class)
+gst_edgetv_init (GTypeInstance * instance, gpointer g_class)
{
GstEdgeTV *edgetv = GST_EDGETV (instance);
edgetv->map = NULL;
}
-static void gst_edgetv_setup(GstVideofilter *videofilter)
+static void
+gst_edgetv_setup (GstVideofilter * videofilter)
{
GstEdgeTV *edgetv;
int width = gst_videofilter_get_input_width (videofilter);
@@ -173,12 +176,15 @@ static void gst_edgetv_setup(GstVideofilter *videofilter)
edgetv->video_width_margin = width % 4;
g_free (edgetv->map);
- edgetv->map = (guint32 *)g_malloc (edgetv->map_width * edgetv->map_height * sizeof (guint32) * 2);
- memset(edgetv->map, 0, edgetv->map_width * edgetv->map_height * sizeof (guint32) * 2);
+ edgetv->map =
+ (guint32 *) g_malloc (edgetv->map_width * edgetv->map_height *
+ sizeof (guint32) * 2);
+ memset (edgetv->map, 0,
+ edgetv->map_width * edgetv->map_height * sizeof (guint32) * 2);
}
-static void
-gst_edgetv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
+static void
+gst_edgetv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
{
GstEdgeTV *filter;
int x, y;
@@ -191,10 +197,10 @@ gst_edgetv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
src = (guint32 *) s;
dest = (guint32 *) d;
-
+
src += filter->width * 4 + 4;
dest += filter->width * 4 + 4;
-
+
for (y = 1; y < filter->map_height - 1; y++) {
for (x = 1; x < filter->map_width - 1; x++) {
@@ -272,7 +278,8 @@ gst_edgetv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
}
static void
-gst_edgetv_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_edgetv_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstEdgeTV *filter;
@@ -288,7 +295,8 @@ gst_edgetv_set_property (GObject * object, guint prop_id, const GValue * value,
}
static void
-gst_edgetv_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_edgetv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstEdgeTV *filter;
diff --git a/gst/effectv/gsteffectv.c b/gst/effectv/gsteffectv.c
index 2fa1583b..71f51c55 100644
--- a/gst/effectv/gsteffectv.c
+++ b/gst/effectv/gsteffectv.c
@@ -31,45 +31,37 @@
#include "gsteffectv.h"
-struct _elements_entry {
+struct _elements_entry
+{
gchar *name;
- GType (*type) (void);
+ GType (*type) (void);
};
static struct _elements_entry _elements[] = {
- { "edgeTV", gst_edgetv_get_type },
- { "agingTV", gst_agingtv_get_type },
- { "diceTV", gst_dicetv_get_type },
- { "warpTV", gst_warptv_get_type },
- { "shagadelicTV", gst_shagadelictv_get_type },
- { "vertigoTV", gst_vertigotv_get_type },
- { "revTV", gst_revtv_get_type },
- { "quarkTV", gst_quarktv_get_type },
- { NULL, 0 },
+ {"edgeTV", gst_edgetv_get_type},
+ {"agingTV", gst_agingtv_get_type},
+ {"diceTV", gst_dicetv_get_type},
+ {"warpTV", gst_warptv_get_type},
+ {"shagadelicTV", gst_shagadelictv_get_type},
+ {"vertigoTV", gst_vertigotv_get_type},
+ {"revTV", gst_revtv_get_type},
+ {"quarkTV", gst_quarktv_get_type},
+ {NULL, 0},
};
-GstStaticPadTemplate gst_effectv_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+GstStaticPadTemplate gst_effectv_src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_BGRx "; "
- GST_VIDEO_CAPS_RGBx
- )
-);
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_RGBx)
+ );
GstStaticPadTemplate gst_effectv_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_BGRx "; "
- GST_VIDEO_CAPS_RGBx
- )
-);
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_RGBx)
+ );
static gboolean
plugin_init (GstPlugin * plugin)
@@ -81,7 +73,7 @@ plugin_init (GstPlugin * plugin)
while (_elements[i].name) {
if (!gst_element_register (plugin, _elements[i].name,
- GST_RANK_NONE, (_elements[i].type) ()))
+ GST_RANK_NONE, (_elements[i].type) ()))
return FALSE;
i++;
}
@@ -89,14 +81,8 @@ plugin_init (GstPlugin * plugin)
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "effectv",
- "effect plugins from the effectv project",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-);
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "effectv",
+ "effect plugins from the effectv project",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN);
diff --git a/gst/effectv/gstquark.c b/gst/effectv/gstquark.c
index 1b4a2278..42683212 100644
--- a/gst/effectv/gstquark.c
+++ b/gst/effectv/gstquark.c
@@ -66,12 +66,10 @@ struct _GstQuarkTVClass
};
/* elementfactory information */
-static GstElementDetails gst_quarktv_details = GST_ELEMENT_DETAILS (
- "QuarkTV",
- "Filter/Effect/Video",
- "Motion dissolver",
- "FUKUCHI, Kentarou <fukuchi@users.sourceforge.net>"
-);
+static GstElementDetails gst_quarktv_details = GST_ELEMENT_DETAILS ("QuarkTV",
+ "Filter/Effect/Video",
+ "Motion dissolver",
+ "FUKUCHI, Kentarou <fukuchi@users.sourceforge.net>");
/* Filter signals and args */
enum
@@ -86,21 +84,21 @@ enum
ARG_PLANES,
};
-static void gst_quarktv_base_init (gpointer g_class);
-static void gst_quarktv_class_init (GstQuarkTVClass * klass);
-static void gst_quarktv_init (GstQuarkTV * filter);
+static void gst_quarktv_base_init (gpointer g_class);
+static void gst_quarktv_class_init (GstQuarkTVClass * klass);
+static void gst_quarktv_init (GstQuarkTV * filter);
-static GstElementStateReturn
- gst_quarktv_change_state (GstElement *element);
-
-static void gst_quarktv_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_quarktv_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
+static GstElementStateReturn gst_quarktv_change_state (GstElement * element);
+
+static void gst_quarktv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_quarktv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_quarktv_chain (GstPad * pad, GstData *_data);
+static void gst_quarktv_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
+
/* static guint gst_quarktv_signals[LAST_SIGNAL] = { 0 }; */
static inline guint32
@@ -111,13 +109,14 @@ fastrand (void)
return (fastrand_val = fastrand_val * 1103515245 + 12345);
}
-GType gst_quarktv_get_type (void)
+GType
+gst_quarktv_get_type (void)
{
static GType quarktv_type = 0;
if (!quarktv_type) {
static const GTypeInfo quarktv_info = {
- sizeof (GstQuarkTVClass),
+ sizeof (GstQuarkTVClass),
gst_quarktv_base_init,
NULL,
(GClassInitFunc) gst_quarktv_class_init,
@@ -128,7 +127,9 @@ GType gst_quarktv_get_type (void)
(GInstanceInitFunc) gst_quarktv_init,
};
- quarktv_type = g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info, 0);
+ quarktv_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info,
+ 0);
}
return quarktv_type;
}
@@ -142,7 +143,7 @@ gst_quarktv_base_init (gpointer g_class)
gst_static_pad_template_get (&gst_effectv_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_effectv_sink_template));
-
+
gst_element_class_set_details (element_class, &gst_quarktv_details);
}
@@ -158,9 +159,9 @@ gst_quarktv_class_init (GstQuarkTVClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PLANES,
- g_param_spec_int ("planes","Planes","Number of frames in the buffer",
- 1, 32, PLANES, G_PARAM_READWRITE));
-
+ g_param_spec_int ("planes", "Planes", "Number of frames in the buffer",
+ 1, 32, PLANES, G_PARAM_READWRITE));
+
gobject_class->set_property = gst_quarktv_set_property;
gobject_class->get_property = gst_quarktv_get_property;
@@ -192,8 +193,8 @@ gst_quarktv_link (GstPad * pad, const GstCaps * caps)
filter->area = filter->width * filter->height;
- for(i = 0; i < filter->planes; i++) {
- if (filter->planetable[i])
+ for (i = 0; i < filter->planes; i++) {
+ if (filter->planetable[i])
gst_buffer_unref (filter->planetable[i]);
filter->planetable[i] = NULL;
}
@@ -204,27 +205,30 @@ gst_quarktv_link (GstPad * pad, const GstCaps * caps)
static void
gst_quarktv_init (GstQuarkTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_effectv_sink_template), "sink");
gst_pad_set_getcaps_function (filter->sinkpad, gst_pad_proxy_getcaps);
gst_pad_set_chain_function (filter->sinkpad, gst_quarktv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_quarktv_link);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get(&gst_effectv_src_template), "src");
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_effectv_src_template), "src");
gst_pad_set_getcaps_function (filter->srcpad, gst_pad_proxy_getcaps);
gst_pad_set_link_function (filter->srcpad, gst_quarktv_link);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->planes = PLANES;
filter->current_plane = filter->planes - 1;
- filter->planetable = (GstBuffer **) g_malloc(filter->planes * sizeof(GstBuffer *));
- memset (filter->planetable, 0, filter->planes * sizeof(GstBuffer *));
+ filter->planetable =
+ (GstBuffer **) g_malloc (filter->planes * sizeof (GstBuffer *));
+ memset (filter->planetable, 0, filter->planes * sizeof (GstBuffer *));
}
static void
-gst_quarktv_chain (GstPad * pad, GstData *_data)
+gst_quarktv_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstQuarkTV *filter;
@@ -239,35 +243,38 @@ gst_quarktv_chain (GstPad * pad, GstData *_data)
area = filter->area;
outbuf = gst_buffer_new ();
- GST_BUFFER_SIZE (outbuf) = area * sizeof(guint32);
- dest = (guint32 *) GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
+ GST_BUFFER_SIZE (outbuf) = area * sizeof (guint32);
+ dest = (guint32 *) GST_BUFFER_DATA (outbuf) =
+ g_malloc (GST_BUFFER_SIZE (outbuf));
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
-
- if (filter->planetable[filter->current_plane])
+
+ if (filter->planetable[filter->current_plane])
gst_buffer_unref (filter->planetable[filter->current_plane]);
filter->planetable[filter->current_plane] = buf;
while (--area) {
GstBuffer *rand;
-
+
/* pick a random buffer */
- rand = filter->planetable[(filter->current_plane + (fastrand () >> 24)) & (filter->planes - 1)];
-
- dest[area] = (rand ? ((guint32 *)GST_BUFFER_DATA (rand))[area] : 0);
+ rand =
+ filter->planetable[(filter->current_plane +
+ (fastrand () >> 24)) & (filter->planes - 1)];
+
+ dest[area] = (rand ? ((guint32 *) GST_BUFFER_DATA (rand))[area] : 0);
}
gst_pad_push (filter->srcpad, GST_DATA (outbuf));
filter->current_plane--;
-
- if (filter->current_plane < 0)
+
+ if (filter->current_plane < 0)
filter->current_plane = filter->planes - 1;
}
static GstElementStateReturn
-gst_quarktv_change_state (GstElement *element)
-{
+gst_quarktv_change_state (GstElement * element)
+{
GstQuarkTV *filter = GST_QUARKTV (element);
switch (GST_STATE_TRANSITION (element)) {
@@ -276,9 +283,9 @@ gst_quarktv_change_state (GstElement *element)
gint i;
for (i = 0; i < filter->planes; i++) {
- if (filter->planetable[i])
- gst_buffer_unref (filter->planetable[i]);
- filter->planetable[i] = NULL;
+ if (filter->planetable[i])
+ gst_buffer_unref (filter->planetable[i]);
+ filter->planetable[i] = NULL;
}
g_free (filter->planetable);
filter->planetable = NULL;
@@ -293,7 +300,8 @@ gst_quarktv_change_state (GstElement *element)
static void
-gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstQuarkTV *filter;
@@ -304,29 +312,29 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) {
case ARG_PLANES:
- {
- gint new_n_planes = g_value_get_int (value);
- GstBuffer **new_planetable;
- gint i;
-
- /* If the number of planes changed, copy across any existing planes */
- if (new_n_planes != filter->planes)
- {
- new_planetable = (GstBuffer **) g_malloc(new_n_planes * sizeof(GstBuffer *));
-
- for(i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
- new_planetable[i] = filter->planetable[i];
- }
- for(; i < filter->planes; i++) {
- if (filter->planetable[i])
- gst_buffer_unref (filter->planetable[i]);
- }
- g_free (filter->planetable);
- filter->planetable = new_planetable;
- filter->current_plane = filter->planes - 1;
- filter->planes = new_n_planes;
- }
+ {
+ gint new_n_planes = g_value_get_int (value);
+ GstBuffer **new_planetable;
+ gint i;
+
+ /* If the number of planes changed, copy across any existing planes */
+ if (new_n_planes != filter->planes) {
+ new_planetable =
+ (GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *));
+
+ for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
+ new_planetable[i] = filter->planetable[i];
+ }
+ for (; i < filter->planes; i++) {
+ if (filter->planetable[i])
+ gst_buffer_unref (filter->planetable[i]);
+ }
+ g_free (filter->planetable);
+ filter->planetable = new_planetable;
+ filter->current_plane = filter->planes - 1;
+ filter->planes = new_n_planes;
}
+ }
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -335,7 +343,8 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
}
static void
-gst_quarktv_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_quarktv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstQuarkTV *filter;
diff --git a/gst/effectv/gstrev.c b/gst/effectv/gstrev.c
index 33e6bf8a..32752107 100644
--- a/gst/effectv/gstrev.c
+++ b/gst/effectv/gstrev.c
@@ -79,7 +79,7 @@ struct _GstRevTVClass
{
GstVideofilterClass parent_class;
- void (*reset) (GstElement *element);
+ void (*reset) (GstElement * element);
};
/* Filter signals and args */
@@ -97,26 +97,27 @@ enum
ARG_GAIN,
};
-static void gst_revtv_base_init (gpointer g_class);
-static void gst_revtv_class_init (gpointer g_class, gpointer class_data);
-static void gst_revtv_init (GTypeInstance *instance, gpointer g_class);
+static void gst_revtv_base_init (gpointer g_class);
+static void gst_revtv_class_init (gpointer g_class, gpointer class_data);
+static void gst_revtv_init (GTypeInstance * instance, gpointer g_class);
-static void gst_revtv_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_revtv_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_revtv_setup (GstVideofilter *videofilter);
-static void gst_revtv_rgb32 (GstVideofilter *videofilter, void *d, void *s);
+static void gst_revtv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_revtv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void gst_revtv_setup (GstVideofilter * videofilter);
+static void gst_revtv_rgb32 (GstVideofilter * videofilter, void *d, void *s);
/* static guint gst_revtv_signals[LAST_SIGNAL] = { 0 }; */
-GType gst_revtv_get_type (void)
+GType
+gst_revtv_get_type (void)
{
static GType revtv_type = 0;
if (!revtv_type) {
static const GTypeInfo revtv_info = {
- sizeof (GstRevTVClass),
+ sizeof (GstRevTVClass),
gst_revtv_base_init,
NULL,
(GClassInitFunc) gst_revtv_class_init,
@@ -127,35 +128,35 @@ GType gst_revtv_get_type (void)
(GInstanceInitFunc) gst_revtv_init,
};
- revtv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info, 0);
+ revtv_type =
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info,
+ 0);
}
return revtv_type;
}
static GstVideofilterFormat gst_revtv_formats[] = {
- { "RGB ", 32, gst_revtv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 }
+ {"RGB ", 32, gst_revtv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000}
};
static void
gst_revtv_base_init (gpointer g_class)
{
/* elementfactory information */
- static GstElementDetails gst_revtv_details = GST_ELEMENT_DETAILS (
- "RevTV",
- "Filter/Effect/Video",
- "A video waveform monitor for each line of video processed",
- "Wim Taymans <wim.taymans@chello.be>"
- );
+ static GstElementDetails gst_revtv_details = GST_ELEMENT_DETAILS ("RevTV",
+ "Filter/Effect/Video",
+ "A video waveform monitor for each line of video processed",
+ "Wim Taymans <wim.taymans@chello.be>");
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, &gst_revtv_details);
- for(i=0; i < G_N_ELEMENTS(gst_revtv_formats); i++) {
- gst_videofilter_class_add_format(videofilter_class,
- gst_revtv_formats + i);
+ for (i = 0; i < G_N_ELEMENTS (gst_revtv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class, gst_revtv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
@@ -171,14 +172,14 @@ gst_revtv_class_init (gpointer klass, gpointer class_data)
videofilter_class = GST_VIDEOFILTER_CLASS (klass);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELAY,
- g_param_spec_int ("delay","Delay","Delay in frames between updates",
- 1, 100, 1, G_PARAM_READWRITE));
+ g_param_spec_int ("delay", "Delay", "Delay in frames between updates",
+ 1, 100, 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LINESPACE,
- g_param_spec_int ("linespace","Linespace","Control line spacing",
- 1, 100, 6, G_PARAM_READWRITE));
+ g_param_spec_int ("linespace", "Linespace", "Control line spacing",
+ 1, 100, 6, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAIN,
- g_param_spec_int ("gain","Gain","Control gain",
- 1, 200, 50, G_PARAM_READWRITE));
+ g_param_spec_int ("gain", "Gain", "Control gain",
+ 1, 200, 50, G_PARAM_READWRITE));
gobject_class->set_property = gst_revtv_set_property;
gobject_class->get_property = gst_revtv_get_property;
@@ -187,7 +188,7 @@ gst_revtv_class_init (gpointer klass, gpointer class_data)
}
static void
-gst_revtv_init (GTypeInstance *instance, gpointer g_class)
+gst_revtv_init (GTypeInstance * instance, gpointer g_class)
{
GstRevTV *restv = GST_REVTV (instance);
@@ -198,7 +199,7 @@ gst_revtv_init (GTypeInstance *instance, gpointer g_class)
}
static void
-gst_revtv_setup (GstVideofilter *videofilter)
+gst_revtv_setup (GstVideofilter * videofilter)
{
GstRevTV *revtv;
@@ -210,7 +211,7 @@ gst_revtv_setup (GstVideofilter *videofilter)
}
static void
-gst_revtv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
+gst_revtv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
{
GstRevTV *filter;
guint32 *src, *dest;
@@ -227,29 +228,30 @@ gst_revtv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
height = filter->height;
/* Clear everything to black */
- memset (dest, 0, width*height*sizeof(guint32));
+ memset (dest, 0, width * height * sizeof (guint32));
// draw the offset lines
- for (y = 0; y < height ; y += filter->linespace){
+ for (y = 0; y < height; y += filter->linespace) {
for (x = 0; x <= width; x++) {
nsrc = src + (y * width) + x;
// Calc Y Value for curpix
R = ((*nsrc) & 0xff0000) >> (16 - 1);
G = ((*nsrc) & 0xff00) >> (8 - 2);
- B = (*nsrc) & 0xff;
+ B = (*nsrc) & 0xff;
- yval = y - ((short) (R + G + B) / filter->vscale) ;
+ yval = y - ((short) (R + G + B) / filter->vscale);
if (yval > 0) {
- dest[x + (yval * width)] = THE_COLOR;
+ dest[x + (yval * width)] = THE_COLOR;
}
}
}
}
static void
-gst_revtv_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_revtv_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstRevTV *filter;
@@ -274,7 +276,8 @@ gst_revtv_set_property (GObject * object, guint prop_id, const GValue * value, G
}
static void
-gst_revtv_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_revtv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstRevTV *filter;
diff --git a/gst/effectv/gstshagadelic.c b/gst/effectv/gstshagadelic.c
index 790649d5..345f2762 100644
--- a/gst/effectv/gstshagadelic.c
+++ b/gst/effectv/gstshagadelic.c
@@ -20,7 +20,7 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
- */
+ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -76,28 +76,30 @@ enum
ARG_0,
};
-static void gst_shagadelictv_base_init (gpointer g_class);
-static void gst_shagadelictv_class_init (gpointer g_class, gpointer class_data);
-static void gst_shagadelictv_init (GTypeInstance *instance, gpointer g_class);
+static void gst_shagadelictv_base_init (gpointer g_class);
+static void gst_shagadelictv_class_init (gpointer g_class, gpointer class_data);
+static void gst_shagadelictv_init (GTypeInstance * instance, gpointer g_class);
-static void gst_shagadelic_initialize (GstShagadelicTV *filter);
+static void gst_shagadelic_initialize (GstShagadelicTV * filter);
-static void gst_shagadelictv_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_shagadelictv_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_shagadelictv_setup (GstVideofilter *videofilter);
-static void gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s);
+static void gst_shagadelictv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_shagadelictv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void gst_shagadelictv_setup (GstVideofilter * videofilter);
+static void gst_shagadelictv_rgb32 (GstVideofilter * videofilter, void *d,
+ void *s);
/*static guint gst_shagadelictv_signals[LAST_SIGNAL] = { 0 }; */
-GType gst_shagadelictv_get_type (void)
+GType
+gst_shagadelictv_get_type (void)
{
static GType shagadelictv_type = 0;
if (!shagadelictv_type) {
static const GTypeInfo shagadelictv_info = {
- sizeof (GstShagadelicTVClass),
+ sizeof (GstShagadelicTVClass),
gst_shagadelictv_base_init,
NULL,
(GClassInitFunc) gst_shagadelictv_class_init,
@@ -108,34 +110,36 @@ GType gst_shagadelictv_get_type (void)
(GInstanceInitFunc) gst_shagadelictv_init,
};
- shagadelictv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV", &shagadelictv_info, 0);
+ shagadelictv_type =
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV",
+ &shagadelictv_info, 0);
}
return shagadelictv_type;
}
static GstVideofilterFormat gst_shagadelictv_formats[] = {
- { "RGB ", 32, gst_shagadelictv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 }
+ {"RGB ", 32, gst_shagadelictv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000}
};
-
+
static void
gst_shagadelictv_base_init (gpointer g_class)
{
/* elementfactory information */
- static GstElementDetails gst_shagadelictv_details = GST_ELEMENT_DETAILS (
- "ShagadelicTV",
- "Filter/Effect/Video",
- "Oh behave, ShagedelicTV makes images shagadelic!",
- "Wim Taymans <wim.taymans@chello.be>"
- );
+ static GstElementDetails gst_shagadelictv_details =
+ GST_ELEMENT_DETAILS ("ShagadelicTV",
+ "Filter/Effect/Video",
+ "Oh behave, ShagedelicTV makes images shagadelic!",
+ "Wim Taymans <wim.taymans@chello.be>");
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, &gst_shagadelictv_details);
- for(i=0;i<G_N_ELEMENTS(gst_shagadelictv_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_shagadelictv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_shagadelictv_formats + i);
}
@@ -158,7 +162,7 @@ gst_shagadelictv_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_shagadelictv_init (GTypeInstance *instance, gpointer g_class)
+gst_shagadelictv_init (GTypeInstance * instance, gpointer g_class)
{
GstShagadelicTV *filter = GST_SHAGADELICTV (instance);
@@ -166,12 +170,12 @@ gst_shagadelictv_init (GTypeInstance *instance, gpointer g_class)
filter->spiral = NULL;
}
-static void
-gst_shagadelictv_setup(GstVideofilter *videofilter)
+static void
+gst_shagadelictv_setup (GstVideofilter * videofilter)
{
GstShagadelicTV *filter;
- 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);
int area;
g_return_if_fail (GST_IS_SHAGADELICTV (videofilter));
@@ -193,16 +197,17 @@ gst_shagadelictv_setup(GstVideofilter *videofilter)
static unsigned int
fastrand (void)
-{
+{
static unsigned int fastrand_val;
return (fastrand_val = fastrand_val * 1103515245 + 12345);
}
static void
-gst_shagadelic_initialize (GstShagadelicTV *filter)
+gst_shagadelic_initialize (GstShagadelicTV * filter)
{
int i, x, y;
+
#ifdef PS2
float xx, yy;
#else
@@ -210,32 +215,35 @@ gst_shagadelic_initialize (GstShagadelicTV *filter)
#endif
i = 0;
- for(y = 0; y < filter->height * 2; y++) {
+ for (y = 0; y < filter->height * 2; y++) {
yy = y - filter->height;
yy *= yy;
for (x = 0; x < filter->width * 2; x++) {
xx = x - filter->width;
#ifdef PS2
- filter->ripple[i++] = ((unsigned int)(sqrtf(xx*xx+yy)*8))&255;
+ filter->ripple[i++] = ((unsigned int) (sqrtf (xx * xx + yy) * 8)) & 255;
#else
- filter->ripple[i++] = ((unsigned int)(sqrt(xx*xx+yy)*8))&255;
+ filter->ripple[i++] = ((unsigned int) (sqrt (xx * xx + yy) * 8)) & 255;
#endif
}
}
i = 0;
for (y = 0; y < filter->height; y++) {
- yy = y - filter->height/2;
-
+ yy = y - filter->height / 2;
+
for (x = 0; x < filter->width; x++) {
- xx = x - filter->width/2;
+ xx = x - filter->width / 2;
#ifdef PS2
filter->spiral[i++] = ((unsigned int)
- ((atan2f(xx, yy)/((float)M_PI)*256*9) + (sqrtf(xx*xx+yy*yy)*5)))&255;
+ ((atan2f (xx,
+ yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx +
+ yy * yy) * 5))) & 255;
#else
filter->spiral[i++] = ((unsigned int)
- ((atan2(xx, yy)/M_PI*256*9) + (sqrt(xx*xx+yy*yy)*5)))&255;
+ ((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx +
+ yy * yy) * 5))) & 255;
#endif
/* Here is another Swinger!
* ((atan2(xx, yy)/M_PI*256) + (sqrt(xx*xx+yy*yy)*10))&255;
@@ -254,7 +262,7 @@ gst_shagadelic_initialize (GstShagadelicTV *filter)
}
static void
-gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
+gst_shagadelictv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
{
GstShagadelicTV *filter;
guint32 *src, *dest;
@@ -280,18 +288,24 @@ gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
* v = *src++;
* *dest++ = v & ((r<<16)|(g<<8)|b);
*/
- r = (gchar) (filter->ripple[(filter->ry + y) * width * 2 + filter->rx + x] + filter->phase * 2) >> 7;
+ r = (gchar) (filter->ripple[(filter->ry + y) * width * 2 + filter->rx +
+ x] + filter->phase * 2) >> 7;
g = (gchar) (filter->spiral[y * width + x] + filter->phase * 3) >> 7;
- b = (gchar) (filter->ripple[(filter->by + y) * width * 2 + filter->bx + x] - filter->phase) >> 7;
+ b = (gchar) (filter->ripple[(filter->by + y) * width * 2 + filter->bx +
+ x] - filter->phase) >> 7;
*dest++ = v & ((r << 16) | (g << 8) | b);
}
}
filter->phase -= 8;
- if ((filter->rx + filter->rvx) < 0 || (filter->rx + filter->rvx) >= width) filter->rvx =- filter->rvx;
- if ((filter->ry + filter->rvy) < 0 || (filter->ry + filter->rvy) >= height) filter->rvy =- filter->rvy;
- if ((filter->bx + filter->bvx) < 0 || (filter->bx + filter->bvx) >= width) filter->bvx =- filter->bvx;
- if ((filter->by + filter->bvy) < 0 || (filter->by + filter->bvy) >= height) filter->bvy =- filter->bvy;
+ if ((filter->rx + filter->rvx) < 0 || (filter->rx + filter->rvx) >= width)
+ filter->rvx = -filter->rvx;
+ if ((filter->ry + filter->rvy) < 0 || (filter->ry + filter->rvy) >= height)
+ filter->rvy = -filter->rvy;
+ if ((filter->bx + filter->bvx) < 0 || (filter->bx + filter->bvx) >= width)
+ filter->bvx = -filter->bvx;
+ if ((filter->by + filter->bvy) < 0 || (filter->by + filter->bvy) >= height)
+ filter->bvy = -filter->bvy;
filter->rx += filter->rvx;
filter->ry += filter->rvy;
filter->bx += filter->bvx;
@@ -299,7 +313,8 @@ gst_shagadelictv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
}
static void
-gst_shagadelictv_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_shagadelictv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstShagadelicTV *filter;
@@ -315,7 +330,8 @@ gst_shagadelictv_set_property (GObject * object, guint prop_id, const GValue * v
}
static void
-gst_shagadelictv_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_shagadelictv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstShagadelicTV *filter;
diff --git a/gst/effectv/gstvertigo.c b/gst/effectv/gstvertigo.c
index 06e795ea..6faa8cb2 100644
--- a/gst/effectv/gstvertigo.c
+++ b/gst/effectv/gstvertigo.c
@@ -19,8 +19,8 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
- */
-
+ */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -62,7 +62,7 @@ struct _GstVertigoTVClass
{
GstVideofilterClass parent_class;
- void (*reset) (GstElement *element);
+ void (*reset) (GstElement * element);
};
/* Filter signals and args */
@@ -80,28 +80,31 @@ enum
ARG_ZOOM_SPEED,
};
-static void gst_vertigotv_base_init (gpointer g_class);
-static void gst_vertigotv_class_init (GstVertigoTVClass * klass, gpointer class_data);
-static void gst_vertigotv_init (GTypeInstance *instance, gpointer g_class);
-static void gst_vertigotv_setup (GstVideofilter *videofilter);
+static void gst_vertigotv_base_init (gpointer g_class);
+static void gst_vertigotv_class_init (GstVertigoTVClass * klass,
+ gpointer class_data);
+static void gst_vertigotv_init (GTypeInstance * instance, gpointer g_class);
+static void gst_vertigotv_setup (GstVideofilter * videofilter);
-static void gst_vertigotv_reset_handler (GstElement *element);
+static void gst_vertigotv_reset_handler (GstElement * element);
-static void gst_vertigotv_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_vertigotv_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_vertigotv_rgb32 (GstVideofilter *videofilter, void *d, void *s);
+static void gst_vertigotv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_vertigotv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void gst_vertigotv_rgb32 (GstVideofilter * videofilter, void *d,
+ void *s);
static guint gst_vertigotv_signals[LAST_SIGNAL] = { 0 };
-GType gst_vertigotv_get_type (void)
+GType
+gst_vertigotv_get_type (void)
{
static GType vertigotv_type = 0;
if (!vertigotv_type) {
static const GTypeInfo vertigotv_info = {
- sizeof (GstVertigoTVClass),
+ sizeof (GstVertigoTVClass),
gst_vertigotv_base_init,
NULL,
(GClassInitFunc) gst_vertigotv_class_init,
@@ -112,33 +115,34 @@ GType gst_vertigotv_get_type (void)
(GInstanceInitFunc) gst_vertigotv_init,
};
- vertigotv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV", &vertigotv_info, 0);
+ vertigotv_type =
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV",
+ &vertigotv_info, 0);
}
return vertigotv_type;
}
static GstVideofilterFormat gst_vertigotv_formats[] = {
- { "RGB ", 32, gst_vertigotv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 }
+ {"RGB ", 32, gst_vertigotv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000}
};
static void
gst_vertigotv_base_init (gpointer g_class)
{
/* elementfactory information */
- static GstElementDetails vertigotv_details = GST_ELEMENT_DETAILS (
- "VertigoTV",
- "Filter/Effect/Video",
- "A loopback alpha blending effector with rotating and scaling",
- "Wim Taymans <wim.taymans@chello.be>"
- );
+ static GstElementDetails vertigotv_details = GST_ELEMENT_DETAILS ("VertigoTV",
+ "Filter/Effect/Video",
+ "A loopback alpha blending effector with rotating and scaling",
+ "Wim Taymans <wim.taymans@chello.be>");
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, &vertigotv_details);
- for(i=0;i<G_N_ELEMENTS(gst_vertigotv_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_vertigotv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_vertigotv_formats + i);
}
@@ -157,22 +161,20 @@ gst_vertigotv_class_init (GstVertigoTVClass * klass, gpointer class_data)
videofilter_class = GST_VIDEOFILTER_CLASS (klass);
gst_vertigotv_signals[RESET_SIGNAL] =
- g_signal_new ("reset-parms",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstVertigoTVClass, reset),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new ("reset-parms",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GstVertigoTVClass, reset),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
klass->reset = gst_vertigotv_reset_handler;
-
+
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SPEED,
- g_param_spec_float ("speed","Speed","Control the speed of movement",
- 0.01, 100.0, 0.02, G_PARAM_READWRITE));
+ g_param_spec_float ("speed", "Speed", "Control the speed of movement",
+ 0.01, 100.0, 0.02, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ZOOM_SPEED,
- g_param_spec_float ("zoom_speed","Zoom Speed","Control the rate of zooming",
- 1.01, 1.1, 1.01, G_PARAM_READWRITE));
+ g_param_spec_float ("zoom_speed", "Zoom Speed",
+ "Control the rate of zooming", 1.01, 1.1, 1.01, G_PARAM_READWRITE));
gobject_class->set_property = gst_vertigotv_set_property;
gobject_class->get_property = gst_vertigotv_get_property;
@@ -181,7 +183,7 @@ gst_vertigotv_class_init (GstVertigoTVClass * klass, gpointer class_data)
}
static void
-gst_vertigotv_reset_handler (GstElement *element)
+gst_vertigotv_reset_handler (GstElement * element)
{
GstVertigoTV *filter = GST_VERTIGOTV (element);
@@ -190,16 +192,16 @@ gst_vertigotv_reset_handler (GstElement *element)
filter->zoomrate = 1.01;
}
-static void
-gst_vertigotv_setup(GstVideofilter *videofilter)
+static void
+gst_vertigotv_setup (GstVideofilter * videofilter)
{
GstVertigoTV *filter;
gint area;
- 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_VERTIGOTV(videofilter));
- filter = GST_VERTIGOTV(videofilter);
+ g_return_if_fail (GST_IS_VERTIGOTV (videofilter));
+ filter = GST_VERTIGOTV (videofilter);
filter->width = width;
filter->height = height;
@@ -207,16 +209,16 @@ gst_vertigotv_setup(GstVideofilter *videofilter)
area = width * height;
g_free (filter->buffer);
- filter->buffer = (guint32 *) g_malloc (area * 2 * sizeof(guint32));
+ filter->buffer = (guint32 *) g_malloc (area * 2 * sizeof (guint32));
- memset (filter->buffer, 0, area * 2 * sizeof(guint32));
+ memset (filter->buffer, 0, area * 2 * sizeof (guint32));
filter->current_buffer = filter->buffer;
filter->alt_buffer = filter->buffer + area;
filter->phase = 0;
}
static void
-gst_vertigotv_init (GTypeInstance *instance, gpointer g_class)
+gst_vertigotv_init (GTypeInstance * instance, gpointer g_class)
{
GstVertigoTV *filter = GST_VERTIGOTV (instance);
@@ -226,36 +228,40 @@ gst_vertigotv_init (GTypeInstance *instance, gpointer g_class)
filter->zoomrate = 1.01;
}
-static void
-gst_vertigotv_set_parms (GstVertigoTV *filter)
+static void
+gst_vertigotv_set_parms (GstVertigoTV * filter)
{
double vx, vy;
double t;
double x, y;
double dizz;
- dizz = sin (filter->phase) * 10 + sin (filter->phase*1.9+5) * 5;
+ dizz = sin (filter->phase) * 10 + sin (filter->phase * 1.9 + 5) * 5;
x = filter->width / 2;
y = filter->height / 2;
- t = (x*x + y*y) * filter->zoomrate;
+ t = (x * x + y * y) * filter->zoomrate;
if (filter->width > filter->height) {
if (dizz >= 0) {
- if (dizz > x) dizz = x;
- vx = (x * (x - dizz) + y * y) / t;
+ if (dizz > x)
+ dizz = x;
+ vx = (x * (x - dizz) + y * y) / t;
} else {
- if (dizz < -x) dizz = -x;
+ if (dizz < -x)
+ dizz = -x;
vx = (x * (x + dizz) + y * y) / t;
}
vy = (dizz * y) / t;
} else {
if (dizz >= 0) {
- if (dizz > y) dizz = y;
+ if (dizz > y)
+ dizz = y;
vx = (x * x + y * (y - dizz)) / t;
} else {
- if (dizz < -y) dizz = -y;
+ if (dizz < -y)
+ dizz = -y;
vx = (x * x + y * (y + dizz)) / t;
}
vy = (dizz * x) / t;
@@ -266,11 +272,12 @@ gst_vertigotv_set_parms (GstVertigoTV *filter)
filter->sy = (-vx * y - vy * x + y + sin (filter->phase * 6) * 2) * 65536;
filter->phase += filter->phase_increment;
- if (filter->phase > 5700000) filter->phase = 0;
+ if (filter->phase > 5700000)
+ filter->phase = 0;
}
-
-static void
-gst_vertigotv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
+
+static void
+gst_vertigotv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
{
GstVertigoTV *filter;
guint32 *src, *dest;
@@ -299,12 +306,14 @@ gst_vertigotv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
for (x = width; x > 0; x--) {
i = (oy >> 16) * width + (ox >> 16);
- if (i < 0) i = 0;
- if (i >= area) i = area;
-
+ if (i < 0)
+ i = 0;
+ if (i >= area)
+ i = area;
+
v = filter->current_buffer[i] & 0xfcfcff;
v = (v * 3) + ((*src++) & 0xfcfcff);
-
+
*p++ = (v >> 2);
ox += filter->dx;
oy += filter->dy;
@@ -313,7 +322,7 @@ gst_vertigotv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
filter->sy += filter->dx;
}
- memcpy(dest, filter->alt_buffer, area * sizeof(guint32));
+ memcpy (dest, filter->alt_buffer, area * sizeof (guint32));
p = filter->current_buffer;
filter->current_buffer = filter->alt_buffer;
@@ -321,7 +330,8 @@ gst_vertigotv_rgb32 (GstVideofilter *videofilter, void *d, void *s)
}
static void
-gst_vertigotv_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_vertigotv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstVertigoTV *filter;
@@ -343,7 +353,8 @@ gst_vertigotv_set_property (GObject * object, guint prop_id, const GValue * valu
}
static void
-gst_vertigotv_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_vertigotv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstVertigoTV *filter;
diff --git a/gst/effectv/gstwarp.c b/gst/effectv/gstwarp.c
index 82c24ddd..4eb81a65 100644
--- a/gst/effectv/gstwarp.c
+++ b/gst/effectv/gstwarp.c
@@ -62,45 +62,51 @@
typedef struct _GstWarpTV GstWarpTV;
typedef struct _GstWarpTVClass GstWarpTVClass;
-struct _GstWarpTV {
+struct _GstWarpTV
+{
GstVideofilter videofilter;
gint width, height;
gint *offstable;
gint32 *disttable;
gint32 ctable[1024];
- gint32 sintable[1024+256];
+ gint32 sintable[1024 + 256];
gint tval;
};
-struct _GstWarpTVClass {
+struct _GstWarpTVClass
+{
GstVideofilterClass parent_class;
};
/* GstWarpTV signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static void gst_warptv_base_init (gpointer g_class);
-static void gst_warptv_class_init (gpointer g_class, gpointer class_data);
-static void gst_warptv_init (GTypeInstance *instance, gpointer g_class);
+static void gst_warptv_base_init (gpointer g_class);
+static void gst_warptv_class_init (gpointer g_class, gpointer class_data);
+static void gst_warptv_init (GTypeInstance * instance, gpointer g_class);
-static void gst_warptv_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_warptv_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_warptv_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_warptv_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_warptv_setup(GstVideofilter *videofilter);
-static void initSinTable (GstWarpTV *filter);
-static void initOffsTable (GstWarpTV *filter);
-static void initDistTable (GstWarpTV *filter);
-static void gst_warptv_rgb32 (GstVideofilter *videofilter, void *d, void *s);
+static void gst_warptv_setup (GstVideofilter * videofilter);
+static void initSinTable (GstWarpTV * filter);
+static void initOffsTable (GstWarpTV * filter);
+static void initDistTable (GstWarpTV * filter);
+static void gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s);
GType
gst_warptv_get_type (void)
@@ -109,46 +115,48 @@ gst_warptv_get_type (void)
if (!warptv_type) {
static const GTypeInfo warptv_info = {
- sizeof(GstWarpTVClass),
+ sizeof (GstWarpTVClass),
gst_warptv_base_init,
NULL,
gst_warptv_class_init,
NULL,
NULL,
- sizeof(GstWarpTV),
+ sizeof (GstWarpTV),
0,
gst_warptv_init,
};
- warptv_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
- "GstWarpTV", &warptv_info, 0);
+ warptv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
+ "GstWarpTV", &warptv_info, 0);
}
return warptv_type;
}
static GstVideofilterFormat gst_warptv_formats[] = {
- { "RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x00ff0000, 0x0000ff00, 0x000000ff },
- { "RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0xff000000, 0x00ff0000, 0x0000ff00 },
- { "RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x000000ff, 0x0000ff00, 0x00ff0000 },
- { "RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000, 0xff000000 },
+ {"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x00ff0000, 0x0000ff00,
+ 0x000000ff},
+ {"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0xff000000, 0x00ff0000,
+ 0x0000ff00},
+ {"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x000000ff, 0x0000ff00,
+ 0x00ff0000},
+ {"RGB ", 32, gst_warptv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
+ 0xff000000},
};
static void
gst_warptv_base_init (gpointer g_class)
{
- static GstElementDetails warptv_details = GST_ELEMENT_DETAILS (
- "WarpTV",
- "Filter/Effect/Video",
- "WarpTV does realtime goo'ing of the video input",
- "Sam Lantinga <slouken@devolution.com>"
- );
+ static GstElementDetails warptv_details = GST_ELEMENT_DETAILS ("WarpTV",
+ "Filter/Effect/Video",
+ "WarpTV does realtime goo'ing of the video input",
+ "Sam Lantinga <slouken@devolution.com>");
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, &warptv_details);
- for(i=0;i<G_N_ELEMENTS(gst_warptv_formats);i++){
- gst_videofilter_class_add_format(videofilter_class,
+ for (i = 0; i < G_N_ELEMENTS (gst_warptv_formats); i++) {
+ gst_videofilter_class_add_format (videofilter_class,
gst_warptv_formats + i);
}
@@ -165,10 +173,9 @@ gst_warptv_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_WARPTV_METHOD, GST_WARPTV_METHOD_1,
- G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_METHOD,
+ g_param_spec_enum ("method", "method", "method",
+ GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_warptv_set_property;
@@ -178,28 +185,29 @@ gst_warptv_class_init (gpointer g_class, gpointer class_data)
}
static void
-gst_warptv_init (GTypeInstance *instance, gpointer g_class)
+gst_warptv_init (GTypeInstance * instance, gpointer g_class)
{
GstWarpTV *warptv = GST_WARPTV (instance);
GstVideofilter *videofilter;
- GST_DEBUG("gst_warptv_init");
+ GST_DEBUG ("gst_warptv_init");
- videofilter = GST_VIDEOFILTER(warptv);
+ videofilter = GST_VIDEOFILTER (warptv);
/* do stuff */
}
static void
-gst_warptv_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_warptv_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstWarpTV *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_WARPTV(object));
- src = GST_WARPTV(object);
+ g_return_if_fail (GST_IS_WARPTV (object));
+ src = GST_WARPTV (object);
- GST_DEBUG("gst_warptv_set_property");
+ GST_DEBUG ("gst_warptv_set_property");
switch (prop_id) {
#if 0
case ARG_METHOD:
@@ -212,13 +220,14 @@ gst_warptv_set_property (GObject *object, guint prop_id, const GValue *value, GP
}
static void
-gst_warptv_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_warptv_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstWarpTV *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_WARPTV(object));
- src = GST_WARPTV(object);
+ g_return_if_fail (GST_IS_WARPTV (object));
+ src = GST_WARPTV (object);
switch (prop_id) {
#if 0
@@ -233,14 +242,15 @@ gst_warptv_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
}
-static void gst_warptv_setup(GstVideofilter *videofilter)
+static void
+gst_warptv_setup (GstVideofilter * videofilter)
{
GstWarpTV *warptv;
- 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_WARPTV(videofilter));
- warptv = GST_WARPTV(videofilter);
+ g_return_if_fail (GST_IS_WARPTV (videofilter));
+ warptv = GST_WARPTV (videofilter);
/* if any setup needs to be done, do it here */
@@ -254,7 +264,7 @@ static void gst_warptv_setup(GstVideofilter *videofilter)
g_free (warptv->disttable);
g_free (warptv->offstable);
- warptv->offstable = (guint32 *) g_malloc (height * sizeof (guint32));
+ warptv->offstable = (guint32 *) g_malloc (height * sizeof (guint32));
warptv->disttable = g_malloc (width * height * sizeof (guint32));
initSinTable (warptv);
@@ -262,11 +272,11 @@ static void gst_warptv_setup(GstVideofilter *videofilter)
initDistTable (warptv);
}
-static void
-initSinTable (GstWarpTV *filter)
+static void
+initSinTable (GstWarpTV * filter)
{
- gint32 *tptr, *tsinptr;
- double i;
+ gint32 *tptr, *tsinptr;
+ double i;
tsinptr = tptr = filter->sintable;
@@ -277,35 +287,36 @@ initSinTable (GstWarpTV *filter)
*tptr++ = *tsinptr++;
}
-static void
-initOffsTable (GstWarpTV *filter)
+static void
+initOffsTable (GstWarpTV * filter)
{
int y;
-
+
for (y = 0; y < filter->height; y++) {
filter->offstable[y] = y * filter->width;
}
}
-
-static void
-initDistTable (GstWarpTV *filter)
+
+static void
+initDistTable (GstWarpTV * filter)
{
gint32 halfw, halfh, *distptr;
+
#ifdef PS2
- float x,y,m;
+ float x, y, m;
#else
- double x,y,m;
+ double x, y, m;
#endif
- halfw = filter->width>> 1;
+ halfw = filter->width >> 1;
halfh = filter->height >> 1;
distptr = filter->disttable;
- m = sqrt ((double)(halfw * halfw + halfh * halfh));
+ m = sqrt ((double) (halfw * halfw + halfh * halfh));
for (y = -halfh; y < halfh; y++)
- for (x= -halfw; x < halfw; x++)
+ for (x = -halfw; x < halfw; x++)
#ifdef PS2
*distptr++ = ((int) ((sqrtf (x * x + y * y) * 511.9999) / m)) << 1;
#else
@@ -313,34 +324,34 @@ initDistTable (GstWarpTV *filter)
#endif
}
-static void gst_warptv_rgb32 (GstVideofilter *videofilter,
- void *d, void *s)
+static void
+gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
{
GstWarpTV *warptv;
- 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);
guint32 *src = s;
guint32 *dest = d;
- gint xw,yw,cw;
- gint32 c,i, x,y, dx,dy, maxx, maxy;
+ gint xw, yw, cw;
+ gint32 c, i, x, y, dx, dy, maxx, maxy;
gint32 skip, *ctptr, *distptr;
gint32 *sintable, *ctable;
- g_return_if_fail(GST_IS_WARPTV(videofilter));
- warptv = GST_WARPTV(videofilter);
+ g_return_if_fail (GST_IS_WARPTV (videofilter));
+ warptv = GST_WARPTV (videofilter);
- xw = (gint) (sin ((warptv->tval + 100) * M_PI / 128) * 30);
- yw = (gint) (sin ((warptv->tval) * M_PI / 256) * -35);
- cw = (gint) (sin ((warptv->tval - 70) * M_PI / 64) * 50);
+ xw = (gint) (sin ((warptv->tval + 100) * M_PI / 128) * 30);
+ yw = (gint) (sin ((warptv->tval) * M_PI / 256) * -35);
+ cw = (gint) (sin ((warptv->tval - 70) * M_PI / 64) * 50);
xw += (gint) (sin ((warptv->tval - 10) * M_PI / 512) * 40);
- yw += (gint) (sin ((warptv->tval + 30) * M_PI / 512) * 40);
+ yw += (gint) (sin ((warptv->tval + 30) * M_PI / 512) * 40);
ctptr = warptv->ctable;
distptr = warptv->disttable;
sintable = warptv->sintable;
ctable = warptv->ctable;
- skip = 0 ; /* video_width*sizeof(RGB32)/4 - video_width;; */
+ skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */
c = 0;
for (x = 0; x < 512; x++) {
@@ -349,24 +360,28 @@ static void gst_warptv_rgb32 (GstVideofilter *videofilter,
*ctptr++ = ((sintable[i + 256] * xw) >> 15);
c += cw;
}
- maxx = width - 2; maxy = height - 2;
+ maxx = width - 2;
+ maxy = height - 2;
for (y = 0; y < height - 1; y++) {
for (x = 0; x < width; x++) {
- i = *distptr++;
- dx = ctable [i + 1] + x;
- dy = ctable [i] + y;
-
- if (dx < 0) dx = 0;
- else if (dx > maxx) dx = maxx;
-
- if (dy < 0) dy = 0;
- else if (dy > maxy) dy = maxy;
- *dest++ = src[warptv->offstable[dy] + dx];
+ i = *distptr++;
+ dx = ctable[i + 1] + x;
+ dy = ctable[i] + y;
+
+ if (dx < 0)
+ dx = 0;
+ else if (dx > maxx)
+ dx = maxx;
+
+ if (dy < 0)
+ dy = 0;
+ else if (dy > maxy)
+ dy = maxy;
+ *dest++ = src[warptv->offstable[dy] + dx];
}
dest += skip;
}
warptv->tval = (warptv->tval + 1) & 511;
}
-