diff options
author | sobomax <sobomax@FreeBSD.org> | 2001-08-22 00:58:33 +0800 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2001-08-22 00:58:33 +0800 |
commit | efafcd8bb3b1e8782924b19af000d8b4459ce265 (patch) | |
tree | 9946f60ba6519a8212235ccac154710046d737dc /audio | |
parent | b0c8637d82b36725e7f29083223eabf2a939007d (diff) | |
download | freebsd-ports-graphics-efafcd8bb3b1e8782924b19af000d8b4459ce265.tar.gz freebsd-ports-graphics-efafcd8bb3b1e8782924b19af000d8b4459ce265.tar.zst freebsd-ports-graphics-efafcd8bb3b1e8782924b19af000d8b4459ce265.zip |
Deffer detection of supported audio rates/formats until we really know what
rate we are looking for. This allows to avoid checking all possible
combinations and significantly improves mpg123 startup time. Bump PORTREVISION.
Submitted by: MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
Diffstat (limited to 'audio')
-rw-r--r-- | audio/mpg123/Makefile | 2 | ||||
-rw-r--r-- | audio/mpg123/files/patch-ab | 29 | ||||
-rw-r--r-- | audio/mpg123/files/patch-audio.c | 105 |
3 files changed, 131 insertions, 5 deletions
diff --git a/audio/mpg123/Makefile b/audio/mpg123/Makefile index 7e7537d89ae..6e2fbd3577f 100644 --- a/audio/mpg123/Makefile +++ b/audio/mpg123/Makefile @@ -7,7 +7,7 @@ PORTNAME= mpg123 PORTVERSION= 0.59r -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= audio ipv6 MASTER_SITES= http://www.mpg123.de/mpg123/ \ http://www-ti.informatik.uni-tuebingen.de/~hippm/mpg123/ \ diff --git a/audio/mpg123/files/patch-ab b/audio/mpg123/files/patch-ab index 76b32c33998..bce0ace75cd 100644 --- a/audio/mpg123/files/patch-ab +++ b/audio/mpg123/files/patch-ab @@ -1,5 +1,8 @@ ---- mpg123.c.orig Fri Jun 18 05:18:11 1999 -+++ mpg123.c Fri Mar 2 16:08:04 2001 + +$FreeBSD$ + +--- mpg123.c.orig Tue Aug 21 19:48:17 2001 ++++ mpg123.c Tue Aug 21 19:49:02 2001 @@ -27,6 +27,10 @@ #include <sched.h> #endif @@ -38,7 +41,25 @@ } return newfile; -@@ -784,6 +788,10 @@ +@@ -605,6 +609,9 @@ + } + + if(fr->header_change > 1 || init) { ++ ++ init_output(); ++ + 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 @@ _wildcard(&argc,&argv); #endif @@ -49,7 +70,7 @@ if(sizeof(short) != 2) { fprintf(stderr,"Ouch SHORT has size of %d bytes (required: '2')\n",(int)sizeof(short)); exit(1); -@@ -917,17 +925,6 @@ +@@ -923,17 +933,6 @@ &dirname, &filename)) fprintf(stderr, "\nDirectory: %s", dirname); fprintf(stderr, "\nPlaying MPEG stream from %s ...\n", filename); diff --git a/audio/mpg123/files/patch-audio.c b/audio/mpg123/files/patch-audio.c new file mode 100644 index 00000000000..29e475a036d --- /dev/null +++ b/audio/mpg123/files/patch-audio.c @@ -0,0 +1,105 @@ + +$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]; |