diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
commit | 5d25c00e4b613b9cdf2c04fa3a68dffa03834a68 (patch) | |
tree | 74a5b1eaf3a324b520e64e87404fd0b3018a7829 /gst/videoflip | |
parent | 1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff) |
gst-indent
Original commit message from CVS:
gst-indent
Diffstat (limited to 'gst/videoflip')
-rw-r--r-- | gst/videoflip/gstvideoflip.c | 264 | ||||
-rw-r--r-- | gst/videoflip/gstvideoflip.h | 20 | ||||
-rw-r--r-- | gst/videoflip/videoflip.c | 138 | ||||
-rw-r--r-- | gst/videoflip/videoflip.h | 24 |
4 files changed, 225 insertions, 221 deletions
diff --git a/gst/videoflip/gstvideoflip.c b/gst/videoflip/gstvideoflip.c index 0f20f47b..9c7816de 100644 --- a/gst/videoflip/gstvideoflip.c +++ b/gst/videoflip/gstvideoflip.c @@ -28,34 +28,37 @@ /* elementfactory information */ -static GstElementDetails videoflip_details = GST_ELEMENT_DETAILS ( - "Video scaler", - "Filter/Effect/Video", - "Resizes video", - "Wim Taymans <wim.taymans@chello.be>" -); +static GstElementDetails videoflip_details = +GST_ELEMENT_DETAILS ("Video scaler", + "Filter/Effect/Video", + "Resizes video", + "Wim Taymans <wim.taymans@chello.be>"); /* 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 (GstVideoflipClass *klass); -static void gst_videoflip_init (GstVideoflip *videoflip); +static void gst_videoflip_base_init (gpointer g_class); +static void gst_videoflip_class_init (GstVideoflipClass * klass); +static void gst_videoflip_init (GstVideoflip * videoflip); -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_chain (GstPad *pad, GstData *_data); -static GstCaps * gst_videoflip_get_capslist(void); +static void gst_videoflip_chain (GstPad * pad, GstData * _data); +static GstCaps *gst_videoflip_get_capslist (void); static GstElementClass *parent_class = NULL; @@ -63,50 +66,50 @@ static GstElementClass *parent_class = NULL; #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 right 90 degrees" }, - { GST_VIDEOFLIP_METHOD_180, "2", "Rotate 180 degrees" }, - { GST_VIDEOFLIP_METHOD_90L, "3", "Rotate left 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 right 90 degrees"}, + {GST_VIDEOFLIP_METHOD_180, "2", "Rotate 180 degrees"}, + {GST_VIDEOFLIP_METHOD_90L, "3", "Rotate left 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", + if (!videoflip_method_type) { + videoflip_method_type = g_enum_register_static ("GstVideoflipMethod", videoflip_methods); } return videoflip_method_type; } static GstPadTemplate * -gst_videoflip_src_template_factory(void) +gst_videoflip_src_template_factory (void) { /* well, actually RGB too, but since there's no RGB format anyway */ GstCaps *caps = gst_caps_from_string ("video/x-raw-yuv, " - "width = (int) [ 0, MAX ], " - "height = (int) [ 0, MAX ], " - "framerate = (double) [ 0, MAX ]"); + "width = (int) [ 0, MAX ], " + "height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]"); - caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ()); + caps = gst_caps_intersect (caps, gst_videoflip_get_capslist ()); return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps); } static GstPadTemplate * -gst_videoflip_sink_template_factory(void) +gst_videoflip_sink_template_factory (void) { GstCaps *caps = gst_caps_from_string ("video/x-raw-yuv, " - "width = (int) [ 0, MAX ], " - "height = (int) [ 0, MAX ], " - "framerate = (double) [ 0, MAX ]"); + "width = (int) [ 0, MAX ], " + "height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]"); - caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ()); + caps = gst_caps_intersect (caps, gst_videoflip_get_capslist ()); return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps); } @@ -118,17 +121,19 @@ gst_videoflip_get_type (void) if (!videoflip_type) { static const GTypeInfo videoflip_info = { - sizeof(GstVideoflipClass), + sizeof (GstVideoflipClass), gst_videoflip_base_init, NULL, - (GClassInitFunc)gst_videoflip_class_init, + (GClassInitFunc) gst_videoflip_class_init, NULL, NULL, - sizeof(GstVideoflip), + sizeof (GstVideoflip), 0, - (GInstanceInitFunc)gst_videoflip_init, + (GInstanceInitFunc) gst_videoflip_init, }; - videoflip_type = g_type_register_static(GST_TYPE_ELEMENT, "GstVideoflip", &videoflip_info, 0); + videoflip_type = + g_type_register_static (GST_TYPE_ELEMENT, "GstVideoflip", + &videoflip_info, 0); } return videoflip_type; } @@ -146,20 +151,20 @@ gst_videoflip_base_init (gpointer g_class) gst_videoflip_src_template_factory ()); } static void -gst_videoflip_class_init (GstVideoflipClass *klass) +gst_videoflip_class_init (GstVideoflipClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; - gobject_class = (GObjectClass*)klass; - gstelement_class = (GstElementClass*)klass; + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; - g_object_class_install_property(G_OBJECT_CLASS(klass), 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 (G_OBJECT_CLASS (klass), ARG_METHOD, + g_param_spec_enum ("method", "method", "method", + GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R, + G_PARAM_READWRITE)); - parent_class = g_type_class_ref(GST_TYPE_ELEMENT); + parent_class = g_type_class_ref (GST_TYPE_ELEMENT); gobject_class->set_property = gst_videoflip_set_property; gobject_class->get_property = gst_videoflip_get_property; @@ -167,14 +172,14 @@ gst_videoflip_class_init (GstVideoflipClass *klass) } static GstCaps * -gst_videoflip_get_capslist(void) +gst_videoflip_get_capslist (void) { GstCaps *caps; GstStructure *structure; int i; caps = gst_caps_new_empty (); - for(i=0;i<videoflip_n_formats;i++){ + for (i = 0; i < videoflip_n_formats; i++) { structure = videoflip_get_cap (videoflip_formats + i); gst_caps_append_structure (caps, structure); } @@ -183,7 +188,7 @@ gst_videoflip_get_capslist(void) } static GstCaps * -gst_videoflip_sink_getcaps (GstPad *pad) +gst_videoflip_sink_getcaps (GstPad * pad) { GstVideoflip *videoflip; GstCaps *capslist = NULL; @@ -194,11 +199,11 @@ gst_videoflip_sink_getcaps (GstPad *pad) GST_DEBUG ("gst_videoflip_sink_getcaps"); videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad)); - + /* get list of peer's caps */ - if(pad == videoflip->srcpad){ + if (pad == videoflip->srcpad) { peercaps = gst_pad_get_allowed_caps (videoflip->sinkpad); - }else{ + } else { peercaps = gst_pad_get_allowed_caps (videoflip->srcpad); } @@ -206,21 +211,20 @@ gst_videoflip_sink_getcaps (GstPad *pad) * doesn't understand. */ /* Look through our list of caps and find those that match with * the peer's formats. Create a list of them. */ - for(i=0;i<videoflip_n_formats;i++){ - GstCaps *fromcaps = gst_caps_new_full(videoflip_get_cap( - videoflip_formats + i), NULL); - if(gst_caps_is_always_compatible(fromcaps, peercaps)){ - gst_caps_append(capslist, fromcaps); + for (i = 0; i < videoflip_n_formats; i++) { + GstCaps *fromcaps = + gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL); + if (gst_caps_is_always_compatible (fromcaps, peercaps)) { + gst_caps_append (capslist, fromcaps); } } gst_caps_free (peercaps); sizecaps = gst_caps_from_string ("video/x-raw-yuv, " - "width = (int) [ 0, MAX ], " - "height = (int) [ 0, MAX ], " - "framerate = (double) [ 0, MAX ]"); + "width = (int) [ 0, MAX ], " + "height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]"); - caps = gst_caps_intersect(capslist, sizecaps); + caps = gst_caps_intersect (capslist, sizecaps); gst_caps_free (sizecaps); return caps; @@ -228,7 +232,7 @@ gst_videoflip_sink_getcaps (GstPad *pad) static GstPadLinkReturn -gst_videoflip_src_link (GstPad *pad, const GstCaps *caps) +gst_videoflip_src_link (GstPad * pad, const GstCaps * caps) { GstVideoflip *videoflip; GstStructure *structure; @@ -236,22 +240,23 @@ gst_videoflip_src_link (GstPad *pad, const GstCaps *caps) GST_DEBUG ("gst_videoflip_src_link"); videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad)); - + structure = gst_caps_get_structure (caps, 0); videoflip->format = videoflip_find_by_caps (caps); - g_return_val_if_fail(videoflip->format, GST_PAD_LINK_REFUSED); + g_return_val_if_fail (videoflip->format, GST_PAD_LINK_REFUSED); ret = gst_structure_get_int (structure, "width", &videoflip->to_width); ret &= gst_structure_get_int (structure, "height", &videoflip->to_height); - if (!ret) return GST_PAD_LINK_REFUSED; + if (!ret) + return GST_PAD_LINK_REFUSED; return GST_PAD_LINK_OK; } static GstPadLinkReturn -gst_videoflip_sink_link (GstPad *pad, const GstCaps *caps) +gst_videoflip_sink_link (GstPad * pad, const GstCaps * caps) { GstVideoflip *videoflip; GstStructure *structure; @@ -259,37 +264,37 @@ gst_videoflip_sink_link (GstPad *pad, const GstCaps *caps) GST_DEBUG ("gst_videoflip_sink_link"); videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad)); - + structure = gst_caps_get_structure (caps, 0); videoflip->format = videoflip_find_by_caps (caps); - g_return_val_if_fail(videoflip->format, GST_PAD_LINK_REFUSED); + g_return_val_if_fail (videoflip->format, GST_PAD_LINK_REFUSED); ret = gst_structure_get_int (structure, "width", &videoflip->from_width); ret &= gst_structure_get_int (structure, "height", &videoflip->from_height); - if (!ret) return GST_PAD_LINK_REFUSED; + if (!ret) + return GST_PAD_LINK_REFUSED; return GST_PAD_LINK_OK; } static void -gst_videoflip_init (GstVideoflip *videoflip) +gst_videoflip_init (GstVideoflip * videoflip) { GST_DEBUG ("gst_videoflip_init"); - videoflip->sinkpad = gst_pad_new_from_template ( - gst_videoflip_sink_template_factory(), - "sink"); - gst_element_add_pad(GST_ELEMENT(videoflip),videoflip->sinkpad); - gst_pad_set_chain_function(videoflip->sinkpad,gst_videoflip_chain); - gst_pad_set_link_function(videoflip->sinkpad,gst_videoflip_sink_link); - gst_pad_set_getcaps_function(videoflip->sinkpad,gst_videoflip_sink_getcaps); - - videoflip->srcpad = gst_pad_new_from_template ( - gst_videoflip_src_template_factory(), - "src"); - gst_element_add_pad(GST_ELEMENT(videoflip),videoflip->srcpad); - gst_pad_set_link_function(videoflip->srcpad,gst_videoflip_src_link); + videoflip->sinkpad = + gst_pad_new_from_template (gst_videoflip_sink_template_factory (), + "sink"); + gst_element_add_pad (GST_ELEMENT (videoflip), videoflip->sinkpad); + gst_pad_set_chain_function (videoflip->sinkpad, gst_videoflip_chain); + gst_pad_set_link_function (videoflip->sinkpad, gst_videoflip_sink_link); + gst_pad_set_getcaps_function (videoflip->sinkpad, gst_videoflip_sink_getcaps); + + videoflip->srcpad = + gst_pad_new_from_template (gst_videoflip_src_template_factory (), "src"); + gst_element_add_pad (GST_ELEMENT (videoflip), videoflip->srcpad); + gst_pad_set_link_function (videoflip->srcpad, gst_videoflip_src_link); //gst_pad_set_getcaps_function(videoflip->srcpad,gst_videoflip_getcaps); videoflip->inited = FALSE; @@ -298,7 +303,7 @@ gst_videoflip_init (GstVideoflip *videoflip) static void -gst_videoflip_chain (GstPad *pad, GstData *_data) +gst_videoflip_chain (GstPad * pad, GstData * _data) { GstBuffer *buf = GST_BUFFER (_data); GstVideoflip *videoflip; @@ -315,54 +320,54 @@ gst_videoflip_chain (GstPad *pad, GstData *_data) videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad)); g_return_if_fail (videoflip->inited); - data = GST_BUFFER_DATA(buf); - size = GST_BUFFER_SIZE(buf); + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); - if(videoflip->passthru){ - gst_pad_push(videoflip->srcpad, GST_DATA (buf)); + if (videoflip->passthru) { + gst_pad_push (videoflip->srcpad, GST_DATA (buf)); return; } - GST_DEBUG ("gst_videoflip_chain: got buffer of %ld bytes in '%s'",size, - GST_OBJECT_NAME (videoflip)); - - GST_DEBUG ("size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d", - size, - videoflip->from_width, videoflip->from_height, - videoflip->to_width, videoflip->to_height, - size, videoflip->from_buf_size, - videoflip->to_buf_size); + GST_DEBUG ("gst_videoflip_chain: got buffer of %ld bytes in '%s'", size, + GST_OBJECT_NAME (videoflip)); + + GST_DEBUG + ("size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d", + size, videoflip->from_width, videoflip->from_height, videoflip->to_width, + videoflip->to_height, size, videoflip->from_buf_size, + videoflip->to_buf_size); g_return_if_fail (size == videoflip->from_buf_size); - outbuf = gst_buffer_new(); + outbuf = gst_buffer_new (); /* FIXME: handle bufferpools */ - GST_BUFFER_SIZE(outbuf) = videoflip->to_buf_size; - GST_BUFFER_DATA(outbuf) = g_malloc (videoflip->to_buf_size); - GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf); + GST_BUFFER_SIZE (outbuf) = videoflip->to_buf_size; + GST_BUFFER_DATA (outbuf) = g_malloc (videoflip->to_buf_size); + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); - g_return_if_fail(videoflip->format); - GST_DEBUG ("format %s",videoflip->format->fourcc); - g_return_if_fail(videoflip->format->scale); + g_return_if_fail (videoflip->format); + GST_DEBUG ("format %s", videoflip->format->fourcc); + g_return_if_fail (videoflip->format->scale); - videoflip->format->scale(videoflip, GST_BUFFER_DATA(outbuf), data); + videoflip->format->scale (videoflip, GST_BUFFER_DATA (outbuf), data); - GST_DEBUG ("gst_videoflip_chain: pushing buffer of %d bytes in '%s'",GST_BUFFER_SIZE(outbuf), - GST_OBJECT_NAME (videoflip)); + GST_DEBUG ("gst_videoflip_chain: pushing buffer of %d bytes in '%s'", + GST_BUFFER_SIZE (outbuf), GST_OBJECT_NAME (videoflip)); - gst_pad_push(videoflip->srcpad, GST_DATA (outbuf)); + gst_pad_push (videoflip->srcpad, GST_DATA (outbuf)); - gst_buffer_unref(buf); + gst_buffer_unref (buf); } 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"); switch (prop_id) { @@ -375,13 +380,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: @@ -395,19 +401,13 @@ gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GPara static gboolean -plugin_init (GstPlugin *plugin) +plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "videoflip", GST_RANK_NONE, GST_TYPE_VIDEOFLIP); + return gst_element_register (plugin, "videoflip", GST_RANK_NONE, + GST_TYPE_VIDEOFLIP); } -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "videoflip", - "Resizes video", - plugin_init, - VERSION, - GST_LICENSE, - GST_PACKAGE, - GST_ORIGIN -) +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "videoflip", + "Resizes video", plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN) diff --git a/gst/videoflip/gstvideoflip.h b/gst/videoflip/gstvideoflip.h index b14b0bd3..4d28ac66 100644 --- a/gst/videoflip/gstvideoflip.h +++ b/gst/videoflip/gstvideoflip.h @@ -25,9 +25,8 @@ #include <gst/gst.h> -G_BEGIN_DECLS - -typedef enum { +G_BEGIN_DECLS typedef enum +{ GST_VIDEOFLIP_METHOD_IDENTITY, GST_VIDEOFLIP_METHOD_90R, GST_VIDEOFLIP_METHOD_180, @@ -53,10 +52,11 @@ typedef enum { typedef struct _GstVideoflip GstVideoflip; typedef struct _GstVideoflipClass GstVideoflipClass; -struct _GstVideoflip { +struct _GstVideoflip +{ GstElement element; - GstPad *sinkpad,*srcpad; + GstPad *sinkpad, *srcpad; gboolean force_size; gint forced_width; @@ -78,16 +78,16 @@ struct _GstVideoflip { gint to_buf_size; }; -struct _GstVideoflipClass { +struct _GstVideoflipClass +{ GstElementClass parent_class; }; -GType gst_videoflip_get_type(void); +GType gst_videoflip_get_type (void); + +void gst_videoflip_setup (GstVideoflip *); -void gst_videoflip_setup(GstVideoflip *); #define gst_videoflip_scale(scale, src, dest) (scale)->scale_cc((scale), (src), (dest)) G_END_DECLS - #endif /* __GST_VIDEOFLIP_H__ */ - diff --git a/gst/videoflip/videoflip.c b/gst/videoflip/videoflip.c index 7956165d..16db2102 100644 --- a/gst/videoflip/videoflip.c +++ b/gst/videoflip/videoflip.c @@ -30,40 +30,44 @@ #include "gstvideoflip.h" -static void gst_videoflip_planar411 (GstVideoflip *scale, unsigned char *dest, unsigned char *src); +static void gst_videoflip_planar411 (GstVideoflip * scale, unsigned char *dest, + unsigned char *src); -static void gst_videoflip_flip(GstVideoflip *videoflip, unsigned char *dest, +static void gst_videoflip_flip (GstVideoflip * videoflip, unsigned char *dest, unsigned char *src, int sw, int sh, int dw, int dh); struct videoflip_format_struct videoflip_formats[] = { - /* planar */ - { "YV12", 12, gst_videoflip_planar411, }, - { "I420", 12, gst_videoflip_planar411, }, + /* planar */ + {"YV12", 12, gst_videoflip_planar411,}, + {"I420", 12, gst_videoflip_planar411,}, }; -int videoflip_n_formats = sizeof(videoflip_formats)/sizeof(videoflip_formats[0]); +int videoflip_n_formats = + sizeof (videoflip_formats) / sizeof (videoflip_formats[0]); GstStructure * -videoflip_get_cap(struct videoflip_format_struct *format) +videoflip_get_cap (struct videoflip_format_struct *format) { unsigned int fourcc; GstStructure *structure; - if(format->scale==NULL) + if (format->scale == 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->bpp){ - structure = gst_structure_new("video/x-raw-rgb", + if (format->bpp) { + structure = gst_structure_new ("video/x-raw-rgb", "depth", G_TYPE_INT, format->bpp, "bpp", G_TYPE_INT, format->depth, "endianness", G_TYPE_INT, format->endianness, "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{ - structure = gst_structure_new("video/x-raw-yuv", + } else { + structure = gst_structure_new ("video/x-raw-yuv", "format", GST_TYPE_FOURCC, fourcc, NULL); } @@ -71,24 +75,24 @@ videoflip_get_cap(struct videoflip_format_struct *format) } struct videoflip_format_struct * -videoflip_find_by_caps(const GstCaps *caps) +videoflip_find_by_caps (const GstCaps * caps) { int i; GST_DEBUG ("finding %p", caps); - g_return_val_if_fail(caps != NULL, NULL); + g_return_val_if_fail (caps != NULL, NULL); - for (i = 0; i < videoflip_n_formats; i++){ + for (i = 0; i < videoflip_n_formats; i++) { GstCaps *c; c = gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL); - if(c){ - if(gst_caps_is_always_compatible(caps, c)){ - gst_caps_free(c); - return videoflip_formats + i; + if (c) { + if (gst_caps_is_always_compatible (caps, c)) { + gst_caps_free (c); + return videoflip_formats + i; } - gst_caps_free(c); + gst_caps_free (c); } } @@ -96,13 +100,13 @@ videoflip_find_by_caps(const GstCaps *caps) } void -gst_videoflip_setup (GstVideoflip *videoflip) +gst_videoflip_setup (GstVideoflip * videoflip) { - if(videoflip->from_width==0 || videoflip->from_height==0){ + if (videoflip->from_width == 0 || videoflip->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: @@ -123,11 +127,11 @@ gst_videoflip_setup (GstVideoflip *videoflip) } GST_DEBUG ("format=%p \"%s\" from %dx%d to %dx%d", - videoflip->format, videoflip->format->fourcc, - videoflip->from_width, videoflip->from_height, - videoflip->to_width, videoflip->to_height); + videoflip->format, videoflip->format->fourcc, + videoflip->from_width, videoflip->from_height, + videoflip->to_width, videoflip->to_height); - if(videoflip->method == GST_VIDEOFLIP_METHOD_IDENTITY){ + if (videoflip->method == GST_VIDEOFLIP_METHOD_IDENTITY) { GST_DEBUG ("videoflip: using passthru"); videoflip->passthru = TRUE; videoflip->inited = TRUE; @@ -135,15 +139,16 @@ gst_videoflip_setup (GstVideoflip *videoflip) } videoflip->from_buf_size = (videoflip->from_width * videoflip->from_height - * videoflip->format->depth) / 8; + * videoflip->format->depth) / 8; videoflip->to_buf_size = (videoflip->to_width * videoflip->to_height - * videoflip->format->depth) / 8; + * videoflip->format->depth) / 8; videoflip->inited = TRUE; } static void -gst_videoflip_planar411 (GstVideoflip *scale, unsigned char *dest, unsigned char *src) +gst_videoflip_planar411 (GstVideoflip * scale, unsigned char *dest, + unsigned char *src) { int sw = scale->from_width; int sh = scale->from_height; @@ -152,77 +157,77 @@ gst_videoflip_planar411 (GstVideoflip *scale, unsigned char *dest, unsigned char GST_DEBUG ("videoflip: scaling planar 4:1:1 %dx%d to %dx%d", sw, sh, dw, dh); - gst_videoflip_flip(scale, dest, src, sw, sh, dw, dh); + gst_videoflip_flip (scale, 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(scale, dest, src, sw, sh, dw, dh); + gst_videoflip_flip (scale, dest, src, sw, sh, dw, dh); - src += sw*sh; - dest += dw*dh; + src += sw * sh; + dest += dw * dh; - gst_videoflip_flip(scale, dest, src, sw, sh, dw, dh); + gst_videoflip_flip (scale, 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; @@ -231,4 +236,3 @@ gst_videoflip_flip(GstVideoflip *videoflip, unsigned char *dest, break; } } - diff --git a/gst/videoflip/videoflip.h b/gst/videoflip/videoflip.h index e912fe98..a6bd5fb7 100644 --- a/gst/videoflip/videoflip.h +++ b/gst/videoflip/videoflip.h @@ -23,24 +23,24 @@ #include "gstvideoflip.h" -struct videoflip_format_struct { - char *fourcc; - int depth; - void (*scale)(GstVideoflip *,unsigned char *dest, unsigned char *src); - int bpp; - unsigned int endianness; - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; +struct videoflip_format_struct +{ + char *fourcc; + int depth; + void (*scale) (GstVideoflip *, unsigned char *dest, unsigned char *src); + int bpp; + unsigned int endianness; + unsigned int red_mask; + unsigned int green_mask; + unsigned int blue_mask; }; extern struct videoflip_format_struct videoflip_formats[]; extern int videoflip_n_formats; -GstStructure *videoflip_get_cap(struct videoflip_format_struct *format); +GstStructure *videoflip_get_cap (struct videoflip_format_struct *format); -struct videoflip_format_struct *videoflip_find_by_caps(const GstCaps *caps); +struct videoflip_format_struct *videoflip_find_by_caps (const GstCaps * caps); #endif - |