tizen 2.0 init
[framework/multimedia/gst-plugins-good0.10.git] / gst / rtp / gstrtpmp4gpay.c
1 /* GStreamer
2  * Copyright (C) <2006> Wim Taymans <wim.taymans@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifdef HAVE_CONFIG_H
21 #  include "config.h"
22 #endif
23
24 #include <string.h>
25
26 #include <gst/base/gstbitreader.h>
27 #include <gst/rtp/gstrtpbuffer.h>
28
29 #include "gstrtpmp4gpay.h"
30
31 GST_DEBUG_CATEGORY_STATIC (rtpmp4gpay_debug);
32 #define GST_CAT_DEFAULT (rtpmp4gpay_debug)
33
34 static GstStaticPadTemplate gst_rtp_mp4g_pay_sink_template =
35     GST_STATIC_PAD_TEMPLATE ("sink",
36     GST_PAD_SINK,
37     GST_PAD_ALWAYS,
38     GST_STATIC_CAPS ("video/mpeg,"
39         "mpegversion=(int) 4,"
40         "systemstream=(boolean)false;"
41         "audio/mpeg," "mpegversion=(int) 4, " "stream-format=(string) raw")
42     );
43
44 static GstStaticPadTemplate gst_rtp_mp4g_pay_src_template =
45 GST_STATIC_PAD_TEMPLATE ("src",
46     GST_PAD_SRC,
47     GST_PAD_ALWAYS,
48     GST_STATIC_CAPS ("application/x-rtp, "
49         "media = (string) { \"video\", \"audio\", \"application\" }, "
50         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
51         "clock-rate = (int) [1, MAX ], "
52         "encoding-name = (string) \"MPEG4-GENERIC\", "
53         /* required string params */
54         "streamtype = (string) { \"4\", \"5\" }, "      /* 4 = video, 5 = audio */
55         /* "profile-level-id = (string) [1,MAX], " */
56         /* "config = (string) [1,MAX]" */
57         "mode = (string) { \"generic\", \"CELP-cbr\", \"CELP-vbr\", \"AAC-lbr\", \"AAC-hbr\" } "
58         /* Optional general parameters */
59         /* "objecttype = (string) [1,MAX], " */
60         /* "constantsize = (string) [1,MAX], " *//* constant size of each AU */
61         /* "constantduration = (string) [1,MAX], " *//* constant duration of each AU */
62         /* "maxdisplacement = (string) [1,MAX], " */
63         /* "de-interleavebuffersize = (string) [1,MAX], " */
64         /* Optional configuration parameters */
65         /* "sizelength = (string) [1, 16], " *//* max 16 bits, should be enough... */
66         /* "indexlength = (string) [1, 8], " */
67         /* "indexdeltalength = (string) [1, 8], " */
68         /* "ctsdeltalength = (string) [1, 64], " */
69         /* "dtsdeltalength = (string) [1, 64], " */
70         /* "randomaccessindication = (string) {0, 1}, " */
71         /* "streamstateindication = (string) [0, 64], " */
72         /* "auxiliarydatasizelength = (string) [0, 64]" */ )
73     );
74
75
76 static void gst_rtp_mp4g_pay_finalize (GObject * object);
77
78 static GstStateChangeReturn gst_rtp_mp4g_pay_change_state (GstElement * element,
79     GstStateChange transition);
80
81 static gboolean gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload,
82     GstCaps * caps);
83 static GstFlowReturn gst_rtp_mp4g_pay_handle_buffer (GstBaseRTPPayload *
84     payload, GstBuffer * buffer);
85 static gboolean gst_rtp_mp4g_pay_handle_event (GstPad * pad, GstEvent * event);
86
87 GST_BOILERPLATE (GstRtpMP4GPay, gst_rtp_mp4g_pay, GstBaseRTPPayload,
88     GST_TYPE_BASE_RTP_PAYLOAD)
89
90      static void gst_rtp_mp4g_pay_base_init (gpointer klass)
91 {
92   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
93
94   gst_element_class_add_static_pad_template (element_class,
95       &gst_rtp_mp4g_pay_src_template);
96   gst_element_class_add_static_pad_template (element_class,
97       &gst_rtp_mp4g_pay_sink_template);
98
99   gst_element_class_set_details_simple (element_class, "RTP MPEG4 ES payloader",
100       "Codec/Payloader/Network/RTP",
101       "Payload MPEG4 elementary streams as RTP packets (RFC 3640)",
102       "Wim Taymans <wim.taymans@gmail.com>");
103 }
104
105 static void
106 gst_rtp_mp4g_pay_class_init (GstRtpMP4GPayClass * klass)
107 {
108   GObjectClass *gobject_class;
109   GstElementClass *gstelement_class;
110   GstBaseRTPPayloadClass *gstbasertppayload_class;
111
112   gobject_class = (GObjectClass *) klass;
113   gstelement_class = (GstElementClass *) klass;
114   gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
115
116   gobject_class->finalize = gst_rtp_mp4g_pay_finalize;
117
118   gstelement_class->change_state = gst_rtp_mp4g_pay_change_state;
119
120   gstbasertppayload_class->set_caps = gst_rtp_mp4g_pay_setcaps;
121   gstbasertppayload_class->handle_buffer = gst_rtp_mp4g_pay_handle_buffer;
122   gstbasertppayload_class->handle_event = gst_rtp_mp4g_pay_handle_event;
123
124   GST_DEBUG_CATEGORY_INIT (rtpmp4gpay_debug, "rtpmp4gpay", 0,
125       "MP4-generic RTP Payloader");
126 }
127
128 static void
129 gst_rtp_mp4g_pay_init (GstRtpMP4GPay * rtpmp4gpay, GstRtpMP4GPayClass * klass)
130 {
131   rtpmp4gpay->adapter = gst_adapter_new ();
132 }
133
134 static void
135 gst_rtp_mp4g_pay_reset (GstRtpMP4GPay * rtpmp4gpay)
136 {
137   GST_DEBUG_OBJECT (rtpmp4gpay, "reset");
138
139   gst_adapter_clear (rtpmp4gpay->adapter);
140   rtpmp4gpay->offset = 0;
141 }
142
143 static void
144 gst_rtp_mp4g_pay_cleanup (GstRtpMP4GPay * rtpmp4gpay)
145 {
146   gst_rtp_mp4g_pay_reset (rtpmp4gpay);
147
148   g_free (rtpmp4gpay->params);
149   rtpmp4gpay->params = NULL;
150
151   if (rtpmp4gpay->config)
152     gst_buffer_unref (rtpmp4gpay->config);
153   rtpmp4gpay->config = NULL;
154
155   g_free (rtpmp4gpay->profile);
156   rtpmp4gpay->profile = NULL;
157
158   rtpmp4gpay->streamtype = NULL;
159   rtpmp4gpay->mode = NULL;
160
161   rtpmp4gpay->frame_len = 0;
162 }
163
164 static void
165 gst_rtp_mp4g_pay_finalize (GObject * object)
166 {
167   GstRtpMP4GPay *rtpmp4gpay;
168
169   rtpmp4gpay = GST_RTP_MP4G_PAY (object);
170
171   gst_rtp_mp4g_pay_cleanup (rtpmp4gpay);
172
173   g_object_unref (rtpmp4gpay->adapter);
174   rtpmp4gpay->adapter = NULL;
175
176   G_OBJECT_CLASS (parent_class)->finalize (object);
177 }
178
179 static const unsigned int sampling_table[16] = {
180   96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
181   16000, 12000, 11025, 8000, 7350, 0, 0, 0
182 };
183
184 static gboolean
185 gst_rtp_mp4g_pay_parse_audio_config (GstRtpMP4GPay * rtpmp4gpay,
186     GstBuffer * buffer)
187 {
188   guint8 *data;
189   guint size;
190   guint8 objectType = 0;
191   guint8 samplingIdx = 0;
192   guint8 channelCfg = 0;
193   GstBitReader br;
194
195   data = GST_BUFFER_DATA (buffer);
196   size = GST_BUFFER_SIZE (buffer);
197
198   gst_bit_reader_init (&br, data, size);
199
200   /* any object type is fine, we need to copy it to the profile-level-id field. */
201   if (!gst_bit_reader_get_bits_uint8 (&br, &objectType, 5))
202     goto too_short;
203   if (objectType == 0)
204     goto invalid_object;
205
206   if (!gst_bit_reader_get_bits_uint8 (&br, &samplingIdx, 4))
207     goto too_short;
208   /* only fixed values for now */
209   if (samplingIdx > 12 && samplingIdx != 15)
210     goto wrong_freq;
211
212   if (!gst_bit_reader_get_bits_uint8 (&br, &channelCfg, 4))
213     goto too_short;
214   if (channelCfg > 7)
215     goto wrong_channels;
216
217   /* rtp rate depends on sampling rate of the audio */
218   if (samplingIdx == 15) {
219     guint32 rate = 0;
220
221     /* index of 15 means we get the rate in the next 24 bits */
222     if (!gst_bit_reader_get_bits_uint32 (&br, &rate, 24))
223       goto too_short;
224
225     rtpmp4gpay->rate = rate;
226   } else {
227     /* else use the rate from the table */
228     rtpmp4gpay->rate = sampling_table[samplingIdx];
229   }
230
231   rtpmp4gpay->frame_len = 1024;
232
233   switch (objectType) {
234     case 1:
235     case 2:
236     case 3:
237     case 4:
238     case 6:
239     case 7:
240     {
241       guint8 frameLenFlag = 0;
242
243       if (gst_bit_reader_get_bits_uint8 (&br, &frameLenFlag, 1))
244         if (frameLenFlag)
245           rtpmp4gpay->frame_len = 960;
246
247       break;
248     }
249     default:
250       break;
251   }
252
253   /* extra rtp params contain the number of channels */
254   g_free (rtpmp4gpay->params);
255   rtpmp4gpay->params = g_strdup_printf ("%d", channelCfg);
256   /* audio stream type */
257   rtpmp4gpay->streamtype = "5";
258   /* mode only high bitrate for now */
259   rtpmp4gpay->mode = "AAC-hbr";
260   /* profile */
261   g_free (rtpmp4gpay->profile);
262   rtpmp4gpay->profile = g_strdup_printf ("%d", objectType);
263
264   GST_DEBUG_OBJECT (rtpmp4gpay,
265       "objectType: %d, samplingIdx: %d (%d), channelCfg: %d, frame_len %d",
266       objectType, samplingIdx, rtpmp4gpay->rate, channelCfg,
267       rtpmp4gpay->frame_len);
268
269   return TRUE;
270
271   /* ERROR */
272 too_short:
273   {
274     GST_ELEMENT_ERROR (rtpmp4gpay, STREAM, FORMAT,
275         (NULL), ("config string too short"));
276     return FALSE;
277   }
278 invalid_object:
279   {
280     GST_ELEMENT_ERROR (rtpmp4gpay, STREAM, FORMAT,
281         (NULL), ("invalid object type"));
282     return FALSE;
283   }
284 wrong_freq:
285   {
286     GST_ELEMENT_ERROR (rtpmp4gpay, STREAM, NOT_IMPLEMENTED,
287         (NULL), ("unsupported frequency index %d", samplingIdx));
288     return FALSE;
289   }
290 wrong_channels:
291   {
292     GST_ELEMENT_ERROR (rtpmp4gpay, STREAM, NOT_IMPLEMENTED,
293         (NULL), ("unsupported number of channels %d, must < 8", channelCfg));
294     return FALSE;
295   }
296 }
297
298 #define VOS_STARTCODE                   0x000001B0
299
300 static gboolean
301 gst_rtp_mp4g_pay_parse_video_config (GstRtpMP4GPay * rtpmp4gpay,
302     GstBuffer * buffer)
303 {
304   guint8 *data;
305   guint size;
306   guint32 code;
307
308   data = GST_BUFFER_DATA (buffer);
309   size = GST_BUFFER_SIZE (buffer);
310
311   if (size < 5)
312     goto too_short;
313
314   code = GST_READ_UINT32_BE (data);
315
316   g_free (rtpmp4gpay->profile);
317   if (code == VOS_STARTCODE) {
318     /* get profile */
319     rtpmp4gpay->profile = g_strdup_printf ("%d", (gint) data[4]);
320   } else {
321     GST_ELEMENT_WARNING (rtpmp4gpay, STREAM, FORMAT,
322         (NULL), ("profile not found in config string, assuming \'1\'"));
323     rtpmp4gpay->profile = g_strdup ("1");
324   }
325
326   /* fixed rate */
327   rtpmp4gpay->rate = 90000;
328   /* video stream type */
329   rtpmp4gpay->streamtype = "4";
330   /* no params for video */
331   rtpmp4gpay->params = NULL;
332   /* mode */
333   rtpmp4gpay->mode = "generic";
334
335   GST_LOG_OBJECT (rtpmp4gpay, "profile %s", rtpmp4gpay->profile);
336
337   return TRUE;
338
339   /* ERROR */
340 too_short:
341   {
342     GST_ELEMENT_ERROR (rtpmp4gpay, STREAM, FORMAT,
343         (NULL), ("config string too short"));
344     return FALSE;
345   }
346 }
347
348 static gboolean
349 gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
350 {
351   gchar *config;
352   GValue v = { 0 };
353   gboolean res;
354
355 #define MP4GCAPS                                                \
356   "streamtype", G_TYPE_STRING, rtpmp4gpay->streamtype,          \
357   "profile-level-id", G_TYPE_STRING, rtpmp4gpay->profile,       \
358   "mode", G_TYPE_STRING, rtpmp4gpay->mode,                      \
359   "config", G_TYPE_STRING, config,                              \
360   "sizelength", G_TYPE_STRING, "13",                            \
361   "indexlength", G_TYPE_STRING, "3",                            \
362   "indexdeltalength", G_TYPE_STRING, "3",                       \
363   NULL
364
365   g_value_init (&v, GST_TYPE_BUFFER);
366   gst_value_set_buffer (&v, rtpmp4gpay->config);
367   config = gst_value_serialize (&v);
368
369   /* hmm, silly */
370   if (rtpmp4gpay->params) {
371     res = gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
372         "encoding-params", G_TYPE_STRING, rtpmp4gpay->params, MP4GCAPS);
373   } else {
374     res = gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
375         MP4GCAPS);
376   }
377
378   g_value_unset (&v);
379   g_free (config);
380
381 #undef MP4GCAPS
382   return res;
383 }
384
385 static gboolean
386 gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
387 {
388   GstRtpMP4GPay *rtpmp4gpay;
389   GstStructure *structure;
390   const GValue *codec_data;
391   const gchar *media_type = NULL;
392   gboolean res;
393
394   rtpmp4gpay = GST_RTP_MP4G_PAY (payload);
395
396   structure = gst_caps_get_structure (caps, 0);
397
398   codec_data = gst_structure_get_value (structure, "codec_data");
399   if (codec_data) {
400     GST_LOG_OBJECT (rtpmp4gpay, "got codec_data");
401     if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
402       GstBuffer *buffer;
403       const gchar *name;
404
405       buffer = gst_value_get_buffer (codec_data);
406       GST_LOG_OBJECT (rtpmp4gpay, "configuring codec_data");
407
408       name = gst_structure_get_name (structure);
409
410       /* parse buffer */
411       if (!strcmp (name, "audio/mpeg")) {
412         res = gst_rtp_mp4g_pay_parse_audio_config (rtpmp4gpay, buffer);
413         media_type = "audio";
414       } else if (!strcmp (name, "video/mpeg")) {
415         res = gst_rtp_mp4g_pay_parse_video_config (rtpmp4gpay, buffer);
416         media_type = "video";
417       } else {
418         res = FALSE;
419       }
420       if (!res)
421         goto config_failed;
422
423       /* now we can configure the buffer */
424       if (rtpmp4gpay->config)
425         gst_buffer_unref (rtpmp4gpay->config);
426
427       rtpmp4gpay->config = gst_buffer_copy (buffer);
428     }
429   }
430   if (media_type == NULL)
431     goto config_failed;
432
433   gst_basertppayload_set_options (payload, media_type, TRUE, "MPEG4-GENERIC",
434       rtpmp4gpay->rate);
435
436   res = gst_rtp_mp4g_pay_new_caps (rtpmp4gpay);
437
438   return res;
439
440   /* ERRORS */
441 config_failed:
442   {
443     GST_DEBUG_OBJECT (rtpmp4gpay, "failed to parse config");
444     return FALSE;
445   }
446 }
447
448 static GstFlowReturn
449 gst_rtp_mp4g_pay_flush (GstRtpMP4GPay * rtpmp4gpay)
450 {
451   guint avail, total;
452   GstBuffer *outbuf;
453   GstFlowReturn ret;
454   guint mtu;
455
456   /* the data available in the adapter is either smaller
457    * than the MTU or bigger. In the case it is smaller, the complete
458    * adapter contents can be put in one packet. In the case the
459    * adapter has more than one MTU, we need to fragment the MPEG data
460    * over multiple packets. */
461   total = avail = gst_adapter_available (rtpmp4gpay->adapter);
462
463   ret = GST_FLOW_OK;
464   mtu = GST_BASE_RTP_PAYLOAD_MTU (rtpmp4gpay);
465
466   while (avail > 0) {
467     guint towrite;
468     guint8 *payload;
469     guint payload_len;
470     guint packet_len;
471
472     /* this will be the total lenght of the packet */
473     packet_len = gst_rtp_buffer_calc_packet_len (avail, 0, 0);
474
475     /* fill one MTU or all available bytes, we need 4 spare bytes for
476      * the AU header. */
477     towrite = MIN (packet_len, mtu - 4);
478
479     /* this is the payload length */
480     payload_len = gst_rtp_buffer_calc_payload_len (towrite, 0, 0);
481
482     GST_DEBUG_OBJECT (rtpmp4gpay,
483         "avail %d, towrite %d, packet_len %d, payload_len %d", avail, towrite,
484         packet_len, payload_len);
485
486     /* create buffer to hold the payload, also make room for the 4 header bytes. */
487     outbuf = gst_rtp_buffer_new_allocate (payload_len + 4, 0, 0);
488
489     /* copy payload */
490     payload = gst_rtp_buffer_get_payload (outbuf);
491
492     /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. -+-+-+-+-+-+-+-+-+-+
493      * |AU-headers-length|AU-header|AU-header|      |AU-header|padding|
494      * |                 |   (1)   |   (2)   |      |   (n)   | bits  |
495      * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. -+-+-+-+-+-+-+-+-+-+
496      */
497     /* AU-headers-length, we only have 1 AU-header */
498     payload[0] = 0x00;
499     payload[1] = 0x10;          /* we use 16 bits for the header */
500
501     /* +---------------------------------------+
502      * |     AU-size                           |
503      * +---------------------------------------+
504      * |     AU-Index / AU-Index-delta         |
505      * +---------------------------------------+
506      * |     CTS-flag                          |
507      * +---------------------------------------+
508      * |     CTS-delta                         |
509      * +---------------------------------------+
510      * |     DTS-flag                          |
511      * +---------------------------------------+
512      * |     DTS-delta                         |
513      * +---------------------------------------+
514      * |     RAP-flag                          |
515      * +---------------------------------------+
516      * |     Stream-state                      |
517      * +---------------------------------------+
518      */
519     /* The AU-header, no CTS, DTS, RAP, Stream-state 
520      *
521      * AU-size is always the total size of the AU, not the fragmented size 
522      */
523     payload[2] = (total & 0x1fe0) >> 5;
524     payload[3] = (total & 0x1f) << 3;   /* we use 13 bits for the size, 3 bits index */
525
526     /* copy stuff from adapter to payload */
527     gst_adapter_copy (rtpmp4gpay->adapter, &payload[4], 0, payload_len);
528     gst_adapter_flush (rtpmp4gpay->adapter, payload_len);
529
530     /* marker only if the packet is complete */
531     gst_rtp_buffer_set_marker (outbuf, avail <= payload_len);
532
533     GST_BUFFER_TIMESTAMP (outbuf) = rtpmp4gpay->first_timestamp;
534     GST_BUFFER_DURATION (outbuf) = rtpmp4gpay->first_duration;
535
536     if (rtpmp4gpay->frame_len) {
537       GST_BUFFER_OFFSET (outbuf) = rtpmp4gpay->offset;
538       rtpmp4gpay->offset += rtpmp4gpay->frame_len;
539     }
540
541     ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtpmp4gpay), outbuf);
542
543     avail -= payload_len;
544   }
545
546   return ret;
547 }
548
549 /* we expect buffers as exactly one complete AU
550  */
551 static GstFlowReturn
552 gst_rtp_mp4g_pay_handle_buffer (GstBaseRTPPayload * basepayload,
553     GstBuffer * buffer)
554 {
555   GstRtpMP4GPay *rtpmp4gpay;
556
557   rtpmp4gpay = GST_RTP_MP4G_PAY (basepayload);
558
559   rtpmp4gpay->first_timestamp = GST_BUFFER_TIMESTAMP (buffer);
560   rtpmp4gpay->first_duration = GST_BUFFER_DURATION (buffer);
561
562   /* we always encode and flush a full AU */
563   gst_adapter_push (rtpmp4gpay->adapter, buffer);
564
565   return gst_rtp_mp4g_pay_flush (rtpmp4gpay);
566 }
567
568 static gboolean
569 gst_rtp_mp4g_pay_handle_event (GstPad * pad, GstEvent * event)
570 {
571   GstRtpMP4GPay *rtpmp4gpay;
572
573   rtpmp4gpay = GST_RTP_MP4G_PAY (gst_pad_get_parent (pad));
574
575   GST_DEBUG ("Got event: %s", GST_EVENT_TYPE_NAME (event));
576
577   switch (GST_EVENT_TYPE (event)) {
578     case GST_EVENT_NEWSEGMENT:
579     case GST_EVENT_EOS:
580       /* This flush call makes sure that the last buffer is always pushed
581        * to the base payloader */
582       gst_rtp_mp4g_pay_flush (rtpmp4gpay);
583       break;
584     case GST_EVENT_FLUSH_STOP:
585       gst_rtp_mp4g_pay_reset (rtpmp4gpay);
586       break;
587     default:
588       break;
589   }
590
591   g_object_unref (rtpmp4gpay);
592
593   /* let parent handle event too */
594   return FALSE;
595 }
596
597 static GstStateChangeReturn
598 gst_rtp_mp4g_pay_change_state (GstElement * element, GstStateChange transition)
599 {
600   GstStateChangeReturn ret;
601   GstRtpMP4GPay *rtpmp4gpay;
602
603   rtpmp4gpay = GST_RTP_MP4G_PAY (element);
604
605   switch (transition) {
606     case GST_STATE_CHANGE_READY_TO_PAUSED:
607       gst_rtp_mp4g_pay_cleanup (rtpmp4gpay);
608       break;
609     default:
610       break;
611   }
612
613   ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
614
615   switch (transition) {
616     case GST_STATE_CHANGE_PAUSED_TO_READY:
617       gst_rtp_mp4g_pay_cleanup (rtpmp4gpay);
618       break;
619     default:
620       break;
621   }
622
623   return ret;
624 }
625
626 gboolean
627 gst_rtp_mp4g_pay_plugin_init (GstPlugin * plugin)
628 {
629   return gst_element_register (plugin, "rtpmp4gpay",
630       GST_RANK_SECONDARY, GST_TYPE_RTP_MP4G_PAY);
631 }