diff options
Diffstat (limited to 'stream/audio_in.c')
-rw-r--r-- | stream/audio_in.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/stream/audio_in.c b/stream/audio_in.c index 420311e848..6cfbcda129 100644 --- a/stream/audio_in.c +++ b/stream/audio_in.c @@ -40,20 +40,20 @@ int audio_in_init(audio_in_t *ai, int type) ai->samplesize = -1; switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: ai->alsa.handle = NULL; ai->alsa.log = NULL; ai->alsa.device = strdup("default"); return 0; #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: ai->oss.audio_fd = -1; ai->oss.device = strdup("/dev/dsp"); return 0; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: ai->sndio.hdl = NULL; ai->sndio.device = strdup("default"); @@ -68,19 +68,19 @@ int audio_in_setup(audio_in_t *ai) { switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: if (ai_alsa_init(ai) < 0) return -1; ai->setup = 1; return 0; #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: if (ai_oss_init(ai) < 0) return -1; ai->setup = 1; return 0; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: if (ai_sndio_init(ai) < 0) return -1; ai->setup = 1; @@ -94,21 +94,21 @@ int audio_in_setup(audio_in_t *ai) int audio_in_set_samplerate(audio_in_t *ai, int rate) { switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: ai->req_samplerate = rate; if (!ai->setup) return 0; if (ai_alsa_setup(ai) < 0) return -1; return ai->samplerate; #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: ai->req_samplerate = rate; if (!ai->setup) return 0; if (ai_oss_set_samplerate(ai) < 0) return -1; return ai->samplerate; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: ai->req_samplerate = rate; if (!ai->setup) return 0; @@ -123,21 +123,21 @@ int audio_in_set_samplerate(audio_in_t *ai, int rate) int audio_in_set_channels(audio_in_t *ai, int channels) { switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: ai->req_channels = channels; if (!ai->setup) return 0; if (ai_alsa_setup(ai) < 0) return -1; return ai->channels; #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: ai->req_channels = channels; if (!ai->setup) return 0; if (ai_oss_set_channels(ai) < 0) return -1; return ai->channels; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: ai->req_channels = channels; if (!ai->setup) return 0; @@ -151,12 +151,12 @@ int audio_in_set_channels(audio_in_t *ai, int channels) int audio_in_set_device(audio_in_t *ai, char *device) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA int i; #endif if (ai->setup) return -1; switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: free(ai->alsa.device); ai->alsa.device = strdup(device); @@ -166,13 +166,13 @@ int audio_in_set_device(audio_in_t *ai, char *device) } return 0; #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: free(ai->oss.device); ai->oss.device = strdup(device); return 0; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: if (ai->sndio.device) free(ai->sndio.device); ai->sndio.device = strdup(device); @@ -187,7 +187,7 @@ int audio_in_uninit(audio_in_t *ai) { if (ai->setup) { switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: if (ai->alsa.log) snd_output_close(ai->alsa.log); @@ -197,13 +197,13 @@ int audio_in_uninit(audio_in_t *ai) ai->setup = 0; return 0; #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: close(ai->oss.audio_fd); ai->setup = 0; return 0; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: if (ai->sndio.hdl) sio_close(ai->sndio.hdl); @@ -218,15 +218,15 @@ int audio_in_uninit(audio_in_t *ai) int audio_in_start_capture(audio_in_t *ai) { switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: return snd_pcm_start(ai->alsa.handle); #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: return 0; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: if (!sio_start(ai->sndio.hdl)) return -1; @@ -242,7 +242,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer) int ret; switch (ai->type) { -#ifdef CONFIG_ALSA +#if HAVE_ALSA case AUDIO_IN_ALSA: ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size); if (ret != ai->alsa.chunk_size) { @@ -262,7 +262,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer) } return ret; #endif -#ifdef CONFIG_OSS_AUDIO +#if HAVE_OSS_AUDIO case AUDIO_IN_OSS: ret = read(ai->oss.audio_fd, buffer, ai->blocksize); if (ret != ai->blocksize) { @@ -276,7 +276,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer) } return ret; #endif -#ifdef CONFIG_SNDIO +#if HAVE_SNDIO case AUDIO_IN_SNDIO: ret = sio_read(ai->sndio.hdl, buffer, ai->blocksize); if (ret != ai->blocksize) { |