1 /* GStreamer |
|
2 * Copyright (C) 2005 Wim Taymans <wim@fluendo.com> |
|
3 * |
|
4 * gstalsasrc.h: |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Library General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Library General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Library General Public |
|
17 * License along with this library; if not, write to the |
|
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
19 * Boston, MA 02111-1307, USA. |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef __GST_ALSASRC_H__ |
|
24 #define __GST_ALSASRC_H__ |
|
25 |
|
26 #include <gst/audio/gstaudiosrc.h> |
|
27 #include "gstalsa.h" |
|
28 #include "gstalsamixer.h" |
|
29 |
|
30 G_BEGIN_DECLS |
|
31 |
|
32 #define GST_TYPE_ALSA_SRC (gst_alsasrc_get_type()) |
|
33 #define GST_ALSA_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_SRC,GstAlsaSrc)) |
|
34 #define GST_ALSA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_SRC,GstAlsaSrcClass)) |
|
35 #define GST_IS_ALSA_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_SRC)) |
|
36 #define GST_IS_ALSA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_SRC)) |
|
37 #define GST_ALSA_SRC_CAST(obj) ((GstAlsaSrc *)(obj)) |
|
38 |
|
39 #define GST_ALSA_SRC_GET_LOCK(obj) (GST_ALSA_SRC_CAST (obj)->alsa_lock) |
|
40 #define GST_ALSA_SRC_LOCK(obj) (g_mutex_lock (GST_ALSA_SRC_GET_LOCK (obj))) |
|
41 #define GST_ALSA_SRC_UNLOCK(obj) (g_mutex_unlock (GST_ALSA_SRC_GET_LOCK (obj))) |
|
42 |
|
43 typedef struct _GstAlsaSrc GstAlsaSrc; |
|
44 typedef struct _GstAlsaSrcClass GstAlsaSrcClass; |
|
45 |
|
46 /** |
|
47 * GstAlsaSrc: |
|
48 * |
|
49 * Opaque data structure |
|
50 */ |
|
51 struct _GstAlsaSrc { |
|
52 GstAudioSrc src; |
|
53 |
|
54 gchar *device; |
|
55 |
|
56 snd_pcm_t *handle; |
|
57 snd_pcm_hw_params_t *hwparams; |
|
58 snd_pcm_sw_params_t *swparams; |
|
59 |
|
60 GstCaps *cached_caps; |
|
61 |
|
62 snd_pcm_access_t access; |
|
63 snd_pcm_format_t format; |
|
64 guint rate; |
|
65 guint channels; |
|
66 gint bytes_per_sample; |
|
67 |
|
68 guint buffer_time; |
|
69 guint period_time; |
|
70 snd_pcm_uframes_t buffer_size; |
|
71 snd_pcm_uframes_t period_size; |
|
72 |
|
73 GstAlsaMixer *mixer; |
|
74 |
|
75 GMutex *alsa_lock; |
|
76 }; |
|
77 |
|
78 struct _GstAlsaSrcClass { |
|
79 GstAudioSrcClass parent_class; |
|
80 }; |
|
81 |
|
82 GType gst_alsasrc_get_type(void); |
|
83 |
|
84 G_END_DECLS |
|
85 |
|
86 #endif /* __GST_ALSASRC_H__ */ |
|