1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-03 13:32:16 +00:00

OSS is optional (fixes case when "tv" enabled, and "ossaudio" disabled)

patch by Chad Netzer <cnetzer@sonic.net>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7844 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-10-22 15:14:30 +00:00
parent dafa2d6507
commit 3d100efa41

View File

@ -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;
}