## gstrtcpbuffer gstrtcpbuffer — Helper methods for dealing with RTCP buffers |

## Synopsis

    #include <gst/rtp/gstrtcpbuffer.h>

    #define             GST_RTCP_VERSION
    #define             GST_RTCP_MAX_SDES
    #define             GST_RTCP_MAX_BYE_SSRC_COUNT
    #define             GST_RTCP_MAX_RB_COUNT
    #define             GST_RTCP_MAX_SDES_ITEM_COUNT
    #define             GST_RTCP_VALID_MASK
    #define             GST_RTCP_VALID_VALUE
    enum                GstRTCPType;
    struct              GstRTCPPacket;
    enum                GstRTCPSDESType;
    enum                GstRTCPFBType;
    GstBuffer *         gst_rtcp_buffer_new_take_data       (gpointer data,
                                                             guint len);
    GstBuffer *         gst_rtcp_buffer_new_copy_data       (gpointer data,
                                                             guint len);
    gboolean            gst_rtcp_buffer_validate_data       (guint8 *data,
                                                             guint len);
    gboolean            gst_rtcp_buffer_validate            (GstBuffer *buffer);
    GstBuffer *         gst_rtcp_buffer_new                 (guint mtu);
    void                gst_rtcp_buffer_end                 (GstBuffer *buffer);
    guint               gst_rtcp_buffer_get_packet_count    (GstBuffer *buffer);
    gboolean            gst_rtcp_buffer_get_first_packet    (GstBuffer *buffer,
                                                             GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_move_to_next        (GstRTCPPacket *packet);
    gboolean            gst_rtcp_buffer_add_packet          (GstBuffer *buffer,
                                                             GstRTCPType type,
                                                             GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_remove              (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_get_padding         (GstRTCPPacket *packet);
    guint8              gst_rtcp_packet_get_count           (GstRTCPPacket *packet);
    GstRTCPType         gst_rtcp_packet_get_type            (GstRTCPPacket *packet);
    guint16             gst_rtcp_packet_get_length          (GstRTCPPacket *packet);
    void                gst_rtcp_packet_sr_get_sender_info  (GstRTCPPacket *packet,
                                                             guint32 *ssrc,
                                                             guint64 *ntptime,
                                                             guint32 *rtptime,
                                                             guint32 *packet_count,
                                                             guint32 *octet_count);
    void                gst_rtcp_packet_sr_set_sender_info  (GstRTCPPacket *packet,
                                                             guint32 ssrc,
                                                             guint64 ntptime,
                                                             guint32 rtptime,
                                                             guint32 packet_count,
                                                             guint32 octet_count);
    guint32             gst_rtcp_packet_rr_get_ssrc         (GstRTCPPacket *packet);
    void                gst_rtcp_packet_rr_set_ssrc         (GstRTCPPacket *packet,
                                                             guint32 ssrc);
    guint               gst_rtcp_packet_get_rb_count        (GstRTCPPacket *packet);
    void                gst_rtcp_packet_get_rb              (GstRTCPPacket *packet,
                                                             guint nth,
                                                             guint32 *ssrc,
                                                             guint8 *fractionlost,
                                                             gint32 *packetslost,
                                                             guint32 *exthighestseq,
                                                             guint32 *jitter,
                                                             guint32 *lsr,
                                                             guint32 *dlsr);
    gboolean            gst_rtcp_packet_add_rb              (GstRTCPPacket *packet,
                                                             guint32 ssrc,
                                                             guint8 fractionlost,
                                                             gint32 packetslost,
                                                             guint32 exthighestseq,
                                                             guint32 jitter,
                                                             guint32 lsr,
                                                             guint32 dlsr);
    void                gst_rtcp_packet_set_rb              (GstRTCPPacket *packet,
                                                             guint nth,
                                                             guint32 ssrc,
                                                             guint8 fractionlost,
                                                             gint32 packetslost,
                                                             guint32 exthighestseq,
                                                             guint32 jitter,
                                                             guint32 lsr,
                                                             guint32 dlsr);
    guint               gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_sdes_first_item     (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_sdes_next_item      (GstRTCPPacket *packet);
    guint32             gst_rtcp_packet_sdes_get_ssrc       (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_sdes_first_entry    (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_sdes_next_entry     (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_sdes_get_entry      (GstRTCPPacket *packet,
                                                             GstRTCPSDESType *type,
                                                             guint8 *len,
                                                             guint8 **data);
    gboolean            gst_rtcp_packet_sdes_copy_entry     (GstRTCPPacket *packet,
                                                             GstRTCPSDESType *type,
                                                             guint8 *len,
                                                             guint8 **data);
    gboolean            gst_rtcp_packet_sdes_add_item       (GstRTCPPacket *packet,
                                                             guint32 ssrc);
    gboolean            gst_rtcp_packet_sdes_add_entry      (GstRTCPPacket *packet,
                                                             GstRTCPSDESType type,
                                                             guint8 len,
                                                             const guint8 *data);
    guint               gst_rtcp_packet_bye_get_ssrc_count  (GstRTCPPacket *packet);
    guint32             gst_rtcp_packet_bye_get_nth_ssrc    (GstRTCPPacket *packet,
                                                             guint nth);
    gboolean            gst_rtcp_packet_bye_add_ssrc        (GstRTCPPacket *packet,
                                                             guint32 ssrc);
    gboolean            gst_rtcp_packet_bye_add_ssrcs       (GstRTCPPacket *packet,
                                                             guint32 *ssrc,
                                                             guint len);
    guint8              gst_rtcp_packet_bye_get_reason_len  (GstRTCPPacket *packet);
    gchar *             gst_rtcp_packet_bye_get_reason      (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_bye_set_reason      (GstRTCPPacket *packet,
                                                             const gchar *reason);
    GstRTCPFBType       gst_rtcp_packet_fb_get_type         (GstRTCPPacket *packet);
    void                gst_rtcp_packet_fb_set_type         (GstRTCPPacket *packet,
                                                             GstRTCPFBType type);
    guint32             gst_rtcp_packet_fb_get_sender_ssrc  (GstRTCPPacket *packet);
    void                gst_rtcp_packet_fb_set_sender_ssrc  (GstRTCPPacket *packet,
                                                             guint32 ssrc);
    guint32             gst_rtcp_packet_fb_get_media_ssrc   (GstRTCPPacket *packet);
    void                gst_rtcp_packet_fb_set_media_ssrc   (GstRTCPPacket *packet,
                                                             guint32 ssrc);
    guint16             gst_rtcp_packet_fb_get_fci_length   (GstRTCPPacket *packet);
    gboolean            gst_rtcp_packet_fb_set_fci_length   (GstRTCPPacket *packet,
                                                             guint16 wordlen);
    guint8 *            gst_rtcp_packet_fb_get_fci          (GstRTCPPacket *packet);
    guint64             gst_rtcp_ntp_to_unix                (guint64 ntptime);
    guint64             gst_rtcp_unix_to_ntp                (guint64 unixtime);
    GstRTCPSDESType     gst_rtcp_sdes_name_to_type          (const gchar *name);
    const gchar *       gst_rtcp_sdes_type_to_name          (GstRTCPSDESType type);

## Description

Note: The API in this module is not yet declared stable.

The GstRTPCBuffer helper functions makes it easy to parse and create regular GstBuffer objects that contain compound RTCP packets. These buffers are typically of 'application/x-rtcp' GstCaps.

An RTCP buffer consists of 1 or more GstRTCPPacket structures that you can retrieve with `gst_rtcp_buffer_get_first_packet()`. GstRTCPPacket acts as a pointer into the RTCP buffer; you can move to the next packet with `gst_rtcp_packet_move_to_next()`.

Last reviewed on 2007-03-26 (0.10.13)

## Details

### GST_RTCP_VERSION

    #define GST_RTCP_VERSION 2

The supported RTCP version 2.

### GST_RTCP_MAX_SDES

    #define GST_RTCP_MAX_SDES 255

The maximum text length for an SDES item.

### GST_RTCP_MAX_BYE_SSRC_COUNT

    #define GST_RTCP_MAX_BYE_SSRC_COUNT   31

The maximum amount of SSRCs in a BYE packet.

### GST_RTCP_MAX_RB_COUNT

    #define GST_RTCP_MAX_RB_COUNT   31

The maximum amount of Receiver report blocks in RR and SR messages.

### GST_RTCP_MAX_SDES_ITEM_COUNT

    #define GST_RTCP_MAX_SDES_ITEM_COUNT   31

The maximum amount of SDES items.

### GST_RTCP_VALID_MASK

    #define GST_RTCP_VALID_MASK (0xc000 | 0x2000 | 0xfe)

Mask for version, padding bit and packet type pair

### GST_RTCP_VALID_VALUE

    #define GST_RTCP_VALID_VALUE ((GST_RTCP_VERSION << 14) | GST_RTCP_TYPE_SR)

Valid value for the first two bytes of an RTCP packet after applying GST_RTCP_VALID_MASK to them.

### enum GstRTCPType

    typedef enum {
      GST_RTCP_TYPE_INVALID = 0,
      GST_RTCP_TYPE_SR      = 200,
      GST_RTCP_TYPE_RR      = 201,
      GST_RTCP_TYPE_SDES    = 202,
      GST_RTCP_TYPE_BYE     = 203,
      GST_RTCP_TYPE_APP     = 204,
      GST_RTCP_TYPE_RTPFB   = 205,
      GST_RTCP_TYPE_PSFB    = 206
    } GstRTCPType;

Different RTCP packet types.

`GST_RTCP_TYPE_INVALID` | Invalid type
`GST_RTCP_TYPE_SR` | Sender report
`GST_RTCP_TYPE_RR` | Receiver report
`GST_RTCP_TYPE_SDES` | Source description
`GST_RTCP_TYPE_BYE` | Goodbye
`GST_RTCP_TYPE_APP` | Application defined
`GST_RTCP_TYPE_RTPFB` | Transport layer feedback. Since: 0.10.23
`GST_RTCP_TYPE_PSFB` | Payload-specific feedback. Since: 0.10.23

### struct GstRTCPPacket

    struct GstRTCPPacket {
      GstBuffer   *buffer;
      guint        offset;
    };

Data structure that points to a packet at `offset` in `buffer`. The size of the structure is made public to allow stack allocations.

GstBuffer *`buffer`; | pointer to RTCP buffer
guint `offset`; | offset of packet in buffer data

### enum GstRTCPSDESType

    typedef enum {
      GST_RTCP_SDES_INVALID  = -1,
      GST_RTCP_SDES_END      = 0,
      GST_RTCP_SDES_CNAME    = 1,
      GST_RTCP_SDES_NAME     = 2,
      GST_RTCP_SDES_EMAIL    = 3,
      GST_RTCP_SDES_PHONE    = 4,
      GST_RTCP_SDES_LOC      = 5,
      GST_RTCP_SDES_TOOL     = 6,
      GST_RTCP_SDES_NOTE     = 7,
      GST_RTCP_SDES_PRIV     = 8
    } GstRTCPSDESType;

Different types of SDES content.

`GST_RTCP_SDES_INVALID` | Invalid SDES entry
`GST_RTCP_SDES_END` | End of SDES list
`GST_RTCP_SDES_CNAME` | Canonical name
`GST_RTCP_SDES_NAME` | User name
`GST_RTCP_SDES_EMAIL` | User's electronic mail address
`GST_RTCP_SDES_PHONE` | User's phone number
`GST_RTCP_SDES_LOC` | Geographic user location
`GST_RTCP_SDES_TOOL` | Name of application or tool
`GST_RTCP_SDES_NOTE` | Notice about the source
`GST_RTCP_SDES_PRIV` | Private extensions

### enum GstRTCPFBType

    typedef enum {
      /* generic */
      GST_RTCP_FB_TYPE_INVALID    = 0,
      /* RTPFB types */
      GST_RTCP_RTPFB_TYPE_NACK    = 1,
      /* RTPFB types assigned in RFC 5104 */
      GST_RTCP_RTPFB_TYPE_TMMBR   = 3,
      GST_RTCP_RTPFB_TYPE_TMMBN   = 4,
      /* PSFB types */
      GST_RTCP_PSFB_TYPE_PLI      = 1,
      GST_RTCP_PSFB_TYPE_SLI      = 2,
      GST_RTCP_PSFB_TYPE_RPSI     = 3,
      GST_RTCP_PSFB_TYPE_AFB      = 15,
      /* PSFB types assigned in RFC 5104 */
      GST_RTCP_PSFB_TYPE_FIR      = 4,
      GST_RTCP_PSFB_TYPE_TSTR     = 5,
      GST_RTCP_PSFB_TYPE_TSTN     = 6,
      GST_RTCP_PSFB_TYPE_VBCN     = 7,
    } GstRTCPFBType;

Different types of feedback messages.

`GST_RTCP_FB_TYPE_INVALID` | Invalid type
`GST_RTCP_RTPFB_TYPE_NACK` | Generic NACK
`GST_RTCP_RTPFB_TYPE_TMMBR` | Temporary Maximum Media Stream Bit Rate Request
`GST_RTCP_RTPFB_TYPE_TMMBN` | Temporary Maximum Media Stream Bit Rate Notification
`GST_RTCP_PSFB_TYPE_PLI` | Picture Loss Indication
`GST_RTCP_PSFB_TYPE_SLI` | Slice Loss Indication
`GST_RTCP_PSFB_TYPE_RPSI` | Reference Picture Selection Indication
`GST_RTCP_PSFB_TYPE_AFB` | Application layer Feedback
`GST_RTCP_PSFB_TYPE_FIR` | Full Intra Request Command
`GST_RTCP_PSFB_TYPE_TSTR` | Temporal-Spatial Trade-off Request
`GST_RTCP_PSFB_TYPE_TSTN` | Temporal-Spatial Trade-off Notification
`GST_RTCP_PSFB_TYPE_VBCN` | Video Back Channel Message

Since 0.10.23

### gst_rtcp_buffer_new_take_data ()

    GstBuffer *         gst_rtcp_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 for the new buffer
`len` : | the length of data
Returns : | A newly allocated buffer with `data` and of size `len`.

### gst_rtcp_buffer_new_copy_data ()

    GstBuffer *         gst_rtcp_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 for the new buffer
`len` : | the length of data
Returns : | A newly allocated buffer with a copy of `data` and of size `len`.

### gst_rtcp_buffer_validate_data ()

    gboolean            gst_rtcp_buffer_validate_data       (guint8 *data,
                                                             guint len);

Check if the `data` and `size` point to the data of a valid RTCP (compound) packet. Use this function to validate a packet before using the other functions in this module.

`data` : | the data to validate
`len` : | the length of `data` to validate
Returns : | TRUE if the data points to a valid RTCP packet.

### gst_rtcp_buffer_validate ()

    gboolean            gst_rtcp_buffer_validate            (GstBuffer *buffer);

Check if the data pointed to by `buffer` is a valid RTCP packet using `gst_rtcp_buffer_validate_data()`.

`buffer` : | the buffer to validate
Returns : | TRUE if `buffer` is a valid RTCP packet.

### gst_rtcp_buffer_new ()

    GstBuffer *         gst_rtcp_buffer_new                 (guint mtu);

Create a new buffer for constructing RTCP packets. The packet will have a maximum size of `mtu`.

`mtu` : | the maximum mtu size.
Returns : | A newly allocated buffer.

### gst_rtcp_buffer_end ()

    void                gst_rtcp_buffer_end                 (GstBuffer *buffer);

Finish `buffer` after being constructured. This function is usually called after `gst_rtcp_buffer_new()` and after adding the RTCP items to the new buffer.

The function adjusts the size of `buffer` with the total length of all the added packets.

`buffer` : | a buffer with an RTCP packet

### gst_rtcp_buffer_get_packet_count ()

    guint               gst_rtcp_buffer_get_packet_count    (GstBuffer *buffer);

Get the number of RTCP packets in `buffer`.

`buffer` : | a valid RTCP buffer
Returns : | the number of RTCP packets in `buffer`.

### gst_rtcp_buffer_get_first_packet ()

    gboolean            gst_rtcp_buffer_get_first_packet    (GstBuffer *buffer,
                                                             GstRTCPPacket *packet);

Initialize a new GstRTCPPacket pointer that points to the first packet in `buffer`.

`buffer` : | a valid RTCP buffer
`packet` : | a GstRTCPPacket
Returns : | TRUE if the packet existed in `buffer`.

### gst_rtcp_packet_move_to_next ()

    gboolean            gst_rtcp_packet_move_to_next        (GstRTCPPacket *packet);

Move the packet pointer `packet` to the next packet in the payload. Use `gst_rtcp_buffer_get_first_packet()` to initialize `packet`.

`packet` : | a GstRTCPPacket
Returns : | TRUE if `packet` is pointing to a valid packet after calling this function.

### gst_rtcp_buffer_add_packet ()

    gboolean            gst_rtcp_buffer_add_packet          (GstBuffer *buffer,
                                                             GstRTCPType type,
                                                             GstRTCPPacket *packet);

Add a new packet of `type` to `buffer`. `packet` will point to the newly created packet.

`buffer` : | a valid RTCP buffer
`type` : | the GstRTCPType of the new packet
`packet` : | pointer to new packet
Returns : | `TRUE` if the packet could be created. This function returns `FALSE` if the max mtu is exceeded for the buffer.

### gst_rtcp_packet_remove ()

    gboolean            gst_rtcp_packet_remove              (GstRTCPPacket *packet);

Removes the packet pointed to by `packet` and moves pointer to the next one

`packet` : | a GstRTCPPacket
Returns : | TRUE if `packet` is pointing to a valid packet after calling this function.

### gst_rtcp_packet_get_padding ()

    gboolean            gst_rtcp_packet_get_padding         (GstRTCPPacket *packet);

Get the packet padding of the packet pointed to by `packet`.

`packet` : | a valid GstRTCPPacket
Returns : | If the packet has the padding bit set.

### gst_rtcp_packet_get_count ()

    guint8              gst_rtcp_packet_get_count           (GstRTCPPacket *packet);

Get the count field in `packet`.

`packet` : | a valid GstRTCPPacket
Returns : | The count field in `packet` or -1 if `packet` does not point to a valid packet.

### gst_rtcp_packet_get_type ()

    GstRTCPType         gst_rtcp_packet_get_type            (GstRTCPPacket *packet);

Get the packet type of the packet pointed to by `packet`.

`packet` : | a valid GstRTCPPacket
Returns : | The packet type or GST_RTCP_TYPE_INVALID when `packet` is not pointing to a valid packet.

### gst_rtcp_packet_get_length ()

    guint16             gst_rtcp_packet_get_length          (GstRTCPPacket *packet);

Get the length field of `packet`. This is the length of the packet in 32-bit words minus one.

`packet` : | a valid GstRTCPPacket
Returns : | The length field of `packet`.

### gst_rtcp_packet_sr_get_sender_info ()

    void                gst_rtcp_packet_sr_get_sender_info  (GstRTCPPacket *packet,
                                                             guint32 *ssrc,
                                                             guint64 *ntptime,
                                                             guint32 *rtptime,
                                                             guint32 *packet_count,
                                                             guint32 *octet_count);

Parse the SR sender info and store the values.

`packet` : | a valid SR GstRTCPPacket
`ssrc` : | result SSRC
`ntptime` : | result NTP time
`rtptime` : | result RTP time
`packet_count` : | result packet count
`octet_count` : | result octet count

### gst_rtcp_packet_sr_set_sender_info ()

    void                gst_rtcp_packet_sr_set_sender_info  (GstRTCPPacket *packet,
                                                             guint32 ssrc,
                                                             guint64 ntptime,
                                                             guint32 rtptime,
                                                             guint32 packet_count,
                                                             guint32 octet_count);

Set the given values in the SR packet `packet`.

`packet` : | a valid SR GstRTCPPacket
`ssrc` : | the SSRC
`ntptime` : | the NTP time
`rtptime` : | the RTP time
`packet_count` : | the packet count
`octet_count` : | the octet count

### gst_rtcp_packet_rr_get_ssrc ()

    guint32             gst_rtcp_packet_rr_get_ssrc         (GstRTCPPacket *packet);

Get the ssrc field of the RR `packet`.

`packet` : | a valid RR GstRTCPPacket
Returns : | the ssrc.

### gst_rtcp_packet_rr_set_ssrc ()

    void                gst_rtcp_packet_rr_set_ssrc         (GstRTCPPacket *packet,
                                                             guint32 ssrc);

Set the ssrc field of the RR `packet`.

`packet` : | a valid RR GstRTCPPacket
`ssrc` : | the SSRC to set

### gst_rtcp_packet_get_rb_count ()

    guint               gst_rtcp_packet_get_rb_count        (GstRTCPPacket *packet);

Get the number of report blocks in `packet`.

`packet` : | a valid SR or RR GstRTCPPacket
Returns : | The number of report blocks in `packet`.

### gst_rtcp_packet_get_rb ()

    void                gst_rtcp_packet_get_rb              (GstRTCPPacket *packet,
                                                             guint nth,
                                                             guint32 *ssrc,
                                                             guint8 *fractionlost,
                                                             gint32 *packetslost,
                                                             guint32 *exthighestseq,
                                                             guint32 *jitter,
                                                             guint32 *lsr,
                                                             guint32 *dlsr);

Parse the values of the `nth` report block in `packet` and store the result in the values.

`packet` : | a valid SR or RR GstRTCPPacket
`nth` : | the nth report block in `packet`
`ssrc` : | result for data source being reported
`fractionlost` : | result for fraction lost since last SR/RR
`packetslost` : | result for the cumululative number of packets lost
`exthighestseq` : | result for the extended last sequence number received
`jitter` : | result for the interarrival jitter
`lsr` : | result for the last SR packet from this source
`dlsr` : | result for the delay since last SR packet

### gst_rtcp_packet_add_rb ()

    gboolean            gst_rtcp_packet_add_rb              (GstRTCPPacket *packet,
                                                             guint32 ssrc,
                                                             guint8 fractionlost,
                                                             gint32 packetslost,
                                                             guint32 exthighestseq,
                                                             guint32 jitter,
                                                             guint32 lsr,
                                                             guint32 dlsr);

Add a new report block to `packet` with the given values.

`packet` : | a valid SR or RR GstRTCPPacket
`ssrc` : | data source being reported
`fractionlost` : | fraction lost since last SR/RR
`packetslost` : | the cumululative number of packets lost
`exthighestseq` : | the extended last sequence number received
`jitter` : | the interarrival jitter
`lsr` : | the last SR packet from this source
`dlsr` : | the delay since last SR packet
Returns : | `TRUE` if the packet was created. This function can return `FALSE` if the max MTU is exceeded or the number of report blocks is greater than GST_RTCP_MAX_RB_COUNT.

### gst_rtcp_packet_set_rb ()

    void                gst_rtcp_packet_set_rb              (GstRTCPPacket *packet,
                                                             guint nth,
                                                             guint32 ssrc,
                                                             guint8 fractionlost,
                                                             gint32 packetslost,
                                                             guint32 exthighestseq,
                                                             guint32 jitter,
                                                             guint32 lsr,
                                                             guint32 dlsr);

Set the `nth` new report block in `packet` with the given values.

Note: Not implemented.

`packet` : | a valid SR or RR GstRTCPPacket
`nth` : | the nth report block to set
`ssrc` : | data source being reported
`fractionlost` : | fraction lost since last SR/RR
`packetslost` : | the cumululative number of packets lost
`exthighestseq` : | the extended last sequence number received
`jitter` : | the interarrival jitter
`lsr` : | the last SR packet from this source
`dlsr` : | the delay since last SR packet

### gst_rtcp_packet_sdes_get_item_count ()

    guint               gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket *packet);

Get the number of items in the SDES packet `packet`.

`packet` : | a valid SDES GstRTCPPacket
Returns : | The number of items in `packet`.

### gst_rtcp_packet_sdes_first_item ()

    gboolean            gst_rtcp_packet_sdes_first_item     (GstRTCPPacket *packet);

Move to the first SDES item in `packet`.

`packet` : | a valid SDES GstRTCPPacket
Returns : | TRUE if there was a first item.

### gst_rtcp_packet_sdes_next_item ()

    gboolean            gst_rtcp_packet_sdes_next_item      (GstRTCPPacket *packet);

Move to the next SDES item in `packet`.

`packet` : | a valid SDES GstRTCPPacket
Returns : | TRUE if there was a next item.

### gst_rtcp_packet_sdes_get_ssrc ()

    guint32             gst_rtcp_packet_sdes_get_ssrc       (GstRTCPPacket *packet);

Get the SSRC of the current SDES item.

`packet` : | a valid SDES GstRTCPPacket
Returns : | the SSRC of the current item.

### gst_rtcp_packet_sdes_first_entry ()

    gboolean            gst_rtcp_packet_sdes_first_entry    (GstRTCPPacket *packet);

Move to the first SDES entry in the current item.

`packet` : | a valid SDES GstRTCPPacket
Returns : | `TRUE` if there was a first entry.

### gst_rtcp_packet_sdes_next_entry ()

    gboolean            gst_rtcp_packet_sdes_next_entry     (GstRTCPPacket *packet);

Move to the next SDES entry in the current item.

`packet` : | a valid SDES GstRTCPPacket
Returns : | `TRUE` if there was a next entry.

### gst_rtcp_packet_sdes_get_entry ()

    gboolean            gst_rtcp_packet_sdes_get_entry      (GstRTCPPacket *packet,
                                                             GstRTCPSDESType *type,
                                                             guint8 *len,
                                                             guint8 **data);

Get the data of the current SDES item entry. `type` (when not NULL) will contain the type of the entry. `data` (when not NULL) will point to `len` bytes.

When `type` refers to a text item, `data` will point to a UTF8 string. Note that this UTF8 string is NOT null-terminated. Use `gst_rtcp_packet_sdes_copy_entry()` to get a null-terminated copy of the entry.

`packet` : | a valid SDES GstRTCPPacket
`type` : | result of the entry type
`len` : | result length of the entry data
`data` : | result entry data
Returns : | `TRUE` if there was valid data.

### gst_rtcp_packet_sdes_copy_entry ()

    gboolean            gst_rtcp_packet_sdes_copy_entry     (GstRTCPPacket *packet,
                                                             GstRTCPSDESType *type,
                                                             guint8 *len,
                                                             guint8 **data);

This function is like `gst_rtcp_packet_sdes_get_entry()` but it returns a null-terminated copy of the data instead. use `g_free()` after usage.

`packet` : | a valid SDES GstRTCPPacket
`type` : | result of the entry type
`len` : | result length of the entry data
`data` : | result entry data
Returns : | `TRUE` if there was valid data.

### gst_rtcp_packet_sdes_add_item ()

    gboolean            gst_rtcp_packet_sdes_add_item       (GstRTCPPacket *packet,
                                                             guint32 ssrc);

Add a new SDES item for `ssrc` to `packet`.

`packet` : | a valid SDES GstRTCPPacket
`ssrc` : | the SSRC of the new item to add
Returns : | `TRUE` if the item could be added, `FALSE` if the maximum amount of items has been exceeded for the SDES packet or the MTU has been reached.

### gst_rtcp_packet_sdes_add_entry ()

    gboolean            gst_rtcp_packet_sdes_add_entry      (GstRTCPPacket *packet,
                                                             GstRTCPSDESType type,
                                                             guint8 len,
                                                             const guint8 *data);

Add a new SDES entry to the current item in `packet`.

`packet` : | a valid SDES GstRTCPPacket
`type` : | the GstRTCPSDESType of the SDES entry
`len` : | the data length
`data` : | the data
Returns : | `TRUE` if the item could be added, `FALSE` if the MTU has been reached.

### gst_rtcp_packet_bye_get_ssrc_count ()

    guint               gst_rtcp_packet_bye_get_ssrc_count  (GstRTCPPacket *packet);

Get the number of SSRC fields in `packet`.

`packet` : | a valid BYE GstRTCPPacket
Returns : | The number of SSRC fields in `packet`.

### gst_rtcp_packet_bye_get_nth_ssrc ()

    guint32             gst_rtcp_packet_bye_get_nth_ssrc    (GstRTCPPacket *packet,
                                                             guint nth);

Get the `nth` SSRC of the BYE `packet`.

`packet` : | a valid BYE GstRTCPPacket
`nth` : | the nth SSRC to get
Returns : | The `nth` SSRC of `packet`.

### gst_rtcp_packet_bye_add_ssrc ()

    gboolean            gst_rtcp_packet_bye_add_ssrc        (GstRTCPPacket *packet,
                                                             guint32 ssrc);

Add `ssrc` to the BYE `packet`.

`packet` : | a valid BYE GstRTCPPacket
`ssrc` : | an SSRC to add
Returns : | `TRUE` if the ssrc was added. This function can return `FALSE` if the max MTU is exceeded or the number of sources blocks is greater than GST_RTCP_MAX_BYE_SSRC_COUNT.

### gst_rtcp_packet_bye_add_ssrcs ()

    gboolean            gst_rtcp_packet_bye_add_ssrcs       (GstRTCPPacket *packet,
                                                             guint32 *ssrc,
                                                             guint len);

Adds `len` SSRCs in `ssrc` to BYE `packet`.

`packet` : | a valid BYE GstRTCPPacket
`ssrc` : | an array of SSRCs to add
`len` : | number of elements in `ssrc`
Returns : | `TRUE` if the all the SSRCs were added. This function can return `FALSE` if the max MTU is exceeded or the number of sources blocks is greater than GST_RTCP_MAX_BYE_SSRC_COUNT.

### gst_rtcp_packet_bye_get_reason_len ()

    guint8              gst_rtcp_packet_bye_get_reason_len  (GstRTCPPacket *packet);

Get the length of the reason string.

`packet` : | a valid BYE GstRTCPPacket
Returns : | The length of the reason string or 0 when there is no reason string present.

### gst_rtcp_packet_bye_get_reason ()

    gchar *             gst_rtcp_packet_bye_get_reason      (GstRTCPPacket *packet);

Get the reason in `packet`.

`packet` : | a valid BYE GstRTCPPacket
Returns : | The reason for the BYE `packet` or NULL if the packet did not contain a reason string. The string must be freed with `g_free()` after usage.

### gst_rtcp_packet_bye_set_reason ()

    gboolean            gst_rtcp_packet_bye_set_reason      (GstRTCPPacket *packet,
                                                             const gchar *reason);

Set the reason string to `reason` in `packet`.

`packet` : | a valid BYE GstRTCPPacket
`reason` : | a reason string
Returns : | TRUE if the string could be set.

### gst_rtcp_packet_fb_get_type ()

    GstRTCPFBType       gst_rtcp_packet_fb_get_type         (GstRTCPPacket *packet);

Get the feedback message type of the FB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
Returns : | The feedback message type.

Since 0.10.23

### gst_rtcp_packet_fb_set_type ()

    void                gst_rtcp_packet_fb_set_type         (GstRTCPPacket *packet,
                                                             GstRTCPFBType type);

Set the feedback message type of the FB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
`type` : | the GstRTCPFBType to set

Since 0.10.23

### gst_rtcp_packet_fb_get_sender_ssrc ()

    guint32             gst_rtcp_packet_fb_get_sender_ssrc  (GstRTCPPacket *packet);

Get the sender SSRC field of the RTPFB or PSFB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
Returns : | the sender SSRC.

Since 0.10.23

### gst_rtcp_packet_fb_set_sender_ssrc ()

    void                gst_rtcp_packet_fb_set_sender_ssrc  (GstRTCPPacket *packet,
                                                             guint32 ssrc);

Set the sender SSRC field of the RTPFB or PSFB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
`ssrc` : | a sender SSRC

Since 0.10.23

### gst_rtcp_packet_fb_get_media_ssrc ()

    guint32             gst_rtcp_packet_fb_get_media_ssrc   (GstRTCPPacket *packet);

Get the media SSRC field of the RTPFB or PSFB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
Returns : | the media SSRC.

Since 0.10.23

### gst_rtcp_packet_fb_set_media_ssrc ()

    void                gst_rtcp_packet_fb_set_media_ssrc   (GstRTCPPacket *packet,
                                                             guint32 ssrc);

Set the media SSRC field of the RTPFB or PSFB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
`ssrc` : | a media SSRC

Since 0.10.23

### gst_rtcp_packet_fb_get_fci_length ()

    guint16             gst_rtcp_packet_fb_get_fci_length   (GstRTCPPacket *packet);

Get the length of the Feedback Control Information attached to a RTPFB or PSFB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
Returns : | The length of the FCI in 32-bit words.

Since 0.10.31

### gst_rtcp_packet_fb_set_fci_length ()

    gboolean            gst_rtcp_packet_fb_set_fci_length   (GstRTCPPacket *packet,
                                                             guint16 wordlen);

Set the length of the Feedback Control Information attached to a RTPFB or PSFB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
`wordlen` : | Length of the FCI in 32-bit words
Returns : | `TRUE` if there was enough space in the packet to add this much FCI

Since 0.10.31

### gst_rtcp_packet_fb_get_fci ()

    guint8 *            gst_rtcp_packet_fb_get_fci          (GstRTCPPacket *packet);

Get the Feedback Control Information attached to a RTPFB or PSFB `packet`.

`packet` : | a valid RTPFB or PSFB GstRTCPPacket
Returns : | a pointer to the FCI

Since 0.10.31

### gst_rtcp_ntp_to_unix ()

    guint64             gst_rtcp_ntp_to_unix                (guint64 ntptime);

Converts an NTP time to UNIX nanoseconds. `ntptime` can typically be the NTP time of an SR RTCP message and contains, in the upper 32 bits, the number of seconds since 1900 and, in the lower 32 bits, the fractional seconds. The resulting value will be the number of nanoseconds since 1970.

`ntptime` : | an NTP timestamp
Returns : | the UNIX time for `ntptime` in nanoseconds.

### gst_rtcp_unix_to_ntp ()

    guint64             gst_rtcp_unix_to_ntp                (guint64 unixtime);

Converts a UNIX timestamp in nanoseconds to an NTP time. The caller should pass a value with nanoseconds since 1970. The NTP time will, in the upper 32 bits, contain the number of seconds since 1900 and, in the lower 32 bits, the fractional seconds. The resulting value can be used as an ntptime for constructing SR RTCP packets.

`unixtime` : | an UNIX timestamp in nanoseconds
Returns : | the NTP time for `unixtime`.

### gst_rtcp_sdes_name_to_type ()

    GstRTCPSDESType     gst_rtcp_sdes_name_to_type          (const gchar *name);

Convert `name` into a `GstRTCPSDESType`. `name` is typically a key in a GstStructure containing SDES items.

`name` : | a SDES name
Returns : | the GstRTCPSDESType for `name` or GST_RTCP_SDES_PRIV when `name` is a private sdes item.

Since 0.10.26

### gst_rtcp_sdes_type_to_name ()

    const gchar *       gst_rtcp_sdes_type_to_name          (GstRTCPSDESType type);

Converts `type` to the string equivalent. The string is typically used as a key in a GstStructure containing SDES items.

`type` : | a GstRTCPSDESType
Returns : | the string equivalent of `type`

Since 0.10.26

## See Also

GstBaseRTPPayload, GstBaseRTPDepayload, gstrtpbuffer