mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
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.
This commit is contained in:
parent
f6b7ea3d39
commit
7536d96d7c
3 changed files with 39 additions and 0 deletions
|
@ -1288,6 +1288,7 @@ gst_rtp_buffer_new_take_data
|
|||
gst_rtp_buffer_new_copy_data
|
||||
gst_rtp_buffer_new_allocate
|
||||
gst_rtp_buffer_new_allocate_len
|
||||
gst_rtp_buffer_list_from_buffer
|
||||
|
||||
gst_rtp_buffer_calc_header_len
|
||||
gst_rtp_buffer_calc_packet_len
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue