From 3d100efa4164d6634fcb394a8ab565607922c59a Mon Sep 17 00:00:00 2001 From: arpi Date: Tue, 22 Oct 2002 15:14:30 +0000 Subject: [PATCH] OSS is optional (fixes case when "tv" enabled, and "ossaudio" disabled) patch by Chad Netzer git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7844 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/audio_in.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libmpdemux/audio_in.c b/libmpdemux/audio_in.c index fbcb12c202..dbc8752be5 100644 --- a/libmpdemux/audio_in.c +++ b/libmpdemux/audio_in.c @@ -31,10 +31,12 @@ int audio_in_init(audio_in_t *ai, int type) ai->alsa.device = strdup("default"); return 0; #endif +#ifdef USE_OSS_AUDIO case AUDIO_IN_OSS: ai->oss.audio_fd = -1; ai->oss.device = strdup("/dev/dsp"); return 0; +#endif default: return -1; } @@ -50,10 +52,12 @@ int audio_in_setup(audio_in_t *ai) ai->setup = 1; return 0; #endif +#ifdef USE_OSS_AUDIO case AUDIO_IN_OSS: if (ai_oss_init(ai) < 0) return -1; ai->setup = 1; return 0; +#endif default: return -1; } @@ -69,11 +73,13 @@ int audio_in_set_samplerate(audio_in_t *ai, int rate) if (ai_alsa_setup(ai) < 0) return -1; return ai->samplerate; #endif +#ifdef USE_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 default: return -1; } @@ -89,11 +95,13 @@ int audio_in_set_channels(audio_in_t *ai, int channels) if (ai_alsa_setup(ai) < 0) return -1; return ai->channels; #endif +#ifdef USE_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 default: return -1; } @@ -114,10 +122,12 @@ int audio_in_set_device(audio_in_t *ai, char *device) } return 0; #endif +#ifdef USE_OSS_AUDIO case AUDIO_IN_OSS: if (ai->oss.device) free(ai->oss.device); ai->oss.device = strdup(device); return 0; +#endif default: return -1; } @@ -137,10 +147,12 @@ int audio_in_uninit(audio_in_t *ai) ai->setup = 0; return 0; #endif +#ifdef USE_OSS_AUDIO case AUDIO_IN_OSS: close(ai->oss.audio_fd); ai->setup = 0; return 0; +#endif } } return -1; @@ -153,8 +165,10 @@ int audio_in_start_capture(audio_in_t *ai) case AUDIO_IN_ALSA: return snd_pcm_start(ai->alsa.handle); #endif +#ifdef USE_OSS_AUDIO case AUDIO_IN_OSS: return 0; +#endif default: return -1; } @@ -185,6 +199,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer) } return ret; #endif +#ifdef USE_OSS_AUDIO case AUDIO_IN_OSS: ret = read(ai->oss.audio_fd, buffer, ai->blocksize); if (ret != ai->blocksize) { @@ -196,6 +211,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer) return -1; } return ret; +#endif default: return -1; }