diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-13 15:27:01 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-13 15:27:01 +0000 |
commit | a967370df58163d7f5219a285a8331b3f79930a3 (patch) | |
tree | d6c4b98d58ce96273f7e99f836d4bbef0e7e2cce /plugins/elements/gstfakesink.c | |
parent | b8edc59edb7c71b3edcc9d51bf6f6d145e60df91 (diff) |
gst-indent run on core
Original commit message from CVS:
gst-indent run on core
Diffstat (limited to 'plugins/elements/gstfakesink.c')
-rw-r--r-- | plugins/elements/gstfakesink.c | 212 |
1 files changed, 112 insertions, 100 deletions
diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 4541f6274..78ecac6cf 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -31,22 +31,22 @@ GST_DEBUG_CATEGORY_STATIC (gst_fakesink_debug); #define GST_CAT_DEFAULT gst_fakesink_debug -GstElementDetails gst_fakesink_details = GST_ELEMENT_DETAILS ( - "Fake Sink", - "Sink", - "Black hole for data", - "Erik Walthinsen <omega@cse.ogi.edu>" -); +GstElementDetails gst_fakesink_details = GST_ELEMENT_DETAILS ("Fake Sink", + "Sink", + "Black hole for data", + "Erik Walthinsen <omega@cse.ogi.edu>"); /* FakeSink signals and args */ -enum { +enum +{ /* FILL ME */ SIGNAL_HANDOFF, LAST_SIGNAL }; -enum { +enum +{ ARG_0, ARG_STATE_ERROR, ARG_NUM_SINKS, @@ -57,12 +57,10 @@ enum { ARG_LAST_MESSAGE, }; -GstStaticPadTemplate fakesink_sink_template = GST_STATIC_PAD_TEMPLATE ( - "sink%d", - GST_PAD_SINK, - GST_PAD_REQUEST, - GST_STATIC_CAPS_ANY -); +GstStaticPadTemplate fakesink_sink_template = GST_STATIC_PAD_TEMPLATE ("sink%d", + GST_PAD_SINK, + GST_PAD_REQUEST, + GST_STATIC_CAPS_ANY); #define GST_TYPE_FAKESINK_STATE_ERROR (gst_fakesink_state_error_get_type()) static GType @@ -70,17 +68,24 @@ gst_fakesink_state_error_get_type (void) { static GType fakesink_state_error_type = 0; static GEnumValue fakesink_state_error[] = { - { FAKESINK_STATE_ERROR_NONE, "0", "No state change errors"}, - { FAKESINK_STATE_ERROR_NULL_READY, "1", "Fail state change from NULL to READY"}, - { FAKESINK_STATE_ERROR_READY_PAUSED, "2", "Fail state change from READY to PAUSED"}, - { FAKESINK_STATE_ERROR_PAUSED_PLAYING, "3", "Fail state change from PAUSED to PLAYING"}, - { FAKESINK_STATE_ERROR_PLAYING_PAUSED, "4", "Fail state change from PLAYING to PAUSED"}, - { FAKESINK_STATE_ERROR_PAUSED_READY , "5", "Fail state change from PAUSED to READY"}, - { FAKESINK_STATE_ERROR_READY_NULL , "6", "Fail state change from READY to NULL"}, + {FAKESINK_STATE_ERROR_NONE, "0", "No state change errors"}, + {FAKESINK_STATE_ERROR_NULL_READY, "1", + "Fail state change from NULL to READY"}, + {FAKESINK_STATE_ERROR_READY_PAUSED, "2", + "Fail state change from READY to PAUSED"}, + {FAKESINK_STATE_ERROR_PAUSED_PLAYING, "3", + "Fail state change from PAUSED to PLAYING"}, + {FAKESINK_STATE_ERROR_PLAYING_PAUSED, "4", + "Fail state change from PLAYING to PAUSED"}, + {FAKESINK_STATE_ERROR_PAUSED_READY, "5", + "Fail state change from PAUSED to READY"}, + {FAKESINK_STATE_ERROR_READY_NULL, "6", + "Fail state change from READY to NULL"}, {0, NULL, NULL}, }; if (!fakesink_state_error_type) { - fakesink_state_error_type = g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error); + fakesink_state_error_type = + g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error); } return fakesink_state_error_type; } @@ -88,82 +93,86 @@ gst_fakesink_state_error_get_type (void) #define _do_init(bla) \ GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element"); -GST_BOILERPLATE_FULL (GstFakeSink, gst_fakesink, GstElement, GST_TYPE_ELEMENT, _do_init); +GST_BOILERPLATE_FULL (GstFakeSink, gst_fakesink, GstElement, GST_TYPE_ELEMENT, + _do_init); -static void gst_fakesink_set_clock (GstElement *element, GstClock *clock); -static GstPad* gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const - gchar *unused); +static void gst_fakesink_set_clock (GstElement * element, GstClock * clock); +static GstPad *gst_fakesink_request_new_pad (GstElement * element, + GstPadTemplate * templ, const gchar * unused); -static void gst_fakesink_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec); -static void gst_fakesink_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec); +static void gst_fakesink_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_fakesink_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); -static GstElementStateReturn - gst_fakesink_change_state (GstElement *element); +static GstElementStateReturn gst_fakesink_change_state (GstElement * element); -static void gst_fakesink_chain (GstPad *pad, GstData *_data); +static void gst_fakesink_chain (GstPad * pad, GstData * _data); static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 }; static void gst_fakesink_base_init (gpointer g_class) { - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_set_details (gstelement_class, &gst_fakesink_details); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&fakesink_sink_template)); } static void -gst_fakesink_class_init (GstFakeSinkClass *klass) +gst_fakesink_class_init (GstFakeSinkClass * 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_NUM_SINKS, - g_param_spec_int ("num_sinks", "Number of sinks", "The number of sinkpads", - 1, G_MAXINT, 1, G_PARAM_READABLE)); + g_param_spec_int ("num_sinks", "Number of sinks", + "The number of sinkpads", 1, G_MAXINT, 1, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STATE_ERROR, - g_param_spec_enum ("state_error", "State Error", "Generate a state change error", - GST_TYPE_FAKESINK_STATE_ERROR, FAKESINK_STATE_ERROR_NONE, G_PARAM_READWRITE)); + g_param_spec_enum ("state_error", "State Error", + "Generate a state change error", GST_TYPE_FAKESINK_STATE_ERROR, + FAKESINK_STATE_ERROR_NONE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, - g_param_spec_string ("last_message", "Last Message", "The message describing current status", - NULL, G_PARAM_READABLE)); + g_param_spec_string ("last_message", "Last Message", + "The message describing current status", NULL, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, - g_param_spec_boolean ("sync", "Sync", "Sync on the clock", - FALSE, G_PARAM_READWRITE)); + g_param_spec_boolean ("sync", "Sync", "Sync on the clock", FALSE, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_HANDOFFS, - g_param_spec_boolean ("signal-handoffs", "Signal handoffs", "Send a signal before unreffing the buffer", - FALSE, G_PARAM_READWRITE)); + g_param_spec_boolean ("signal-handoffs", "Signal handoffs", + "Send a signal before unreffing the buffer", FALSE, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "Silent", "Don't produce last_message events", - FALSE, G_PARAM_READWRITE)); + g_param_spec_boolean ("silent", "Silent", + "Don't produce last_message events", FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP, - g_param_spec_boolean ("dump", "Dump", "Dump received bytes to stdout", - FALSE, G_PARAM_READWRITE)); + g_param_spec_boolean ("dump", "Dump", "Dump received bytes to stdout", + FALSE, G_PARAM_READWRITE)); gst_fakesink_signals[SIGNAL_HANDOFF] = - g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL, - gst_marshal_VOID__POINTER_OBJECT, G_TYPE_NONE, 2, - GST_TYPE_BUFFER, GST_TYPE_PAD); + g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL, + gst_marshal_VOID__POINTER_OBJECT, G_TYPE_NONE, 2, + GST_TYPE_BUFFER, GST_TYPE_PAD); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property); - gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_fakesink_request_new_pad); - gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_fakesink_set_clock); - gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_fakesink_change_state); + gstelement_class->request_new_pad = + GST_DEBUG_FUNCPTR (gst_fakesink_request_new_pad); + gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_fakesink_set_clock); + gstelement_class->change_state = + GST_DEBUG_FUNCPTR (gst_fakesink_change_state); } -static void -gst_fakesink_init (GstFakeSink *fakesink) +static void +gst_fakesink_init (GstFakeSink * fakesink) { GstPad *pad; @@ -182,17 +191,18 @@ gst_fakesink_init (GstFakeSink *fakesink) } static void -gst_fakesink_set_clock (GstElement *element, GstClock *clock) -{ +gst_fakesink_set_clock (GstElement * element, GstClock * clock) +{ GstFakeSink *sink; sink = GST_FAKESINK (element); sink->clock = clock; -} +} -static GstPad* -gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused) +static GstPad * +gst_fakesink_request_new_pad (GstElement * element, GstPadTemplate * templ, + const gchar * unused) { gchar *name; GstPad *sinkpad; @@ -212,14 +222,15 @@ gst_fakesink_request_new_pad (GstElement *element, GstPadTemplate *templ, const sinkpad = gst_pad_new_from_template (templ, name); g_free (name); gst_pad_set_chain_function (sinkpad, GST_DEBUG_FUNCPTR (gst_fakesink_chain)); - + gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad); return sinkpad; } static void -gst_fakesink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +gst_fakesink_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) { GstFakeSink *sink; @@ -247,16 +258,17 @@ gst_fakesink_set_property (GObject *object, guint prop_id, const GValue *value, } } -static void -gst_fakesink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +static void +gst_fakesink_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) { GstFakeSink *sink; - + /* it's not null if we got it, but it might not be ours */ g_return_if_fail (GST_IS_FAKESINK (object)); - + sink = GST_FAKESINK (object); - + switch (prop_id) { case ARG_NUM_SINKS: g_value_set_int (value, GST_ELEMENT (sink)->numsinkpads); @@ -285,8 +297,8 @@ gst_fakesink_get_property (GObject *object, guint prop_id, GValue *value, GParam } } -static void -gst_fakesink_chain (GstPad *pad, GstData *_data) +static void +gst_fakesink_chain (GstPad * pad, GstData * _data) { GstBuffer *buf = GST_BUFFER (_data); GstFakeSink *fakesink; @@ -299,51 +311,52 @@ gst_fakesink_chain (GstPad *pad, GstData *_data) if (GST_IS_EVENT (buf)) { GstEvent *event = GST_EVENT (buf); - - if (!fakesink->silent) { + + if (!fakesink->silent) { g_free (fakesink->last_message); - fakesink->last_message = g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p", - GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event); - + fakesink->last_message = + g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p", + GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event); + g_object_notify (G_OBJECT (fakesink), "last_message"); } - + switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: - if (fakesink->sync && fakesink->clock) { - gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value; - gst_element_set_time (GST_ELEMENT (fakesink), value); + if (fakesink->sync && fakesink->clock) { + gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value; + + gst_element_set_time (GST_ELEMENT (fakesink), value); } default: gst_pad_event_default (pad, event); - break; + break; } return; } - if (fakesink->sync && fakesink->clock) { + if (fakesink->sync && fakesink->clock) { gst_element_wait (GST_ELEMENT (fakesink), GST_BUFFER_TIMESTAMP (buf)); } - if (!fakesink->silent) { + if (!fakesink->silent) { g_free (fakesink->last_message); - fakesink->last_message = g_strdup_printf ("chain ******* (%s:%s)< (%d bytes, timestamp: %" - G_GINT64_FORMAT ", duration: %" - G_GINT64_FORMAT ", offset: %" - G_GINT64_FORMAT ", flags: %d) %p", - GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), - GST_BUFFER_TIMESTAMP (buf), - GST_BUFFER_DURATION (buf), - GST_BUFFER_OFFSET (buf), - GST_BUFFER_FLAGS (buf), buf); - + fakesink->last_message = + g_strdup_printf ("chain ******* (%s:%s)< (%d bytes, timestamp: %" + G_GINT64_FORMAT ", duration: %" G_GINT64_FORMAT ", offset: %" + G_GINT64_FORMAT ", flags: %d) %p", GST_DEBUG_PAD_NAME (pad), + GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), + GST_BUFFER_DURATION (buf), GST_BUFFER_OFFSET (buf), + GST_BUFFER_FLAGS (buf), buf); + g_object_notify (G_OBJECT (fakesink), "last_message"); } if (fakesink->signal_handoffs) - g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0, buf, pad); + g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0, + buf, pad); if (fakesink->dump) { gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); @@ -353,7 +366,7 @@ gst_fakesink_chain (GstPad *pad, GstData *_data) } static GstElementStateReturn -gst_fakesink_change_state (GstElement *element) +gst_fakesink_change_state (GstElement * element) { GstFakeSink *fakesink = GST_FAKESINK (element); @@ -395,4 +408,3 @@ error: GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL)); return GST_STATE_FAILURE; } - |