./ext/CdIo.h in rb_cdio-0.1.1 vs ./ext/CdIo.h in rb_cdio-0.2.0

- old
+ new

@@ -19,33 +19,83 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <string.h> #include <cdio/iso9660.h> #include <cdio/cdtext.h> +#include <cdio/audio.h> #include <cdio/cd_types.h> +#include <cdio/mmc.h> #include <ruby.h> +// if we got cddb, include the library +#ifdef HAVE_CDDB_CDDB_H + #ifndef HAVE_CDDB + #define HAVE_CDDB 1 + #endif + #include <cddb/cddb.h> +#endif + +/** Test **/ + +#if LIBCDIO_VERSION_NUM < 73 + #error rb_cdio 0.2.0 needs libcdio>=0.73 +#endif + + +/** End tests **/ + #define GET_CDIO(self,p) \ CdIo* p; \ Data_Get_Struct(self, CdIo, p); \ if(NULL==p) {rb_raise(rb_eException,"No pointer to CdIo");} +#define GET_TRACK(obj,p,t) \ +CdIo* p; \ +track_t t; \ +Data_Get_Struct(rb_iv_get(obj, "@cd"), CdIo, p); \ +if(NULL==p) {rb_raise(rb_eException,"No pointer to CdIo");} \ +t=FIX2INT(rb_iv_get(obj,"@number")); +#define HASH_STR(hash,str1,str2) \ +rb_hash_aset(hash,rb_str_new2(str1),rb_str_new2(str2)); + #undef CDIO_DRIVE_CAP_WRITE_DVD #define CDIO_DRIVE_CAP_WRITE_DVD ( \ CDIO_DRIVE_CAP_WRITE_DVD_R \ | CDIO_DRIVE_CAP_WRITE_DVD_PR \ | CDIO_DRIVE_CAP_WRITE_DVD_RAM \ | CDIO_DRIVE_CAP_WRITE_DVD_RW \ | CDIO_DRIVE_CAP_WRITE_DVD_RPW \ ) +// module CdIo VALUE mCdIo; +// class CdIo::Cd VALUE cCdIoCd; +// module CdIo::CdDa +VALUE mCdIoCdda; +// class CdIo::Track VALUE cCdIoTrack; +// class CdIo::TrackIso9660 VALUE cCdIoTrackIso9660; +VALUE cCdIoTrackCdda; +// class CdIo::Tracks VALUE cCdIoTracks; +// module CdIo::Exception +VALUE mCdIoException; +// Exceptions +VALUE eCdIoError; +VALUE eCdIoUnsupported; +VALUE eCdIoUnitit; +VALUE eCdIoNotPermitted; +VALUE eCdIoBadParameter; +VALUE eCdIoBadPointer; +VALUE eCdIoNoDriver; +VALUE eCdIoCddbError; +VALUE eCdIoCddbConn; + + int Init_CdIo(); // Metodos para el módulo CdIo VALUE rb_cdio_open(int argc, VALUE * argv, VALUE module); VALUE rb_cdio_get_devices(int argc, VALUE * argv, VALUE module); // ok @@ -68,12 +118,12 @@ VALUE rb_cdio_is_binfile(VALUE module, VALUE name); VALUE rb_cdio_is_cuefile(VALUE module, VALUE name); VALUE rb_cdio_is_nrg(VALUE module, VALUE name); VALUE rb_cdio_is_tocfile(VALUE module, VALUE name); VALUE rb_cdio_is_device(int argc, VALUE * argv, VALUE module); +VALUE rb_cdio_close_tray(VALUE module, VALUE name); - /* * Métodos para clase CdIo::Cd */ VALUE rb_cdio_cd_new(int argc, VALUE * argv, VALUE class); // ok VALUE rb_cdio_cd_init(VALUE class, VALUE device, VALUE driver); // ok @@ -85,11 +135,32 @@ VALUE rb_cdio_cd_is_dvd(VALUE obj); VALUE rb_cdio_cd_get_freedb(VALUE obj); VALUE rb_cdio_cd_get_drive_cap(VALUE obj); VALUE rb_cdio_cd_get_hwinfo(VALUE obj); VALUE rb_cdio_cd_close(VALUE obj); +VALUE rb_cdio_cd_eject(VALUE obj); VALUE rb_cdio_cd_get_cdtext(VALUE obj); +// module functions CdDa +VALUE rb_cdio_cdda_get_volume(VALUE obj); +VALUE rb_cdio_cdda_set_volume(VALUE obj,VALUE vol); +VALUE rb_cdio_cdda_play(int argc,VALUE* argv,VALUE obj); +VALUE rb_cdio_cdda_pause(VALUE obj); +VALUE rb_cdio_cdda_resume(VALUE obj); +VALUE rb_cdio_cdda_stop(VALUE obj); +VALUE rb_cdio_cdda_subchannel(VALUE obj); +VALUE rb_cdio_cdda_cddb_id(VALUE obj); +VALUE rb_cdio_cdda_cddb(VALUE obj); +VALUE rb_cdio_cdda_cddb_matches(VALUE obj); +VALUE rb_cdio_cdda_cddb_fetch(VALUE obj,VALUE match); + +VALUE rb_cdio_cdda_category(VALUE obj); +VALUE rb_cdio_cdda_title(VALUE obj); +VALUE rb_cdio_cdda_artist(VALUE obj); +VALUE rb_cdio_cdda_year(VALUE obj); +VALUE rb_cdio_cdda_genre(VALUE obj); +VALUE rb_cdio_cdda_length(VALUE obj); +VALUE rb_cdio_cdda_extra_data(VALUE obj); /** * Métodos para la clase CdIo::Tracks */ VALUE rb_cdio_tracks_init(VALUE obj, VALUE cd); @@ -105,9 +176,11 @@ VALUE rb_cdio_track_get_cdtext(VALUE obj); /* TrackIso9660*/ VALUE rb_cdio_trackiso9660_init(VALUE obj, VALUE oCd, VALUE i_track); +/* TrackCdda */ +VALUE rb_cdio_trackcdda_play(VALUE obj); /* * Métodos comunes */ VALUE get_cap(cdio_drive_read_cap_t * read_cap, cdio_drive_write_cap_t * write_cap,