![]() |
![]() |
![]() |
GStreamer Base Plugins 0.10 Library Reference Manual | ![]() |
---|---|---|---|---|
#include <gst/rtp/gstrtpbuffer.h> enum GstRTPPayload; #define GST_RTP_VERSION void gst_rtp_buffer_allocate_data (GstBuffer *buffer, guint payload_len, guint8 pad_len, guint8 csrc_count); 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); guint32 gst_rtp_buffer_get_csrc (GstBuffer *buffer, guint8 idx); guint8 gst_rtp_buffer_get_csrc_count (GstBuffer *buffer); gboolean gst_rtp_buffer_get_extension (GstBuffer *buffer); gboolean gst_rtp_buffer_get_marker (GstBuffer *buffer); guint gst_rtp_buffer_get_packet_len (GstBuffer *buffer); gboolean gst_rtp_buffer_get_padding (GstBuffer *buffer); gpointer gst_rtp_buffer_get_payload (GstBuffer *buffer); GstBuffer* gst_rtp_buffer_get_payload_buffer (GstBuffer *buffer); GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstBuffer *buffer, guint offset, guint len); guint gst_rtp_buffer_get_payload_len (GstBuffer *buffer); guint8 gst_rtp_buffer_get_payload_type (GstBuffer *buffer); guint16 gst_rtp_buffer_get_seq (GstBuffer *buffer); guint32 gst_rtp_buffer_get_ssrc (GstBuffer *buffer); guint32 gst_rtp_buffer_get_timestamp (GstBuffer *buffer); guint8 gst_rtp_buffer_get_version (GstBuffer *buffer); 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); GstBuffer* gst_rtp_buffer_new_copy_data (gpointer data, guint len); GstBuffer* gst_rtp_buffer_new_take_data (gpointer data, guint len); void gst_rtp_buffer_pad_to (GstBuffer *buffer, guint len); void gst_rtp_buffer_set_csrc (GstBuffer *buffer, guint8 idx, guint32 csrc); void gst_rtp_buffer_set_extension (GstBuffer *buffer, gboolean extension); void gst_rtp_buffer_set_marker (GstBuffer *buffer, gboolean marker); void gst_rtp_buffer_set_packet_len (GstBuffer *buffer, guint len); void gst_rtp_buffer_set_padding (GstBuffer *buffer, gboolean padding); void gst_rtp_buffer_set_payload_type (GstBuffer *buffer, guint8 payload_type); void gst_rtp_buffer_set_seq (GstBuffer *buffer, guint16 seq); void gst_rtp_buffer_set_ssrc (GstBuffer *buffer, guint32 ssrc); void gst_rtp_buffer_set_timestamp (GstBuffer *buffer, guint32 timestamp); void gst_rtp_buffer_set_version (GstBuffer *buffer, guint8 version); gboolean gst_rtp_buffer_validate (GstBuffer *buffer); gboolean gst_rtp_buffer_validate_data (guint8 *data, guint len);
The GstRTPBuffer helper functions makes it easy to parse and create regular GstBuffer objects that contain RTP payloads. These buffers are typically of 'application/x-rtp' GstCaps.
Last reviewed on 2006-07-17 (0.10.10)
typedef enum { /* Audio: */ GST_RTP_PAYLOAD_PCMU = 0, GST_RTP_PAYLOAD_GSM = 3, GST_RTP_PAYLOAD_PCMA = 8, GST_RTP_PAYLOAD_L16_STEREO = 10, GST_RTP_PAYLOAD_L16_MONO = 11, GST_RTP_PAYLOAD_MPA = 14, GST_RTP_PAYLOAD_G723_63 = 16, GST_RTP_PAYLOAD_G723_53 = 17, GST_RTP_PAYLOAD_TS48 = 18, GST_RTP_PAYLOAD_TS41 = 19, GST_RTP_PAYLOAD_G728 = 20, GST_RTP_PAYLOAD_G729 = 21, /* Video: */ GST_RTP_PAYLOAD_MPV = 32, GST_RTP_PAYLOAD_H263 = 34, /* BOTH */ } GstRTPPayload;
Standard predefined fixed payload types.
GST_RTP_PAYLOAD_PCMU
GST_RTP_PAYLOAD_PCMU
ITU-T G.711. mu-law audio (RFC 3551)
ITU-T G.711. mu-law audio (RFC 3551)
GST_RTP_PAYLOAD_GSM
GST_RTP_PAYLOAD_GSM
GSM audio
GSM audio
GST_RTP_PAYLOAD_PCMA
GST_RTP_PAYLOAD_PCMA
ITU-T G.711 A-law audio (RFC 3551)
ITU-T G.711 A-law audio (RFC 3551)
GST_RTP_PAYLOAD_L16_STEREO
GST_RTP_PAYLOAD_L16_STEREO
stereo PCM
stereo PCM
GST_RTP_PAYLOAD_L16_MONO
GST_RTP_PAYLOAD_L16_MONO
mono PCM
mono PCM
GST_RTP_PAYLOAD_MPA
GST_RTP_PAYLOAD_MPA
Audio MPEG 1-3.
Audio MPEG 1-3.
GST_RTP_PAYLOAD_G723_63
GST_RTP_PAYLOAD_G723_63
Not standard
Not standard
GST_RTP_PAYLOAD_G723_53
GST_RTP_PAYLOAD_G723_53
Not standard
Not standard
GST_RTP_PAYLOAD_TS48
GST_RTP_PAYLOAD_TS48
Not standard
Not standard
GST_RTP_PAYLOAD_TS41
GST_RTP_PAYLOAD_TS41
Not standard
Not standard
GST_RTP_PAYLOAD_G728
GST_RTP_PAYLOAD_G728
Not standard
Not standard
GST_RTP_PAYLOAD_G729
GST_RTP_PAYLOAD_G729
Not standard
Not standard
GST_RTP_PAYLOAD_MPV
GST_RTP_PAYLOAD_MPV
Video MPEG 1 & 2
Video MPEG 1 & 2
GST_RTP_PAYLOAD_H263
GST_RTP_PAYLOAD_H263
Video H263
Video H263
void gst_rtp_buffer_allocate_data (GstBuffer *buffer, guint payload_len, guint8 pad_len, guint8 csrc_count);
Allocate enough data in buffer
to hold an RTP packet with csrc_count
CSRCs,
a payload length of payload_len
and padding of pad_len
.
MALLOCDATA of buffer
will be overwritten and will not be freed.
All other RTP header fields will be set to 0/FALSE.
buffer
:buffer
a GstBuffer
a GstBuffer
GstBufferGstBufferpayload_len
:payload_len
the length of the payload
the length of the payload
pad_len
:pad_len
the amount of padding
the amount of padding
csrc_count
:csrc_count
the number of CSRC entries
the number of CSRC entries
buffer : |
a GstBuffer |
payload_len : |
the length of the payload |
pad_len : |
the amount of padding |
csrc_count : |
the number of CSRC entries |
guint gst_rtp_buffer_calc_header_len (guint8 csrc_count);
Calculate the header length of an RTP packet with csrc_count
CSRC entries.
An RTP packet can have at most 15 CSRC entries.
csrc_count
:csrc_count
the number of CSRC entries
the number of CSRC entries
Returns :Returns The length of an RTP header with csrc_count
CSRC entries.
The length of an RTP header with csrc_count
CSRC entries.
csrc_count
csrc_count : |
the number of CSRC entries |
Returns : | The length of an RTP header with csrc_count CSRC entries.
|
guint gst_rtp_buffer_calc_packet_len (guint payload_len, guint8 pad_len, guint8 csrc_count);
Calculate the total length of an RTP packet with a payload size of payload_len
,
a padding of pad_len
and a csrc_count
CSRC entries.
payload_len
:payload_len
the length of the payload
the length of the payload
pad_len
:pad_len
the amount of padding
the amount of padding
csrc_count
:csrc_count
the number of CSRC entries
the number of CSRC entries
Returns :Returns The total length of an RTP header with given parameters.
The total length of an RTP header with given parameters.
payload_len : |
the length of the payload |
pad_len : |
the amount of padding |
csrc_count : |
the number of CSRC entries |
Returns : | The total length of an RTP header with given parameters. |
guint gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
Calculate the length of the payload of an RTP packet with size packet_len
,
a padding of pad_len
and a csrc_count
CSRC entries.
packet_len
:packet_len
the length of the total RTP packet
the length of the total RTP packet
pad_len
:pad_len
the amount of padding
the amount of padding
csrc_count
:csrc_count
the number of CSRC entries
the number of CSRC entries
Returns :Returns The length of the payload of an RTP packet with given parameters.
The length of the payload of an RTP packet with given parameters.
packet_len : |
the length of the total RTP packet |
pad_len : |
the amount of padding |
csrc_count : |
the number of CSRC entries |
Returns : | The length of the payload of an RTP packet with given parameters. |
guint32 gst_rtp_buffer_get_csrc (GstBuffer *buffer, guint8 idx);
Get the CSRC at index idx
in buffer
.
buffer
:buffer
the buffer
the buffer
idx
:idx
the index of the CSRC to get
the index of the CSRC to get
Returns :Returns the CSRC at index idx
in host order.
the CSRC at index idx
in host order.
idx
buffer : |
the buffer |
idx : |
the index of the CSRC to get |
Returns : | the CSRC at index idx in host order.
|
guint8 gst_rtp_buffer_get_csrc_count (GstBuffer *buffer);
Get the CSRC count of the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns the CSRC count of buffer
.
the CSRC count of buffer
.
buffer
buffer : |
the buffer |
Returns : | the CSRC count of buffer .
|
gboolean gst_rtp_buffer_get_extension (GstBuffer *buffer);
Check if the extension bit is set on the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns TRUE if buffer
has the extension bit set.
TRUE if buffer
has the extension bit set.
buffer
buffer : |
the buffer |
Returns : | TRUE if buffer has the extension bit set.
|
gboolean gst_rtp_buffer_get_marker (GstBuffer *buffer);
Check if the marker bit is set on the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns TRUE if buffer
has the marker bit set.
TRUE if buffer
has the marker bit set.
buffer
buffer : |
the buffer |
Returns : | TRUE if buffer has the marker bit set.
|
guint gst_rtp_buffer_get_packet_len (GstBuffer *buffer);
Return the total length of the packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns The total length of the packet in buffer
.
The total length of the packet in buffer
.
buffer
buffer : |
the buffer |
Returns : | The total length of the packet in buffer .
|
gboolean gst_rtp_buffer_get_padding (GstBuffer *buffer);
Check if the padding bit is set on the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns TRUE if buffer
has the padding bit set.
TRUE if buffer
has the padding bit set.
buffer
buffer : |
the buffer |
Returns : | TRUE if buffer has the padding bit set.
|
gpointer gst_rtp_buffer_get_payload (GstBuffer *buffer);
Get a pointer to the payload data in buffer
. This pointer is valid as long
as a reference to buffer
is helt.
buffer
:buffer
the buffer
the buffer
Returns :Returns A pointer to the payload data in buffer
.
A pointer to the payload data in buffer
.
buffer
buffer : |
the buffer |
Returns : | A pointer to the payload data in buffer .
|
GstBuffer* gst_rtp_buffer_get_payload_buffer (GstBuffer *buffer);
Create a buffer of the payload of the RTP packet in buffer
. This function
will internally create a subbuffer of buffer
so that a memcopy can be
avoided.
buffer
:buffer
the buffer
the buffer
Returns :Returns A new buffer with the data of the payload.
A new buffer with the data of the payload.
buffer : |
the buffer |
Returns : | A new buffer with the data of the payload. |
GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstBuffer *buffer, guint offset, guint len);
Create a subbuffer of the payload of the RTP packet in buffer
. offset
bytes
are skipped in the payload and the subbuffer will be of size len
.
If len
is -1 the total payload starting from offset
if subbuffered.
buffer
:buffer
the buffer
the buffer
offset
:offset
the offset in the payload
the offset in the payload
len
:len
the length in the payload
the length in the payload
Returns :Returns A new buffer with the specified data of the payload.
A new buffer with the specified data of the payload.
buffer : |
the buffer |
offset : |
the offset in the payload |
len : |
the length in the payload |
Returns : | A new buffer with the specified data of the payload. |
Since 0.10.10
guint gst_rtp_buffer_get_payload_len (GstBuffer *buffer);
Get the length of the payload of the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns The length of the payload in buffer
.
The length of the payload in buffer
.
buffer
buffer : |
the buffer |
Returns : | The length of the payload in buffer .
|
guint8 gst_rtp_buffer_get_payload_type (GstBuffer *buffer);
Get the payload type of the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns The payload type.
The payload type.
buffer : |
the buffer |
Returns : | The payload type. |
guint16 gst_rtp_buffer_get_seq (GstBuffer *buffer);
Get the sequence number of the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns The sequence number in host order.
The sequence number in host order.
buffer : |
the buffer |
Returns : | The sequence number in host order. |
guint32 gst_rtp_buffer_get_ssrc (GstBuffer *buffer);
Get the SSRC of the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns the SSRC of buffer
in host order.
the SSRC of buffer
in host order.
buffer
buffer : |
the buffer |
Returns : | the SSRC of buffer in host order.
|
guint32 gst_rtp_buffer_get_timestamp (GstBuffer *buffer);
Get the timestamp of the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns The timestamp in host order.
The timestamp in host order.
buffer : |
the buffer |
Returns : | The timestamp in host order. |
guint8 gst_rtp_buffer_get_version (GstBuffer *buffer);
Get the version number of the RTP packet in buffer
.
buffer
:buffer
the buffer
the buffer
Returns :Returns The version of buffer
.
The version of buffer
.
buffer
buffer : |
the buffer |
Returns : | The version of buffer .
|
GstBuffer* gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len, guint8 csrc_count);
Allocate a new Gstbuffer with enough data to hold an RTP packet with csrc_count
CSRCs,
a payload length of payload_len
and padding of pad_len
.
All other RTP header fields will be set to 0/FALSE.
payload_len
:payload_len
the length of the payload
the length of the payload
pad_len
:pad_len
the amount of padding
the amount of padding
csrc_count
:csrc_count
the number of CSRC entries
the number of CSRC entries
Returns :Returns A newly allocated buffer that can hold an RTP packet with given
parameters.
A newly allocated buffer that can hold an RTP packet with given
parameters.
payload_len : |
the length of the payload |
pad_len : |
the amount of padding |
csrc_count : |
the number of CSRC entries |
Returns : | A newly allocated buffer that can hold an RTP packet with given parameters. |
GstBuffer* gst_rtp_buffer_new_allocate_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
Create a new GstBuffer that can hold an RTP packet that is exactly
packet_len
long. The length of the payload depends on pad_len
and
csrc_count
and can be calculated with gst_rtp_buffer_calc_payload_len()
.
All RTP header fields will be set to 0/FALSE.
packet_len
:packet_len
the total length of the packet
the total length of the packet
pad_len
:pad_len
the amount of padding
the amount of padding
csrc_count
:csrc_count
the number of CSRC entries
the number of CSRC entries
Returns :Returns A newly allocated buffer that can hold an RTP packet of packet_len
.
A newly allocated buffer that can hold an RTP packet of packet_len
.
packet_len
packet_len : |
the total length of the packet |
pad_len : |
the amount of padding |
csrc_count : |
the number of CSRC entries |
Returns : | A newly allocated buffer that can hold an RTP packet of packet_len .
|
GstBuffer* gst_rtp_buffer_new_copy_data (gpointer data, guint len);
Create a new buffer and set the data to a copy of len
bytes of data
and the size to len
. The data will be freed when the buffer
is freed.
data
:data
data for the new buffer
data for the new buffer
len
:len
the length of data
the length of data
Returns :Returns A newly allocated buffer with a copy of data
and of size len
.
A newly allocated buffer with a copy of data
and of size len
.
data
len
data : |
data for the new buffer |
len : |
the length of data |
Returns : | A newly allocated buffer with a copy of data and of size len .
|
GstBuffer* gst_rtp_buffer_new_take_data (gpointer data, guint len);
Create a new buffer and set the data and size of the buffer to data
and len
respectively. data
will be freed when the buffer is unreffed, so this
function transfers ownership of data
to the new buffer.
data
:data
data for the new buffer
data for the new buffer
len
:len
the length of data
the length of data
Returns :Returns A newly allocated buffer with data
and of size len
.
A newly allocated buffer with data
and of size len
.
data
len
data : |
data for the new buffer |
len : |
the length of data |
Returns : | A newly allocated buffer with data and of size len .
|
void gst_rtp_buffer_pad_to (GstBuffer *buffer, guint len);
Set the amount of padding in the RTP packing in buffer
to
len
. If len
is 0, the padding is removed.
NOTE: This function does not work correctly.
buffer
:buffer
the buffer
the buffer
len
:len
the new amount of padding
the new amount of padding
buffer : |
the buffer |
len : |
the new amount of padding |
void gst_rtp_buffer_set_csrc (GstBuffer *buffer, guint8 idx, guint32 csrc);
Modify the CSRC at index idx
in buffer
to csrc
.
buffer
:buffer
the buffer
the buffer
idx
:idx
the CSRC index to set
the CSRC index to set
csrc
:csrc
the CSRC in host order to set at idx
the CSRC in host order to set at idx
idx
buffer : |
the buffer |
idx : |
the CSRC index to set |
csrc : |
the CSRC in host order to set at idx
|
void gst_rtp_buffer_set_extension (GstBuffer *buffer, gboolean extension);
Set the extension bit on the RTP packet in buffer
to extension
.
buffer
:buffer
the buffer
the buffer
extension
:extension
the new extension
the new extension
buffer : |
the buffer |
extension : |
the new extension |
void gst_rtp_buffer_set_marker (GstBuffer *buffer, gboolean marker);
Set the marker bit on the RTP packet in buffer
to marker
.
buffer
:buffer
the buffer
the buffer
marker
:marker
the new marker
the new marker
buffer : |
the buffer |
marker : |
the new marker |
void gst_rtp_buffer_set_packet_len (GstBuffer *buffer, guint len);
Set the total buffer
size to len
. The data in the buffer will be made
larger if needed. Any padding will be removed from the packet.
buffer
:buffer
the buffer
the buffer
len
:len
the new packet length
the new packet length
buffer : |
the buffer |
len : |
the new packet length |
void gst_rtp_buffer_set_padding (GstBuffer *buffer, gboolean padding);
Set the padding bit on the RTP packet in buffer
to padding
.
buffer
:buffer
the buffer
the buffer
padding
:padding
the new padding
the new padding
buffer : |
the buffer |
padding : |
the new padding |
void gst_rtp_buffer_set_payload_type (GstBuffer *buffer, guint8 payload_type);
Set the payload type of the RTP packet in buffer
to payload_type
.
buffer
:buffer
the buffer
the buffer
payload_type
:payload_type
the new type
the new type
buffer : |
the buffer |
payload_type : |
the new type |
void gst_rtp_buffer_set_seq (GstBuffer *buffer, guint16 seq);
Set the sequence number of the RTP packet in buffer
to seq
.
buffer
:buffer
the buffer
the buffer
seq
:seq
the new sequence number
the new sequence number
buffer : |
the buffer |
seq : |
the new sequence number |
void gst_rtp_buffer_set_ssrc (GstBuffer *buffer, guint32 ssrc);
Set the SSRC on the RTP packet in buffer
to ssrc
.
buffer
:buffer
the buffer
the buffer
ssrc
:ssrc
the new SSRC
the new SSRC
buffer : |
the buffer |
ssrc : |
the new SSRC |
void gst_rtp_buffer_set_timestamp (GstBuffer *buffer, guint32 timestamp);
Set the timestamp of the RTP packet in buffer
to timestamp
.
buffer
:buffer
the buffer
the buffer
timestamp
:timestamp
the new timestamp
the new timestamp
buffer : |
the buffer |
timestamp : |
the new timestamp |
void gst_rtp_buffer_set_version (GstBuffer *buffer, guint8 version);
Set the version of the RTP packet in buffer
to version
.
buffer
:buffer
the buffer
the buffer
version
:version
the new version
the new version
buffer : |
the buffer |
version : |
the new version |
gboolean gst_rtp_buffer_validate (GstBuffer *buffer);
Check if the data pointed to by buffer
is a valid RTP packet using
gst_rtp_buffer_validate_data()
.
buffer
:buffer
the buffer to validate
the buffer to validate
Returns :Returns TRUE if buffer
is a valid RTP packet.
TRUE if buffer
is a valid RTP packet.
buffer
buffer : |
the buffer to validate |
Returns : | TRUE if buffer is a valid RTP packet.
|
gboolean gst_rtp_buffer_validate_data (guint8 *data, guint len);
Check if the data
and size
point to the data of a valid RTP packet.
This function checks the length, version and padding of the packet data.
Use this function to validate a packet before using the other functions in
this module.
data
:data
the data to validate
the data to validate
len
:len
the length of data
to validate
the length of data
to validate
data
Returns :Returns TRUE if the data points to a valid RTP packet.
TRUE if the data points to a valid RTP packet.
data : |
the data to validate |
len : |
the length of data to validate
|
Returns : | TRUE if the data points to a valid RTP packet. |