gstaudiosrc

## gstaudiosrc gstaudiosrc — Simple base class for audio sources |

## Synopsis

    #include <gst/audio/gstaudiosrc.h>

                        GstAudioSrc;
                        GstAudioSrcClass;

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstPushSrc
                               +----GstBaseAudioSrc
                                     +----GstAudioSrc

## Description

This is the most simple base class for audio sources that only requires subclasses to implement a set of simple functions:

`open()` | Open the device.
`prepare()` | Configure the device with the specified format.
`read()` | Read samples from the device.
`reset()` | Unblock reads and flush the device.
`delay()` | Get the number of samples in the device but not yet read.
`unprepare()` | Undo operations done by prepare.
`close()` | Close the device.

All scheduling of samples and timestamps is done in this base class together with GstBaseAudioSrc using a default implementation of a GstRingBuffer that uses threads.

Last reviewed on 2006-09-27 (0.10.12)

## Details

### GstAudioSrc

    typedef struct _GstAudioSrc GstAudioSrc;

Base class for simple audio sources.

### GstAudioSrcClass

    typedef struct {
      GstBaseAudioSrcClass parent_class;

      /* vtable */

      /* open the device with given specs */
      gboolean (*open)      (GstAudioSrc *src);
      /* prepare resources and state to operate with the given specs */
      gboolean (*prepare)   (GstAudioSrc *src, GstRingBufferSpec *spec);
      /* undo anything that was done in prepare() */
      gboolean (*unprepare) (GstAudioSrc *src);
      /* close the device */
      gboolean (*close)     (GstAudioSrc *src);
      /* read samples from the device */
      guint    (*read)      (GstAudioSrc *src, gpointer data, guint length);
      /* get number of samples queued in the device */
      guint    (*delay)     (GstAudioSrc *src);
      /* reset the audio device, unblock from a write */
      void     (*reset)     (GstAudioSrc *src);
    } GstAudioSrcClass;

GstAudioSrc class. Override the vmethod to implement functionality.

GstBaseAudioSrcClass `parent_class`; | the parent class.
`open` () | open the device with the specified caps
`prepare` () | configure device with format
`unprepare` () | undo the configuration
`close` () | close the device
`read` () | read samples to the audio device
`delay` () | the number of samples queued in the device
`reset` () | unblock a read to the device and reset.

## See Also

#GstBaseAudioSrc, GstRingBuffer, GstAudioSrc.