Remove patches that break audio capability detection, as well as a patch

that works around a driver bug that was fixed a year ago.

PR:		ports/33617, ports/32670, ports/35009, ports/32669
This commit is contained in:
Dag-Erling Smørgrav 2002-02-18 09:34:12 +00:00
parent f3b9ca556a
commit 2b4d7bc2c7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=54856
4 changed files with 2 additions and 212 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= mpg123
PORTVERSION= 0.59r
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= audio ipv6
MASTER_SITES= http://www.mpg123.de/mpg123/ \
http://www-ti.informatik.uni-tuebingen.de/~hippm/mpg123/ \

View File

@ -51,15 +51,7 @@ $FreeBSD$
old_rate = ai.rate;
old_format = ai.format;
old_channels = ai.channels;
@@ -652,7 +659,6 @@
break;
}
- init_output();
if(ai.rate != old_rate || ai.channels != old_channels ||
ai.format != old_format || param.force_reopen) {
if(param.force_mono < 0) {
@@ -787,6 +793,10 @@
@@ -787,6 +794,10 @@
_wildcard(&argc,&argv);
#endif

View File

@ -1,97 +0,0 @@
--- audio_oss.c.orig Mon Feb 12 21:51:27 2001
+++ audio_oss.c Mon Feb 12 22:12:27 2001
@@ -143,12 +143,21 @@
int audio_set_channels(struct audio_info_struct *ai)
{
- int chan = ai->channels - 1;
+ int chan = ai->channels - 1, avail;
int ret;
if(ai->channels < 0)
return 0;
+ if (ioctl(ai->fn, SNDCTL_DSP_GETFMTS, &avail) < 0) {
+ perror("SNDCTL_DSP_GETFMTS");
+ return -1;
+ }
+
+ if (chan && (avail & AFMT_STEREO) == 0) {
+ return -1;
+ }
+
ret = ioctl(ai->fn, SNDCTL_DSP_STEREO, &chan);
if(chan != (ai->channels-1)) {
return -1;
@@ -158,8 +167,8 @@
int audio_set_format(struct audio_info_struct *ai)
{
- int sample_size,fmts;
- int sf,ret;
+ int sample_size, fmts, avail;
+ int sf;
if(ai->format == -1)
return 0;
@@ -194,17 +203,33 @@
if(ioctl(ai->fn, SNDCTL_DSP_SAMPLESIZE,&sample_size) < 0)
return -1;
#endif
+
+ /* newpcm note: need to check format is available before setting,
+ * otherwise driver will not successfully change speed or channels
+ * as format maybe incorrectly set in driver. newpcm probably needs
+ * modifying to stop broken formats sticking. */
+ if (ioctl(ai->fn, SNDCTL_DSP_GETFMTS, &avail) < 0) {
+ perror("SNDCTL_DSP_GETFMTS");
+ return -1;
+ }
+
+ if ((fmts & avail) == 0) {
+ return -1;
+ }
+
sf = fmts;
- ret = ioctl(ai->fn, SNDCTL_DSP_SETFMT, &fmts);
+ if (ioctl(ai->fn, SNDCTL_DSP_SETFMT, &fmts) < 0) {
+ perror("SNDCTL_DSP_SETFMT");
+ return -1;
+ }
if(sf != fmts) {
return -1;
}
- return ret;
+ return 0;
}
/*
- * get formats for specific channel/rate parameters
- */
+ * get formats for specific channel/rate parameters */
int audio_get_formats(struct audio_info_struct *ai)
{
int fmt = 0;
@@ -219,17 +244,17 @@
for(i=0;i<6;i++) {
ai->format = fmts[i];
- if(audio_set_format(ai) < 0) {
+ ai->rate = r;
+ if(audio_rate_best_match(ai) < 0) {
continue;
- }
+ }
ai->channels = c;
if(audio_set_channels(ai) < 0) {
continue;
}
- ai->rate = r;
- if(audio_rate_best_match(ai) < 0) {
+ if(audio_set_format(ai) < 0) {
continue;
- }
+ }
if( (ai->rate*100 > r*(100-AUDIO_RATE_TOLERANCE)) && (ai->rate*100 < r*(100+AUDIO_RATE_TOLERANCE)) ) {
fmt |= fmts[i];
}

View File

@ -1,105 +0,0 @@
$FreeBSD$
--- audio.c.orig Tue Apr 6 18:53:05 1999
+++ audio.c Tue Aug 21 19:38:08 2001
@@ -62,8 +62,45 @@
AUDIO_FORMAT_ALAW_8
};
+/* 0: not checked
+ * 1: capable
+ * -1: not capable
+ */
static char capabilities[NUM_CHANNELS][NUM_ENCODINGS][NUM_RATES];
+/* true (1): capable
+ * false (0): not capable
+ */
+static char get_capabilities(struct audio_info_struct *ai,
+ int channel,int encoding,int rate) {
+ /* printf("get_capabilities(%d,%d,%d)\n",channel,encoding,rate); */
+ if (capabilities[channel][encoding][rate] == 0) {
+ struct audio_info_struct ai1 = *ai;
+ int fmts;
+ int k;
+ ai1.channels = channels[channel];
+ ai1.rate = rates[rate];
+ fmts = audio_get_formats(&ai1);
+ /*printf("fmts=%x\n",fmts); */
+ fflush(stdout);
+ if (fmts < 0)
+ for (k=0; k<NUM_ENCODINGS; k++)
+ capabilities[channel][k][rate] = -1;
+ else
+ for (k=0; k<NUM_ENCODINGS; k++)
+ if ((fmts & encodings[k]) == encodings[k])
+ capabilities[channel][k][rate] = 1;
+ else
+ capabilities[channel][k][rate] = -1;
+ }
+ switch (capabilities[channel][encoding][rate]){
+ case 1: return 1;
+ case -1: return 0;
+ default:
+ abort();
+ }
+}
+
void audio_capabilities(struct audio_info_struct *ai)
{
int fmts;
@@ -86,6 +123,8 @@
exit(1);
}
+ /*
+
for(i=0;i<NUM_CHANNELS;i++) {
for(j=0;j<NUM_RATES;j++) {
ai1.channels = channels[i];
@@ -100,7 +139,7 @@
}
}
- audio_close(&ai1);
+ */
if(param.verbose > 1) {
fprintf(stderr,"\nAudio capabilities:\n |");
@@ -111,13 +150,13 @@
for(k=0;k<k1;k++) {
fprintf(stderr," %5d |",rates[k]);
for(j=0;j<NUM_ENCODINGS;j++) {
- if(capabilities[0][j][k]) {
- if(capabilities[1][j][k])
+ if(get_capabilities(&ai1,0,j,k)) {
+ if(get_capabilities(&ai1,1,j,k))
fprintf(stderr," M/S |");
else
fprintf(stderr," M |");
}
- else if(capabilities[1][j][k])
+ else if(get_capabilities(&ai1,1,j,k))
fprintf(stderr," S |");
else
fprintf(stderr," |");
@@ -126,6 +165,9 @@
}
fprintf(stderr,"\n");
}
+
+ audio_close(&ai1);
+
}
static int rate2num(int r)
@@ -144,7 +186,7 @@
if(rn >= 0) {
for(i=f0;i<f2;i++) {
- if(capabilities[c][i][rn]) {
+ if(get_capabilities(ai,c,i,rn)) {
ai->rate = rates[rn];
ai->format = encodings[i];
ai->channels = channels[c];