## gstbasertpaudiopayload gstbasertpaudiopayload — Base class for audio RTP payloader |

## Synopsis

    #include <gst/rtp/gstbasertpaudiopayload.h>

    struct              GstBaseRTPAudioPayload;
    struct              GstBaseRTPAudioPayloadClass;
    void                gst_base_rtp_audio_payload_set_frame_based
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload);
    void                gst_base_rtp_audio_payload_set_frame_options
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload,
                                                             gint frame_duration,
                                                             gint frame_size);
    void                gst_base_rtp_audio_payload_set_sample_based
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload);
    void                gst_base_rtp_audio_payload_set_sample_options
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload,
                                                             gint sample_size);
    GstAdapter *        gst_base_rtp_audio_payload_get_adapter
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload);
    GstFlowReturn       gst_base_rtp_audio_payload_push     (GstBaseRTPAudioPayload *baseaudiopayload,
                                                             const guint8 *data,
                                                             guint payload_len,
                                                             GstClockTime timestamp);
    GstFlowReturn       gst_base_rtp_audio_payload_flush    (GstBaseRTPAudioPayload *baseaudiopayload,
                                                             guint payload_len,
                                                             GstClockTime timestamp);
    void                gst_base_rtp_audio_payload_set_samplebits_options
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload,
                                                             gint sample_size);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBaseRTPPayload
                         +----GstBaseRTPAudioPayload

## Properties

      "buffer-list"              gboolean              : Read / Write

## Description

### Usage

Provides a base class for audio RTP payloaders for frame or sample based audio codecs (constant bitrate)

This class derives from GstBaseRTPPayload. It can be used for payloading audio codecs. It will only work with constant bitrate codecs. It supports both frame based and sample based codecs. It takes care of packing up the audio data into RTP packets and filling up the headers accordingly. The payloading is done based on the maximum MTU (mtu) and the maximum time per packet (max-ptime). The general idea is to divide large data buffers into smaller RTP packets. The RTP packet size is the minimum of either the MTU, max-ptime (if set) or available data. The RTP packet size is always larger or equal to min-ptime (if set). If min-ptime is not set, any residual data is sent in a last RTP packet. In the case of frame based codecs, the resulting RTP packets always contain full frames.

To use this base class, your child element needs to call either `gst_base_rtp_audio_payload_set_frame_based()` or `gst_base_rtp_audio_payload_set_sample_based()`. This is usually done in the element's `_init()` function. Then, the child element must call either `gst_base_rtp_audio_payload_set_frame_options()`, `gst_base_rtp_audio_payload_set_sample_options()` or gst_base_rtp_audio_payload_set_samplebits_options. Since GstBaseRTPAudioPayload derives from GstBaseRTPPayload, the child element must set any variables or call/override any functions required by that base class. The child element does not need to override any other functions specific to GstBaseRTPAudioPayload.

## Details

### struct GstBaseRTPAudioPayload

    struct GstBaseRTPAudioPayload;

### struct GstBaseRTPAudioPayloadClass

    struct GstBaseRTPAudioPayloadClass {
      GstBaseRTPPayloadClass parent_class;

      gpointer _gst_reserved[GST_PADDING];
    };

### gst_base_rtp_audio_payload_set_frame_based ()

    void                gst_base_rtp_audio_payload_set_frame_based
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload);

Tells GstBaseRTPAudioPayload that the child element is for a frame based audio codec

`basertpaudiopayload` : | a pointer to the element.

### gst_base_rtp_audio_payload_set_frame_options ()

    void                gst_base_rtp_audio_payload_set_frame_options
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload,
                                                             gint frame_duration,
                                                             gint frame_size);

Sets the options for frame based audio codecs.

`basertpaudiopayload` : | a pointer to the element.
`frame_duration` : | The duraction of an audio frame in milliseconds.
`frame_size` : | The size of an audio frame in bytes.

### gst_base_rtp_audio_payload_set_sample_based ()

    void                gst_base_rtp_audio_payload_set_sample_based
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload);

Tells GstBaseRTPAudioPayload that the child element is for a sample based audio codec

`basertpaudiopayload` : | a pointer to the element.

### gst_base_rtp_audio_payload_set_sample_options ()

    void                gst_base_rtp_audio_payload_set_sample_options
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload,
                                                             gint sample_size);

Sets the options for sample based audio codecs.

`basertpaudiopayload` : | a pointer to the element.
`sample_size` : | Size per sample in bytes.

### gst_base_rtp_audio_payload_get_adapter ()

    GstAdapter *        gst_base_rtp_audio_payload_get_adapter
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload);

Gets the internal adapter used by the depayloader.

`basertpaudiopayload` : | a GstBaseRTPAudioPayload
Returns : | a GstAdapter.

Since 0.10.13

### gst_base_rtp_audio_payload_push ()

    GstFlowReturn       gst_base_rtp_audio_payload_push     (GstBaseRTPAudioPayload *baseaudiopayload,
                                                             const guint8 *data,
                                                             guint payload_len,
                                                             GstClockTime timestamp);

Create an RTP buffer and store `payload_len` bytes of `data` as the payload. Set the timestamp on the new buffer to `timestamp` before pushing the buffer downstream.

`baseaudiopayload` : | a GstBaseRTPPayload
`data` : | data to set as payload
`payload_len` : | length of payload
`timestamp` : | a GstClockTime
Returns : | a GstFlowReturn

Since 0.10.13

### gst_base_rtp_audio_payload_flush ()

    GstFlowReturn       gst_base_rtp_audio_payload_flush    (GstBaseRTPAudioPayload *baseaudiopayload,
                                                             guint payload_len,
                                                             GstClockTime timestamp);

Create an RTP buffer and store `payload_len` bytes of the adapter as the payload. Set the timestamp on the new buffer to `timestamp` before pushing the buffer downstream.

If `payload_len` is -1, all pending bytes will be flushed. If `timestamp` is -1, the timestamp will be calculated automatically.

`baseaudiopayload` : | a GstBaseRTPPayload
`payload_len` : | length of payload
`timestamp` : | a GstClockTime
Returns : | a GstFlowReturn

Since 0.10.25

### gst_base_rtp_audio_payload_set_samplebits_options ()

    void                gst_base_rtp_audio_payload_set_samplebits_options
                                                            (GstBaseRTPAudioPayload *basertpaudiopayload,
                                                             gint sample_size);

Sets the options for sample based audio codecs.

`basertpaudiopayload` : | a pointer to the element.
`sample_size` : | Size per sample in bits.

Since 0.10.18

## Property Details

### The `"buffer-list"` property

      "buffer-list"              gboolean              : Read / Write

Use Buffer Lists.

Default value: FALSE