## GstRTPBasePayload GstRTPBasePayload — Base class for RTP payloader |

## Functions

#define | GST_RTP_BASE_PAYLOAD_MTU()
#define | GST_RTP_BASE_PAYLOAD_PT()
#define | GST_RTP_BASE_PAYLOAD_SINKPAD()
#define | GST_RTP_BASE_PAYLOAD_SRCPAD()
gboolean | gst_rtp_base_payload_is_filled ()
GstFlowReturn | gst_rtp_base_payload_push ()
GstFlowReturn | gst_rtp_base_payload_push_list ()
void | gst_rtp_base_payload_set_options ()
gboolean | gst_rtp_base_payload_set_outcaps ()
GstBuffer * | gst_rtp_base_payload_allocate_output_buffer ()
guint | gst_rtp_base_payload_get_source_count ()
gboolean | gst_rtp_base_payload_is_source_info_enabled ()
void | gst_rtp_base_payload_set_source_info_enabled ()

## Properties

gint64 | max-ptime | Read / Write
gint64 | min-ptime | Read / Write
guint | mtu | Read / Write
gboolean | onvif-no-rate-control | Read / Write
gboolean | perfect-rtptime | Read / Write
guint | pt | Read / Write
gint64 | ptime-multiple | Read / Write
guint | seqnum | Read
gint | seqnum-offset | Read / Write
gboolean | source-info | Read / Write
guint | ssrc | Read / Write
GstStructure * | stats | Read
guint | timestamp | Read
guint | timestamp-offset | Read / Write

## Types and Values

struct | GstRTPBasePayload
struct | GstRTPBasePayloadClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstRTPBasePayload
                        ╰── GstRTPBaseAudioPayload

## Includes

    #include <gst/rtp/rtp.h>

## Description

Provides a base class for RTP payloaders

## Functions

### GST_RTP_BASE_PAYLOAD_MTU()

    #define GST_RTP_BASE_PAYLOAD_MTU(payload) (GST_RTP_BASE_PAYLOAD (payload)->mtu)

Get access to the configured MTU of `payload` .

#### Parameters

payload | a GstRTPBasePayload |

### GST_RTP_BASE_PAYLOAD_PT()

    #define GST_RTP_BASE_PAYLOAD_PT(payload)  (GST_RTP_BASE_PAYLOAD (payload)->pt)

Get access to the configured payload type of `payload` .

#### Parameters

payload | a GstRTPBasePayload |

### GST_RTP_BASE_PAYLOAD_SINKPAD()

    #define GST_RTP_BASE_PAYLOAD_SINKPAD(payload) (GST_RTP_BASE_PAYLOAD (payload)->sinkpad)

Get access to the sinkpad of `payload` .

#### Parameters

payload | a GstRTPBasePayload |

### GST_RTP_BASE_PAYLOAD_SRCPAD()

    #define GST_RTP_BASE_PAYLOAD_SRCPAD(payload)  (GST_RTP_BASE_PAYLOAD (payload)->srcpad)

Get access to the srcpad of `payload` .

#### Parameters

payload | a GstRTPBasePayload |

### gst_rtp_base_payload_is_filled ()

    gboolean
    gst_rtp_base_payload_is_filled (GstRTPBasePayload *payload,
                                    guint size,
                                    GstClockTime duration);

Check if the packet with `size` and `duration` would exceed the configured maximum size.

#### Parameters

payload | a GstRTPBasePayload |
size | the size of the packet |
duration | the duration of the packet |

#### Returns

`TRUE` if the packet of `size` and `duration` would exceed the configured MTU or max_ptime.

### gst_rtp_base_payload_push ()

    GstFlowReturn
    gst_rtp_base_payload_push (GstRTPBasePayload *payload,
                               GstBuffer *buffer);

Push `buffer` to the peer element of the payloader. The SSRC, payload type, seqnum and timestamp of the RTP buffer will be updated first.

This function takes ownership of `buffer` .

#### Parameters

payload | a GstRTPBasePayload |
buffer | a GstBuffer |

#### Returns

a GstFlowReturn.

### gst_rtp_base_payload_push_list ()

    GstFlowReturn
    gst_rtp_base_payload_push_list (GstRTPBasePayload *payload,
                                    GstBufferList *list);

Push `list` to the peer element of the payloader. The SSRC, payload type, seqnum and timestamp of the RTP buffer will be updated first.

This function takes ownership of `list` .

#### Parameters

payload | a GstRTPBasePayload |
list | a GstBufferList |

