## gstaudiobasesrc gstaudiobasesrc — Base class for audio sources |

## Synopsis

    #include <gst/audio/gstaudiobasesrc.h>

    struct              GstAudioBaseSrc;
    struct              GstAudioBaseSrcClass;
    enum                GstAudioBaseSrcSlaveMethod;
    #define             GST_AUDIO_BASE_SRC_CLOCK            (obj)
    #define             GST_AUDIO_BASE_SRC_PAD              (obj)
    GstAudioRingBuffer * gst_audio_base_src_create_ringbuffer
                                                            (GstAudioBaseSrc *src);
    void                gst_audio_base_src_set_provide_clock
                                                            (GstAudioBaseSrc *src,
                                                             gboolean provide);
    gboolean            gst_audio_base_src_get_provide_clock
                                                            (GstAudioBaseSrc *src);
    GstAudioBaseSrcSlaveMethod gst_audio_base_src_get_slave_method
                                                            (GstAudioBaseSrc *src);
    void                gst_audio_base_src_set_slave_method (GstAudioBaseSrc *src,
                                                             GstAudioBaseSrcSlaveMethod method);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GstObject
                   +----GstElement
                         +----GstBaseSrc
                               +----GstPushSrc
                                     +----GstAudioBaseSrc
                                           +----GstAudioSrc

## Properties

      "actual-buffer-time"       gint64                : Read
      "actual-latency-time"      gint64                : Read
      "buffer-time"              gint64                : Read / Write
      "latency-time"             gint64                : Read / Write
      "provide-clock"            gboolean              : Read / Write
      "slave-method"             GstAudioBaseSrcSlaveMethod  : Read / Write

## Description

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

Last reviewed on 2006-09-27 (0.10.12)

## Details

### struct GstAudioBaseSrc

    struct GstAudioBaseSrc;

Opaque GstAudioBaseSrc.

### struct GstAudioBaseSrcClass

    struct GstAudioBaseSrcClass {
      GstPushSrcClass      parent_class;

      /* subclass ringbuffer allocation */
      GstAudioRingBuffer* (*create_ringbuffer)  (GstAudioBaseSrc *src);
    };

GstAudioBaseSrc class. Override the vmethod to implement functionality.

GstPushSrcClass `parent_class`; | the parent class.
`create_ringbuffer` () | create and return a GstAudioRingBuffer to read from.

### enum GstAudioBaseSrcSlaveMethod

    typedef enum {
      GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE,
      GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP,
      GST_AUDIO_BASE_SRC_SLAVE_SKEW,
      GST_AUDIO_BASE_SRC_SLAVE_NONE
    } GstAudioBaseSrcSlaveMethod;

Different possible clock slaving algorithms when the internal audio clock was not selected as the pipeline clock.

`GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE` | Resample to match the master clock.
`GST_AUDIO_BASE_SRC_SLAVE_RETIMESTAMP` | Retimestamp output buffers with master clock time.
`GST_AUDIO_BASE_SRC_SLAVE_SKEW` | Adjust capture pointer when master clock drifts too much.
`GST_AUDIO_BASE_SRC_SLAVE_NONE` | No adjustment is done.

### GST_AUDIO_BASE_SRC_CLOCK()

    #define GST_AUDIO_BASE_SRC_CLOCK(obj)    (GST_AUDIO_BASE_SRC (obj)->clock)

Get the GstClock of `obj`.

`obj` : | a GstAudioBaseSrc

### GST_AUDIO_BASE_SRC_PAD()

    #define GST_AUDIO_BASE_SRC_PAD(obj)      (GST_BASE_SRC (obj)->srcpad)

Get the source GstPad of `obj`.

`obj` : | a GstAudioBaseSrc

### gst_audio_base_src_create_ringbuffer ()

    GstAudioRingBuffer * gst_audio_base_src_create_ringbuffer
                                                            (GstAudioBaseSrc *src);

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

`src` : | a GstAudioBaseSrc.
Returns : | The new ringbuffer of `src`. [transfer none]

### gst_audio_base_src_set_provide_clock ()

    void                gst_audio_base_src_set_provide_clock
                                                            (GstAudioBaseSrc *src,
                                                             gboolean provide);

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

`src` : | a GstAudioBaseSrc
`provide` : | new state

### gst_audio_base_src_get_provide_clock ()

    gboolean            gst_audio_base_src_get_provide_clock
                                                            (GstAudioBaseSrc *src);

Queries whether `src` will provide a clock or not. See also gst_audio_base_src_set_provide_clock.

`src` : | a GstAudioBaseSrc
Returns : | `TRUE` if `src` will provide a clock.

### gst_audio_base_src_get_slave_method ()

    GstAudioBaseSrcSlaveMethod gst_audio_base_src_get_slave_method
                                                            (GstAudioBaseSrc *src);

Get the current slave method used by `src`.

`src` : | a GstAudioBaseSrc
Returns : | The current slave method used by `src`.

### gst_audio_base_src_set_slave_method ()

    void                gst_audio_base_src_set_slave_method (GstAudioBaseSrc *src,
                                                             GstAudioBaseSrcSlaveMethod method);

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

`src` : | a GstAudioBaseSrc
`method` : | the new slave method

## Property Details

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

      "actual-buffer-time"       gint64                : Read

Actual configured size of audio buffer in microseconds.

Allowed values: >= -1

Default value: -1

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

      "actual-latency-time"      gint64                : Read

Actual configured audio latency in microseconds.

Allowed values: >= -1

Default value: -1

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

      "buffer-time"              gint64                : Read / Write

Size of audio buffer in microseconds, this is the maximum amount of data that is buffered in the device and the maximum latency that the source reports.

Allowed values: >= 1

Default value: 200000

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

      "latency-time"             gint64                : Read / Write

The minimum amount of data to read in each iteration in microseconds, this is the minimum latency that the source reports.

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"             GstAudioBaseSrcSlaveMethod  : Read / Write

Algorithm to use to match the rate of the masterclock.

Default value: GST_AUDIO_BASE_SRC_SLAVE_SKEW

## See Also

GstAudioSrc, GstAudioRingBuffer.