pkgsrc/sysutils/cdrdao/patches/patch-ba
drochner 1e0bb28697 adapt to a change in libao's WAV output format, cdrdao can now
import mp3 files directly again
bump PKGREV
2013-05-03 16:14:47 +00:00

47 lines
1.2 KiB
Text

$NetBSD: patch-ba,v 1.1 2013/05/03 16:14:47 drochner Exp $
adapt to libao's output format
--- trackdb/TrackData.cc.orig 2009-04-20 21:20:17.000000000 +0000
+++ trackdb/TrackData.cc
@@ -642,7 +642,7 @@ int TrackData::waveLength(const char *fi
char magic[4];
long headerLen = 0;
long len;
- short waveFormat;
+ unsigned short waveFormat;
short waveChannels;
long waveRate;
short waveBits;
@@ -715,7 +715,7 @@ int TrackData::waveLength(const char *fi
waveFormat = readShort(fp);
- if (waveFormat != 1) {
+ if (waveFormat != 1 && waveFormat != 0xfffe) {
// not PCM format
log_message(-2, "%s: not in PCM format.", filename);
fclose(fp);
@@ -749,7 +749,21 @@ int TrackData::waveLength(const char *fi
return 2;
}
- len -= 16;
+ if (waveFormat == 1)
+ len -= 16;
+ else {
+ readShort(fp); // cbsize
+ readShort(fp); // validbits
+ readLong(fp); // channelmask
+ waveFormat = readShort(fp); // subformat
+ if (waveFormat != 1) {
+ // not PCM format
+ log_message(-2, "%s: not in PCM format.", filename);
+ fclose(fp);
+ return 2;
+ }
+ len -= 26;
+ }
// skip chunk data
if (fseek(fp, len, SEEK_CUR) != 0) {