./ext/CdIo_Cdda.c in rb_cdio-0.2.0 vs ./ext/CdIo_Cdda.c in rb_cdio-0.2.1
- old
+ new
@@ -6,10 +6,11 @@
/**
* CDDB
* Extraido desde cd-info.
**/
+#ifdef HAVE_CDDB
static int
cddb_dec_digit_sum(int n)
{
int ret = 0;
@@ -50,10 +51,11 @@
t = msf_seconds(&msf) - msf_seconds(&start_msf);
return ((n % 0xff) << 24 | t << 8 | i_tracks);
}
+
static cddb_disc_t *
cd_create(int dlength, int tcount, int *foffset, int use_time)
{
int i;
cddb_disc_t *disc;
@@ -209,12 +211,12 @@
if (disc != NULL) {
cddb_disc_destroy(disc);
}
}
+#endif
-
/**
* Audio Functions
*/
@@ -338,14 +340,18 @@
}
VALUE
rb_cdio_cdda_cddb_id(VALUE obj)
{
+#ifdef HAVE_CDDB
char cddb[8];
GET_CDIO(obj, p_cdio);
track_t nt = cdio_get_num_tracks(p_cdio);
sprintf(cddb, "%08lx", cddb_discid(p_cdio, nt));
return rb_str_new2(cddb);
+#else
+ rb_raise(rb_eException, "You need libcddb");
+#endif
}
VALUE