summaryrefslogtreecommitdiffstats
path: root/gst/videofilter/gstvideoflip.c
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/gstvideoflip.c
parent1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff)
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/videofilter/gstvideoflip.c')
-rw-r--r--gst/videofilter/gstvideoflip.c272
1 files changed, 137 insertions, 135 deletions
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;
}
}
-
-