1 /* 2 * Copyright (C) 2001 CodeFactory AB 3 * Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se> 4 * Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu> 5 * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> 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 Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 20 */ 21 22 23 #ifndef __GST_ALSA_H__ 24 #define __GST_ALSA_H__ 25 26 27 #define ALSA_PCM_NEW_HW_PARAMS_API 28 #define ALSA_PCM_NEW_SW_PARAMS_API 29 30 #include <alsa/asoundlib.h> 31 #include <alsa/control.h> 32 #include <alsa/error.h> 33 #include <gst/gst.h> 34 #include <gst/audio/audio.h> 35 36 #define GST_CHECK_ALSA_VERSION(major,minor,micro) \ 37 (SND_LIB_MAJOR > (major) || \ 38 (SND_LIB_MAJOR == (major) && SND_LIB_MINOR > (minor)) || \ 39 (SND_LIB_MAJOR == (major) && SND_LIB_MINOR == (minor) && \ 40 SND_LIB_SUBMINOR >= (micro))) 41 42 #define PASSTHROUGH_CAPS \ 43 "audio/x-ac3, framed = (boolean) true;" \ 44 "audio/x-eac3, framed = (boolean) true; " \ 45 "audio/x-dts, framed = (boolean) true, " \ 46 "block-size = (int) { 512, 1024, 2048 }; " \ 47 "audio/mpeg, mpegversion = (int) 1, " \ 48 "mpegaudioversion = (int) [ 1, 3 ], parsed = (boolean) true;" 49 50 51 GST_DEBUG_CATEGORY_EXTERN (alsa_debug); 52 #define GST_CAT_DEFAULT alsa_debug 53 54 snd_pcm_t * gst_alsa_open_iec958_pcm (GstObject * obj, gchar *device); 55 56 GstCaps * gst_alsa_probe_supported_formats (GstObject * obj, 57 gchar * device, 58 snd_pcm_t * handle, 59 const GstCaps * template_caps); 60 61 gchar * gst_alsa_find_device_name (GstObject * obj, 62 const gchar * device, 63 snd_pcm_t * handle, 64 snd_pcm_stream_t stream); 65 66 gchar * gst_alsa_find_card_name (GstObject * obj, 67 const gchar * devcard, 68 snd_pcm_stream_t stream); 69 70 void gst_alsa_add_channel_reorder_map (GstObject * obj, 71 GstCaps * caps); 72 73 extern const GstAudioChannelPosition alsa_position[][8]; 74 #ifdef SND_CHMAP_API_VERSION 75 gboolean alsa_chmap_to_channel_positions (const snd_pcm_chmap_t *chmap, 76 GstAudioChannelPosition *pos); 77 78 void alsa_detect_channels_mapping (GstObject * obj, 79 snd_pcm_t * handle, 80 GstAudioRingBufferSpec * spec, 81 guint channels, 82 GstAudioRingBuffer * buf); 83 #endif 84 85 #endif /* __GST_ALSA_H__ */ 86