gstaudiobasesink

## gstaudiobasesink gstaudiobasesink — Base class for audio sinks |

## Synopsis

    #include <gst/audio/gstaudiobasesink.h>

    struct              GstAudioBaseSink;
    struct              GstAudioBaseSinkClass;
    enum                GstAudioBaseSinkSlaveMethod;
    #define             GST_AUDIO_BASE_SINK_CLOCK           (obj)
    #define             GST_AUDIO_BASE_SINK_PAD             (obj)
    GstAudioRingBuffer * gst_audio_base_sink_create_ringbuffer
                                                            (GstAudioBaseSink *sink);
    void                gst_audio_base_sink_set_provide_clock
                                                            (GstAudioBaseSink *sink,
                                                             gboolean provide);
    gboolean            gst_audio_base_sink_get_provide_clock
                                                            (GstAudioBaseSink *sink);
    void                gst_audio_base_sink_set_slave_method
                                                            (GstAudioBaseSink *sink,
                                                             GstAudioBaseSinkSlaveMethod method);
    GstAudioBaseSinkSlaveMethod gst_audio_base_sink_get_slave_method
                                                            (GstAudioBaseSink *sink);
    gint64              gst_audio_base_sink_get_drift_tolerance
                                                            (GstAudioBaseSink *sink);
    void                gst_audio_base_sink_set_drift_tolerance
                                                            (GstAudioBaseSink *sink,
                                                             gint64 drift_tolerance);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GstObject
                   +----GstElement
                         +----GstBaseSink
                               +----GstAudioBaseSink
                                     +----GstAudioSink

## Properties

      "alignment-threshold"      guint64               : Read / Write
      "buffer-time"              gint64                : Read / Write
      "can-activate-pull"        gboolean              : Read / Write
      "discont-wait"             guint64               : Read / Write
      "drift-tolerance"          gint64                : Read / Write
      "latency-time"             gint64                : Read / Write
      "provide-clock"            gboolean              : Read / Write
      "slave-method"             GstAudioBaseSinkSlaveMethod  : Read / Write

## Description

This is the base class for audio sinks. Subclasses need to implement the ::create_ringbuffer vmethod. This base class will then take care of writing samples to the ringbuffer, synchronisation, clipping and flushing.

Last reviewed on 2006-09-27 (0.10.12)

## Details

### struct GstAudioBaseSink

    struct GstAudioBaseSink;

Opaque GstAudioBaseSink.

### struct GstAudioBaseSinkClass

    struct GstAudioBaseSinkClass {
      GstBaseSinkClass     parent_class;

      /* subclass ringbuffer allocation */
      GstAudioRingBuffer* (*create_ringbuffer)  (GstAudioBaseSink *sink);

      /* subclass payloader */
      GstBuffer*          (*payload)            (GstAudioBaseSink *sink,
                                                 GstBuffer        *buffer);
    };

GstAudioBaseSink class. Override the vmethod to implement functionality.

GstBaseSinkClass `parent_class`; | the parent class.
`create_ringbuffer` () | create and return a GstAudioRingBuffer to write to.
`payload` () | payload data in a format suitable to write to the sink. If no payloading is required, returns a reffed copy of the original buffer, else returns the payloaded buffer with all other metadata copied.

### enum GstAudioBaseSinkSlaveMethod

    typedef enum {
      GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE,
      GST_AUDIO_BASE_SINK_SLAVE_SKEW,
      GST_AUDIO_BASE_SINK_SLAVE_NONE
    } GstAudioBaseSinkSlaveMethod;

Different possible clock slaving algorithms used when the internal audio clock is not selected as the pipeline master clock.

`GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE` | Resample to match the master clock
`GST_AUDIO_BASE_SINK_SLAVE_SKEW` | Adjust playout pointer when master clock drifts too much.
`GST_AUDIO_BASE_SINK_SLAVE_NONE` | No adjustment is done.

### GST_AUDIO_BASE_SINK_CLOCK()

    #define GST_AUDIO_BASE_SINK_CLOCK(obj)   (GST_AUDIO_BASE_SINK (obj)->clock)

Get the GstClock of `obj`.

`obj` : | a GstAudioBaseSink

### GST_AUDIO_BASE_SINK_PAD()

    #define GST_AUDIO_BASE_SINK_PAD(obj)     (GST_BASE_SINK (obj)->sinkpad)

Get the sink GstPad of `obj`.

`obj` : | a GstAudioBaseSink

