Commit 7536d96d authored by Olivier Crête's avatar Olivier Crête Committed by Wim Taymans
Browse files

rtpbuffer: Add function to transform a GstBuffer into a GstBufferList

Add a new function called gst_rtp_buffer_list_from_buffer() that takes
a GstBuffer containing a RTP packets and spits out a GstBufferList
containing two buffers, one with the header and the other with the payload.
parent f6b7ea3d
......@@ -1288,6 +1288,7 @@ gst_rtp_buffer_new_take_data
......@@ -2022,3 +2022,38 @@ gst_rtp_buffer_list_add_extension_twobytes_header (GstBufferListIterator * it,
return retval;
* gst_rtp_buffer_list_from_buffer:
* @buffer: a #GstBuffer containing a RTP packet
* Splits a #GstBuffer into a #GstBufferList containing separate
* buffers for the header and data sections.
* Returns: a #GstBufferList
GstBufferList *
gst_rtp_buffer_list_from_buffer (GstBuffer * buffer)
GstBufferList *bufferlist;
GstBuffer *sub;
GstBufferListIterator *it;
guint8 *payload;
bufferlist = gst_buffer_list_new ();
it = gst_buffer_list_iterate (bufferlist);
gst_buffer_list_iterator_add_group (it);
payload = gst_rtp_buffer_get_payload (buffer);
sub = gst_buffer_create_sub (buffer, 0, payload - GST_BUFFER_DATA (buffer));
gst_buffer_list_iterator_add (it, sub);
sub = gst_rtp_buffer_get_payload_buffer (buffer);
gst_buffer_list_iterator_add (it, sub);
gst_buffer_list_iterator_free (it);
return bufferlist;
......@@ -45,6 +45,9 @@ GstBuffer* gst_rtp_buffer_new_copy_data (gpointer data, guint len);
GstBuffer* gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len, guint8 csrc_count);
GstBuffer* gst_rtp_buffer_new_allocate_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
GstBufferList* gst_rtp_buffer_list_from_buffer (GstBuffer * buffer);
guint gst_rtp_buffer_calc_header_len (guint8 csrc_count);
guint gst_rtp_buffer_calc_packet_len (guint payload_len, guint8 pad_len, guint8 csrc_count);
guint gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment