All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pcm_ioplug.h
Go to the documentation of this file.
/*
* ALSA external PCM plugin SDK
*
* Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __ALSA_PCM_IOPLUG_H
#define __ALSA_PCM_IOPLUG_H
enum {
SND_PCM_IOPLUG_HW_ACCESS = 0,
SND_PCM_IOPLUG_HW_FORMAT,
SND_PCM_IOPLUG_HW_CHANNELS,
SND_PCM_IOPLUG_HW_RATE,
SND_PCM_IOPLUG_HW_PERIOD_BYTES,
SND_PCM_IOPLUG_HW_BUFFER_BYTES,
SND_PCM_IOPLUG_HW_PERIODS,
SND_PCM_IOPLUG_HW_PARAMS
};
typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
#ifdef DOC_HIDDEN
/* redefine typedefs for stupid doxygen */
typedef snd_pcm_ioplug snd_pcm_ioplug_t;
typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
#endif
/*
* bit flags for additional conditions
*/
#define SND_PCM_IOPLUG_FLAG_LISTED (1<<0)
#define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1)
/*
* Protocol version
*/
#define SND_PCM_IOPLUG_VERSION_MAJOR 1
#define SND_PCM_IOPLUG_VERSION_MINOR 0
#define SND_PCM_IOPLUG_VERSION_TINY 2
#define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
(SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
(SND_PCM_IOPLUG_VERSION_TINY))
struct snd_pcm_ioplug {
unsigned int version;
const char *name;
unsigned int flags;
int poll_fd;
unsigned int poll_events;
unsigned int mmap_rw;
const snd_pcm_ioplug_callback_t *callback;
void *private_data;
snd_pcm_t *pcm;
snd_pcm_stream_t stream;
snd_pcm_state_t state;
volatile snd_pcm_uframes_t appl_ptr;
volatile snd_pcm_uframes_t hw_ptr;
int nonblock;
snd_pcm_access_t access;
snd_pcm_format_t format;
unsigned int channels;
unsigned int rate;
snd_pcm_uframes_t period_size;
snd_pcm_uframes_t buffer_size;
};
struct snd_pcm_ioplug_callback {
int (*start)(snd_pcm_ioplug_t *io);
int (*stop)(snd_pcm_ioplug_t *io);
snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
const snd_pcm_channel_area_t *areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t size);
int (*close)(snd_pcm_ioplug_t *io);
int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
int (*hw_free)(snd_pcm_ioplug_t *io);
int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
int (*prepare)(snd_pcm_ioplug_t *io);
int (*drain)(snd_pcm_ioplug_t *io);
int (*pause)(snd_pcm_ioplug_t *io, int enable);
int (*resume)(snd_pcm_ioplug_t *io);
int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_ioplug_t *io);
snd_pcm_chmap_t *(*get_chmap)(snd_pcm_ioplug_t *io);
int (*set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map);
};
int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
snd_pcm_stream_t stream, int mode);
int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
/* update poll_fd and mmap_rw */
int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
/* get a mmap area (for mmap_rw only) */
const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
/* clear hw_parameter setting */
void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
/* hw_parameter setting */
int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
/* change PCM status */
int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
#endif /* __ALSA_PCM_IOPLUG_H */
snd_pcm_ioplug_set_param_list
int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list)
Set parameter as the list.
Definition: pcm_ioplug.c:1055
snd_pcm_ioplug_callback::dump
void(* dump)(snd_pcm_ioplug_t *io, snd_output_t *out)
Definition: pcm_ioplug.h:192
snd_pcm_ioplug_callback::set_chmap
int(* set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map)
Definition: pcm_ioplug.h:208
snd_pcm_sw_params_t
struct _snd_pcm_sw_params snd_pcm_sw_params_t
Definition: pcm.h:67
snd_pcm_ioplug::appl_ptr
volatile snd_pcm_uframes_t appl_ptr
Definition: pcm_ioplug.h:112
SND_PCM_IOPLUG_HW_FORMAT
Definition: pcm_ioplug.h:44
snd_pcm_chmap_query_t
Definition: pcm.h:596
snd_pcm_state_t
snd_pcm_state_t
Definition: pcm.h:275
SND_PCM_IOPLUG_HW_ACCESS
Definition: pcm_ioplug.h:43
snd_pcm_ioplug_callback::hw_params
int(* hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)
Definition: pcm_ioplug.h:152
snd_pcm_ioplug_set_state
int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state)
Change the ioplug PCM status.
Definition: pcm_ioplug.c:1141
snd_pcm_ioplug::poll_events
unsigned int poll_events
Definition: pcm_ioplug.h:95
snd_pcm_ioplug_mmap_areas
const snd_pcm_channel_area_t * snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug)
Get mmap area of ioplug.
Definition: pcm_ioplug.c:1124
snd_pcm_ioplug_delete
int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io)
Delete the ioplug instance.
Definition: pcm_ioplug.c:1026
snd_pcm_ioplug_callback::poll_descriptors_count
int(* poll_descriptors_count)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:180
snd_pcm_channel_area_t
Definition: pcm.h:450
snd_pcm_hw_params_t
struct _snd_pcm_hw_params snd_pcm_hw_params_t
Definition: pcm.h:64
snd_pcm_chmap_t
Definition: pcm.h:590
snd_pcm_ioplug_callback::pause
int(* pause)(snd_pcm_ioplug_t *io, int enable)
Definition: pcm_ioplug.h:172
snd_pcm_ioplug::callback
const snd_pcm_ioplug_callback_t * callback
Definition: pcm_ioplug.h:100
snd_pcm_ioplug_callback::stop
int(* stop)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:133
snd_pcm_ioplug_callback::resume
int(* resume)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:176
snd_pcm_ioplug_callback::drain
int(* drain)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:168
snd_pcm_ioplug_callback::poll_revents
int(* poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents)
Definition: pcm_ioplug.h:188
snd_pcm_ioplug_callback::hw_free
int(* hw_free)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:156
snd_pcm_ioplug::private_data
void * private_data
Definition: pcm_ioplug.h:104
SND_PCM_IOPLUG_HW_PERIODS
Definition: pcm_ioplug.h:49
snd_pcm_ioplug::nonblock
int nonblock
Definition: pcm_ioplug.h:114
snd_pcm_ioplug::poll_fd
int poll_fd
Definition: pcm_ioplug.h:94
snd_pcm_ioplug
Definition: pcm_ioplug.h:83
snd_pcm_format_t
snd_pcm_format_t
Definition: pcm.h:125
snd_pcm_sframes_t
long snd_pcm_sframes_t
Definition: pcm.h:358
SND_PCM_IOPLUG_HW_PARAMS
Definition: pcm_ioplug.h:50
snd_pcm_ioplug::buffer_size
snd_pcm_uframes_t buffer_size
Definition: pcm_ioplug.h:121
snd_pcm_ioplug_callback
Definition: pcm_ioplug.h:125
snd_pcm_ioplug::period_size
snd_pcm_uframes_t period_size
Definition: pcm_ioplug.h:120
snd_pcm_ioplug::version
unsigned int version
Definition: pcm_ioplug.h:88
snd_pcm_ioplug_callback::poll_descriptors
int(* poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space)
Definition: pcm_ioplug.h:184
snd_output_t
struct _snd_output snd_output_t
Internal structure for an output object.
Definition: output.h:54
snd_pcm_ioplug_callback::sw_params
int(* sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params)
Definition: pcm_ioplug.h:160
snd_pcm_ioplug::state
snd_pcm_state_t state
Definition: pcm_ioplug.h:111
snd_pcm_ioplug::name
const char * name
Definition: pcm_ioplug.h:92
snd_pcm_ioplug::rate
unsigned int rate
Definition: pcm_ioplug.h:119
snd_pcm_ioplug::format
snd_pcm_format_t format
Definition: pcm_ioplug.h:117
snd_pcm_ioplug_callback_t
snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t
Definition: pcm_ioplug.h:60
SND_PCM_IOPLUG_HW_BUFFER_BYTES
Definition: pcm_ioplug.h:48
snd_pcm_ioplug_callback::start
int(* start)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:129
snd_pcm_ioplug_callback::pointer
snd_pcm_sframes_t(* pointer)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:137
snd_pcm_ioplug_set_param_minmax
int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max)
Set parameter as the min/max values.
Definition: pcm_ioplug.c:1079
snd_pcm_ioplug_callback::transfer
snd_pcm_sframes_t(* transfer)(snd_pcm_ioplug_t *io, const snd_pcm_channel_area_t *areas, snd_pcm_uframes_t offset, snd_pcm_uframes_t size)
Definition: pcm_ioplug.h:141
snd_pcm_ioplug_callback::delay
int(* delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp)
Definition: pcm_ioplug.h:196
snd_pcm_ioplug::flags
unsigned int flags
Definition: pcm_ioplug.h:93
snd_pcm_ioplug::access
snd_pcm_access_t access
Definition: pcm_ioplug.h:116
snd_pcm_ioplug_create
int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name, snd_pcm_stream_t stream, int mode)
Create an ioplug instance.
Definition: pcm_ioplug.c:974
snd_pcm_ioplug_callback::close
int(* close)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:148
snd_pcm_ioplug_params_reset
void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io)
Reset ioplug parameters.
Definition: pcm_ioplug.c:1038
SND_PCM_IOPLUG_HW_CHANNELS
Definition: pcm_ioplug.h:45
SND_PCM_IOPLUG_HW_PERIOD_BYTES
Definition: pcm_ioplug.h:47
snd_pcm_ioplug::channels
unsigned int channels
Definition: pcm_ioplug.h:118
snd_pcm_ioplug::stream
snd_pcm_stream_t stream
Definition: pcm_ioplug.h:110
snd_pcm_ioplug_reinit_status
int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug)
Reinitialize the poll and mmap status.
Definition: pcm_ioplug.c:1104
snd_pcm_uframes_t
unsigned long snd_pcm_uframes_t
Definition: pcm.h:356
snd_pcm_stream_t
snd_pcm_stream_t
Definition: pcm.h:101
snd_pcm_ioplug::pcm
snd_pcm_t * pcm
Definition: pcm_ioplug.h:108
snd_pcm_ioplug_callback::prepare
int(* prepare)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:164
SND_PCM_IOPLUG_HW_RATE
Definition: pcm_ioplug.h:46
snd_pcm_t
struct _snd_pcm snd_pcm_t
Definition: pcm.h:376
snd_pcm_ioplug::mmap_rw
unsigned int mmap_rw
Definition: pcm_ioplug.h:96
snd_pcm_ioplug::hw_ptr
volatile snd_pcm_uframes_t hw_ptr
Definition: pcm_ioplug.h:113
snd_pcm_access_t
snd_pcm_access_t
Definition: pcm.h:110
snd_pcm_ioplug_t
snd_pcm_ioplug snd_pcm_ioplug_t
Definition: pcm_ioplug.h:59