2 * Copyright (C) <2005> Wim Taymans <wim.taymans@gmail.com>
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.
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.
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.
28 #include <gst/rtp/gstrtpbuffer.h>
30 #include "gstrtph263ppay.h"
32 #define DEFAULT_FRAGMENTATION_MODE GST_FRAGMENTATION_MODE_NORMAL
37 PROP_FRAGMENTATION_MODE
40 #define GST_TYPE_FRAGMENTATION_MODE (gst_fragmentation_mode_get_type())
42 gst_fragmentation_mode_get_type (void)
44 static GType fragmentation_mode_type = 0;
45 static const GEnumValue fragmentation_mode[] = {
46 {GST_FRAGMENTATION_MODE_NORMAL, "Normal", "normal"},
47 {GST_FRAGMENTATION_MODE_SYNC, "Fragment at sync points", "sync"},
51 if (!fragmentation_mode_type) {
52 fragmentation_mode_type =
53 g_enum_register_static ("GstFragmentationMode", fragmentation_mode);
55 return fragmentation_mode_type;
59 GST_DEBUG_CATEGORY_STATIC (rtph263ppay_debug);
60 #define GST_CAT_DEFAULT rtph263ppay_debug
62 static GstStaticPadTemplate gst_rtp_h263p_pay_sink_template =
63 GST_STATIC_PAD_TEMPLATE ("sink",
66 GST_STATIC_CAPS ("video/x-h263, " "variant = (string) \"itu\"")
70 * We also return these in getcaps() as required by the SDP caps
72 * width = (int) [16, 4096]
73 * height = (int) [16, 4096]
74 * "annex-f = (boolean) {true, false},"
75 * "annex-i = (boolean) {true, false},"
76 * "annex-j = (boolean) {true, false},"
77 * "annex-l = (boolean) {true, false},"
78 * "annex-t = (boolean) {true, false},"
79 * "annex-v = (boolean) {true, false}")
83 static GstStaticPadTemplate gst_rtp_h263p_pay_src_template =
84 GST_STATIC_PAD_TEMPLATE ("src",
87 GST_STATIC_CAPS ("application/x-rtp, "
88 "media = (string) \"video\", "
89 "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
90 "clock-rate = (int) 90000, " "encoding-name = (string) \"H263-1998\"; "
92 "media = (string) \"video\", "
93 "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
94 "clock-rate = (int) 90000, " "encoding-name = (string) \"H263-2000\"")
97 static void gst_rtp_h263p_pay_finalize (GObject * object);
99 static void gst_rtp_h263p_pay_set_property (GObject * object, guint prop_id,
100 const GValue * value, GParamSpec * pspec);
101 static void gst_rtp_h263p_pay_get_property (GObject * object, guint prop_id,
102 GValue * value, GParamSpec * pspec);
104 static gboolean gst_rtp_h263p_pay_setcaps (GstBaseRTPPayload * payload,
106 static GstCaps *gst_rtp_h263p_pay_sink_getcaps (GstBaseRTPPayload * payload,
108 static GstFlowReturn gst_rtp_h263p_pay_handle_buffer (GstBaseRTPPayload *
109 payload, GstBuffer * buffer);
111 GST_BOILERPLATE (GstRtpH263PPay, gst_rtp_h263p_pay, GstBaseRTPPayload,
112 GST_TYPE_BASE_RTP_PAYLOAD);
115 gst_rtp_h263p_pay_base_init (gpointer klass)
117 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
119 gst_element_class_add_static_pad_template (element_class,
120 &gst_rtp_h263p_pay_src_template);
121 gst_element_class_add_static_pad_template (element_class,
122 &gst_rtp_h263p_pay_sink_template);
124 gst_element_class_set_details_simple (element_class, "RTP H263 payloader",
125 "Codec/Payloader/Network/RTP",
126 "Payload-encodes H263/+/++ video in RTP packets (RFC 4629)",
127 "Wim Taymans <wim.taymans@gmail.com>");
131 gst_rtp_h263p_pay_class_init (GstRtpH263PPayClass * klass)
133 GObjectClass *gobject_class;
134 GstBaseRTPPayloadClass *gstbasertppayload_class;
136 gobject_class = (GObjectClass *) klass;
137 gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
139 gobject_class->finalize = gst_rtp_h263p_pay_finalize;
140 gobject_class->set_property = gst_rtp_h263p_pay_set_property;
141 gobject_class->get_property = gst_rtp_h263p_pay_get_property;
143 gstbasertppayload_class->set_caps = gst_rtp_h263p_pay_setcaps;
144 gstbasertppayload_class->get_caps = gst_rtp_h263p_pay_sink_getcaps;
145 gstbasertppayload_class->handle_buffer = gst_rtp_h263p_pay_handle_buffer;
147 g_object_class_install_property (G_OBJECT_CLASS (klass),
148 PROP_FRAGMENTATION_MODE, g_param_spec_enum ("fragmentation-mode",
149 "Fragmentation Mode",
150 "Packet Fragmentation Mode", GST_TYPE_FRAGMENTATION_MODE,
151 DEFAULT_FRAGMENTATION_MODE,
152 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
154 GST_DEBUG_CATEGORY_INIT (rtph263ppay_debug, "rtph263ppay",
155 0, "rtph263ppay (RFC 4629)");
159 gst_rtp_h263p_pay_init (GstRtpH263PPay * rtph263ppay,
160 GstRtpH263PPayClass * klass)
162 rtph263ppay->adapter = gst_adapter_new ();
164 rtph263ppay->fragmentation_mode = DEFAULT_FRAGMENTATION_MODE;
168 gst_rtp_h263p_pay_finalize (GObject * object)
170 GstRtpH263PPay *rtph263ppay;
172 rtph263ppay = GST_RTP_H263P_PAY (object);
174 g_object_unref (rtph263ppay->adapter);
175 rtph263ppay->adapter = NULL;
177 G_OBJECT_CLASS (parent_class)->finalize (object);
181 gst_rtp_h263p_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
185 gchar *encoding_name = NULL;
187 g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
189 peercaps = gst_pad_peer_get_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload));
191 GstCaps *intersect = gst_caps_intersect (peercaps,
192 gst_pad_get_pad_template_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload)));
194 gst_caps_unref (peercaps);
195 if (!gst_caps_is_empty (intersect)) {
196 GstStructure *s = gst_caps_get_structure (intersect, 0);
197 encoding_name = g_strdup (gst_structure_get_string (s, "encoding-name"));
199 gst_caps_unref (intersect);
203 encoding_name = g_strdup ("H263-1998");
205 gst_basertppayload_set_options (payload, "video", TRUE,
206 (gchar *) encoding_name, 90000);
207 res = gst_basertppayload_set_outcaps (payload, NULL);
208 g_free (encoding_name);
214 caps_append (GstCaps * caps, GstStructure * in_s, guint x, guint y, guint mpi)
221 if (mpi < 1 || mpi > 32)
224 s = gst_structure_copy (in_s);
226 gst_structure_set (s,
227 "width", GST_TYPE_INT_RANGE, 1, x,
228 "height", GST_TYPE_INT_RANGE, 1, y,
229 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 1001 * mpi, NULL);
231 gst_caps_merge_structure (caps, s);
236 gst_rtp_h263p_pay_sink_getcaps (GstBaseRTPPayload * payload, GstPad * pad)
238 GstRtpH263PPay *rtph263ppay;
239 GstCaps *caps = NULL;
240 GstCaps *peercaps = NULL;
241 GstCaps *intersect = NULL;
244 rtph263ppay = GST_RTP_H263P_PAY (payload);
246 peercaps = gst_pad_peer_get_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload));
249 gst_caps_copy (gst_pad_get_pad_template_caps
250 (GST_BASE_RTP_PAYLOAD_SINKPAD (payload)));
252 intersect = gst_caps_intersect (peercaps,
253 gst_pad_get_pad_template_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload)));
254 gst_caps_unref (peercaps);
256 if (gst_caps_is_empty (intersect))
259 caps = gst_caps_new_empty ();
260 for (i = 0; i < gst_caps_get_size (intersect); i++) {
261 GstStructure *s = gst_caps_get_structure (intersect, i);
262 const gchar *encoding_name = gst_structure_get_string (s, "encoding-name");
264 if (!strcmp (encoding_name, "H263-2000")) {
265 const gchar *profile_str = gst_structure_get_string (s, "profile");
266 const gchar *level_str = gst_structure_get_string (s, "level");
270 if (profile_str && level_str) {
271 gboolean i = FALSE, j = FALSE, l = FALSE, t = FALSE, f = FALSE,
273 GstStructure *new_s = gst_structure_new ("video/x-h263",
274 "variant", G_TYPE_STRING, "itu",
277 profile = atoi (profile_str);
278 level = atoi (level_str);
280 /* These profiles are defined in the H.263 Annex X */
283 /* The Baseline Profile (Profile 0) */
286 /* H.320 Coding Efficiency Version 2 Backward-Compatibility Profile
288 * Baseline + Annexes I, J, L.4 and T
290 i = j = l = t = TRUE;
293 /* Version 1 Backward-Compatibility Profile (Profile 2)
296 i = j = l = t = f = TRUE;
299 /* Version 2 Interactive and Streaming Wireless Profile
300 * Baseline + Annexes I, J, T
305 /* Version 3 Interactive and Streaming Wireless Profile (Profile 4)
306 * Baseline + Annexes I, J, T, V, W.6.3.8,
308 /* Missing W.6.3.8 */
309 i = j = t = v = TRUE;
312 /* Conversational High Compression Profile (Profile 5)
313 * Baseline + Annexes F, I, J, L.4, T, D, U
316 f = i = j = l = t = TRUE;
319 /* Conversational Internet Profile (Profile 6)
320 * Baseline + Annexes F, I, J, L.4, T, D, U and
321 * K with arbitratry slice ordering
323 /* Missing D, U, K with arbitratry slice ordering */
324 f = i = j = l = t = TRUE;
327 /* Conversational Interlace Profile (Profile 7)
328 * Baseline + Annexes F, I, J, L.4, T, D, U, W.6.3.11
330 /* Missing D, U, W.6.3.11 */
331 f = i = j = l = t = TRUE;
334 /* High Latency Profile (Profile 8)
335 * Baseline + Annexes F, I, J, L.4, T, D, U, P.5, O.1.1 and
336 * K with arbitratry slice ordering
338 /* Missing D, U, P.5, O.1.1 */
339 f = i = j = l = t = TRUE;
344 if (f || i || j || t || l || v) {
348 g_value_init (&list, GST_TYPE_LIST);
349 g_value_init (&vstr, G_TYPE_STRING);
351 g_value_set_static_string (&vstr, "h263");
352 gst_value_list_append_value (&list, &vstr);
353 g_value_set_static_string (&vstr, "h263p");
354 gst_value_list_append_value (&list, &vstr);
357 g_value_set_static_string (&vstr, "h263pp");
358 gst_value_list_append_value (&list, &vstr);
360 g_value_unset (&vstr);
362 gst_structure_set_value (new_s, "h263version", &list);
363 g_value_unset (&list);
365 gst_structure_set (new_s, "h263version", G_TYPE_STRING, "h263", NULL);
370 gst_structure_set (new_s, "annex-f", G_TYPE_BOOLEAN, FALSE, NULL);
372 gst_structure_set (new_s, "annex-i", G_TYPE_BOOLEAN, FALSE, NULL);
374 gst_structure_set (new_s, "annex-j", G_TYPE_BOOLEAN, FALSE, NULL);
376 gst_structure_set (new_s, "annex-t", G_TYPE_BOOLEAN, FALSE, NULL);
378 gst_structure_set (new_s, "annex-l", G_TYPE_BOOLEAN, FALSE, NULL);
380 gst_structure_set (new_s, "annex-v", G_TYPE_BOOLEAN, FALSE, NULL);
383 if (level <= 10 || level == 45) {
384 gst_structure_set (new_s,
385 "width", GST_TYPE_INT_RANGE, 1, 176,
386 "height", GST_TYPE_INT_RANGE, 1, 144,
387 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 2002, NULL);
388 gst_caps_merge_structure (caps, new_s);
389 } else if (level <= 20) {
390 GstStructure *s_copy = gst_structure_copy (new_s);
392 gst_structure_set (new_s,
393 "width", GST_TYPE_INT_RANGE, 1, 352,
394 "height", GST_TYPE_INT_RANGE, 1, 288,
395 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 2002, NULL);
396 gst_caps_merge_structure (caps, new_s);
398 gst_structure_set (s_copy,
399 "width", GST_TYPE_INT_RANGE, 1, 176,
400 "height", GST_TYPE_INT_RANGE, 1, 144,
401 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 1001, NULL);
402 gst_caps_merge_structure (caps, s_copy);
403 } else if (level <= 40) {
405 gst_structure_set (new_s,
406 "width", GST_TYPE_INT_RANGE, 1, 352,
407 "height", GST_TYPE_INT_RANGE, 1, 288,
408 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 1001, NULL);
409 gst_caps_merge_structure (caps, new_s);
410 } else if (level <= 50) {
411 GstStructure *s_copy = gst_structure_copy (new_s);
413 gst_structure_set (new_s,
414 "width", GST_TYPE_INT_RANGE, 1, 352,
415 "height", GST_TYPE_INT_RANGE, 1, 288,
416 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 50, 1, NULL);
417 gst_caps_merge_structure (caps, new_s);
419 gst_structure_set (s_copy,
420 "width", GST_TYPE_INT_RANGE, 1, 352,
421 "height", GST_TYPE_INT_RANGE, 1, 240,
422 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60000, 1001, NULL);
423 gst_caps_merge_structure (caps, s_copy);
424 } else if (level <= 60) {
425 GstStructure *s_copy = gst_structure_copy (new_s);
427 gst_structure_set (new_s,
428 "width", GST_TYPE_INT_RANGE, 1, 720,
429 "height", GST_TYPE_INT_RANGE, 1, 288,
430 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 50, 1, NULL);
431 gst_caps_merge_structure (caps, new_s);
433 gst_structure_set (s_copy,
434 "width", GST_TYPE_INT_RANGE, 1, 720,
435 "height", GST_TYPE_INT_RANGE, 1, 240,
436 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60000, 1001, NULL);
437 gst_caps_merge_structure (caps, s_copy);
438 } else if (level <= 70) {
439 GstStructure *s_copy = gst_structure_copy (new_s);
441 gst_structure_set (new_s,
442 "width", GST_TYPE_INT_RANGE, 1, 720,
443 "height", GST_TYPE_INT_RANGE, 1, 576,
444 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 50, 1, NULL);
445 gst_caps_merge_structure (caps, new_s);
447 gst_structure_set (s_copy,
448 "width", GST_TYPE_INT_RANGE, 1, 720,
449 "height", GST_TYPE_INT_RANGE, 1, 480,
450 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60000, 1001, NULL);
451 gst_caps_merge_structure (caps, s_copy);
453 gst_caps_merge_structure (caps, new_s);
457 GstStructure *new_s = gst_structure_new ("video/x-h263",
458 "variant", G_TYPE_STRING, "itu",
459 "h263version", G_TYPE_STRING, "h263",
462 GST_DEBUG_OBJECT (rtph263ppay, "No profile or level specified"
463 " for H263-2000, defaulting to baseline H263");
465 gst_caps_merge_structure (caps, new_s);
468 gboolean f = FALSE, i = FALSE, j = FALSE, t = FALSE;
469 /* FIXME: ffmpeg support the Appendix K too, how do we express it ?
473 GstStructure *new_s = gst_structure_new ("video/x-h263",
474 "variant", G_TYPE_STRING, "itu",
476 gboolean added = FALSE;
478 str = gst_structure_get_string (s, "f");
479 if (str && !strcmp (str, "1"))
482 str = gst_structure_get_string (s, "i");
483 if (str && !strcmp (str, "1"))
486 str = gst_structure_get_string (s, "j");
487 if (str && !strcmp (str, "1"))
490 str = gst_structure_get_string (s, "t");
491 if (str && !strcmp (str, "1"))
494 if (f || i || j || t) {
498 g_value_init (&list, GST_TYPE_LIST);
499 g_value_init (&vstr, G_TYPE_STRING);
501 g_value_set_static_string (&vstr, "h263");
502 gst_value_list_append_value (&list, &vstr);
503 g_value_set_static_string (&vstr, "h263p");
504 gst_value_list_append_value (&list, &vstr);
505 g_value_unset (&vstr);
507 gst_structure_set_value (new_s, "h263version", &list);
508 g_value_unset (&list);
510 gst_structure_set (new_s, "h263version", G_TYPE_STRING, "h263", NULL);
514 gst_structure_set (new_s, "annex-f", G_TYPE_BOOLEAN, FALSE, NULL);
516 gst_structure_set (new_s, "annex-i", G_TYPE_BOOLEAN, FALSE, NULL);
518 gst_structure_set (new_s, "annex-j", G_TYPE_BOOLEAN, FALSE, NULL);
520 gst_structure_set (new_s, "annex-t", G_TYPE_BOOLEAN, FALSE, NULL);
523 str = gst_structure_get_string (s, "custom");
525 unsigned int xmax, ymax, mpi;
526 if (sscanf (str, "%u,%u,%u", &xmax, &ymax, &mpi) == 3) {
527 if (xmax % 4 && ymax % 4 && mpi >= 1 && mpi <= 32) {
528 caps_append (caps, new_s, xmax, ymax, mpi);
531 GST_WARNING_OBJECT (rtph263ppay, "Invalid custom framesize/MPI"
532 " %u x %u at %u, ignoring", xmax, ymax, mpi);
535 GST_WARNING_OBJECT (rtph263ppay, "Invalid custom framesize/MPI: %s,"
540 str = gst_structure_get_string (s, "16cif");
542 int mpi = atoi (str);
543 caps_append (caps, new_s, 1408, 1152, mpi);
547 str = gst_structure_get_string (s, "4cif");
549 int mpi = atoi (str);
550 caps_append (caps, new_s, 704, 576, mpi);
554 str = gst_structure_get_string (s, "cif");
556 int mpi = atoi (str);
557 caps_append (caps, new_s, 352, 288, mpi);
561 str = gst_structure_get_string (s, "qcif");
563 int mpi = atoi (str);
564 caps_append (caps, new_s, 176, 144, mpi);
568 str = gst_structure_get_string (s, "sqcif");
570 int mpi = atoi (str);
571 caps_append (caps, new_s, 128, 96, mpi);
576 gst_structure_free (new_s);
578 gst_caps_merge_structure (caps, new_s);
582 gst_caps_unref (intersect);
589 gst_rtp_h263p_pay_set_property (GObject * object, guint prop_id,
590 const GValue * value, GParamSpec * pspec)
592 GstRtpH263PPay *rtph263ppay;
594 rtph263ppay = GST_RTP_H263P_PAY (object);
597 case PROP_FRAGMENTATION_MODE:
598 rtph263ppay->fragmentation_mode = g_value_get_enum (value);
601 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
607 gst_rtp_h263p_pay_get_property (GObject * object, guint prop_id,
608 GValue * value, GParamSpec * pspec)
610 GstRtpH263PPay *rtph263ppay;
612 rtph263ppay = GST_RTP_H263P_PAY (object);
615 case PROP_FRAGMENTATION_MODE:
616 g_value_set_enum (value, rtph263ppay->fragmentation_mode);
619 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
625 gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay)
632 avail = gst_adapter_available (rtph263ppay->adapter);
637 /* This algorithm assumes the H263/+/++ encoder sends complete frames in each
639 /* With Fragmentation Mode at GST_FRAGMENTATION_MODE_NORMAL:
640 * This algorithm implements the Follow-on packets method for packetization.
641 * This assumes low packet loss network.
642 * With Fragmentation Mode at GST_FRAGMENTATION_MODE_SYNC:
643 * This algorithm separates large frames at synchronisation points (Segments)
644 * (See RFC 4629 section 6). It would be interesting to have a property such as network
645 * quality to select between both packetization methods */
646 /* TODO Add VRC supprt (See RFC 4629 section 5.2) */
654 gboolean found_gob = FALSE;
656 if (rtph263ppay->fragmentation_mode == GST_FRAGMENTATION_MODE_SYNC) {
657 /* start after 1st gop possible */
658 guint parsed_len = 3;
659 const guint8 *parse_data = NULL;
661 parse_data = gst_adapter_peek (rtph263ppay->adapter, avail);
663 /* Check if we have a gob or eos , eossbs */
664 /* FIXME EOS and EOSSBS packets should never contain any gobs and vice-versa */
665 if (avail >= 3 && *parse_data == 0 && *(parse_data + 1) == 0
666 && *(parse_data + 2) >= 0x80) {
667 GST_DEBUG_OBJECT (rtph263ppay, " Found GOB header");
670 /* Find next and cut the packet accordingly */
671 /* TODO we should get as many gobs as possible until MTU is reached, this
672 * code seems to just get one GOB per packet */
673 while (parsed_len + 2 < avail) {
674 if (parse_data[parsed_len] == 0 && parse_data[parsed_len + 1] == 0
675 && parse_data[parsed_len + 2] >= 0x80) {
676 next_gop = parsed_len;
677 GST_DEBUG_OBJECT (rtph263ppay, " Next GOB Detected at : %d",
685 /* for picture start frames (non-fragmented), we need to remove the first
686 * two 0x00 bytes and set P=1 */
687 header_len = (fragmented && !found_gob) ? 2 : 0;
689 towrite = MIN (avail, gst_rtp_buffer_calc_payload_len
690 (GST_BASE_RTP_PAYLOAD_MTU (rtph263ppay) - header_len, 0, 0));
693 towrite = MIN (next_gop, towrite);
695 payload_len = header_len + towrite;
697 outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
698 /* last fragment gets the marker bit set */
699 gst_rtp_buffer_set_marker (outbuf, avail > towrite ? 0 : 1);
701 payload = gst_rtp_buffer_get_payload (outbuf);
703 gst_adapter_copy (rtph263ppay->adapter, &payload[header_len], 0, towrite);
706 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
707 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
708 * | RR |P|V| PLEN |PEBIT|
709 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
711 /* if fragmented or gop header , write p bit =1 */
712 payload[0] = (fragmented && !found_gob) ? 0x00 : 0x04;
715 GST_BUFFER_TIMESTAMP (outbuf) = rtph263ppay->first_timestamp;
716 GST_BUFFER_DURATION (outbuf) = rtph263ppay->first_duration;
718 gst_adapter_flush (rtph263ppay->adapter, towrite);
720 ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtph263ppay), outbuf);
730 gst_rtp_h263p_pay_handle_buffer (GstBaseRTPPayload * payload,
733 GstRtpH263PPay *rtph263ppay;
736 rtph263ppay = GST_RTP_H263P_PAY (payload);
738 rtph263ppay->first_timestamp = GST_BUFFER_TIMESTAMP (buffer);
739 rtph263ppay->first_duration = GST_BUFFER_DURATION (buffer);
741 /* we always encode and flush a full picture */
742 gst_adapter_push (rtph263ppay->adapter, buffer);
743 ret = gst_rtp_h263p_pay_flush (rtph263ppay);
749 gst_rtp_h263p_pay_plugin_init (GstPlugin * plugin)
751 return gst_element_register (plugin, "rtph263ppay",
752 GST_RANK_SECONDARY, GST_TYPE_RTP_H263P_PAY);