Re-indent to Gst style

This commit is contained in:
Olivier Crête 2009-02-20 17:45:50 -05:00 committed by Edward Hervey
parent fe071273c4
commit ad4d98d70c
8 changed files with 78 additions and 92 deletions

View file

@ -4,7 +4,7 @@
<filename>../../gst/aacparse/.libs/libgstaacparse.so</filename> <filename>../../gst/aacparse/.libs/libgstaacparse.so</filename>
<basename>libgstaacparse.so</basename> <basename>libgstaacparse.so</basename>
<version>0.10.10.1</version> <version>0.10.10.1</version>
<license>unknown</license> <license>LGPL</license>
<source>gst-plugins-bad</source> <source>gst-plugins-bad</source>
<package>GStreamer Bad Plug-ins CVS/prerelease</package> <package>GStreamer Bad Plug-ins CVS/prerelease</package>
<origin>Unknown package origin</origin> <origin>Unknown package origin</origin>

View file

@ -1,7 +1,7 @@
<plugin> <plugin>
<name>modplug</name> <name>modplug</name>
<description>.MOD audio decoding</description> <description>.MOD audio decoding</description>
<filename>../../gst/modplug/.libs/libgstmodplug.so</filename> <filename>../../ext/modplug/.libs/libgstmodplug.so</filename>
<basename>libgstmodplug.so</basename> <basename>libgstmodplug.so</basename>
<version>0.10.10.1</version> <version>0.10.10.1</version>
<license>LGPL</license> <license>LGPL</license>

View file

@ -20,13 +20,13 @@
<name>video_%d</name> <name>video_%d</name>
<direction>sink</direction> <direction>sink</direction>
<presence>request</presence> <presence>request</presence>
<details>video/x-h264, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details> <details>video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps> </caps>
<caps> <caps>
<name>audio_%d</name> <name>audio_%d</name>
<direction>sink</direction> <direction>sink</direction>
<presence>request</presence> <presence>request</presence>
<details>audio/AMR, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]</details> <details>audio/AMR, rate=(int)8000, channels=(int)[ 1, 2 ]; audio/AMR-WB, rate=(int)16000, channels=(int)[ 1, 2 ]; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]</details>
</caps> </caps>
<caps> <caps>
<name>src</name> <name>src</name>
@ -101,13 +101,13 @@
<name>video_%d</name> <name>video_%d</name>
<direction>sink</direction> <direction>sink</direction>
<presence>request</presence> <presence>request</presence>
<details>video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h263, h263version=(string)h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-dv, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-qt-part, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details> <details>video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-dv, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-qt-part, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps> </caps>
<caps> <caps>
<name>audio_%d</name> <name>audio_%d</name>
<direction>sink</direction> <direction>sink</direction>
<presence>request</presence> <presence>request</presence>
<details>audio/x-raw-int, width=(int)8, depth=(int)8, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)24, depth=(int)24, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)32, depth=(int)32, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]; audio/x-alaw, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/x-mulaw, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]</details> <details>audio/x-raw-int, width=(int)8, depth=(int)8, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)24, depth=(int)24, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)32, depth=(int)32, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]; audio/x-alaw, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/AMR, rate=(int)8000, channels=(int)[ 1, 2 ]; audio/AMR-WB, rate=(int)16000, channels=(int)[ 1, 2 ]</details>
</caps> </caps>
<caps> <caps>
<name>src</name> <name>src</name>