### gst_audio_base_sink_create_ringbuffer ()

    GstAudioRingBuffer * gst_audio_base_sink_create_ringbuffer
                                                            (GstAudioBaseSink *sink);

Create and return the GstAudioRingBuffer for `sink`. This function will call the ::create_ringbuffer vmethod and will set `sink` as the parent of the returned buffer (see `gst_object_set_parent()`).

`sink` : | a GstAudioBaseSink.
Returns : | The new ringbuffer of `sink`. [transfer none]

### gst_audio_base_sink_set_provide_clock ()

    void                gst_audio_base_sink_set_provide_clock
                                                            (GstAudioBaseSink *sink,
                                                             gboolean provide);

Controls whether `sink` will provide a clock or not. If `provide` is `TRUE`, `gst_element_provide_clock()` will return a clock that reflects the datarate of `sink`. If `provide` is `FALSE`, `gst_element_provide_clock()` will return NULL.

`sink` : | a GstAudioBaseSink
`provide` : | new state

### gst_audio_base_sink_get_provide_clock ()

    gboolean            gst_audio_base_sink_get_provide_clock
                                                            (GstAudioBaseSink *sink);

Queries whether `sink` will provide a clock or not. See also gst_audio_base_sink_set_provide_clock.

`sink` : | a GstAudioBaseSink
Returns : | `TRUE` if `sink` will provide a clock.

### gst_audio_base_sink_set_slave_method ()

    void                gst_audio_base_sink_set_slave_method
                                                            (GstAudioBaseSink *sink,
                                                             GstAudioBaseSinkSlaveMethod method);

Controls how clock slaving will be performed in `sink`.

`sink` : | a GstAudioBaseSink
`method` : | the new slave method

### gst_audio_base_sink_get_slave_method ()

    GstAudioBaseSinkSlaveMethod gst_audio_base_sink_get_slave_method
                                                            (GstAudioBaseSink *sink);

Get the current slave method used by `sink`.

`sink` : | a GstAudioBaseSink
Returns : | The current slave method used by `sink`.

### gst_audio_base_sink_get_drift_tolerance ()

    gint64              gst_audio_base_sink_get_drift_tolerance
                                                            (GstAudioBaseSink *sink);

Get the current drift tolerance, in microseconds, used by `sink`.

`sink` : | a GstAudioBaseSink
Returns : | The current drift tolerance used by `sink`.

### gst_audio_base_sink_set_drift_tolerance ()

    void                gst_audio_base_sink_set_drift_tolerance
                                                            (GstAudioBaseSink *sink,
                                                             gint64 drift_tolerance);

Controls the sink's drift tolerance.

`sink` : | a GstAudioBaseSink
`drift_tolerance` : | the new drift tolerance in microseconds

## Property Details

### The `"alignment-threshold"` property

      "alignment-threshold"      guint64               : Read / Write

Timestamp alignment threshold in nanoseconds.

Allowed values: [1,18446744073709551614]

Default value: 40000000

### The `"buffer-time"` property

      "buffer-time"              gint64                : Read / Write

Size of audio buffer in microseconds, this is the minimum latency that the sink reports.

Allowed values: >= 1

Default value: 200000

### The `"can-activate-pull"` property

      "can-activate-pull"        gboolean              : Read / Write

Allow pull-based scheduling.

Default value: FALSE

### The `"discont-wait"` property

      "discont-wait"             guint64               : Read / Write

A window of time in nanoseconds to wait before creating a discontinuity as a result of breaching the drift-tolerance.

Allowed values: <= 18446744073709551614

Default value: 1000000000

### The `"drift-tolerance"` property

      "drift-tolerance"          gint64                : Read / Write

Controls the amount of time in microseconds that clocks are allowed to drift before resynchronisation happens.

Allowed values: >= 1

Default value: 40000

### The `"latency-time"` property

      "latency-time"             gint64                : Read / Write

The minimum amount of data to write in each iteration in microseconds.

Allowed values: >= 1

Default value: 10000

### The `"provide-clock"` property

      "provide-clock"            gboolean              : Read / Write

Provide a clock to be used as the global pipeline clock.

Default value: TRUE

### The `"slave-method"` property

      "slave-method"             GstAudioBaseSinkSlaveMethod  : Read / Write

Algorithm to use to match the rate of the masterclock.

Default value: GST_AUDIO_BASE_SINK_SLAVE_SKEW

## See Also

GstAudioSink, GstAudioRingBuffer.