- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

# /builddir/build/BUILD/alsa-lib-1.1.0/include/pcm_ioplug.h

Go to the documentation of this file.

    00001
    00010 /*
    00011  * ALSA external PCM plugin SDK
    00012  *
    00013  * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
    00014  *
    00015  *   This library is free software; you can redistribute it and/or modify
    00016  *   it under the terms of the GNU Lesser General Public License as
    00017  *   published by the Free Software Foundation; either version 2.1 of
    00018  *   the License, or (at your option) any later version.
    00019  *
    00020  *   This program is distributed in the hope that it will be useful,
    00021  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00022  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00023  *   GNU Lesser General Public License for more details.
    00024  *
    00025  *   You should have received a copy of the GNU Lesser General Public
    00026  *   License along with this library; if not, write to the Free Software
    00027  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    00028  *
    00029  */
    00030
    00031 #ifndef __ALSA_PCM_IOPLUG_H
    00032 #define __ALSA_PCM_IOPLUG_H
    00033
    00042 enum {
    00043         SND_PCM_IOPLUG_HW_ACCESS = 0,
    00044         SND_PCM_IOPLUG_HW_FORMAT,
    00045         SND_PCM_IOPLUG_HW_CHANNELS,
    00046         SND_PCM_IOPLUG_HW_RATE,
    00047         SND_PCM_IOPLUG_HW_PERIOD_BYTES,
    00048         SND_PCM_IOPLUG_HW_BUFFER_BYTES,
    00049         SND_PCM_IOPLUG_HW_PERIODS,
    00050         SND_PCM_IOPLUG_HW_PARAMS
    00051 };
    00052
    00054 typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
    00056 typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
    00057 #ifdef DOC_HIDDEN
    00058 /* redefine typedefs for stupid doxygen */
    00059 typedef snd_pcm_ioplug snd_pcm_ioplug_t;
    00060 typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
    00061 #endif
    00062
    00063 /*
    00064  * bit flags for additional conditions
    00065  */
    00066 #define SND_PCM_IOPLUG_FLAG_LISTED      (1<<0)
    00067 #define SND_PCM_IOPLUG_FLAG_MONOTONIC   (1<<1)
    00069 /*
    00070  * Protocol version
    00071  */
    00072 #define SND_PCM_IOPLUG_VERSION_MAJOR    1
    00073 #define SND_PCM_IOPLUG_VERSION_MINOR    0
    00074 #define SND_PCM_IOPLUG_VERSION_TINY     2
    00078 #define SND_PCM_IOPLUG_VERSION          ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
    00079                                          (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
    00080                                          (SND_PCM_IOPLUG_VERSION_TINY))
    00081
    00083 struct snd_pcm_ioplug {
    00088         unsigned int version;
    00092         const char *name;
    00093         unsigned int flags;
    00094         int poll_fd;
    00095         unsigned int poll_events;
    00096         unsigned int mmap_rw;
    00100         const snd_pcm_ioplug_callback_t *callback;
    00104         void *private_data;
    00108         snd_pcm_t *pcm;
    00109
    00110         snd_pcm_stream_t stream;
    00111         snd_pcm_state_t state;
    00112         volatile snd_pcm_uframes_t appl_ptr;
    00113         volatile snd_pcm_uframes_t hw_ptr;
    00114         int nonblock;
    00116         snd_pcm_access_t access;
    00117         snd_pcm_format_t format;
    00118         unsigned int channels;
    00119         unsigned int rate;
    00120         snd_pcm_uframes_t period_size;
    00121         snd_pcm_uframes_t buffer_size;
    00122 };
    00123
    00125 struct snd_pcm_ioplug_callback {
    00129         int (*start)(snd_pcm_ioplug_t *io);
    00133         int (*stop)(snd_pcm_ioplug_t *io);
    00137         snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
    00141         snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
    00142                                       const snd_pcm_channel_area_t *areas,
    00143                                       snd_pcm_uframes_t offset,
    00144                                       snd_pcm_uframes_t size);
    00148         int (*close)(snd_pcm_ioplug_t *io);
    00152         int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
    00156         int (*hw_free)(snd_pcm_ioplug_t *io);
    00160         int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
    00164         int (*prepare)(snd_pcm_ioplug_t *io);
    00168         int (*drain)(snd_pcm_ioplug_t *io);
    00172         int (*pause)(snd_pcm_ioplug_t *io, int enable);
    00176         int (*resume)(snd_pcm_ioplug_t *io);
    00180         int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
    00184         int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
    00188         int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
    00192         void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
    00196         int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
    00200         snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_ioplug_t *io);
    00204         snd_pcm_chmap_t *(*get_chmap)(snd_pcm_ioplug_t *io);
    00208         int (*set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map);
    00209 };
    00210
    00211
    00212 int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
    00213                           snd_pcm_stream_t stream, int mode);
    00214 int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
    00215
    00216 /* update poll_fd and mmap_rw */
    00217 int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
    00218
    00219 /* get a mmap area (for mmap_rw only) */
    00220 const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
    00221
    00222 /* clear hw_parameter setting */
    00223 void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
    00224
    00225 /* hw_parameter setting */
    00226 int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
    00227 int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
    00228
    00229 /* change PCM status */
    00230 int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
    00231
    00234 #endif /* __ALSA_PCM_IOPLUG_H */

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines