changeset 16940:7eb9b500dd7f

save us from #ifndef hell
author faust3
date Sun, 06 Nov 2005 21:09:07 +0000
parents 45a58caf19fb
children aff6d5831e25
files libmpdemux/cdda.c
diffstat 1 files changed, 5 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/cdda.c	Sun Nov 06 19:57:02 2005 +0000
+++ b/libmpdemux/cdda.c	Sun Nov 06 21:09:07 2005 +0000
@@ -13,6 +13,11 @@
 
 #include "cdd.h"
 
+#ifndef CD_FRAMESIZE_RAW
+#define CD_FRAMESIZE_RAW CDIO_CD_FRAMESIZE_RAW
+#endif
+
+
 extern char *cdrom_device;
 
 static struct cdda_params {
@@ -250,17 +255,10 @@
 #endif
 
   st->priv = priv;
-#ifndef HAVE_LIBCDIO
   st->start_pos = priv->start_sector*CD_FRAMESIZE_RAW;
   st->end_pos = priv->end_sector*CD_FRAMESIZE_RAW;
   st->type = STREAMTYPE_CDDA;
   st->sector_size = CD_FRAMESIZE_RAW;
-#else
-  st->start_pos = priv->start_sector*CDIO_CD_FRAMESIZE_RAW;
-  st->end_pos = priv->end_sector*CDIO_CD_FRAMESIZE_RAW;
-  st->type = STREAMTYPE_CDDA;
-  st->sector_size = CDIO_CD_FRAMESIZE_RAW;
-#endif
 
   st->fill_buffer = fill_buffer;
   st->seek = seek;
@@ -289,22 +287,13 @@
   buf = paranoia_read(p->cdp,cdparanoia_callback);
 
 #ifdef WORDS_BIGENDIAN 
-#ifndef HAVE_LIBCDIO
   for(i=0;i<CD_FRAMESIZE_RAW/2;i++)
-#else
-  for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)
-#endif
           buf[i]=le2me_16(buf[i]);
 #endif
 
   p->sector++;
-#ifndef HAVE_LIBCDIO
   s->pos = p->sector*CD_FRAMESIZE_RAW;
   memcpy(buffer,buf,CD_FRAMESIZE_RAW);
-#else
-  s->pos = p->sector*CDIO_CD_FRAMESIZE_RAW;
-  memcpy(buffer,buf,CDIO_CD_FRAMESIZE_RAW);
-#endif
 
   if((p->sector < p->start_sector) || (p->sector >= p->end_sector)) {
     s->eof = 1;
@@ -325,11 +314,7 @@
   }
 
   
-#ifndef HAVE_LIBCDIO
   return CD_FRAMESIZE_RAW;
-#else
-  return CDIO_CD_FRAMESIZE_RAW;
-#endif
 }
 
 static int seek(stream_t* s,off_t newpos) {
@@ -345,13 +330,8 @@
     return 0;
   }
 
-#ifndef HAVE_LIBCDIO
   sec = s->pos/CD_FRAMESIZE_RAW;
 //printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);
-#else
-  sec = s->pos/CDIO_CD_FRAMESIZE_RAW;
-//printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CDIO_CD_FRAMESIZE_RAW);
-#endif
 //printf("sector: %d  new: %d\n", p->sector, sec );
  
   for(i=0;i<p->cd->tracks;i++){
@@ -382,11 +362,7 @@
 #endif
 
   p->sector = sec;
-#ifndef HAVE_LIBCDIO
 //  s->pos = sec*CD_FRAMESIZE_RAW;
-#else
-//  s->pos = sec*CDIO_CD_FRAMESIZE_RAW;
-#endif
 
 //printf("seek: %d, sec: %d\n", (int)s->pos, sec);
   paranoia_seek(p->cdp,sec,SEEK_SET);