2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2005 Wim Taymans <wim@fluendo.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef __GST_AUDIO_SINK_H__
24 #define __GST_AUDIO_SINK_H__
27 #include <gst/audio/gstbaseaudiosink.h>
31 #define GST_TYPE_AUDIO_SINK (gst_audio_sink_get_type())
32 #define GST_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SINK,GstAudioSink))
33 #define GST_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
34 #define GST_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
35 #define GST_IS_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SINK))
36 #define GST_IS_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SINK))
38 typedef struct _GstAudioSink GstAudioSink;
39 typedef struct _GstAudioSinkClass GstAudioSinkClass;
44 * Opaque #GstAudioSink.
46 struct _GstAudioSink {
47 GstBaseAudioSink element;
49 /*< private >*/ /* with LOCK */
53 gpointer _gst_reserved[GST_PADDING];
58 * @parent_class: the parent class structure.
59 * @open: Open the device. No configuration needs to be done at this point.
60 * This function is also used to check if the device is available.
61 * @prepare: Prepare the device to operate with the specified parameters.
62 * @unprepare: Undo operations done in prepare.
63 * @close: Close the device.
64 * @write: Write data to the device.
65 * @delay: Return how many samples are still in the device. This is used to
66 * drive the synchronisation.
67 * @reset: Returns as quickly as possible from a write and flush any pending
68 * samples from the device.
70 * #GstAudioSink class. Override the vmethods to implement functionality.
72 struct _GstAudioSinkClass {
73 GstBaseAudioSinkClass parent_class;
77 /* open the device with given specs */
78 gboolean (*open) (GstAudioSink *sink);
79 /* prepare resources and state to operate with the given specs */
80 gboolean (*prepare) (GstAudioSink *sink, GstRingBufferSpec *spec);
81 /* undo anything that was done in prepare() */
82 gboolean (*unprepare) (GstAudioSink *sink);
83 /* close the device */
84 gboolean (*close) (GstAudioSink *sink);
85 /* write samples to the device */
86 /* FIXME 0.11: change return value to gint, as most implementation use that
88 guint (*write) (GstAudioSink *sink, gpointer data, guint length);
89 /* get number of samples queued in the device */
90 guint (*delay) (GstAudioSink *sink);
91 /* reset the audio device, unblock from a write */
92 void (*reset) (GstAudioSink *sink);
95 gpointer _gst_reserved[GST_PADDING];
98 GType gst_audio_sink_get_type(void);
102 #endif /* __GST_AUDIO_SINK_H__ */