rtpmux: Re-indent to Gst style
authorOlivier Crête <olivier.crete@collabora.co.uk>
Fri, 20 Feb 2009 22:45:50 +0000 (17:45 -0500)
committerTim-Philipp Müller <tim@centricular.net>
Sun, 16 Dec 2012 16:33:24 +0000 (16:33 +0000)
gst/rtpmanager/gstrtpdtmfmux.c
gst/rtpmanager/gstrtpdtmfmux.h
gst/rtpmanager/gstrtpmux.c
gst/rtpmanager/gstrtpmux.h
gst/rtpmanager/gstrtpmuxer.c

index 6ad5baa..8b4c449 100644 (file)
@@ -93,10 +93,8 @@ static void gst_rtp_dtmf_mux_base_init (gpointer g_class);
 static void gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass);
 static void gst_rtp_dtmf_mux_finalize (GObject * object);
 
-static gboolean gst_rtp_dtmf_mux_sink_event (GstPad * pad,
-    GstEvent * event);
-static GstFlowReturn gst_rtp_dtmf_mux_chain (GstPad * pad,
-    GstBuffer * buffer);
+static gboolean gst_rtp_dtmf_mux_sink_event (GstPad * pad, GstEvent * event);
+static GstFlowReturn gst_rtp_dtmf_mux_chain (GstPad * pad, GstBuffer * buffer);
 
 static GstRTPMuxClass *parent_class = NULL;
 
@@ -147,14 +145,14 @@ gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass)
   parent_class = g_type_class_peek_parent (klass);
 
   gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM] =
-    g_signal_new ("locking", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
-                 G_STRUCT_OFFSET (GstRTPDTMFMuxClass, locking),NULL, NULL,
-                 gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD);
+      g_signal_new ("locking", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (GstRTPDTMFMuxClass, locking), NULL, NULL,
+      gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
 
   gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM] =
-    g_signal_new ("unlocked", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
-                 G_STRUCT_OFFSET (GstRTPDTMFMuxClass, unlocked),NULL, NULL,
-                 gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD);
+      g_signal_new ("unlocked", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (GstRTPDTMFMuxClass, unlocked), NULL, NULL,
+      gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
 
   gobject_class->finalize = gst_rtp_dtmf_mux_finalize;
   gstrtpmux_class->chain_func = gst_rtp_dtmf_mux_chain;
@@ -202,45 +200,42 @@ gst_rtp_dtmf_mux_chain (GstPad * pad, GstBuffer * buffer)
 }
 
 static void
-gst_rtp_dtmf_mux_lock_stream (GstRTPDTMFMux *mux, GstPad * pad)
+gst_rtp_dtmf_mux_lock_stream (GstRTPDTMFMux * mux, GstPad * pad)
 {
   if (mux->special_pad != NULL)
     GST_WARNING_OBJECT (mux,
-            "Stream lock already acquired by pad %s",
-            GST_ELEMENT_NAME (mux->special_pad));
+        "Stream lock already acquired by pad %s",
+        GST_ELEMENT_NAME (mux->special_pad));
 
   else {
     GST_DEBUG_OBJECT (mux,
-            "Stream lock acquired by pad %s",
-            GST_ELEMENT_NAME (pad));
+        "Stream lock acquired by pad %s", GST_ELEMENT_NAME (pad));
     mux->special_pad = gst_object_ref (pad);
   }
 }
 
 static void
-gst_rtp_dtmf_mux_unlock_stream (GstRTPDTMFMux *mux, GstPad * pad)
+gst_rtp_dtmf_mux_unlock_stream (GstRTPDTMFMux * mux, GstPad * pad)
 {
   if (mux->special_pad == NULL)
-    GST_WARNING_OBJECT (mux,
-            "Stream lock not acquired, can't release it");
+    GST_WARNING_OBJECT (mux, "Stream lock not acquired, can't release it");
 
   else if (pad != mux->special_pad)
     GST_WARNING_OBJECT (mux,
-            "pad %s attempted to release Stream lock"
-            " which was acquired by pad %s", GST_ELEMENT_NAME (pad),
-            GST_ELEMENT_NAME (mux->special_pad));
+        "pad %s attempted to release Stream lock"
+        " which was acquired by pad %s", GST_ELEMENT_NAME (pad),
+        GST_ELEMENT_NAME (mux->special_pad));
   else {
     GST_DEBUG_OBJECT (mux,
-            "Stream lock released by pad %s",
-            GST_ELEMENT_NAME (mux->special_pad));
+        "Stream lock released by pad %s", GST_ELEMENT_NAME (mux->special_pad));
     gst_object_unref (mux->special_pad);
     mux->special_pad = NULL;
   }
 }
 
 static gboolean
-gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
-        const GstStructure * event_structure)
+gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux * mux, GstPad * pad,
+    const GstStructure * event_structure)
 {
   gboolean lock;
 
@@ -248,7 +243,8 @@ gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
     return FALSE;
 
   if (lock)
-    g_signal_emit (G_OBJECT (mux), gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM], 0, pad);
+    g_signal_emit (G_OBJECT (mux),
+        gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM], 0, pad);
 
   GST_OBJECT_LOCK (mux);
   if (lock)
@@ -258,14 +254,15 @@ gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
   GST_OBJECT_UNLOCK (mux);
 
   if (!lock)
-    g_signal_emit (G_OBJECT (mux), gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM], 0, pad);
+    g_signal_emit (G_OBJECT (mux),
+        gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM], 0, pad);
 
   return TRUE;
 }
 
 static gboolean
-gst_rtp_dtmf_mux_handle_downstream_event (GstRTPDTMFMux *mux,
-        GstPad * pad, GstEvent * event)
+gst_rtp_dtmf_mux_handle_downstream_event (GstRTPDTMFMux * mux,
+    GstPad * pad, GstEvent * event)
 {
   const GstStructure *structure;
   gboolean ret = FALSE;
index 8a253f1..c73ada4 100644 (file)
 #include <gstrtpmux.h>
 
 G_BEGIN_DECLS
-
 #define GST_TYPE_RTP_DTMF_MUX (gst_rtp_dtmf_mux_get_type())
 #define GST_RTP_DTMF_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_DTMF_MUX, GstRTPDTMFMux))
 #define GST_RTP_DTMF_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_DTMF_MUX, GstRTPDTMFMux))
 #define GST_IS_RTP_DTMF_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_DTMF_MUX))
 #define GST_IS_RTP_DTMF_MUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DTMF_MUX))
-
 typedef struct _GstRTPDTMFMux GstRTPDTMFMux;
 typedef struct _GstRTPDTMFMuxClass GstRTPDTMFMuxClass;
 
@@ -59,13 +57,12 @@ struct _GstRTPDTMFMuxClass
   GstRTPMuxClass parent_class;
 
   /* signals */
-  void (*locking) (GstElement *element, GstPad *pad);
-  void (*unlocked) (GstElement *element, GstPad *pad);
+  void (*locking) (GstElement * element, GstPad * pad);
+  void (*unlocked) (GstElement * element, GstPad * pad);
 };
 
 GType gst_rtp_dtmf_mux_get_type (void);
 gboolean gst_rtp_dtmf_mux_plugin_init (GstPlugin * plugin);
 
 G_END_DECLS
-
 #endif /* __GST_RTP_DTMF_MUX_H__ */
index 39f2f3d..bdf29cf 100644 (file)
@@ -64,7 +64,8 @@ enum
 #define DEFAULT_SEQNUM_OFFSET    -1
 #define DEFAULT_SSRC             -1
 
-typedef struct {
+typedef struct
+{
   gboolean have_ts_base;
   guint clock_base;
 } GstRTPMuxPadPrivate;
@@ -89,11 +90,10 @@ static void gst_rtp_mux_finalize (GObject * object);
 
 static GstPad *gst_rtp_mux_request_new_pad (GstElement * element,
     GstPadTemplate * templ, const gchar * name);
-static void gst_rtp_mux_release_pad (GstElement * element, GstPad *pad);
-static GstFlowReturn gst_rtp_mux_chain (GstPad * pad,
-    GstBuffer * buffer);
-static gboolean gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps);
-static GstCaps * gst_rtp_mux_getcaps (GstPad *pad);
+static void gst_rtp_mux_release_pad (GstElement * element, GstPad * pad);
+static GstFlowReturn gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer);
+static gboolean gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps);
+static GstCaps *gst_rtp_mux_getcaps (GstPad * pad);
 
 static GstStateChangeReturn gst_rtp_mux_change_state (GstElement *
     element, GstStateChange transition);
@@ -185,8 +185,8 @@ gst_rtp_mux_class_init (GstRTPMuxClass * klass)
   klass->chain_func = gst_rtp_mux_chain;
 }
 
