diff options
author | kris <kris@FreeBSD.org> | 2003-03-05 18:14:11 +0800 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2003-03-05 18:14:11 +0800 |
commit | 4f0d98ccc6185839f3423228fd04b0199f8a4ee8 (patch) | |
tree | fab8fa67b3cff9d12e4f906557ed3b46f6feeb6b | |
parent | 411efd327c313bcccd3b605b38ff9c41cce9d689 (diff) | |
download | freebsd-ports-gnome-4f0d98ccc6185839f3423228fd04b0199f8a4ee8.tar.gz freebsd-ports-gnome-4f0d98ccc6185839f3423228fd04b0199f8a4ee8.tar.zst freebsd-ports-gnome-4f0d98ccc6185839f3423228fd04b0199f8a4ee8.zip |
From the PR:
When generating mono .WAV files from a CD, dagrab generates an
incorrect RIFF header and the last (partial) block is saved in
stereo rather than mono. Also no error checking is performed
on writes in mono mode.
The problem in the header is that the total chunk size (Rlen)
is not adjusted for mono data and always contains the size
assuming stereo data.
For the last (partial) block, there is no test whether the
data is being saved as mono or stereo - the block is always
written in stereo mode.
Bump PORTREVISION
PR: ports/42975
Submitted by: Peter Jeremy <peter.jeremy@alcatel.com.au>
-rw-r--r-- | audio/dagrab/Makefile | 1 | ||||
-rw-r--r-- | audio/dagrab/files/patch-ab | 91 |
2 files changed, 82 insertions, 10 deletions
diff --git a/audio/dagrab/Makefile b/audio/dagrab/Makefile index 4cf2248ecc72..cfb174f6272c 100644 --- a/audio/dagrab/Makefile +++ b/audio/dagrab/Makefile @@ -7,6 +7,7 @@ PORTNAME= dagrab PORTVERSION= 0.3.5 +PORTREVISION= 1 CATEGORIES= audio MASTER_SITES= ${MASTER_SITE_SUNSITE} MASTER_SITE_SUBDIR= apps/sound/cdrom diff --git a/audio/dagrab/files/patch-ab b/audio/dagrab/files/patch-ab index 6d48f8c9324c..a565f4a633ec 100644 --- a/audio/dagrab/files/patch-ab +++ b/audio/dagrab/files/patch-ab @@ -1,5 +1,5 @@ ---- dagrab.c.orig Sun Feb 20 01:32:46 2000 -+++ dagrab.c Mon Aug 7 19:29:28 2000 +--- dagrab.c.orig Sat Feb 19 08:32:46 2000 ++++ dagrab.c Wed Mar 5 02:12:38 2003 @@ -94,26 +94,20 @@ #include <string.h> #include <errno.h> @@ -50,7 +50,38 @@ #define KW_TRACK 0 #define KW_FULLD 1 #define KW_AUTHOR 2 -@@ -226,16 +226,16 @@ +@@ -206,16 +206,20 @@ + + struct Wavefile cd_newave(unsigned size) + { +- struct Wavefile dummy={{'R','I','F','F'},0x24+size,{'W','A','V','E'}, +- {'f','m','t',' '},0x10,1,2,44100,4*44100,4,16, +- {'d','a','t','a'},size }; +- /*dummy.Dlen=size; +- dummy.Rlen=0x24+size;*/ +- dummy.sample_rate = opt_srate; +- dummy.channel = 2 - opt_mono; +- dummy.byte_rate = opt_srate << dummy.channel; +- dummy.align = dummy.channel * dummy.sample >> 3; +- dummy.Dlen >>= opt_mono; ++ struct Wavefile dummy={{'R','I','F','F'}, /* Rid */ ++ 0x24 + (size >> opt_mono), /* Rlen */ ++ {'W','A','V','E'}, /* Wid */ ++ {'f','m','t',' '}, /* Fid */ ++ 0x10, /* Flen */ ++ 1, /* tag */ ++ 2 - opt_mono, /* channel */ ++ opt_srate, /* sample_rate */ ++ opt_srate << (2 - opt_mono), /* byte_rate */ ++ 16 * (2 - opt_mono) >> 3, /* align */ ++ 16, /* sample */ ++ {'d','a','t','a'}, /* Did */ ++ size >> opt_mono /* Dlen */ ++ }; + return dummy; + } + +@@ -226,16 +230,16 @@ return buf; } @@ -73,7 +104,7 @@ } void cd_read_audio(int lba,int num,char *buf) -@@ -244,13 +244,13 @@ +@@ -244,13 +248,13 @@ /*NOTE: if num>CDROM_NBLOCKS_BUFFER as defined in ide_cd.c (8 in linux 2.0.32) jitter correction may be required inside the block. */ { @@ -92,7 +123,7 @@ /*fprintf(stderr,"%s: read raw ioctl failed \n",progname);*/ fprintf(stderr,"\n%s: read raw ioctl failed at lba %d length %d: %s\n", progname,lba,num,strerror(errno)); -@@ -471,7 +471,7 @@ +@@ -471,7 +475,7 @@ DIR *d; struct dirent *e; char *id2,*p,*cddb,*loc; @@ -101,7 +132,7 @@ char id[12]; char *path; char path2[500]; -@@ -645,10 +645,10 @@ +@@ -645,10 +649,10 @@ int cd_getinfo(char *cd_dev,struct cd_trk_list *tl) { int i; @@ -115,7 +146,7 @@ fprintf(stderr,"%s: error opening device %s\n",progname,cd_dev); exit(1); } -@@ -656,7 +656,7 @@ +@@ -656,7 +660,7 @@ fprintf(stderr,"%s: read TOC ioctl failed: %s\n",progname,strerror(errno)); exit(1); } @@ -124,7 +155,7 @@ if((tl->starts=(int *)malloc((tl->max-tl->min+2)*sizeof(int)))==NULL){ fprintf(stderr,"%s: list data allocation failed\n",progname); exit(1); -@@ -668,21 +668,21 @@ +@@ -668,21 +672,21 @@ for (i=tl->min;i<=tl->max;i++) { @@ -152,7 +183,47 @@ i=cddb_main(tl); if(i==-1) { -@@ -961,7 +961,7 @@ +@@ -796,6 +800,7 @@ + struct Wavefile header; + int fd,bytes,i,n,q,space; + int bcount, sc, missing, speed = 0, ldp, now; ++ ssize_t wlen; + + if(tn<tl->min || tn>tl->max) return (-1); + space = ((tl->starts[tn-tl->min+1]-tl->starts[tn-tl->min]) * +@@ -879,8 +884,10 @@ + d = p1[c]; + buf3[c] = ((short)(d&65535) + (short)(d>>16)) >> 1; + } +- write(fd,buf3,n>>1); +- } else if(write(fd,p1,n)==-1){ ++ wlen = write(fd,buf3,n>>1); ++ } else ++ wlen = write(fd,p1,n); ++ if (wlen == -1){ + fprintf(stderr,"%s: error writing wave file %s: %s\n", + progname,nam,strerror(errno)); + exit(1); +@@ -896,7 +903,17 @@ + /* dump last bytes */ + if (bytes<(tl->starts[tn+1]-tl->starts[tn])*CD_FRAMESIZE_RAW){ + n=(tl->starts[tn+1]-tl->starts[tn])*CD_FRAMESIZE_RAW-bytes; +- if(write(fd,p1,n)==-1){ ++ if(opt_mono) { ++ register int c, d; ++ for(c = 0; c < (n>>2); c++) { ++ d = p1[c]; ++ buf3[c] = ((short)(d&65535) + (short)(d>>16)) >> 1; ++ } ++ wlen = write(fd,buf3,n>>1); ++ } else ++ wlen = write(fd,p1,n); ++ ++ if(wlen==-1){ + fprintf(stderr,"%s: error writing wave file %s: %s\n",progname,nam,strerror(errno)); + exit(1); + }; +@@ -961,7 +978,7 @@ int main(int ac,char **av) { int i,l,disp_TOC=0; @@ -161,7 +232,7 @@ int all_tracks=0; struct cd_trk_list tl; char cd_dev[BLEN+1]=CDDEVICE; -@@ -969,10 +969,8 @@ +@@ -969,10 +986,8 @@ char filter[BLEN+1] = ""; char path[500]; FILE *f; |