## gstbaseaudiosrc gstbaseaudiosrc — Base class for audio sources |

## Synopsis

    #include <gst/audio/gstbaseaudiosrc.h>

    struct              GstBaseAudioSrc;
    struct              GstBaseAudioSrcClass;
    enum                GstBaseAudioSrcSlaveMethod;
    #define             GST_BASE_AUDIO_SRC_CLOCK            (obj)
    #define             GST_BASE_AUDIO_SRC_PAD              (obj)
    GstRingBuffer *     gst_base_audio_src_create_ringbuffer
                                                            (GstBaseAudioSrc *src);
    void                gst_base_audio_src_set_provide_clock
                                                            (GstBaseAudioSrc *src,
                                                             gboolean provide);
    gboolean            gst_base_audio_src_get_provide_clock
                                                            (GstBaseAudioSrc *src);
    GstBaseAudioSrcSlaveMethod gst_base_audio_src_get_slave_method
                                                            (GstBaseAudioSrc *src);
    void                gst_base_audio_src_set_slave_method (GstBaseAudioSrc *src,
                                                             GstBaseAudioSrcSlaveMethod method);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstPushSrc
                               +----GstBaseAudioSrc
                                     +----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"             GstBaseAudioSrcSlaveMethod  : 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 GstBaseAudioSrc

    struct GstBaseAudioSrc;

Opaque GstBaseAudioSrc.

### struct GstBaseAudioSrcClass

    struct GstBaseAudioSrcClass {
      GstPushSrcClass parent_class;

      /* subclass ringbuffer allocation */
      GstRingBuffer* (*create_ringbuffer)  (GstBaseAudioSrc *src);
    };

GstBaseAudioSrc class. Override the vmethod to implement functionality.

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

### enum GstBaseAudioSrcSlaveMethod

    typedef enum {
      GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE,
      GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP,
      GST_BASE_AUDIO_SRC_SLAVE_SKEW,
      GST_BASE_AUDIO_SRC_SLAVE_NONE
    } GstBaseAudioSrcSlaveMethod;

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

`GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE` | Resample to match the master clock.
`GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP` | Retimestamp output buffers with master clock time.
`GST_BASE_AUDIO_SRC_SLAVE_SKEW` | Adjust capture pointer when master clock drifts too much.
`GST_BASE_AUDIO_SRC_SLAVE_NONE` | No adjustment is done.

### GST_BASE_AUDIO_SRC_CLOCK()

    #define GST_BASE_AUDIO_SRC_CLOCK(obj)    (GST_BASE_AUDIO_SRC (obj)->clock)

Get the GstClock of `obj`.

`obj` : | a GstBaseAudioSrc

### GST_BASE_AUDIO_SRC_PAD()

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

Get the source GstPad of `obj`.

`obj` : | a GstBaseAudioSrc

### gst_base_audio_src_create_ringbuffer ()

    GstRingBuffer *     gst_base_audio_src_create_ringbuffer
                                                            (GstBaseAudioSrc *src);

Create and return the GstRingBuffer 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 GstBaseAudioSrc.
Returns : | The new ringbuffer of `src`.

### gst_base_audio_src_set_provide_clock ()

    void                gst_base_audio_src_set_provide_clock
                                                            (GstBaseAudioSrc *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 GstBaseAudioSrc
`provide` : | new state

Since 0.10.16

### gst_base_audio_src_get_provide_clock ()

    gboolean            gst_base_audio_src_get_provide_clock
                                                            (GstBaseAudioSrc *src);

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

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

Since 0.10.16

### gst_base_audio_src_get_slave_method ()

    GstBaseAudioSrcSlaveMethod gst_base_audio_src_get_slave_method
                                                            (GstBaseAudioSrc *src);

Get the current slave method used by `src`.

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

Since 0.10.20

### gst_base_audio_src_set_slave_method ()

    void                gst_base_audio_src_set_slave_method (GstBaseAudioSrc *src,
                                                             GstBaseAudioSrcSlaveMethod method);

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

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

Since 0.10.20

## 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

Since 0.10.20

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

      "actual-latency-time"      gint64                : Read

Actual configured audio latency in microseconds.

Allowed values: >= -1

Default value: -1

Since 0.10.20

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

      "buffer-time"              gint64                : Read / Write

Size of audio buffer in microseconds.

Allowed values: >= 1

Default value: 200000

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

      "latency-time"             gint64                : Read / Write

Audio latency 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"             GstBaseAudioSrcSlaveMethod  : Read / Write

Algorithm to use to match the rate of the masterclock.

Default value: GST_BASE_AUDIO_SRC_SLAVE_SKEW

## See Also

GstAudioSrc, GstRingBuffer.