#### Returns

a GstFlowReturn.

### gst_rtp_base_payload_set_options ()

    void
    gst_rtp_base_payload_set_options (GstRTPBasePayload *payload,
                                      const gchar *media,
                                      gboolean dynamic,
                                      const gchar *encoding_name,
                                      guint32 clock_rate);

Set the rtp options of the payloader. These options will be set in the caps of the payloader. Subclasses must call this method before calling `gst_rtp_base_payload_push()` or `gst_rtp_base_payload_set_outcaps()`.

#### Parameters

payload | a GstRTPBasePayload |
media | the media type (typically "audio" or "video") |
dynamic | if the payload type is dynamic |
encoding_name | the encoding name |
clock_rate | the clock rate of the media |

### gst_rtp_base_payload_set_outcaps ()

    gboolean
    gst_rtp_base_payload_set_outcaps (GstRTPBasePayload *payload,
                                      const gchar *fieldname,
                                      ...);

Configure the output caps with the optional parameters.

Variable arguments should be in the form field name, field type (as a GType), value(s). The last variable argument should be NULL.

#### Parameters

payload | a GstRTPBasePayload |
fieldname | the first field name or `NULL` |
... | field values |

#### Returns

`TRUE` if the caps could be set.

### gst_rtp_base_payload_allocate_output_buffer ()

    GstBuffer *
    gst_rtp_base_payload_allocate_output_buffer
                                   (GstRTPBasePayload *payload,
                                    guint payload_len,
                                    guint8 pad_len,
                                    guint8 csrc_count);

Allocate a new GstBuffer with enough data to hold an RTP packet with minimum `csrc_count` CSRCs, a payload length of `payload_len` and padding of `pad_len` . If `payload` has “source-info” `TRUE` additional CSRCs may be allocated and filled with RTP source information.

#### Parameters

payload | a GstRTPBasePayload |
payload_len | the length of the payload |
pad_len | the amount of padding |
csrc_count | the minimum number of CSRC entries |

#### Returns

A newly allocated buffer that can hold an RTP packet with given parameters.

Since: 1.16

### gst_rtp_base_payload_get_source_count ()

    guint
    gst_rtp_base_payload_get_source_count (GstRTPBasePayload *payload,
                                           GstBuffer *buffer);

Count the total number of RTP sources found in the meta of `buffer` , which will be automically added by `gst_rtp_base_payload_allocate_output_buffer()`. If “source-info” is `FALSE` the count will be 0.

#### Parameters

payload | a GstRTPBasePayload |
buffer | a GstBuffer, typically the buffer to payload. | [transfer none]

#### Returns

The number of sources.

Since: 1.16

### gst_rtp_base_payload_is_source_info_enabled ()

    gboolean
    gst_rtp_base_payload_is_source_info_enabled
                                   (GstRTPBasePayload *payload);

Queries whether the payloader will add contributing sources (CSRCs) to the RTP header from GstRTPSourceMeta.

#### Parameters

payload | a GstRTPBasePayload |

#### Returns

`TRUE` if source-info is enabled.

Since: 1.16

### gst_rtp_base_payload_set_source_info_enabled ()

    void
    gst_rtp_base_payload_set_source_info_enabled
                                   (GstRTPBasePayload *payload,
                                    gboolean enable);

Enable or disable adding contributing sources to RTP packets from GstRTPSourceMeta.

#### Parameters

payload | a GstRTPBasePayload |
enable | whether to add contributing sources to RTP packets |

Since: 1.16

## Types and Values

### struct GstRTPBasePayload

    struct GstRTPBasePayload;

### struct GstRTPBasePayloadClass

    struct GstRTPBasePayloadClass {
      GstElementClass parent_class;

      /* query accepted caps */
      GstCaps *     (*get_caps)             (GstRTPBasePayload *payload, GstPad * pad, GstCaps * filter);
      /* receive caps on the sink pad, configure the payloader. */
      gboolean      (*set_caps)             (GstRTPBasePayload *payload, GstCaps *caps);

      /* handle a buffer, perform 0 or more gst_rtp_base_payload_push() on
       * the RTP buffers. This function takes ownership of the buffer. */
      GstFlowReturn (*handle_buffer)        (GstRTPBasePayload *payload,
                                             GstBuffer *buffer);
      /* handle events and queries */
      gboolean      (*sink_event)           (GstRTPBasePayload *payload, GstEvent * event);
      gboolean      (*src_event)            (GstRTPBasePayload *payload, GstEvent * event);
      gboolean      (*query)                (GstRTPBasePayload *payload, GstPad *pad, GstQuery * query);
    };

