ALSA project - the C library reference
pcm_extplug.h
Go to the documentation of this file.
1 
10 /*
11  * ALSA external PCM plugin SDK (draft version)
12  *
13  * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
14  *
15  * This library is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU Lesser General Public License as
17  * published by the Free Software Foundation; either version 2.1 of
18  * the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU Lesser General Public License for more details.
24  *
25  * You should have received a copy of the GNU Lesser General Public
26  * License along with this library; if not, write to the Free Software
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28  *
29  */
30 
31 #if !defined(__ALSA_PCM_EXTERNAL_H) && !defined(ALSA_LIBRARY_BUILD)
32 #warning "use #include <alsa/pcm_external.h>, <alsa/pcm_extplug.h> should not be used directly"
33 #include <alsa/pcm_external.h>
34 #endif
35 
36 #ifndef __ALSA_PCM_EXTPLUG_H
37 #define __ALSA_PCM_EXTPLUG_H
38 
47 enum {
48  SND_PCM_EXTPLUG_HW_FORMAT,
49  SND_PCM_EXTPLUG_HW_CHANNELS,
50  SND_PCM_EXTPLUG_HW_PARAMS
51 };
52 
54 typedef struct snd_pcm_extplug snd_pcm_extplug_t;
56 typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
57 #ifdef DOC_HIDDEN
58 /* redefine typedefs for stupid doxygen */
59 typedef snd_pcm_extplug snd_pcm_extplug_t;
60 typedef snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
61 #endif
62 
63 /*
64  * Protocol version
65  */
66 #define SND_PCM_EXTPLUG_VERSION_MAJOR 1
67 #define SND_PCM_EXTPLUG_VERSION_MINOR 0
68 #define SND_PCM_EXTPLUG_VERSION_TINY 2
72 #define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\
73  (SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\
74  (SND_PCM_EXTPLUG_VERSION_TINY))
75 
77 struct snd_pcm_extplug {
82  unsigned int version;
86  const char *name;
90  const snd_pcm_extplug_callback_t *callback;
94  void *private_data;
98  snd_pcm_t *pcm;
102  snd_pcm_stream_t stream;
110  snd_pcm_subformat_t subformat;
114  unsigned int channels;
118  unsigned int rate;
122  snd_pcm_format_t slave_format;
126  snd_pcm_subformat_t slave_subformat;
130  unsigned int slave_channels;
131 };
132 
134 struct snd_pcm_extplug_callback {
138  snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext,
139  const snd_pcm_channel_area_t *dst_areas,
140  snd_pcm_uframes_t dst_offset,
141  const snd_pcm_channel_area_t *src_areas,
142  snd_pcm_uframes_t src_offset,
143  snd_pcm_uframes_t size);
147  int (*close)(snd_pcm_extplug_t *ext);
151  int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params);
155  int (*hw_free)(snd_pcm_extplug_t *ext);
159  void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out);
163  int (*init)(snd_pcm_extplug_t *ext);
167  snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_extplug_t *ext);
171  snd_pcm_chmap_t *(*get_chmap)(snd_pcm_extplug_t *ext);
175  int (*set_chmap)(snd_pcm_extplug_t *ext, const snd_pcm_chmap_t *map);
176 };
177 
178 
179 int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name,
180  snd_config_t *root, snd_config_t *slave_conf,
181  snd_pcm_stream_t stream, int mode);
182 int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext);
183 
184 /* clear hw_parameter setting */
185 void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext);
186 
187 /* hw_parameter setting */
188 int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
189 int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
190 int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
191 int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
192 int snd_pcm_extplug_set_param_link(snd_pcm_extplug_t *extplug, int type,
193  int keep_link);
194 
198 static __inline__ int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
199 {
200  return snd_pcm_extplug_set_param_list(extplug, type, 1, &val);
201 }
202 
206 static __inline__ int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
207 {
208  return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val);
209 }
210 
213 #endif /* __ALSA_PCM_EXTPLUG_H */
Definition: pcm.h:652
uint8_t type
Definition: ump_msg.h:183
Definition: pcm.h:496
snd_pcm_subformat_t
Definition: pcm.h:288
struct _snd_pcm_hw_params snd_pcm_hw_params_t
Definition: pcm.h:68
Definition: pcm.h:646
int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max)
Set master parameter as the min/max values.
Definition: pcm_extplug.c:850
struct _snd_config snd_config_t
Internal structure for a configuration node object.
Definition: conf.h:74
snd_pcm_format_t
Definition: pcm.h:129
long snd_pcm_sframes_t
Definition: pcm.h:402
struct _snd_output snd_output_t
Internal structure for an output object.
Definition: output.h:60
int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list)
Set slave parameter as the list.
Definition: pcm_extplug.c:780
uint16_t format
Definition: ump_msg.h:184
int snd_pcm_extplug_create(snd_pcm_extplug_t *extplug, const char *name, snd_config_t *root, snd_config_t *slave_conf, snd_pcm_stream_t stream, int mode)
Create an extplug instance.
Definition: pcm_extplug.c:676
void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *extplug)
Reset extplug parameters.
Definition: pcm_extplug.c:762
int snd_pcm_extplug_delete(snd_pcm_extplug_t *extplug)
Delete the extplug instance.
Definition: pcm_extplug.c:750
int snd_pcm_extplug_set_param_link(snd_pcm_extplug_t *extplug, int type, int keep_link)
Keep the client and slave format/channels the same if requested. This is for example useful if this e...
Definition: pcm_extplug.c:874
unsigned long snd_pcm_uframes_t
Definition: pcm.h:400
int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list)
Set master parameter as the list.
Definition: pcm_extplug.c:828
snd_pcm_stream_t
Definition: pcm.h:105
int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max)
Set slave parameter as the min/max values.
Definition: pcm_extplug.c:802
struct _snd_pcm snd_pcm_t
Definition: pcm.h:422