From deaa91326fe5d854bd8d2989e547715f2bee88b0 Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 14 Jan 2005 04:09:30 +0000 Subject: [PATCH] Looked at WAV spec format. Probably (but I'm not certain) the thing that was wrong was the test program which needs to byte swap. What confuses me now is how the media players sort this out. --- lib/cdda_interface/interface.c | 10 +--------- test/testparanoia.c | 30 +++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/lib/cdda_interface/interface.c b/lib/cdda_interface/interface.c index f93a5242..3d476268 100644 --- a/lib/cdda_interface/interface.c +++ b/lib/cdda_interface/interface.c @@ -1,5 +1,5 @@ /* - $Id: interface.c,v 1.11 2005/01/14 03:41:11 rocky Exp $ + $Id: interface.c,v 1.12 2005/01/14 04:09:30 rocky Exp $ Copyright (C) 2005 Rocky Bernstein Copyright (C) 1998 Monty xiphmont@mit.edu @@ -111,15 +111,7 @@ cdda_open(cdrom_drive_t *d) /* d->select_speed(d,d->maxspeed); most drives are full speed by default */ if (d->bigendianp==-1) -#ifdef USE_DATA_BIGENDIANP d->bigendianp=data_bigendianp(d); -#else -#if WORDS_BIGENDIAN - d->bigendianp=1; -#else - d->bigendianp=0; -#endif /*WORDS_BIGENDIAN*/ -#endif /*USE_DATA_BIGENDIANP*/ return(0); } diff --git a/test/testparanoia.c b/test/testparanoia.c index d0917588..feb5b4f1 100644 --- a/test/testparanoia.c +++ b/test/testparanoia.c @@ -34,6 +34,12 @@ #include #endif +#ifdef WORDS_BIGENDIAN +#define BIGENDIAN 1 +#else +#define BIGENDIAN 0 +#endif + #define SKIP_TEST_RC 77 #define MAX_SECTORS 50 @@ -133,12 +139,26 @@ main(int argc, const char *argv[]) if ( PARANOIA_CB_READ == audio_status[i] || PARANOIA_CB_VERIFY == audio_status[i] ) { /* We read the block via paranoia without an error. */ + if ( 0 == cdio_read_audio_sector(d->p_cdio, readbuf, i_lsn) ) { - if ( 0 != memcmp(audio_buf[i], readbuf, - CDIO_CD_FRAMESIZE_RAW) ) { - printf("LSN %ld doesn't match\n", (long int) i_lsn); - i_rc = 1; - goto out; + if ( BIGENDIAN != d->bigendianp ) { + /* We will compare in the slow, pedantic way*/ + int j; + for (j=0; j < CDIO_CD_FRAMESIZE_RAW ; j +=2) { + if (audio_buf[i][j] != readbuf[j+1] && + audio_buf[i][j+1] != readbuf[j] ) { + printf("LSN %ld doesn't match\n", (long int) i_lsn); + i_rc = 1; + goto out; + } + } + } else { + if ( 0 != memcmp(audio_buf[i], readbuf, + CDIO_CD_FRAMESIZE_RAW) ) { + printf("LSN %ld doesn't match\n", (long int) i_lsn); + i_rc = 1; + goto out; + } } } } else {