View 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_class_init (GstRTPDTMFMuxClass * klass);
static void gst_rtp_dtmf_mux_finalize (GObject * object); static void gst_rtp_dtmf_mux_finalize (GObject * object);
static gboolean gst_rtp_dtmf_mux_sink_event (GstPad * pad, static gboolean gst_rtp_dtmf_mux_sink_event (GstPad * pad, GstEvent * event);
GstEvent * event); static GstFlowReturn gst_rtp_dtmf_mux_chain (GstPad * pad, GstBuffer * buffer);
static GstFlowReturn gst_rtp_dtmf_mux_chain (GstPad * pad,
GstBuffer * buffer);
static GstRTPMuxClass *parent_class = NULL; 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); parent_class = g_type_class_peek_parent (klass);
gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM] = gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM] =
g_signal_new ("locking", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, g_signal_new ("locking", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstRTPDTMFMuxClass, locking),NULL, NULL, G_STRUCT_OFFSET (GstRTPDTMFMuxClass, locking), NULL, NULL,
gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD); gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM] = gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM] =
g_signal_new ("unlocked", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, g_signal_new ("unlocked", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstRTPDTMFMuxClass, unlocked),NULL, NULL, G_STRUCT_OFFSET (GstRTPDTMFMuxClass, unlocked), NULL, NULL,
gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD); gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
gobject_class->finalize = gst_rtp_dtmf_mux_finalize; gobject_class->finalize = gst_rtp_dtmf_mux_finalize;
gstrtpmux_class->chain_func = gst_rtp_dtmf_mux_chain; gstrtpmux_class->chain_func = gst_rtp_dtmf_mux_chain;
@ -202,45 +200,42 @@ gst_rtp_dtmf_mux_chain (GstPad * pad, GstBuffer * buffer)
} }
static void 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) if (mux->special_pad != NULL)
GST_WARNING_OBJECT (mux, GST_WARNING_OBJECT (mux,
"Stream lock already acquired by pad %s", "Stream lock already acquired by pad %s",
GST_ELEMENT_NAME (mux->special_pad)); GST_ELEMENT_NAME (mux->special_pad));
else { else {
GST_DEBUG_OBJECT (mux, GST_DEBUG_OBJECT (mux,
"Stream lock acquired by pad %s", "Stream lock acquired by pad %s", GST_ELEMENT_NAME (pad));
GST_ELEMENT_NAME (pad));
mux->special_pad = gst_object_ref (pad); mux->special_pad = gst_object_ref (pad);
} }
} }
static void 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) if (mux->special_pad == NULL)
GST_WARNING_OBJECT (mux, GST_WARNING_OBJECT (mux, "Stream lock not acquired, can't release it");
"Stream lock not acquired, can't release it");
else if (pad != mux->special_pad) else if (pad != mux->special_pad)
GST_WARNING_OBJECT (mux, GST_WARNING_OBJECT (mux,
"pad %s attempted to release Stream lock" "pad %s attempted to release Stream lock"
" which was acquired by pad %s", GST_ELEMENT_NAME (pad), " which was acquired by pad %s", GST_ELEMENT_NAME (pad),
GST_ELEMENT_NAME (mux->special_pad)); GST_ELEMENT_NAME (mux->special_pad));
else { else {
GST_DEBUG_OBJECT (mux, GST_DEBUG_OBJECT (mux,
"Stream lock released by pad %s", "Stream lock released by pad %s", GST_ELEMENT_NAME (mux->special_pad));
GST_ELEMENT_NAME (mux->special_pad));
gst_object_unref (mux->special_pad); gst_object_unref (mux->special_pad);
mux->special_pad = NULL; mux->special_pad = NULL;
} }
} }
static gboolean static gboolean
gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad, gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux * mux, GstPad * pad,
const GstStructure * event_structure) const GstStructure * event_structure)
{ {
gboolean lock; gboolean lock;
@ -248,7 +243,8 @@ gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
return FALSE; return FALSE;
if (lock) 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); GST_OBJECT_LOCK (mux);
if (lock) if (lock)
@ -258,14 +254,15 @@ gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
GST_OBJECT_UNLOCK (mux); GST_OBJECT_UNLOCK (mux);
if (!lock) 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; return TRUE;
} }
static gboolean static gboolean
gst_rtp_dtmf_mux_handle_downstream_event (GstRTPDTMFMux *mux, gst_rtp_dtmf_mux_handle_downstream_event (GstRTPDTMFMux * mux,
GstPad * pad, GstEvent * event) GstPad * pad, GstEvent * event)
{ {
const GstStructure *structure; const GstStructure *structure;
gboolean ret = FALSE; gboolean ret = FALSE;
@ -327,4 +324,3 @@ gst_rtp_dtmf_mux_plugin_init (GstPlugin * plugin)
return gst_element_register (plugin, "rtpdtmfmux", GST_RANK_NONE, return gst_element_register (plugin, "rtpdtmfmux", GST_RANK_NONE,
GST_TYPE_RTP_DTMF_MUX); GST_TYPE_RTP_DTMF_MUX);
} }

