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., 51 Franklin St, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 23 #ifndef __GST_ALSASRC_H__ 24 #define __GST_ALSASRC_H__ 25 26 #include <gst/audio/audio.h> 27 #include "gstalsa.h" 28 29 G_BEGIN_DECLS 30 31 #define GST_TYPE_ALSA_SRC (gst_alsasrc_get_type()) 32 #define GST_ALSA_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_SRC,GstAlsaSrc)) 33 #define GST_ALSA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_SRC,GstAlsaSrcClass)) 34 #define GST_IS_ALSA_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_SRC)) 35 #define GST_IS_ALSA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_SRC)) 36 #define GST_ALSA_SRC_CAST(obj) ((GstAlsaSrc *)(obj)) 37 38 #define GST_ALSA_SRC_GET_LOCK(obj) (&GST_ALSA_SRC_CAST (obj)->alsa_lock) 39 #define GST_ALSA_SRC_LOCK(obj) (g_mutex_lock (GST_ALSA_SRC_GET_LOCK (obj))) 40 #define GST_ALSA_SRC_UNLOCK(obj) (g_mutex_unlock (GST_ALSA_SRC_GET_LOCK (obj))) 41 42 typedef struct _GstAlsaSrc GstAlsaSrc; 43 typedef struct _GstAlsaSrcClass GstAlsaSrcClass; 44 45 /** 46 * GstAlsaSrc: 47 * 48 * Opaque data structure 49 */ 50 struct _GstAlsaSrc { 51 GstAudioSrc src; 52 53 gchar *device; 54 55 snd_pcm_t *handle; 56 snd_pcm_hw_params_t *hwparams; 57 snd_pcm_sw_params_t *swparams; 58 59 GstCaps *cached_caps; 60 61 snd_pcm_access_t access; 62 snd_pcm_format_t format; 63 guint rate; 64 guint channels; 65 gint bpf; 66 gboolean driver_timestamps; 67 gboolean use_driver_timestamps; 68 69 guint buffer_time; 70 guint period_time; 71 snd_pcm_uframes_t buffer_size; 72 snd_pcm_uframes_t period_size; 73 74 GMutex alsa_lock; 75 }; 76 77 struct _GstAlsaSrcClass { 78 GstAudioSrcClass parent_class; 79 }; 80 81 GType gst_alsasrc_get_type(void); 82 83 G_END_DECLS 84 85 #endif /* __GST_ALSASRC_H__ */ 86