Permalink
Browse files

Revise CD-Text to handle Leon Merten Lohse's new CD-Text interface.

This patch is from Leon.
  • Loading branch information...
1 parent 871f6c3 commit 028c33bd113c33cc4601189e4d57eeff43bf8a66 R. Bernstein committed Apr 13, 2012
Showing with 19 additions and 13 deletions.
  1. +16 −8 swig/disc.swg
  2. +1 −4 swig/perlcdio.swg
  3. +2 −1 swig/types.swg
View
@@ -96,29 +96,37 @@ SV * get_cdtext (CdIo_t *p_cdio, int track);
%inline %{
SV * get_cdtext (CdIo_t *p_cdio, int track)
{
-#if LIBCDIO_VERSION_NUM <= 83
HV * cdtext_hash;
- char **cdtext; const char *str; int num; unsigned int l=0;
- cdtext = ( char **)cdio_get_cdtext (p_cdio, (track_t) track);
+ cdtext_t *cdtext; const char *str; int num; unsigned int l=0;
+#if LIBCDIO_VERSION_NUM <= 83
+ cdtext = cdio_get_cdtext (p_cdio, (track_t) track);
+#else
+ cdtext = cdio_get_cdtext (p_cdio);
+#endif
if(!cdtext)
return newSV(0); //we return undef if there is no cdtext on the disk
cdtext_hash = newHV();
for (num=0; num<MAX_CDTEXT_FIELDS; num++) {
- if(cdtext[num]) {
+#if LIBCDIO_VERSION_NUM <= 83
+ if(cdtext_get_const(num,cdtext)) {
+#else
+ if(cdtext_get_const(cdtext,num,track)) {
+#endif
l++;
str = cdtext_field2str(num);
hv_store(cdtext_hash, str, strlen(str),
- newSVpv(cdtext[num], 0), 0);
+#if LIBCDIO_VERSION_NUM <= 83
+ newSVpv(cdtext_get_const(num,cdtext), 0), 0);
+#else
+ newSVpv(cdtext_get_const(cdtext,num,track), 0), 0);
+#endif
}
}
if(!l) {
SvREFCNT_dec((SV*)cdtext_hash);
return newSV(0);
} // we could easily return the number of strings, too.
return newRV_noinc(sv_2mortal((SV*)cdtext_hash));
-#else
- return newSV(0);
-#endif
}
%}
View
@@ -17,9 +17,6 @@ use this library."
#include <cdio/iso9660.h>
%}
-#include <cdio/cdio.h>
-#include <cdio/audio.h>
-
%include "typemaps.i"
/*%include "cstring.i"*/
@@ -67,7 +64,7 @@ is currently using.");
%inline %{
const char * cdio_version()
{
- return cdio_version_string;
+ return CDIO_VERSION;
}
%}
View
@@ -23,6 +23,8 @@
SWIG to understand say that a lsn_t is an int.
*/
+%include "inttypes.i"
+
#ifdef NEED_LONG
#define LONG long
#else
@@ -37,7 +39,6 @@
typedef long int my_ssize_t;
typedef unsigned int driver_id_t;
typedef int lsn_t;
-typedef int int16_t;
typedef int lba_t;
typedef unsigned int track_t;
typedef long int driver_return_code_t;

0 comments on commit 028c33b

Please sign in to comment.