From 7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 14 Mar 2004 22:34:33 +0000 Subject: gst-indent Original commit message from CVS: gst-indent --- gst/videodrop/gstvideodrop.c | 170 ++++++++++++++++++++----------------------- 1 file changed, 78 insertions(+), 92 deletions(-) (limited to 'gst/videodrop/gstvideodrop.c') diff --git a/gst/videodrop/gstvideodrop.c b/gst/videodrop/gstvideodrop.c index 546873f0..6a83fd9d 100644 --- a/gst/videodrop/gstvideodrop.c +++ b/gst/videodrop/gstvideodrop.c @@ -25,63 +25,56 @@ #include /* elementfactory information */ -static GstElementDetails videodrop_details = GST_ELEMENT_DETAILS ( - "Video frame dropper", - "Filter/Effect/Video", - "Re-FPS'es video", - "Ronald Bultje " -); +static GstElementDetails videodrop_details = +GST_ELEMENT_DETAILS ("Video frame dropper", + "Filter/Effect/Video", + "Re-FPS'es video", + "Ronald Bultje "); /* GstVideodrop signals and args */ -enum { +enum +{ /* FILL ME */ LAST_SIGNAL }; -enum { +enum +{ ARG_0, ARG_SPEED - /* FILL ME */ + /* FILL ME */ }; static GstStaticPadTemplate gst_videodrop_src_template = -GST_STATIC_PAD_TEMPLATE ( - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS( - GST_VIDEO_CAPS_YUV("{ YUY2, I420, YV12, YUYV, UYVY }") - ) -); +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ YUY2, I420, YV12, YUYV, UYVY }") + ) + ); static GstStaticPadTemplate gst_videodrop_sink_template = -GST_STATIC_PAD_TEMPLATE ( - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS( - GST_VIDEO_CAPS_YUV("{ YUY2, I420, YV12, YUYV, UYVY }") - ) -); - -static void gst_videodrop_base_init (gpointer g_class); -static void gst_videodrop_class_init (GstVideodropClass *klass); -static void gst_videodrop_init (GstVideodrop *videodrop); -static void gst_videodrop_chain (GstPad *pad, GstData *_data); - -static void gst_videodrop_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gst_videodrop_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ YUY2, I420, YV12, YUYV, UYVY }") + ) + ); -static GstElementStateReturn - gst_videodrop_change_state (GstElement *element); +static void gst_videodrop_base_init (gpointer g_class); +static void gst_videodrop_class_init (GstVideodropClass * klass); +static void gst_videodrop_init (GstVideodrop * videodrop); +static void gst_videodrop_chain (GstPad * pad, GstData * _data); + +static void gst_videodrop_set_property (GObject * object, + guint prop_id, const GValue * value, GParamSpec * pspec); +static void gst_videodrop_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec); + +static GstElementStateReturn gst_videodrop_change_state (GstElement * element); static GstElementClass *parent_class = NULL; + /*static guint gst_videodrop_signals[LAST_SIGNAL] = { 0 }; */ GType @@ -103,8 +96,7 @@ gst_videodrop_get_type (void) }; videodrop_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstVideodrop", - &videodrop_info, 0); + "GstVideodrop", &videodrop_info, 0); } return videodrop_type; @@ -123,7 +115,7 @@ gst_videodrop_base_init (gpointer g_class) gst_static_pad_template_get (&gst_videodrop_src_template)); } static void -gst_videodrop_class_init (GstVideodropClass *klass) +gst_videodrop_class_init (GstVideodropClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); @@ -131,9 +123,8 @@ gst_videodrop_class_init (GstVideodropClass *klass) parent_class = g_type_class_peek_parent (klass); g_object_class_install_property (object_class, ARG_SPEED, - g_param_spec_float ("speed", "Speed", - "Output speed (relative to input)", - 0.01, 100, 1, G_PARAM_READWRITE)); + g_param_spec_float ("speed", "Speed", + "Output speed (relative to input)", 0.01, 100, 1, G_PARAM_READWRITE)); object_class->set_property = gst_videodrop_set_property; object_class->get_property = gst_videodrop_get_property; @@ -142,7 +133,7 @@ gst_videodrop_class_init (GstVideodropClass *klass) } static GstCaps * -gst_videodrop_getcaps (GstPad *pad) +gst_videodrop_getcaps (GstPad * pad) { GstVideodrop *videodrop; GstPad *otherpad; @@ -153,21 +144,21 @@ gst_videodrop_getcaps (GstPad *pad) videodrop = GST_VIDEODROP (gst_pad_get_parent (pad)); otherpad = (pad == videodrop->srcpad) ? videodrop->sinkpad : - videodrop->srcpad; + videodrop->srcpad; caps = gst_pad_get_allowed_caps (otherpad); - for (i=0;isrcpad) ? videodrop->sinkpad : - videodrop->srcpad; + videodrop->srcpad; structure = gst_caps_get_structure (caps, 0); ret = gst_structure_get_double (structure, "framerate", &fps); - if (!ret) return GST_PAD_LINK_REFUSED; + if (!ret) + return GST_PAD_LINK_REFUSED; if (gst_pad_is_negotiated (otherpad)) { othercaps = gst_caps_copy (caps); @@ -194,8 +186,7 @@ gst_videodrop_link (GstPad *pad, const GstCaps *caps) } else { otherfps = videodrop->to_fps; } - gst_caps_set_simple (othercaps, - "framerate", G_TYPE_DOUBLE, otherfps, NULL); + gst_caps_set_simple (othercaps, "framerate", G_TYPE_DOUBLE, otherfps, NULL); link_ret = gst_pad_try_set_caps (otherpad, othercaps); if (GST_PAD_LINK_FAILED (link_ret)) { return link_ret; @@ -212,21 +203,23 @@ gst_videodrop_link (GstPad *pad, const GstCaps *caps) } static void -gst_videodrop_init (GstVideodrop *videodrop) +gst_videodrop_init (GstVideodrop * videodrop) { GST_FLAG_SET (videodrop, GST_ELEMENT_EVENT_AWARE); - + GST_DEBUG ("gst_videodrop_init"); - videodrop->sinkpad = gst_pad_new_from_template ( - gst_static_pad_template_get (&gst_videodrop_sink_template), "sink"); + videodrop->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get + (&gst_videodrop_sink_template), "sink"); gst_element_add_pad (GST_ELEMENT (videodrop), videodrop->sinkpad); gst_pad_set_chain_function (videodrop->sinkpad, gst_videodrop_chain); gst_pad_set_getcaps_function (videodrop->sinkpad, gst_videodrop_getcaps); gst_pad_set_link_function (videodrop->sinkpad, gst_videodrop_link); - videodrop->srcpad = gst_pad_new_from_template ( - gst_static_pad_template_get (&gst_videodrop_src_template), "src"); - gst_element_add_pad (GST_ELEMENT(videodrop), videodrop->srcpad); + videodrop->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get + (&gst_videodrop_src_template), "src"); + gst_element_add_pad (GST_ELEMENT (videodrop), videodrop->srcpad); gst_pad_set_getcaps_function (videodrop->srcpad, gst_videodrop_getcaps); gst_pad_set_link_function (videodrop->srcpad, gst_videodrop_link); @@ -237,7 +230,7 @@ gst_videodrop_init (GstVideodrop *videodrop) } static void -gst_videodrop_chain (GstPad *pad, GstData *data) +gst_videodrop_chain (GstPad * pad, GstData * data) { GstVideodrop *videodrop = GST_VIDEODROP (gst_pad_get_parent (pad)); GstBuffer *buf; @@ -249,12 +242,13 @@ gst_videodrop_chain (GstPad *pad, GstData *data) /* since we rely on timestamps of the source, we need to handle * changes in time carefully. */ gint64 time; + if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) { - videodrop->time_adjust = time; + videodrop->time_adjust = time; videodrop->total = videodrop->pass = 0; } else { - GST_ELEMENT_ERROR (videodrop, STREAM, TOO_LAZY, (NULL), - ("Received discont, but no time information")); + GST_ELEMENT_ERROR (videodrop, STREAM, TOO_LAZY, (NULL), + ("Received discont, but no time information")); gst_event_unref (event); return; } @@ -268,7 +262,8 @@ gst_videodrop_chain (GstPad *pad, GstData *data) videodrop->total++; while (((GST_BUFFER_TIMESTAMP (buf) - videodrop->time_adjust) * - videodrop->to_fps * videodrop->speed / GST_SECOND) >= videodrop->pass) { + videodrop->to_fps * videodrop->speed / GST_SECOND) >= + videodrop->pass) { /* since we write to the struct (time/duration), we need a new struct, * but we don't want to copy around data - a subbuffer is the easiest * way to accomplish that... */ @@ -276,7 +271,7 @@ gst_videodrop_chain (GstPad *pad, GstData *data) /* adjust timestamp/duration and push forward */ GST_BUFFER_TIMESTAMP (copy) = videodrop->time_adjust / videodrop->speed + - GST_SECOND * videodrop->pass / videodrop->to_fps; + GST_SECOND * videodrop->pass / videodrop->to_fps; GST_BUFFER_DURATION (copy) = GST_SECOND / videodrop->to_fps; gst_pad_push (videodrop->srcpad, GST_DATA (copy)); @@ -287,10 +282,8 @@ gst_videodrop_chain (GstPad *pad, GstData *data) } static void -gst_videodrop_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +gst_videodrop_set_property (GObject * object, + guint prop_id, const GValue * value, GParamSpec * pspec) { GstVideodrop *videodrop = GST_VIDEODROP (object); @@ -305,10 +298,8 @@ gst_videodrop_set_property (GObject *object, } static void -gst_videodrop_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +gst_videodrop_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec) { GstVideodrop *videodrop = GST_VIDEODROP (object); @@ -323,7 +314,7 @@ gst_videodrop_get_property (GObject *object, } static GstElementStateReturn -gst_videodrop_change_state (GstElement *element) +gst_videodrop_change_state (GstElement * element) { GstVideodrop *videodrop = GST_VIDEODROP (element); @@ -344,19 +335,14 @@ gst_videodrop_change_state (GstElement *element) } static gboolean -plugin_init (GstPlugin *plugin) +plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "videodrop", GST_RANK_NONE, GST_TYPE_VIDEODROP); + return gst_element_register (plugin, "videodrop", GST_RANK_NONE, + GST_TYPE_VIDEODROP); } -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "videodrop", - "Re-FPS'es video", - plugin_init, - VERSION, - GST_LICENSE, - GST_PACKAGE, - GST_ORIGIN -) +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "videodrop", + "Re-FPS'es video", + plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN) -- cgit v1.2.1