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