## GstAudioSink

GstAudioSink — Simple base class for audio sinks

## Types and Values

struct | GstAudioSink
struct | GstAudioSinkClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBaseSink
                        ╰── GstAudioBaseSink
                            ╰── GstAudioSink

## Includes

    #include <gst/audio/gstaudiosink.h>

## Description

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

- ``open()`` :Open the device.

- ``prepare()`` :Configure the device with the specified format.

- ``write()`` :Write samples to the device.

- ``reset()`` :Unblock writes and flush the device.

- ``delay()`` :Get the number of samples written but not yet played by the device.

- ``unprepare()`` :Undo operations done by prepare.

- ``close()`` :Close the device.

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

## Functions

## Types and Values

### struct GstAudioSink

    struct GstAudioSink;

Opaque GstAudioSink.

### struct GstAudioSinkClass

    struct GstAudioSinkClass {
      GstAudioBaseSinkClass parent_class;

      /* vtable */

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

GstAudioSink class. Override the vmethods to implement functionality.

#### Members

`open` () | Open the device. No configuration needs to be done at this point. This function is also used to check if the device is available. |
`prepare` () | Prepare the device to operate with the specified parameters. |
`unprepare` () | Undo operations done in prepare. |
`close` () | Close the device. |
`write` () | Write data to the device. |
`delay` () | Return how many frames are still in the device. This is used to drive the synchronisation. |
`reset` () | Returns as quickly as possible from a write and flush any pending samples from the device. |

## See Also

GstAudioBaseSink, GstAudioRingBuffer, GstAudioSink.