• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
33 G_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 
42 typedef struct _GstAudioSink GstAudioSink;
43 typedef struct _GstAudioSinkClass GstAudioSinkClass;
44 
45 /**
46  * GstAudioSink:
47  *
48  * Opaque #GstAudioSink.
49  */
50 struct _GstAudioSink {
51   GstAudioBaseSink       element;
52 
53   /*< private >*/ /* with LOCK */
54   GThread   *thread;
55 
56   /*< private >*/
57   gpointer _gst_reserved[GST_PADDING];
58 };
59 
60 /**
61  * GstAudioSinkClass:
62  * @parent_class: the parent class structure.
63  * @open: Open the device. No configuration needs to be done at this point.
64  *        This function is also used to check if the device is available.
65  * @prepare: Prepare the device to operate with the specified parameters.
66  * @unprepare: Undo operations done in prepare.
67  * @close: Close the device.
68  * @write: Write data to the device.
69  * @delay: Return how many frames are still in the device. This is used to
70  *         drive the synchronisation.
71  * @reset: Returns as quickly as possible from a write and flush any pending
72  *         samples from the device.
73  *
74  * #GstAudioSink class. Override the vmethods to implement functionality.
75  */
76 struct _GstAudioSinkClass {
77   GstAudioBaseSinkClass parent_class;
78 
79   /* vtable */
80 
81   /* open the device with given specs */
82   gboolean (*open)      (GstAudioSink *sink);
83   /* prepare resources and state to operate with the given specs */
84   gboolean (*prepare)   (GstAudioSink *sink, GstAudioRingBufferSpec *spec);
85   /* undo anything that was done in prepare() */
86   gboolean (*unprepare) (GstAudioSink *sink);
87   /* close the device */
88   gboolean (*close)     (GstAudioSink *sink);
89   /* write samples to the device */
90   gint     (*write)     (GstAudioSink *sink, gpointer data, guint length);
91   /* get number of frames queued in the device */
92   guint    (*delay)     (GstAudioSink *sink);
93   /* reset the audio device, unblock from a write */
94   void     (*reset)     (GstAudioSink *sink);
95 
96   /*< private >*/
97   gpointer _gst_reserved[GST_PADDING];
98 };
99 
100 GST_AUDIO_API
101 GType gst_audio_sink_get_type(void);
102 
103 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
104 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioSink, gst_object_unref)
105 #endif
106 
107 G_END_DECLS
108 
109 #endif /* __GST_AUDIO_SINK_H__ */
110