View file

@ -30,13 +30,11 @@
#include <gstrtpmux.h> #include <gstrtpmux.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_RTP_DTMF_MUX (gst_rtp_dtmf_mux_get_type()) #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(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_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(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)) #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 _GstRTPDTMFMux GstRTPDTMFMux;
typedef struct _GstRTPDTMFMuxClass GstRTPDTMFMuxClass; typedef struct _GstRTPDTMFMuxClass GstRTPDTMFMuxClass;
@ -59,14 +57,12 @@ struct _GstRTPDTMFMuxClass
GstRTPMuxClass parent_class; GstRTPMuxClass parent_class;
/* signals */ /* signals */
void (*locking) (GstElement *element, GstPad *pad); void (*locking) (GstElement * element, GstPad * pad);
void (*unlocked) (GstElement *element, GstPad *pad); void (*unlocked) (GstElement * element, GstPad * pad);
}; };
GType gst_rtp_dtmf_mux_get_type (void); GType gst_rtp_dtmf_mux_get_type (void);
gboolean gst_rtp_dtmf_mux_plugin_init (GstPlugin * plugin); gboolean gst_rtp_dtmf_mux_plugin_init (GstPlugin * plugin);
G_END_DECLS G_END_DECLS
#endif /* __GST_RTP_DTMF_MUX_H__ */ #endif /* __GST_RTP_DTMF_MUX_H__ */

View file

