rtpmux: Do the includes locally
[platform/upstream/gst-plugins-good.git] / gst / rtpmanager / gstrtpmux.c
1 /* RTP muxer element for GStreamer
2  *
3  * gstrtpmux.c:
4  *
5  * Copyright (C) <2007> Nokia Corporation.
6  *   Contact: Zeeshan Ali <zeeshan.ali@nokia.com>
7  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
8  *               2000,2005 Wim Taymans <wim@fluendo.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */
25
26 /**
27  * SECTION:element-rtpmux
28  *
29  * The rtp muxer takes multiple RTP streams having the same clock-rate and
30  * muxes into a single stream with a single SSRC.
31  */
32
33 #ifdef HAVE_CONFIG_H
34 #include "config.h"
35 #endif
36
37 #include <gst/gst.h>
38 #include <gst/rtp/gstrtpbuffer.h>
39 #include <string.h>
40
41 #include "gstrtpmux.h"
42
43 GST_DEBUG_CATEGORY_STATIC (gst_rtp_mux_debug);
44 #define GST_CAT_DEFAULT gst_rtp_mux_debug
45
46 /* elementfactory information */
47 static const GstElementDetails gst_rtp_mux_details =
48 GST_ELEMENT_DETAILS ("RTP muxer",
49     "Codec/Muxer",
50     "multiplex N rtp streams into one",
51     "Zeeshan Ali <first.last@nokia.com>");
52
53 enum
54 {
55   ARG_0,
56   PROP_TIMESTAMP_OFFSET,
57   PROP_SEQNUM_OFFSET,
58   PROP_SEQNUM,
59   PROP_SSRC
60 };
61
62 #define DEFAULT_TIMESTAMP_OFFSET -1
63 #define DEFAULT_SEQNUM_OFFSET    -1
64 #define DEFAULT_SSRC             -1
65
66 typedef struct
67 {
68   gboolean have_ts_base;
69   guint clock_base;
70 } GstRTPMuxPadPrivate;
71
72 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
73     GST_PAD_SRC,
74     GST_PAD_ALWAYS,
75     GST_STATIC_CAPS ("application/x-rtp")
76     );
77
78 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d",
79     GST_PAD_SINK,
80     GST_PAD_REQUEST,
81     GST_STATIC_CAPS ("application/x-rtp")
82     );
83
84 static void gst_rtp_mux_base_init (gpointer g_class);
85 static void gst_rtp_mux_class_init (GstRTPMuxClass * klass);
86 static void gst_rtp_mux_init (GstRTPMux * rtp_mux);
87
88 static void gst_rtp_mux_finalize (GObject * object);
89
90 static GstPad *gst_rtp_mux_request_new_pad (GstElement * element,
91     GstPadTemplate * templ, const gchar * name);
92 static void gst_rtp_mux_release_pad (GstElement * element, GstPad * pad);
93 static GstFlowReturn gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer);
94 static gboolean gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps);
95 static GstCaps *gst_rtp_mux_getcaps (GstPad * pad);
96
97 static GstStateChangeReturn gst_rtp_mux_change_state (GstElement *
98     element, GstStateChange transition);
99
100 static void gst_rtp_mux_set_property (GObject * object, guint prop_id,
101     const GValue * value, GParamSpec * pspec);
102 static void gst_rtp_mux_get_property (GObject * object, guint prop_id,
103     GValue * value, GParamSpec * pspec);
104
105 static gboolean gst_rtp_mux_src_event (GstPad * pad, GstEvent * event);
106
107 static GstElementClass *parent_class = NULL;
108
109 GType
110 gst_rtp_mux_get_type (void)
111 {
112   static GType rtp_mux_type = 0;
113
114   if (!rtp_mux_type) {
115     static const GTypeInfo rtp_mux_info = {
116       sizeof (GstRTPMuxClass),
117       gst_rtp_mux_base_init,
118       NULL,
119       (GClassInitFunc) gst_rtp_mux_class_init,
120       NULL,
121       NULL,
122       sizeof (GstRTPMux),
123       0,
124       (GInstanceInitFunc) gst_rtp_mux_init,
125     };
126
127     rtp_mux_type =
128         g_type_register_static (GST_TYPE_ELEMENT, "GstRTPMux",
129         &rtp_mux_info, 0);
130   }
131   return rtp_mux_type;
132 }
133
134 static void
135 gst_rtp_mux_base_init (gpointer g_class)
136 {
137   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
138
139   gst_element_class_add_pad_template (element_class,
140       gst_static_pad_template_get (&src_factory));
141   gst_element_class_add_pad_template (element_class,
142       gst_static_pad_template_get (&sink_factory));
143
144   gst_element_class_set_details (element_class, &gst_rtp_mux_details);
145 }
146
147 static void
148 gst_rtp_mux_class_init (GstRTPMuxClass * klass)
149 {
150   GObjectClass *gobject_class;
151   GstElementClass *gstelement_class;
152
153   gobject_class = (GObjectClass *) klass;
154   gstelement_class = (GstElementClass *) klass;
155
156   parent_class = g_type_class_peek_parent (klass);
157
158   gobject_class->finalize = gst_rtp_mux_finalize;
159   gobject_class->get_property = gst_rtp_mux_get_property;
160   gobject_class->set_property = gst_rtp_mux_set_property;
161
162   g_object_class_install_property (G_OBJECT_CLASS (klass),
163       PROP_TIMESTAMP_OFFSET, g_param_spec_int ("timestamp-offset",
164           "Timestamp Offset",
165           "Offset to add to all outgoing timestamps (-1 = random)", -1,
166           G_MAXINT, DEFAULT_TIMESTAMP_OFFSET, G_PARAM_READWRITE));
167   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM_OFFSET,
168       g_param_spec_int ("seqnum-offset", "Sequence number Offset",
169           "Offset to add to all outgoing seqnum (-1 = random)", -1, G_MAXINT,
170           DEFAULT_SEQNUM_OFFSET, G_PARAM_READWRITE));
171   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM,
172       g_param_spec_uint ("seqnum", "Sequence number",
173           "The RTP sequence number of the last processed packet",
174           0, G_MAXUINT, 0, G_PARAM_READABLE));
175   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SSRC,
176       g_param_spec_uint ("ssrc", "SSRC",
177           "The SSRC of the packets (-1 == random)",
178           0, G_MAXUINT, DEFAULT_SSRC, G_PARAM_READWRITE));
179
180   gstelement_class->request_new_pad =
181       GST_DEBUG_FUNCPTR (gst_rtp_mux_request_new_pad);
182   gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_mux_release_pad);
183   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_mux_change_state);
184
185   klass->chain_func = gst_rtp_mux_chain;
186 }
187
188 static gboolean
189 gst_rtp_mux_src_event (GstPad * pad, GstEvent * event)
190 {
191   GstElement *rtp_mux;
192   GstIterator *iter;
193   GstPad *sinkpad;
194   gboolean result = FALSE;
195   gboolean done = FALSE;
196
197   rtp_mux = gst_pad_get_parent_element (pad);
198   g_return_val_if_fail (rtp_mux != NULL, FALSE);
199
200   iter = gst_element_iterate_sink_pads (rtp_mux);
201
202   while (!done) {
203     switch (gst_iterator_next (iter, (gpointer) & sinkpad)) {
204       case GST_ITERATOR_OK:
205         gst_event_ref (event);
206         result |= gst_pad_push_event (sinkpad, event);
207         gst_object_unref (sinkpad);
208         break;
209       case GST_ITERATOR_RESYNC:
210         gst_iterator_resync (iter);
211         result = FALSE;
212         break;
213       case GST_ITERATOR_ERROR:
214         GST_WARNING_OBJECT (rtp_mux, "Error iterating sinkpads");
215       case GST_ITERATOR_DONE:
216         done = TRUE;
217         break;
218     }
219   }
220   gst_iterator_free (iter);
221   gst_object_unref (rtp_mux);
222   gst_event_unref (event);
223
224   return result;
225 }
226
227 static void
228 gst_rtp_mux_init (GstRTPMux * rtp_mux)
229 {
230   GstElementClass *klass = GST_ELEMENT_GET_CLASS (rtp_mux);
231
232   rtp_mux->srcpad =
233       gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
234           "src"), "src");
235   gst_pad_set_event_function (rtp_mux->srcpad,
236       GST_DEBUG_FUNCPTR (gst_rtp_mux_src_event));
237   gst_element_add_pad (GST_ELEMENT (rtp_mux), rtp_mux->srcpad);
238
239   rtp_mux->ssrc = DEFAULT_SSRC;
240   rtp_mux->ts_offset = DEFAULT_TIMESTAMP_OFFSET;
241   rtp_mux->seqnum_offset = DEFAULT_SEQNUM_OFFSET;
242 }
243
244 static void
245 gst_rtp_mux_finalize (GObject * object)
246 {
247   GstRTPMux *rtp_mux;
248
249   rtp_mux = GST_RTP_MUX (object);
250
251   G_OBJECT_CLASS (parent_class)->finalize (object);
252 }
253
254 static GstPad *
255 gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ)
256 {
257   GstPad *newpad = NULL;
258   GstPadTemplate *class_templ;
259
260   class_templ =
261       gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (rtp_mux),
262       "sink_%d");
263
264   if (templ == class_templ) {
265     gchar *name;
266
267     /* create new pad with the name */
268     name = g_strdup_printf ("sink_%02d", rtp_mux->numpads);
269     newpad = gst_pad_new_from_template (templ, name);
270     g_free (name);
271
272     rtp_mux->numpads++;
273   } else {
274     GST_WARNING_OBJECT (rtp_mux, "this is not our template!\n");
275   }
276
277   return newpad;
278 }
279
280 static void
281 gst_rtp_mux_setup_sinkpad (GstRTPMux * rtp_mux, GstPad * sinkpad)
282 {
283   GstRTPMuxClass *klass;
284   GstRTPMuxPadPrivate *padpriv = g_slice_new0 (GstRTPMuxPadPrivate);
285
286   klass = GST_RTP_MUX_GET_CLASS (rtp_mux);
287
288   /* setup some pad functions */
289   gst_pad_set_setcaps_function (sinkpad, gst_rtp_mux_setcaps);
290   gst_pad_set_getcaps_function (sinkpad, gst_rtp_mux_getcaps);
291   if (klass->chain_func)
292     gst_pad_set_chain_function (sinkpad, klass->chain_func);
293   if (klass->sink_event_func)
294     gst_pad_set_event_function (sinkpad, klass->sink_event_func);
295
296   /* This could break with gstreamer 0.10.9 */
297   gst_pad_set_active (sinkpad, TRUE);
298
299   gst_pad_set_element_private (sinkpad, padpriv);
300
301   /* dd the pad to the element */
302   gst_element_add_pad (GST_ELEMENT (rtp_mux), sinkpad);
303 }
304
305 static GstPad *
306 gst_rtp_mux_request_new_pad (GstElement * element,
307     GstPadTemplate * templ, const gchar * req_name)
308 {
309   GstRTPMux *rtp_mux;
310   GstPad *newpad;
311
312   g_return_val_if_fail (templ != NULL, NULL);
313   g_return_val_if_fail (GST_IS_RTP_MUX (element), NULL);
314
315   rtp_mux = GST_RTP_MUX (element);
316
317   if (templ->direction != GST_PAD_SINK) {
318     GST_WARNING_OBJECT (rtp_mux, "request pad that is not a SINK pad");
319     return NULL;
320   }
321
322   newpad = gst_rtp_mux_create_sinkpad (rtp_mux, templ);
323   if (newpad)
324     gst_rtp_mux_setup_sinkpad (rtp_mux, newpad);
325   else
326     GST_WARNING_OBJECT (rtp_mux, "failed to create request pad");
327
328   return newpad;
329 }
330
331 static void
332 gst_rtp_mux_release_pad (GstElement * element, GstPad * pad)
333 {
334   GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
335
336   if (padpriv)
337     g_slice_free (GstRTPMuxPadPrivate, padpriv);
338   gst_pad_set_element_private (pad, NULL);
339
340   gst_element_remove_pad (element, pad);
341 }
342
343 /* Put our own clock-base on the buffer */
344 static void
345 gst_rtp_mux_readjust_rtp_timestamp (GstRTPMux * rtp_mux, GstPad * pad,
346     GstBuffer * buffer)
347 {
348   guint32 ts;
349   guint32 sink_ts_base = 0;
350   GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
351
352   if (padpriv->have_ts_base)
353     sink_ts_base = padpriv->clock_base;
354
355   ts = gst_rtp_buffer_get_timestamp (buffer) - sink_ts_base + rtp_mux->ts_base;
356   GST_LOG_OBJECT (rtp_mux, "Re-adjusting RTP ts %u to %u",
357       gst_rtp_buffer_get_timestamp (buffer), ts);
358   gst_rtp_buffer_set_timestamp (buffer, ts);
359 }
360
361 static GstFlowReturn
362 gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer)
363 {
364   GstRTPMux *rtp_mux;
365   GstStructure *structure;
366   GstFlowReturn ret;
367
368   rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad));
369
370   if (!gst_rtp_buffer_validate (buffer)) {
371     GST_ERROR_OBJECT (rtp_mux, "Invalid RTP buffer");
372     gst_object_unref (rtp_mux);
373     return GST_FLOW_ERROR;
374   }
375
376   buffer = gst_buffer_make_writable (buffer);
377
378   GST_OBJECT_LOCK (rtp_mux);
379   rtp_mux->seqnum++;
380   gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum);
381   GST_OBJECT_UNLOCK (rtp_mux);
382   GST_BUFFER_CAPS (buffer) = gst_caps_make_writable (GST_BUFFER_CAPS (buffer));
383   structure = gst_caps_get_structure (GST_BUFFER_CAPS (buffer), 0U);
384   gst_structure_set (structure, "seqnum-base", G_TYPE_UINT,
385       rtp_mux->seqnum_base, NULL);
386   gst_rtp_buffer_set_ssrc (buffer, rtp_mux->current_ssrc);
387   gst_rtp_mux_readjust_rtp_timestamp (rtp_mux, pad, buffer);
388   GST_LOG_OBJECT (rtp_mux, "Pushing packet size %d, seq=%d, ts=%u",
389       GST_BUFFER_SIZE (buffer), rtp_mux->seqnum,
390       gst_rtp_buffer_get_timestamp (buffer));
391
392   gst_buffer_set_caps (buffer, GST_PAD_CAPS (rtp_mux->srcpad));
393
394   ret = gst_pad_push (rtp_mux->srcpad, buffer);
395
396   gst_object_unref (rtp_mux);
397   return ret;
398 }
399
400 static gboolean
401 gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps)
402 {
403   GstRTPMux *rtp_mux;
404   GstStructure *structure;
405   gboolean ret = TRUE;
406   GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
407
408   rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad));
409
410   structure = gst_caps_get_structure (caps, 0);
411
412   if (!ret)
413     goto out;
414
415   if (gst_structure_get_uint (structure, "clock-base", &padpriv->clock_base)) {
416     padpriv->have_ts_base = TRUE;
417   }
418
419   caps = gst_caps_copy (caps);
420
421   gst_caps_set_simple (caps,
422       "clock-base", G_TYPE_UINT, rtp_mux->ts_base,
423       "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL);
424
425   GST_DEBUG_OBJECT (rtp_mux,
426       "setting caps %" GST_PTR_FORMAT " on src pad..", caps);
427   ret = gst_pad_set_caps (rtp_mux->srcpad, caps);
428   gst_caps_unref (caps);
429
430 out:
431   gst_object_unref (rtp_mux);
432
433   return ret;
434 }
435
436 static void
437 clear_caps (GstCaps * caps, gboolean only_clock_rate)
438 {
439   gint i, j;
440
441   /* Lets only match on the clock-rate */
442   for (i = 0; i < gst_caps_get_size (caps); i++) {
443     GstStructure *s = gst_caps_get_structure (caps, i);
444
445     for (j = 0; j < gst_structure_n_fields (s); j++) {
446       const gchar *name = gst_structure_nth_field_name (s, j);
447
448       if (strcmp (name, "clock-rate") && (only_clock_rate ||
449               (strcmp (name, "ssrc")))) {
450         gst_structure_remove_field (s, name);
451         j--;
452       }
453     }
454   }
455 }
456
457 static gboolean
458 same_clock_rate_fold (gpointer item, GValue * ret, gpointer user_data)
459 {
460   GstPad *mypad = user_data;
461   GstPad *pad = item;
462   GstCaps *peercaps;
463   GstCaps *othercaps;
464   const GstCaps *accumcaps;
465   GstCaps *intersect;
466
467   if (pad == mypad)
468     return TRUE;
469
470   peercaps = gst_pad_peer_get_caps (pad);
471   if (!peercaps)
472     return TRUE;
473
474   othercaps = gst_caps_intersect (peercaps,
475       gst_pad_get_pad_template_caps (pad));
476   gst_caps_unref (peercaps);
477
478   accumcaps = gst_value_get_caps (ret);
479
480   clear_caps (othercaps, TRUE);
481
482   intersect = gst_caps_intersect (accumcaps, othercaps);
483
484   g_value_take_boxed (ret, intersect);
485
486   gst_caps_unref (othercaps);
487
488   return !gst_caps_is_empty (intersect);
489 }
490
491 static GstCaps *
492 gst_rtp_mux_getcaps (GstPad * pad)
493 {
494   GstRTPMux *mux = GST_RTP_MUX (gst_pad_get_parent (pad));
495   GstCaps *caps = NULL;
496   GstIterator *iter = NULL;
497   GValue v = { 0 };
498   GstIteratorResult res;
499   GstCaps *peercaps = gst_pad_peer_get_caps (mux->srcpad);
500   GstCaps *othercaps = NULL;
501
502   if (peercaps) {
503     othercaps = gst_caps_intersect (peercaps,
504         gst_pad_get_pad_template_caps (pad));
505     gst_caps_unref (peercaps);
506   } else {
507     othercaps = gst_caps_copy (gst_pad_get_pad_template_caps (mux->srcpad));
508   }
509
510   clear_caps (othercaps, FALSE);
511
512   g_value_init (&v, GST_TYPE_CAPS);
513
514   iter = gst_element_iterate_sink_pads (GST_ELEMENT (mux));
515   do {
516     gst_value_set_caps (&v, othercaps);
517     res = gst_iterator_fold (iter, same_clock_rate_fold, &v, pad);
518   } while (res == GST_ITERATOR_RESYNC);
519   gst_iterator_free (iter);
520
521   caps = (GstCaps *) gst_value_get_caps (&v);
522
523   if (res == GST_ITERATOR_ERROR) {
524     gst_caps_unref (caps);
525     caps = gst_caps_new_empty ();
526   }
527
528   if (othercaps)
529     gst_caps_unref (othercaps);
530   gst_object_unref (mux);
531
532   return caps;
533 }
534
535
536 static void
537 gst_rtp_mux_get_property (GObject * object,
538     guint prop_id, GValue * value, GParamSpec * pspec)
539 {
540   GstRTPMux *rtp_mux;
541
542   rtp_mux = GST_RTP_MUX (object);
543
544   switch (prop_id) {
545     case PROP_TIMESTAMP_OFFSET:
546       g_value_set_int (value, rtp_mux->ts_offset);
547       break;
548     case PROP_SEQNUM_OFFSET:
549       g_value_set_int (value, rtp_mux->seqnum_offset);
550       break;
551     case PROP_SEQNUM:
552       GST_OBJECT_LOCK (rtp_mux);
553       g_value_set_uint (value, rtp_mux->seqnum);
554       GST_OBJECT_UNLOCK (rtp_mux);
555       break;
556     case PROP_SSRC:
557       g_value_set_uint (value, rtp_mux->ssrc);
558       break;
559     default:
560       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
561       break;
562   }
563 }
564
565 static void
566 gst_rtp_mux_set_property (GObject * object,
567     guint prop_id, const GValue * value, GParamSpec * pspec)
568 {
569   GstRTPMux *rtp_mux;
570
571   rtp_mux = GST_RTP_MUX (object);
572
573   switch (prop_id) {
574     case PROP_TIMESTAMP_OFFSET:
575       rtp_mux->ts_offset = g_value_get_int (value);
576       break;
577     case PROP_SEQNUM_OFFSET:
578       rtp_mux->seqnum_offset = g_value_get_int (value);
579       break;
580     case PROP_SSRC:
581       rtp_mux->ssrc = g_value_get_uint (value);
582       break;
583     default:
584       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
585       break;
586   }
587 }
588
589 static void
590 gst_rtp_mux_ready_to_paused (GstRTPMux * rtp_mux)
591 {
592   GST_OBJECT_LOCK (rtp_mux);
593
594   if (rtp_mux->ssrc == -1)
595     rtp_mux->current_ssrc = g_random_int ();
596   else
597     rtp_mux->current_ssrc = rtp_mux->ssrc;
598
599   if (rtp_mux->seqnum_offset == -1)
600     rtp_mux->seqnum_base = g_random_int_range (0, G_MAXUINT16);
601   else
602     rtp_mux->seqnum_base = rtp_mux->seqnum_offset;
603   rtp_mux->seqnum = rtp_mux->seqnum_base;
604
605   if (rtp_mux->ts_offset == -1)
606     rtp_mux->ts_base = g_random_int ();
607   else
608     rtp_mux->ts_base = rtp_mux->ts_offset;
609   GST_DEBUG_OBJECT (rtp_mux, "set clock-base to %u", rtp_mux->ts_base);
610
611   GST_OBJECT_UNLOCK (rtp_mux);
612 }
613
614 static GstStateChangeReturn
615 gst_rtp_mux_change_state (GstElement * element, GstStateChange transition)
616 {
617   GstRTPMux *rtp_mux;
618
619   rtp_mux = GST_RTP_MUX (element);
620
621   switch (transition) {
622     case GST_STATE_CHANGE_NULL_TO_READY:
623       break;
624     case GST_STATE_CHANGE_READY_TO_PAUSED:
625       gst_rtp_mux_ready_to_paused (rtp_mux);
626       break;
627     case GST_STATE_CHANGE_PAUSED_TO_READY:
628       break;
629     default:
630       break;
631   }
632
633   return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
634 }
635
636 gboolean
637 gst_rtp_mux_plugin_init (GstPlugin * plugin)
638 {
639   GST_DEBUG_CATEGORY_INIT (gst_rtp_mux_debug, "rtpmux", 0, "rtp muxer");
640
641   return gst_element_register (plugin, "rtpmux", GST_RANK_NONE,
642       GST_TYPE_RTP_MUX);
643 }