$OpenBSD: patch-audio.c,v 1.3 2004/09/15 20:35:59 brad Exp $ --- audio.c.orig Tue Apr 6 11:53:05 1999 +++ audio.c Wed Sep 15 16:22:34 2004 @@ -68,41 +68,42 @@ void audio_capabilities(struct audio_inf { int fmts; int i,j,k,k1=NUM_RATES-1; - struct audio_info_struct ai1 = *ai; if (param.outmode != DECODE_AUDIO) { memset(capabilities,1,sizeof(capabilities)); return; } - memset(capabilities,0,sizeof(capabilities)); + memset(capabilities,-1,sizeof(capabilities)); if(param.force_rate) { rates[NUM_RATES-1] = param.force_rate; k1 = NUM_RATES; } - if(audio_open(&ai1) < 0) { - perror("audio"); - exit(1); - } + if(param.verbose > 1) { + struct audio_info_struct ai1 = *ai; + if(audio_open(&ai1) < 0) { + perror("audio"); + exit(1); + } - for(i=0;i 1) { + audio_close(&ai1); fprintf(stderr,"\nAudio capabilities:\n |"); for(j=0;j= 0) { for(i=f0;ichannels = channels[c]; + ai->rate = rates[rn]; + fmts = audio_get_formats(ai); + for(k=0;krate = rates[rn]; ai->format = encodings[i]; ai->channels = channels[c]; @@ -160,7 +173,11 @@ static int audio_fit_cap_helper(struct a * c=num of channels of stream * r=rate of stream */ -void audio_fit_capabilities(struct audio_info_struct *ai,int c,int r) +#ifdef OPENBSD +void audio_fit_capabilities(struct audio_info_struct *ai, int c, int r) +#else +static void do_audio_fit_capabilities(struct audio_info_struct *ai,int c,int r) +#endif { int rn; int f0=0; @@ -247,6 +264,23 @@ void audio_fit_capabilities(struct audio exit(1); } +#ifndef OPENBSD +void audio_fit_capabilities(struct audio_info_struct *ai,int c,int r) +{ + struct audio_info_struct ai1 = *ai; + + if (param.verbose <= 1 && audio_open(&ai1) >= 0) { + do_audio_fit_capabilities(&ai1, c, r); + ai->rate = ai1.rate; + ai->channels = ai1.channels; + ai->format = ai1.format; + audio_close(&ai1); + } else { + do_audio_fit_capabilities(ai, c, r); + } +} +#endif + char *audio_encoding_name(int format) { int i; @@ -258,7 +292,7 @@ char *audio_encoding_name(int format) return "Unknown"; } -#if !defined(SOLARIS) && !defined(__NetBSD__) || defined(NAS) +#if !defined(SOLARIS) && !defined(__NetBSD__) && !defined(__OpenBSD__) || defined(NAS) void audio_queueflush(struct audio_info_struct *ai) { }