@ -64,7 +64,8 @@ enum
#define DEFAULT_SEQNUM_OFFSET -1 #define DEFAULT_SEQNUM_OFFSET -1
#define DEFAULT_SSRC -1 #define DEFAULT_SSRC -1
typedef struct { typedef struct
{
gboolean have_ts_base; gboolean have_ts_base;
guint clock_base; guint clock_base;
} GstRTPMuxPadPrivate; } GstRTPMuxPadPrivate;
@ -89,11 +90,10 @@ static void gst_rtp_mux_finalize (GObject * object);
static GstPad *gst_rtp_mux_request_new_pad (GstElement * element, static GstPad *gst_rtp_mux_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name); GstPadTemplate * templ, const gchar * name);
static void gst_rtp_mux_release_pad (GstElement * element, GstPad *pad); static void gst_rtp_mux_release_pad (GstElement * element, GstPad * pad);
static GstFlowReturn gst_rtp_mux_chain (GstPad * pad, static GstFlowReturn gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer);
GstBuffer * buffer); static gboolean gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps);
static gboolean gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps); static GstCaps *gst_rtp_mux_getcaps (GstPad * pad);
static GstCaps * gst_rtp_mux_getcaps (GstPad *pad);
static GstStateChangeReturn gst_rtp_mux_change_state (GstElement * static GstStateChangeReturn gst_rtp_mux_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
@ -185,8 +185,8 @@ gst_rtp_mux_class_init (GstRTPMuxClass * klass)
klass->chain_func = gst_rtp_mux_chain; klass->chain_func = gst_rtp_mux_chain;
} }
static gboolean gst_rtp_mux_src_event (GstPad * pad, static gboolean
GstEvent * event) gst_rtp_mux_src_event (GstPad * pad, GstEvent * event)
{ {
GstElement *rtp_mux; GstElement *rtp_mux;
GstIterator *iter; GstIterator *iter;
@ -200,7 +200,7 @@ static gboolean gst_rtp_mux_src_event (GstPad * pad,
iter = gst_element_iterate_sink_pads (rtp_mux); iter = gst_element_iterate_sink_pads (rtp_mux);
while (!done) { while (!done) {
switch (gst_iterator_next (iter, (gpointer) &sinkpad)) { switch (gst_iterator_next (iter, (gpointer) & sinkpad)) {
case GST_ITERATOR_OK: case GST_ITERATOR_OK:
gst_event_ref (event); gst_event_ref (event);
result |= gst_pad_push_event (sinkpad, event); result |= gst_pad_push_event (sinkpad, event);
@ -254,10 +254,11 @@ static GstPad *
gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ) gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ)
{ {
GstPad *newpad = NULL; GstPad *newpad = NULL;
GstPadTemplate * class_templ; GstPadTemplate *class_templ;
class_templ = gst_element_class_get_pad_template ( class_templ =
GST_ELEMENT_GET_CLASS (rtp_mux), "sink_%d"); gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (rtp_mux),
"sink_%d");
if (templ == class_templ) { if (templ == class_templ) {
gchar *name; gchar *name;
@ -327,7 +328,7 @@ gst_rtp_mux_request_new_pad (GstElement * element,
} }
static void 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); GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
@ -360,7 +361,7 @@ static GstFlowReturn
gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer) gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer)
{ {
GstRTPMux *rtp_mux; GstRTPMux *rtp_mux;
GstStructure * structure; GstStructure *structure;
GstFlowReturn ret; GstFlowReturn ret;
rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad)); 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; return GST_FLOW_ERROR;
} }
buffer = gst_buffer_make_writable(buffer); buffer = gst_buffer_make_writable (buffer);
GST_OBJECT_LOCK (rtp_mux); GST_OBJECT_LOCK (rtp_mux);
rtp_mux->seqnum++; rtp_mux->seqnum++;
gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum); gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum);
GST_OBJECT_UNLOCK (rtp_mux); 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); 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_buffer_set_ssrc (buffer, rtp_mux->current_ssrc);
gst_rtp_mux_readjust_rtp_timestamp (rtp_mux, pad, buffer); gst_rtp_mux_readjust_rtp_timestamp (rtp_mux, pad, buffer);
GST_LOG_OBJECT (rtp_mux, "Pushing packet size %d, seq=%d, ts=%u", 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 static gboolean
gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps) gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstRTPMux *rtp_mux; GstRTPMux *rtp_mux;
GstStructure *structure; GstStructure *structure;
@ -417,22 +419,21 @@ gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps)
gst_caps_set_simple (caps, gst_caps_set_simple (caps,
"clock-base", G_TYPE_UINT, rtp_mux->ts_base, "clock-base", G_TYPE_UINT, rtp_mux->ts_base,
"seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL);
NULL);
GST_DEBUG_OBJECT (rtp_mux, GST_DEBUG_OBJECT (rtp_mux,
"setting caps %" GST_PTR_FORMAT " on src pad..", caps); "setting caps %" GST_PTR_FORMAT " on src pad..", caps);
ret = gst_pad_set_caps (rtp_mux->srcpad, caps); ret = gst_pad_set_caps (rtp_mux->srcpad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
out: out:
gst_object_unref (rtp_mux); gst_object_unref (rtp_mux);
return ret; return ret;
} }
static void static void
clear_caps (GstCaps *caps, gboolean only_clock_rate) clear_caps (GstCaps * caps, gboolean only_clock_rate)
{ {
gint i, j; gint i, j;
@ -453,7 +454,7 @@ clear_caps (GstCaps *caps, gboolean only_clock_rate)
} }
static gboolean 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 *mypad = user_data;
GstPad *pad = item; GstPad *pad = item;
@ -487,22 +488,21 @@ same_clock_rate_fold (gpointer item, GValue *ret, gpointer user_data)
} }
static GstCaps * static GstCaps *
gst_rtp_mux_getcaps (GstPad *pad) gst_rtp_mux_getcaps (GstPad * pad)
{ {
GstRTPMux *mux = GST_RTP_MUX (gst_pad_get_parent (pad)); GstRTPMux *mux = GST_RTP_MUX (gst_pad_get_parent (pad));
GstCaps *caps = NULL; GstCaps *caps = NULL;
GstIterator *iter = NULL; GstIterator *iter = NULL;
GValue v = {0}; GValue v = { 0 };
GstIteratorResult res; GstIteratorResult res;
GstCaps *peercaps = gst_pad_peer_get_caps (mux->srcpad); GstCaps *peercaps = gst_pad_peer_get_caps (mux->srcpad);
GstCaps *othercaps = NULL; GstCaps *othercaps = NULL;
if (peercaps) { if (peercaps) {
othercaps = gst_caps_intersect (peercaps, othercaps = gst_caps_intersect (peercaps,
gst_pad_get_pad_template_caps (pad)); gst_pad_get_pad_template_caps (pad));
gst_caps_unref (peercaps); gst_caps_unref (peercaps);
} } else {
else {
othercaps = gst_caps_copy (gst_pad_get_pad_template_caps (mux->srcpad)); 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); } while (res == GST_ITERATOR_RESYNC);
gst_iterator_free (iter); gst_iterator_free (iter);
caps = (GstCaps*) gst_value_get_caps (&v); caps = (GstCaps *) gst_value_get_caps (&v);
if (res == GST_ITERATOR_ERROR) { if (res == GST_ITERATOR_ERROR) {
gst_caps_unref (caps); gst_caps_unref (caps);
@ -605,7 +605,7 @@ gst_rtp_mux_ready_to_paused (GstRTPMux * rtp_mux)
rtp_mux->ts_base = g_random_int (); rtp_mux->ts_base = g_random_int ();
else else
rtp_mux->ts_base = rtp_mux->ts_offset; 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); GST_OBJECT_UNLOCK (rtp_mux);
} }
@ -635,10 +635,8 @@ gst_rtp_mux_change_state (GstElement * element, GstStateChange transition)
gboolean gboolean
gst_rtp_mux_plugin_init (GstPlugin * plugin) gst_rtp_mux_plugin_init (GstPlugin * plugin)
{ {
GST_DEBUG_CATEGORY_INIT (gst_rtp_mux_debug, "rtpmux", 0, GST_DEBUG_CATEGORY_INIT (gst_rtp_mux_debug, "rtpmux", 0, "rtp muxer");
"rtp muxer");
return gst_element_register (plugin, "rtpmux", GST_RANK_NONE, return gst_element_register (plugin, "rtpmux", GST_RANK_NONE,
GST_TYPE_RTP_MUX); GST_TYPE_RTP_MUX);
} }

View file

@ -29,14 +29,12 @@
#include <gst/gst.h> #include <gst/gst.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_RTP_MUX (gst_rtp_mux_get_type()) #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(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_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_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(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)) #define GST_IS_RTP_MUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MUX))
typedef struct _GstRTPMux GstRTPMux; typedef struct _GstRTPMux GstRTPMux;
typedef struct _GstRTPMuxClass GstRTPMuxClass; typedef struct _GstRTPMuxClass GstRTPMuxClass;
@ -55,28 +53,26 @@ struct _GstRTPMux
/* sinkpads */ /* sinkpads */
gint numpads; gint numpads;
guint32 ts_base; guint32 ts_base;
guint16 seqnum_base; guint16 seqnum_base;
gint32 ts_offset; gint32 ts_offset;
gint16 seqnum_offset; gint16 seqnum_offset;
guint16 seqnum; /* protected by object lock */ guint16 seqnum; /* protected by object lock */
guint ssrc; guint ssrc;
guint current_ssrc; guint current_ssrc;
}; };
struct _GstRTPMuxClass struct _GstRTPMuxClass
{ {
GstElementClass parent_class; GstElementClass parent_class;
GstFlowReturn (* chain_func) (GstPad * pad, GstBuffer * buffer); GstFlowReturn (*chain_func) (GstPad * pad, GstBuffer * buffer);
gboolean (* sink_event_func) (GstPad * pad, GstEvent * event); gboolean (*sink_event_func) (GstPad * pad, GstEvent * event);
}; };
GType gst_rtp_mux_get_type (void); GType gst_rtp_mux_get_type (void);
gboolean gst_rtp_mux_plugin_init (GstPlugin * plugin); gboolean gst_rtp_mux_plugin_init (GstPlugin * plugin);
G_END_DECLS G_END_DECLS
#endif /* __GST_RTP_MUX_H__ */ #endif /* __GST_RTP_MUX_H__ */

View file

@ -45,4 +45,4 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"rtpmuxer", "rtpmuxer",
"RTP Muxer plugins", "RTP Muxer plugins",
plugin_init, "0.1" , "LGPL", "Farsight", "http://farsight.sf.net"); plugin_init, "0.1", "LGPL", "Farsight", "http://farsight.sf.net");