/** * Copyright (c) 2005 Claudio Bustos * This code is hereby licensed for public consumption under the * GNU GPL v2. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "CdIo.h" static bool read_iso9660_pvd(const CdIo * p_cdio, track_format_t track_format, /* out */ iso9660_pvd_t * p_pvd) { switch (track_format) { case TRACK_FORMAT_CDI: case TRACK_FORMAT_XA: if (0 != cdio_read_mode2_sector(p_cdio, p_pvd, ISO_PVD_SECTOR, false)) return false; break; case TRACK_FORMAT_DATA: if (0 != cdio_read_mode1_sector(p_cdio, p_pvd, ISO_PVD_SECTOR, false)) return false; break; case TRACK_FORMAT_AUDIO: case TRACK_FORMAT_PSX: case TRACK_FORMAT_ERROR: default: return false; } return true; } VALUE rb_cdio_trackiso9660_new(VALUE cd, int track) { VALUE argv[2]; argv[0] = cd; argv[1] = INT2FIX(track); return rb_class_new_instance(2, argv, cCdIoTrackIso9660); } VALUE rb_cdio_trackiso9660_init(VALUE obj, VALUE cd, VALUE track) { VALUE argv[2]; argv[0] = cd; argv[1] = track; rb_call_super(2, argv); GET_CDIO(cd, p_cdio); iso9660_pvd_t pvd; track_format_t track_format = cdio_get_track_format(p_cdio, FIX2INT(track)); // ok, empezamos con el chiste! if (read_iso9660_pvd(p_cdio, track_format, &pvd)) { // "system_id", "volume_id", "volumeset_id", // "preparer_id","publisher_id","application_id" rb_iv_set(obj, "@system_id", rb_str_new2(iso9660_get_system_id(&pvd))); rb_iv_set(obj, "@volume_id", rb_str_new2(iso9660_get_volume_id(&pvd))); rb_iv_set(obj, "@volumeset_id", rb_str_new2(iso9660_get_volumeset_id(&pvd))); rb_iv_set(obj, "@preparer_id", rb_str_new2(iso9660_get_preparer_id(&pvd))); rb_iv_set(obj, "@publisher_id", rb_str_new2(iso9660_get_publisher_id(&pvd))); rb_iv_set(obj, "@application_id", rb_str_new2(iso9660_get_application_id(&pvd))); } return obj; }