Merge remote-tracking branch 'origin/master' into 0.11
[platform/upstream/gst-plugins-good.git] / gst / rtp / gstrtpmp4vpay.c
1 /* GStreamer
2  * Copyright (C) <2005> 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/rtp/gstrtpbuffer.h>
27
28 #include "gstrtpmp4vpay.h"
29
30 GST_DEBUG_CATEGORY_STATIC (rtpmp4vpay_debug);
31 #define GST_CAT_DEFAULT (rtpmp4vpay_debug)
32
33 static GstStaticPadTemplate gst_rtp_mp4v_pay_sink_template =
34     GST_STATIC_PAD_TEMPLATE ("sink",
35     GST_PAD_SINK,
36     GST_PAD_ALWAYS,
37     GST_STATIC_CAPS ("video/mpeg,"
38         "mpegversion=(int) 4," "systemstream=(boolean)false;" "video/x-xvid")
39     );
40
41 static GstStaticPadTemplate gst_rtp_mp4v_pay_src_template =
42 GST_STATIC_PAD_TEMPLATE ("src",
43     GST_PAD_SRC,
44     GST_PAD_ALWAYS,
45     GST_STATIC_CAPS ("application/x-rtp, "
46         "media = (string) \"video\", "
47         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
48         "clock-rate = (int) [1, MAX ], " "encoding-name = (string) \"MP4V-ES\""
49         /* two string params
50          *
51          "profile-level-id = (string) [1,MAX]"
52          "config = (string) [1,MAX]"
53          */
54     )
55     );
56
57 #define DEFAULT_SEND_CONFIG     FALSE
58 #define DEFAULT_BUFFER_LIST     FALSE
59 #define DEFAULT_CONFIG_INTERVAL 0
60
61 enum
62 {
63   ARG_0,
64   ARG_SEND_CONFIG,
65   ARG_BUFFER_LIST,
66   ARG_CONFIG_INTERVAL
67 };
68
69
70 static void gst_rtp_mp4v_pay_finalize (GObject * object);
71
72 static void gst_rtp_mp4v_pay_set_property (GObject * object, guint prop_id,
73     const GValue * value, GParamSpec * pspec);
74 static void gst_rtp_mp4v_pay_get_property (GObject * object, guint prop_id,
75     GValue * value, GParamSpec * pspec);
76
77 static gboolean gst_rtp_mp4v_pay_setcaps (GstRTPBasePayload * payload,
78     GstCaps * caps);
79 static GstFlowReturn gst_rtp_mp4v_pay_handle_buffer (GstRTPBasePayload *
80     payload, GstBuffer * buffer);
81 static gboolean gst_rtp_mp4v_pay_sink_event (GstRTPBasePayload * pay,
82     GstEvent * event);
83
84 #define gst_rtp_mp4v_pay_parent_class parent_class
85 G_DEFINE_TYPE (GstRtpMP4VPay, gst_rtp_mp4v_pay, GST_TYPE_RTP_BASE_PAYLOAD)
86
87      static void gst_rtp_mp4v_pay_class_init (GstRtpMP4VPayClass * klass)
88 {
89   GObjectClass *gobject_class;
90   GstElementClass *gstelement_class;
91   GstRTPBasePayloadClass *gstrtpbasepayload_class;
92
93   gobject_class = (GObjectClass *) klass;
94   gstelement_class = (GstElementClass *) klass;
95   gstrtpbasepayload_class = (GstRTPBasePayloadClass *) klass;
96
97   gobject_class->set_property = gst_rtp_mp4v_pay_set_property;
98   gobject_class->get_property = gst_rtp_mp4v_pay_get_property;
99
100   gst_element_class_add_pad_template (gstelement_class,
101       gst_static_pad_template_get (&gst_rtp_mp4v_pay_src_template));
102   gst_element_class_add_pad_template (gstelement_class,
103       gst_static_pad_template_get (&gst_rtp_mp4v_pay_sink_template));
104
105   gst_element_class_set_details_simple (gstelement_class,
106       "RTP MPEG4 Video payloader", "Codec/Payloader/Network/RTP",
107       "Payload MPEG-4 video as RTP packets (RFC 3016)",
108       "Wim Taymans <wim.taymans@gmail.com>");
109
110   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SEND_CONFIG,
111       g_param_spec_boolean ("send-config", "Send Config",
112           "Send the config parameters in RTP packets as well(deprecated "
113           "see config-interval)",
114           DEFAULT_SEND_CONFIG, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
115
116   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFER_LIST,
117       g_param_spec_boolean ("buffer-list", "Buffer Array",
118           "Use Buffer Arrays",
119           DEFAULT_BUFFER_LIST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
120
121   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONFIG_INTERVAL,
122       g_param_spec_uint ("config-interval", "Config Send Interval",
123           "Send Config Insertion Interval in seconds (configuration headers "
124           "will be multiplexed in the data stream when detected.) (0 = disabled)",
125           0, 3600, DEFAULT_CONFIG_INTERVAL,
126           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
127       );
128
129   gobject_class->finalize = gst_rtp_mp4v_pay_finalize;
130
131   gstrtpbasepayload_class->set_caps = gst_rtp_mp4v_pay_setcaps;
132   gstrtpbasepayload_class->handle_buffer = gst_rtp_mp4v_pay_handle_buffer;
133   gstrtpbasepayload_class->sink_event = gst_rtp_mp4v_pay_sink_event;
134
135   GST_DEBUG_CATEGORY_INIT (rtpmp4vpay_debug, "rtpmp4vpay", 0,
136       "MP4 video RTP Payloader");
137 }
138
139 static void
140 gst_rtp_mp4v_pay_init (GstRtpMP4VPay * rtpmp4vpay)
141 {
142   rtpmp4vpay->adapter = gst_adapter_new ();
143   rtpmp4vpay->rate = 90000;
144   rtpmp4vpay->profile = 1;
145   rtpmp4vpay->buffer_list = DEFAULT_BUFFER_LIST;
146   rtpmp4vpay->send_config = DEFAULT_SEND_CONFIG;
147   rtpmp4vpay->need_config = TRUE;
148   rtpmp4vpay->config_interval = DEFAULT_CONFIG_INTERVAL;
149   rtpmp4vpay->last_config = -1;
150
151   rtpmp4vpay->config = NULL;
152 }
153
154 static void
155 gst_rtp_mp4v_pay_finalize (GObject * object)
156 {
157   GstRtpMP4VPay *rtpmp4vpay;
158
159   rtpmp4vpay = GST_RTP_MP4V_PAY (object);
160
161   if (rtpmp4vpay->config) {
162     gst_buffer_unref (rtpmp4vpay->config);
163     rtpmp4vpay->config = NULL;
164   }
165   g_object_unref (rtpmp4vpay->adapter);
166   rtpmp4vpay->adapter = NULL;
167
168   G_OBJECT_CLASS (parent_class)->finalize (object);
169 }
170
171 static gboolean
172 gst_rtp_mp4v_pay_new_caps (GstRtpMP4VPay * rtpmp4vpay)
173 {
174   gchar *profile, *config;
175   GValue v = { 0 };
176   gboolean res;
177
178   profile = g_strdup_printf ("%d", rtpmp4vpay->profile);
179   g_value_init (&v, GST_TYPE_BUFFER);
180   gst_value_set_buffer (&v, rtpmp4vpay->config);
181   config = gst_value_serialize (&v);
182
183   res = gst_rtp_base_payload_set_outcaps (GST_RTP_BASE_PAYLOAD (rtpmp4vpay),
184       "profile-level-id", G_TYPE_STRING, profile,
185       "config", G_TYPE_STRING, config, NULL);
186
187   g_value_unset (&v);
188
189   g_free (profile);
190   g_free (config);
191
192   return res;
193 }
194
195 static gboolean
196 gst_rtp_mp4v_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
197 {
198   GstRtpMP4VPay *rtpmp4vpay;
199   GstStructure *structure;
200   const GValue *codec_data;
201   gboolean res;
202
203   rtpmp4vpay = GST_RTP_MP4V_PAY (payload);
204
205   gst_rtp_base_payload_set_options (payload, "video", TRUE, "MP4V-ES",
206       rtpmp4vpay->rate);
207
208   res = TRUE;
209
210   structure = gst_caps_get_structure (caps, 0);
211   codec_data = gst_structure_get_value (structure, "codec_data");
212   if (codec_data) {
213     GST_LOG_OBJECT (rtpmp4vpay, "got codec_data");
214     if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
215       GstBuffer *buffer;
216
217       buffer = gst_value_get_buffer (codec_data);
218
219       if (gst_buffer_get_size (buffer) < 5)
220         goto done;
221
222       gst_buffer_extract (buffer, 4, &rtpmp4vpay->profile, 1);
223       GST_LOG_OBJECT (rtpmp4vpay, "configuring codec_data, profile %d",
224           rtpmp4vpay->profile);
225
226       if (rtpmp4vpay->config)
227         gst_buffer_unref (rtpmp4vpay->config);
228       rtpmp4vpay->config = gst_buffer_copy (buffer);
229       res = gst_rtp_mp4v_pay_new_caps (rtpmp4vpay);
230     }
231   }
232
233 done:
234   return res;
235 }
236
237 static void
238 gst_rtp_mp4v_pay_empty (GstRtpMP4VPay * rtpmp4vpay)
239 {
240   gst_adapter_clear (rtpmp4vpay->adapter);
241 }
242
243 static GstFlowReturn
244 gst_rtp_mp4v_pay_flush (GstRtpMP4VPay * rtpmp4vpay)
245 {
246   guint avail;
247   GstBuffer *outbuf;
248   GstBuffer *outbuf_data = NULL;
249   GstFlowReturn ret;
250   GstBufferList *list = NULL;
251
252   /* the data available in the adapter is either smaller
253    * than the MTU or bigger. In the case it is smaller, the complete
254    * adapter contents can be put in one packet. In the case the
255    * adapter has more than one MTU, we need to split the MP4V data
256    * over multiple packets. */
257   avail = gst_adapter_available (rtpmp4vpay->adapter);
258
259   if (rtpmp4vpay->config == NULL && rtpmp4vpay->need_config) {
260     /* when we don't have a config yet, flush things out */
261     gst_adapter_flush (rtpmp4vpay->adapter, avail);
262     avail = 0;
263   }
264
265   if (!avail)
266     return GST_FLOW_OK;
267
268   ret = GST_FLOW_OK;
269
270   if (rtpmp4vpay->buffer_list) {
271     /* Use buffer lists. Each frame will be put into a list
272      * of buffers and the whole list will be pushed downstream
273      * at once */
274     list = gst_buffer_list_new ();
275   }
276
277   while (avail > 0) {
278     guint towrite;
279     guint payload_len;
280     guint packet_len;
281     GstRTPBuffer rtp;
282
283     /* this will be the total lenght of the packet */
284     packet_len = gst_rtp_buffer_calc_packet_len (avail, 0, 0);
285
286     /* fill one MTU or all available bytes */
287     towrite = MIN (packet_len, GST_RTP_BASE_PAYLOAD_MTU (rtpmp4vpay));
288
289     /* this is the payload length */
290     payload_len = gst_rtp_buffer_calc_payload_len (towrite, 0, 0);
291
292     /* create buffer without payload. The payload will be put
293      * in next buffer instead. Both buffers will be merged */
294     outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
295
296     /* Take buffer with the payload from the adapter */
297     outbuf_data = gst_adapter_take_buffer (rtpmp4vpay->adapter, payload_len);
298
299     avail -= payload_len;
300
301     gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
302     gst_rtp_buffer_set_marker (&rtp, avail == 0);
303     gst_rtp_buffer_unmap (&rtp);
304
305     outbuf = gst_buffer_join (outbuf, outbuf_data);
306
307     GST_BUFFER_TIMESTAMP (outbuf) = rtpmp4vpay->first_timestamp;
308
309     if (rtpmp4vpay->buffer_list) {
310       /* add to list */
311       gst_buffer_list_insert (list, -1, outbuf);
312     } else {
313       ret =
314           gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtpmp4vpay), outbuf);
315     }
316   }
317
318   if (rtpmp4vpay->buffer_list) {
319     /* push the whole buffer list at once */
320     ret =
321         gst_rtp_base_payload_push_list (GST_RTP_BASE_PAYLOAD (rtpmp4vpay),
322         list);
323   }
324
325   return ret;
326 }
327
328 #define VOS_STARTCODE                   0x000001B0
329 #define VOS_ENDCODE                     0x000001B1
330 #define USER_DATA_STARTCODE             0x000001B2
331 #define GOP_STARTCODE                   0x000001B3
332 #define VISUAL_OBJECT_STARTCODE         0x000001B5
333 #define VOP_STARTCODE                   0x000001B6
334
335 static gboolean
336 gst_rtp_mp4v_pay_depay_data (GstRtpMP4VPay * enc, guint8 * data, guint size,
337     gint * strip, gboolean * vopi)
338 {
339   guint32 code;
340   gboolean result;
341   *vopi = FALSE;
342
343   *strip = 0;
344
345   if (size < 5)
346     return FALSE;
347
348   code = GST_READ_UINT32_BE (data);
349   GST_DEBUG_OBJECT (enc, "start code 0x%08x", code);
350
351   switch (code) {
352     case VOS_STARTCODE:
353     case 0x00000101:
354     {
355       gint i;
356       guint8 profile;
357       gboolean newprofile = FALSE;
358       gboolean equal;
359
360       if (code == VOS_STARTCODE) {
361         /* profile_and_level_indication */
362         profile = data[4];
363
364         GST_DEBUG_OBJECT (enc, "VOS profile 0x%08x", profile);
365
366         if (profile != enc->profile) {
367           newprofile = TRUE;
368           enc->profile = profile;
369         }
370       }
371
372       /* up to the next GOP_STARTCODE or VOP_STARTCODE is
373        * the config information */
374       code = 0xffffffff;
375       for (i = 5; i < size - 4; i++) {
376         code = (code << 8) | data[i];
377         if (code == GOP_STARTCODE || code == VOP_STARTCODE)
378           break;
379       }
380       i -= 3;
381       /* see if config changed */
382       equal = FALSE;
383       if (enc->config) {
384         if (gst_buffer_get_size (enc->config) == i) {
385           equal = gst_buffer_memcmp (enc->config, 0, data, i) == 0;
386         }
387       }
388       /* if config string changed or new profile, make new caps */
389       if (!equal || newprofile) {
390         guint8 *bdata;
391
392         if (enc->config)
393           gst_buffer_unref (enc->config);
394         enc->config = gst_buffer_new_and_alloc (i);
395         bdata = gst_buffer_map (enc->config, NULL, NULL, GST_MAP_WRITE);
396         memcpy (bdata, data, i);
397         gst_buffer_unmap (enc->config, bdata, -1);
398         gst_rtp_mp4v_pay_new_caps (enc);
399       }
400       *strip = i;
401       /* we need to flush out the current packet. */
402       result = TRUE;
403       break;
404     }
405     case VOP_STARTCODE:
406       GST_DEBUG_OBJECT (enc, "VOP");
407       /* VOP startcode, we don't have to flush the packet */
408       result = FALSE;
409       /* vop-coding-type == I-frame */
410       if (size > 4 && (data[4] >> 6 == 0)) {
411         GST_DEBUG_OBJECT (enc, "VOP-I");
412         *vopi = TRUE;
413       }
414       break;
415     case GOP_STARTCODE:
416       GST_DEBUG_OBJECT (enc, "GOP");
417       *vopi = TRUE;
418       result = TRUE;
419       break;
420     case 0x00000100:
421       enc->need_config = FALSE;
422       result = TRUE;
423       break;
424     default:
425       if (code >= 0x20 && code <= 0x2f) {
426         GST_DEBUG_OBJECT (enc, "short header");
427         result = FALSE;
428       } else {
429         GST_DEBUG_OBJECT (enc, "other startcode");
430         /* all other startcodes need a flush */
431         result = TRUE;
432       }
433       break;
434   }
435   return result;
436 }
437
438 /* we expect buffers starting on startcodes. 
439  */
440 static GstFlowReturn
441 gst_rtp_mp4v_pay_handle_buffer (GstRTPBasePayload * basepayload,
442     GstBuffer * buffer)
443 {
444   GstRtpMP4VPay *rtpmp4vpay;
445   GstFlowReturn ret;
446   guint avail;
447   gsize size;
448   guint packet_len;
449   guint8 *data;
450   gboolean flush;
451   gint strip;
452   GstClockTime timestamp, duration;
453   gboolean vopi;
454   gboolean send_config;
455
456   ret = GST_FLOW_OK;
457   send_config = FALSE;
458
459   rtpmp4vpay = GST_RTP_MP4V_PAY (basepayload);
460
461   data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
462   timestamp = GST_BUFFER_TIMESTAMP (buffer);
463   duration = GST_BUFFER_DURATION (buffer);
464   avail = gst_adapter_available (rtpmp4vpay->adapter);
465
466   if (duration == -1)
467     duration = 0;
468
469   /* empty buffer, take timestamp */
470   if (avail == 0) {
471     rtpmp4vpay->first_timestamp = timestamp;
472     rtpmp4vpay->duration = 0;
473   }
474
475   /* depay incomming data and see if we need to start a new RTP
476    * packet */
477   flush = gst_rtp_mp4v_pay_depay_data (rtpmp4vpay, data, size, &strip, &vopi);
478   gst_buffer_unmap (buffer, data, -1);
479   data = NULL;
480
481   if (strip) {
482     /* strip off config if requested */
483     if (!(rtpmp4vpay->config_interval > 0)) {
484       GstBuffer *subbuf;
485
486       GST_LOG_OBJECT (rtpmp4vpay, "stripping config at %d, size %d", strip,
487           (gint) size - strip);
488
489       /* strip off header */
490       subbuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_MEMORY, strip,
491           size - strip);
492       GST_BUFFER_TIMESTAMP (subbuf) = timestamp;
493       gst_buffer_unref (buffer);
494       buffer = subbuf;
495
496       size = gst_buffer_get_size (buffer);
497     } else {
498       GST_LOG_OBJECT (rtpmp4vpay, "found config in stream");
499       rtpmp4vpay->last_config = timestamp;
500     }
501   }
502
503   /* there is a config request, see if we need to insert it */
504   if (vopi && (rtpmp4vpay->config_interval > 0) && rtpmp4vpay->config) {
505     if (rtpmp4vpay->last_config != -1) {
506       guint64 diff;
507
508       GST_LOG_OBJECT (rtpmp4vpay,
509           "now %" GST_TIME_FORMAT ", last VOP-I %" GST_TIME_FORMAT,
510           GST_TIME_ARGS (timestamp), GST_TIME_ARGS (rtpmp4vpay->last_config));
511
512       /* calculate diff between last config in milliseconds */
513       if (timestamp > rtpmp4vpay->last_config) {
514         diff = timestamp - rtpmp4vpay->last_config;
515       } else {
516         diff = 0;
517       }
518
519       GST_DEBUG_OBJECT (rtpmp4vpay,
520           "interval since last config %" GST_TIME_FORMAT, GST_TIME_ARGS (diff));
521
522       /* bigger than interval, queue config */
523       /* FIXME should convert timestamps to running time */
524       if (GST_TIME_AS_SECONDS (diff) >= rtpmp4vpay->config_interval) {
525         GST_DEBUG_OBJECT (rtpmp4vpay, "time to send config");
526         send_config = TRUE;
527       }
528     } else {
529       /* no known previous config time, send now */
530       GST_DEBUG_OBJECT (rtpmp4vpay, "no previous config time, send now");
531       send_config = TRUE;
532     }
533
534     if (send_config) {
535       /* we need to send config now first */
536       GstBuffer *superbuf;
537
538       GST_LOG_OBJECT (rtpmp4vpay, "inserting config in stream");
539
540       /* insert header */
541       superbuf = gst_buffer_merge (rtpmp4vpay->config, buffer);
542
543       GST_BUFFER_TIMESTAMP (superbuf) = timestamp;
544       gst_buffer_unref (buffer);
545       buffer = superbuf;
546
547       size = gst_buffer_get_size (buffer);
548
549       if (timestamp != -1) {
550         rtpmp4vpay->last_config = timestamp;
551       }
552     }
553   }
554
555   /* if we need to flush, do so now */
556   if (flush) {
557     ret = gst_rtp_mp4v_pay_flush (rtpmp4vpay);
558     rtpmp4vpay->first_timestamp = timestamp;
559     rtpmp4vpay->duration = 0;
560     avail = 0;
561   }
562
563   /* get packet length of data and see if we exceeded MTU. */
564   packet_len = gst_rtp_buffer_calc_packet_len (avail + size, 0, 0);
565
566   if (gst_rtp_base_payload_is_filled (basepayload,
567           packet_len, rtpmp4vpay->duration + duration)) {
568     ret = gst_rtp_mp4v_pay_flush (rtpmp4vpay);
569     rtpmp4vpay->first_timestamp = timestamp;
570     rtpmp4vpay->duration = 0;
571   }
572
573   /* push new data */
574   gst_adapter_push (rtpmp4vpay->adapter, buffer);
575
576   rtpmp4vpay->duration += duration;
577
578   return ret;
579 }
580
581 static gboolean
582 gst_rtp_mp4v_pay_sink_event (GstRTPBasePayload * pay, GstEvent * event)
583 {
584   GstRtpMP4VPay *rtpmp4vpay;
585
586   rtpmp4vpay = GST_RTP_MP4V_PAY (pay);
587
588   GST_DEBUG ("Got event: %s", GST_EVENT_TYPE_NAME (event));
589
590   switch (GST_EVENT_TYPE (event)) {
591     case GST_EVENT_SEGMENT:
592     case GST_EVENT_EOS:
593       /* This flush call makes sure that the last buffer is always pushed
594        * to the base payloader */
595       gst_rtp_mp4v_pay_flush (rtpmp4vpay);
596       break;
597     case GST_EVENT_FLUSH_STOP:
598       gst_rtp_mp4v_pay_empty (rtpmp4vpay);
599       break;
600     default:
601       break;
602   }
603
604   /* let parent handle event too */
605   return GST_RTP_BASE_PAYLOAD_CLASS (parent_class)->sink_event (pay, event);
606 }
607
608 static void
609 gst_rtp_mp4v_pay_set_property (GObject * object, guint prop_id,
610     const GValue * value, GParamSpec * pspec)
611 {
612   GstRtpMP4VPay *rtpmp4vpay;
613
614   rtpmp4vpay = GST_RTP_MP4V_PAY (object);
615
616   switch (prop_id) {
617     case ARG_SEND_CONFIG:
618       rtpmp4vpay->send_config = g_value_get_boolean (value);
619       /* send the configuration once every minute */
620       if (rtpmp4vpay->send_config && !(rtpmp4vpay->config_interval > 0)) {
621         rtpmp4vpay->config_interval = 60;
622       }
623       break;
624     case ARG_BUFFER_LIST:
625       rtpmp4vpay->buffer_list = g_value_get_boolean (value);
626       break;
627     case ARG_CONFIG_INTERVAL:
628       rtpmp4vpay->config_interval = g_value_get_uint (value);
629       break;
630     default:
631       break;
632   }
633 }
634
635 static void
636 gst_rtp_mp4v_pay_get_property (GObject * object, guint prop_id,
637     GValue * value, GParamSpec * pspec)
638 {
639   GstRtpMP4VPay *rtpmp4vpay;
640
641   rtpmp4vpay = GST_RTP_MP4V_PAY (object);
642
643   switch (prop_id) {
644     case ARG_SEND_CONFIG:
645       g_value_set_boolean (value, rtpmp4vpay->send_config);
646       break;
647     case ARG_BUFFER_LIST:
648       g_value_set_boolean (value, rtpmp4vpay->buffer_list);
649       break;
650     case ARG_CONFIG_INTERVAL:
651       g_value_set_uint (value, rtpmp4vpay->config_interval);
652       break;
653     default:
654       break;
655   }
656 }
657
658 gboolean
659 gst_rtp_mp4v_pay_plugin_init (GstPlugin * plugin)
660 {
661   return gst_element_register (plugin, "rtpmp4vpay",
662       GST_RANK_SECONDARY, GST_TYPE_RTP_MP4V_PAY);
663 }