1/* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2005 Wim Taymans <wim@fluendo.com>
4 *
5 * gstaudiosink.h:
6 *
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.
11 *
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.
16 *
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., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __GST_AUDIO_AUDIO_H__
24#include <gst/audio/audio.h>
25#endif
26
27#ifndef __GST_AUDIO_SINK_H__
28#define __GST_AUDIO_SINK_H__
29
30#include <gst/gst.h>
31#include <gst/audio/gstaudiobasesink.h>
32
33G_BEGIN_DECLS
34
35#define GST_TYPE_AUDIO_SINK (gst_audio_sink_get_type())
36#define GST_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SINK,GstAudioSink))
37#define GST_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
38#define GST_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
39#define GST_IS_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SINK))
40#define GST_IS_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SINK))
41
42typedef struct _GstAudioSink GstAudioSink;
43typedef struct _GstAudioSinkClass GstAudioSinkClass;
44typedef struct _GstAudioSinkClassExtension GstAudioSinkClassExtension;
45
46/**
47 * GstAudioSink:
48 *
49 * Opaque #GstAudioSink.
50 */
51struct _GstAudioSink {
52 GstAudioBaseSink element;
53
54 /*< private >*/ /* with LOCK */
55 GThread *thread;
56
57 /*< private >*/
58 gpointer _gst_reserved[GST_PADDING];
59};
60
61/**
62 * GstAudioSinkClass:
63 * @parent_class: the parent class structure.
64 * @open: Open the device. No configuration needs to be done at this point.
65 * This function is also used to check if the device is available.
66 * @prepare: Prepare the device to operate with the specified parameters.
67 * @unprepare: Undo operations done in prepare.
68 * @close: Close the device.
69 * @write: Write data to the device.
70 * This vmethod is allowed to block until all the data is written.
71 * If such is the case then it is expected that pause, stop and
72 * reset will unblock the write when called.
73 * @delay: Return how many frames are still in the device. Participates in
74 * computing the time for audio clocks and drives the synchronisation.
75 * @reset: Returns as quickly as possible from a write and flush any pending
76 * samples from the device.
77 * This vmethod is deprecated. Please provide pause and stop instead.
78 * @pause: Pause the device and unblock write as fast as possible.
79 * For retro compatibility, the audio sink will fallback
80 * to calling reset if this vmethod is not provided. Since: 1.18
81 * @resume: Resume the device. Since: 1.18
82 * @stop: Stop the device and unblock write as fast as possible.
83 * Pending samples are flushed from the device.
84 * For retro compatibility, the audio sink will fallback
85 * to calling reset if this vmethod is not provided. Since: 1.18
86 * @extension: class extension structure. Since: 1.18
87 */
88struct _GstAudioSinkClass {
89 GstAudioBaseSinkClass parent_class;
90
91 /* vtable */
92
93 /* open the device with given specs */
94 gboolean (*open) (GstAudioSink *sink);
95 /* prepare resources and state to operate with the given specs */
96 gboolean (*prepare) (GstAudioSink *sink, GstAudioRingBufferSpec *spec);
97 /* undo anything that was done in prepare() */
98 gboolean (*unprepare) (GstAudioSink *sink);
99 /* close the device */
100 gboolean (*close) (GstAudioSink *sink);
101 /* write samples to the device */
102 gint (*write) (GstAudioSink *sink, gpointer data, guint length);
103 /* get number of frames queued in the device */
104 guint (*delay) (GstAudioSink *sink);
105 /* deprecated: reset the audio device, unblock from a write */
106 void (*reset) (GstAudioSink *sink);
107 /* pause the audio device, unblock from a write */
108 void (*pause) (GstAudioSink *sink);
109 /* resume the audio device */
110 void (*resume) (GstAudioSink *sink);
111 /* stop the audio device, unblock from a write */
112 void (*stop) (GstAudioSink *sink);
113
114 GstAudioSinkClassExtension *extension;
115};
116
117/**
118 * GstAudioSinkClassExtension:
119 * @clear-all: Clear the device. Since: 1.18
120 */
121struct _GstAudioSinkClassExtension
122{
123 /* clear the audio device */
124 void (*clear_all) (GstAudioSink *sink);
125
126 /* no padding needed */
127};
128
129GST_AUDIO_API
130GType gst_audio_sink_get_type(void);
131
132G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioSink, gst_object_unref)
133
134G_END_DECLS
135
136#endif /* __GST_AUDIO_SINK_H__ */
137

source code of include/gstreamer-1.0/gst/audio/gstaudiosink.h