Base class for audio RTP payloader.

#### Members

`get_caps` () | get desired caps |
`set_caps` () | configure the payloader |
`handle_buffer` () | process data |
`sink_event` () | custom event handling on the sinkpad |
`src_event` () | custom event handling on the srcpad |
`query` () | custom query handling |

## Property Details

### The `“max-ptime”` property

      “max-ptime”                gint64

Maximum duration of the packet data in ns (-1 = unlimited up to MTU).

Flags: Read / Write

Allowed values: >= -1

Default value: -1

### The `“min-ptime”` property

      “min-ptime”                gint64

Minimum duration of the packet data in ns (can't go above MTU)

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“mtu”` property

      “mtu”                      guint

Maximum size of one packet.

Flags: Read / Write

Allowed values: >= 28

Default value: 1400

### The `“onvif-no-rate-control”` property

      “onvif-no-rate-control”    gboolean

Make the payloader timestamp packets according to the Rate-Control=no behaviour specified in the ONVIF replay spec.

Flags: Read / Write

Default value: FALSE

Since: 1.16

### The `“perfect-rtptime”` property

      “perfect-rtptime”          gboolean

Try to use the offset fields to generate perfect RTP timestamps. When this option is disabled, RTP timestamps are generated from GST_BUFFER_PTS of each payloaded buffer. The PTSes of buffers may not necessarily increment with the amount of data in each input buffer, consider e.g. the case where the buffer arrives from a network which means that the PTS is unrelated to the amount of data. Because the RTP timestamps are generated from GST_BUFFER_PTS this can result in RTP timestamps that also don't increment with the amount of data in the payloaded packet. To circumvent this it is possible to set the perfect rtptime option enabled. When this option is enabled the payloader will increment the RTP timestamps based on GST_BUFFER_OFFSET which relates to the amount of data in each packet rather than the GST_BUFFER_PTS of each buffer and therefore the RTP timestamps will more closely correlate with the amount of data in each buffer. Currently GstRTPBasePayload is limited to handling perfect RTP timestamps for audio streams.

Flags: Read / Write

Default value: TRUE

### The `“pt”` property

      “pt”                       guint

The payload type of the packets.

Flags: Read / Write

Allowed values: <= 127

Default value: 96

### The `“ptime-multiple”` property

      “ptime-multiple”           gint64

Force buffers to be multiples of this duration in ns (0 disables)

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“seqnum”` property

      “seqnum”                   guint

The RTP sequence number of the last processed packet.

Flags: Read

Allowed values: <= 65535

Default value: 0

### The `“seqnum-offset”` property

      “seqnum-offset”            gint

Offset to add to all outgoing seqnum (-1 = random).

Flags: Read / Write

Allowed values: [-1,65535]

Default value: -1

### The `“source-info”` property

      “source-info”              gboolean

Enable writing the CSRC field in allocated RTP header based on RTP source information found in the input buffer's GstRTPSourceMeta.

Flags: Read / Write

Default value: FALSE

Since: 1.16

### The `“ssrc”` property

      “ssrc”                     guint

The SSRC of the packets (default == random).

Flags: Read / Write

Default value: 4294967295

### The `“stats”` property

      “stats”                    GstStructure *

Various payloader statistics retrieved atomically (and are therefore synchroized with each other), these can be used e.g. to generate an RTP-Info header. This property return a GstStructure named application/x-rtp-payload-stats containing the following fields relating to the last processed buffer and current state of the stream being payloaded:

- `clock-rate` :G_TYPE_UINT, clock-rate of the stream

- `running-time` :G_TYPE_UINT64, running time

- `seqnum` :G_TYPE_UINT, sequence number, same as “seqnum”

- `timestamp` :G_TYPE_UINT, RTP timestamp, same as “timestamp”

- `ssrc` :G_TYPE_UINT, The SSRC in use

- `pt` :G_TYPE_UINT, The Payload type in use, same as “pt”

- `seqnum-offset` :G_TYPE_UINT, The current offset added to the seqnum

- `timestamp-offset` :G_TYPE_UINT, The current offset added to the timestamp

Flags: Read

### The `“timestamp”` property

      “timestamp”                guint

The RTP timestamp of the last processed packet.

Flags: Read

Default value: 0

### The `“timestamp-offset”` property

      “timestamp-offset”         guint

Offset to add to all outgoing timestamps (default = random).

Flags: Read / Write

Default value: 4294967295