-static gboolean gst_rtp_mux_src_event (GstPad * pad,
-    GstEvent * event)
+static gboolean
+gst_rtp_mux_src_event (GstPad * pad, GstEvent * event)
 {
   GstElement *rtp_mux;
   GstIterator *iter;
@@ -200,7 +200,7 @@ static gboolean gst_rtp_mux_src_event (GstPad * pad,
   iter = gst_element_iterate_sink_pads (rtp_mux);
 
   while (!done) {
-    switch (gst_iterator_next (iter, (gpointer) &sinkpad)) {
+    switch (gst_iterator_next (iter, (gpointer) & sinkpad)) {
       case GST_ITERATOR_OK:
         gst_event_ref (event);
         result |= gst_pad_push_event (sinkpad, event);
@@ -254,10 +254,11 @@ static GstPad *
 gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ)
 {
   GstPad *newpad = NULL;
-  GstPadTemplate * class_templ;
+  GstPadTemplate *class_templ;
 
-  class_templ = gst_element_class_get_pad_template (
-          GST_ELEMENT_GET_CLASS (rtp_mux), "sink_%d");
+  class_templ =
+      gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (rtp_mux),
+      "sink_%d");
 
   if (templ == class_templ) {
     gchar *name;
@@ -327,7 +328,7 @@ gst_rtp_mux_request_new_pad (GstElement * element,
 }
 
 static void
-gst_rtp_mux_release_pad (GstElement * element, GstPad *pad)
+gst_rtp_mux_release_pad (GstElement * element, GstPad * pad)
 {
   GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
 
@@ -360,7 +361,7 @@ static GstFlowReturn
 gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstRTPMux *rtp_mux;
-  GstStructure * structure;
+  GstStructure *structure;
   GstFlowReturn ret;
 
   rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad));
@@ -371,15 +372,16 @@ gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer)
     return GST_FLOW_ERROR;
   }
 
-  buffer = gst_buffer_make_writable(buffer);
+  buffer = gst_buffer_make_writable (buffer);
 
   GST_OBJECT_LOCK (rtp_mux);
   rtp_mux->seqnum++;
   gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum);
   GST_OBJECT_UNLOCK (rtp_mux);
-  GST_BUFFER_CAPS (buffer) = gst_caps_make_writable(GST_BUFFER_CAPS (buffer));
+  GST_BUFFER_CAPS (buffer) = gst_caps_make_writable (GST_BUFFER_CAPS (buffer));
   structure = gst_caps_get_structure (GST_BUFFER_CAPS (buffer), 0U);
-  gst_structure_set (structure, "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL);
+  gst_structure_set (structure, "seqnum-base", G_TYPE_UINT,
+      rtp_mux->seqnum_base, NULL);
   gst_rtp_buffer_set_ssrc (buffer, rtp_mux->current_ssrc);
   gst_rtp_mux_readjust_rtp_timestamp (rtp_mux, pad, buffer);
   GST_LOG_OBJECT (rtp_mux, "Pushing packet size %d, seq=%d, ts=%u",
@@ -395,7 +397,7 @@ gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer)
 }
 
 static gboolean
-gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps)
+gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps)
 {
   GstRTPMux *rtp_mux;
   GstStructure *structure;
@@ -417,22 +419,21 @@ gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps)
 
   gst_caps_set_simple (caps,
       "clock-base", G_TYPE_UINT, rtp_mux->ts_base,
-      "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base,
-      NULL);
+      "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL);
 
   GST_DEBUG_OBJECT (rtp_mux,
       "setting caps %" GST_PTR_FORMAT " on src pad..", caps);
   ret = gst_pad_set_caps (rtp_mux->srcpad, caps);
   gst_caps_unref (caps);
 
- out:
+out:
   gst_object_unref (rtp_mux);
 
   return ret;
 }
 
 static void
-clear_caps (GstCaps *caps, gboolean only_clock_rate)
+clear_caps (GstCaps * caps, gboolean only_clock_rate)
 {
   gint i, j;
 
@@ -453,7 +454,7 @@ clear_caps (GstCaps *caps, gboolean only_clock_rate)
 }
 
 static gboolean
-same_clock_rate_fold (gpointer item, GValue *ret, gpointer user_data)
+same_clock_rate_fold (gpointer item, GValue * ret, gpointer user_data)
 {
   GstPad *mypad = user_data;
   GstPad *pad = item;
@@ -487,22 +488,21 @@ same_clock_rate_fold (gpointer item, GValue *ret, gpointer user_data)
 }
 
 static GstCaps *
-gst_rtp_mux_getcaps (GstPad *pad)
+gst_rtp_mux_getcaps (GstPad * pad)
 {
   GstRTPMux *mux = GST_RTP_MUX (gst_pad_get_parent (pad));
   GstCaps *caps = NULL;
   GstIterator *iter = NULL;
-  GValue v = {0};
+  GValue v = { 0 };
   GstIteratorResult res;
   GstCaps *peercaps = gst_pad_peer_get_caps (mux->srcpad);
-  GstCaps *othercaps =  NULL;
+  GstCaps *othercaps = NULL;
 
   if (peercaps) {
     othercaps = gst_caps_intersect (peercaps,
         gst_pad_get_pad_template_caps (pad));
     gst_caps_unref (peercaps);
-  }
-  else {
+  } else {
     othercaps = gst_caps_copy (gst_pad_get_pad_template_caps (mux->srcpad));
   }
 
@@ -517,7 +517,7 @@ gst_rtp_mux_getcaps (GstPad *pad)
   } while (res == GST_ITERATOR_RESYNC);
   gst_iterator_free (iter);
 
-  caps = (GstCaps*) gst_value_get_caps (&v);
+  caps = (GstCaps *) gst_value_get_caps (&v);
 
   if (res == GST_ITERATOR_ERROR) {
     gst_caps_unref (caps);
@@ -605,7 +605,7 @@ gst_rtp_mux_ready_to_paused (GstRTPMux * rtp_mux)
     rtp_mux->ts_base = g_random_int ();
   else
     rtp_mux->ts_base = rtp_mux->ts_offset;
-    GST_DEBUG_OBJECT (rtp_mux, "set clock-base to %u", rtp_mux->ts_base);
+  GST_DEBUG_OBJECT (rtp_mux, "set clock-base to %u", rtp_mux->ts_base);
 
   GST_OBJECT_UNLOCK (rtp_mux);
 }
@@ -635,10 +635,8 @@ gst_rtp_mux_change_state (GstElement * element, GstStateChange transition)
 gboolean
 gst_rtp_mux_plugin_init (GstPlugin * plugin)
 {
-  GST_DEBUG_CATEGORY_INIT (gst_rtp_mux_debug, "rtpmux", 0,
-      "rtp muxer");
+  GST_DEBUG_CATEGORY_INIT (gst_rtp_mux_debug, "rtpmux", 0, "rtp muxer");
 
   return gst_element_register (plugin, "rtpmux", GST_RANK_NONE,
       GST_TYPE_RTP_MUX);
 }
-
index 9d92049..a3fc133 100644 (file)
 #include <gst/gst.h>
 
 G_BEGIN_DECLS
-
 #define GST_TYPE_RTP_MUX (gst_rtp_mux_get_type())
 #define GST_RTP_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MUX, GstRTPMux))
 #define GST_RTP_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MUX, GstRTPMux))
 #define GST_RTP_MUX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_MUX, GstRTPMuxClass))
 #define GST_IS_RTP_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MUX))
 #define GST_IS_RTP_MUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MUX))
-
 typedef struct _GstRTPMux GstRTPMux;
 typedef struct _GstRTPMuxClass GstRTPMuxClass;
 
@@ -55,27 +53,26 @@ struct _GstRTPMux
   /* sinkpads */
   gint numpads;
 
-  guint32  ts_base;
-  guint16  seqnum_base;
+  guint32 ts_base;
+  guint16 seqnum_base;
 
-  gint32   ts_offset;
-  gint16   seqnum_offset;
-  guint16  seqnum;         /* protected by object lock */
-  guint    ssrc;
-  guint    current_ssrc;
+  gint32 ts_offset;
+  gint16 seqnum_offset;
+  guint16 seqnum;               /* protected by object lock */
+  guint ssrc;
+  guint current_ssrc;
 };
 
 struct _GstRTPMuxClass
 {
   GstElementClass parent_class;
 
-  GstFlowReturn (* chain_func)  (GstPad * pad, GstBuffer * buffer);
-  gboolean (* sink_event_func)  (GstPad * pad, GstEvent * event);
+    GstFlowReturn (*chain_func) (GstPad * pad, GstBuffer * buffer);
+    gboolean (*sink_event_func) (GstPad * pad, GstEvent * event);
 };
 
 GType gst_rtp_mux_get_type (void);
 gboolean gst_rtp_mux_plugin_init (GstPlugin * plugin);
 
 G_END_DECLS
-
 #endif /* __GST_RTP_MUX_H__ */
index a51c540..a4837d7 100644 (file)
@@ -45,4 +45,4 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
     GST_VERSION_MINOR,
     "rtpmuxer",
     "RTP Muxer plugins",
-    plugin_init, "0.1" , "LGPL", "Farsight", "http://farsight.sf.net");
+    plugin_init, "0.1", "LGPL", "Farsight", "http://farsight.sf.net");