#!/bin/env ruby # = rb_cdio # This package create bindings to the library libcdio # # == Version # :include:VERSION # # == Changelog # :include:ChangeLog.txt # # = Module CdIo # The module CdIo defines constants, classes and methods # to retrieve information of Cd devices and images, # using the libcdio library. # # # The name of the constants are the same of libcdio, so theirs values # can change on different OS and versions of the library module CdIo CDIO_DISC_MODE_CD_DA=0 CDIO_DISC_MODE_CD_DATA=1 CDIO_DISC_MODE_CD_MIXED=3 CDIO_DISC_MODE_CD_XA=2 CDIO_DISC_MODE_DVD_OTHER=10 CDIO_DISC_MODE_DVD_PR=8 CDIO_DISC_MODE_DVD_PRW=9 CDIO_DISC_MODE_DVD_R=6 CDIO_DISC_MODE_DVD_RAM=5 CDIO_DISC_MODE_DVD_ROM=4 CDIO_DISC_MODE_DVD_RW=7 CDIO_DISC_MODE_ERROR=12 CDIO_DISC_MODE_NO_INFO=11 # Driver for a .bin or .cue file DRIVER_BINCUE=8 DRIVER_CDRDAO=7 # Driver for a device (cd or dvd) DRIVER_DEVICE=10 DRIVER_FREEBSD=2 DRIVER_LINUX=3 DRIVER_NRG=9 DRIVER_OSX=5 DRIVER_SOLARIS=4 DRIVER_UNKNOWN=0 DRIVER_WIN32=6 TRACK_FORMAT_AUDIO=0 TRACK_FORMAT_CDI=1 TRACK_FORMAT_DATA=3 TRACK_FORMAT_ERROR=5 TRACK_FORMAT_PSX=4 TRACK_FORMAT_XA=2 # The number for the leadout track of a cd CDIO_CDROM_LEADOUT_TRACK=170 # Returns all active devices (with a cd or dvd inside) # # CdIo.get_devices #=> ["/dev/cdrom"] def CdIo.devices end # Returns a string for the default device # # CdIo.get_default_device #=> "/dev/cdrom" def CdIo.default_device(cd=nil) end # Returns a hash with the capabilities of the device # # CdIo.get_drive_cap_dev("/dev/cdrom") #=> {"misc"=>{"close_tray"=>true, "mcn"=>false, "media_changed"=>false, "select_disk"=>false, "lock"=>true, "isrc"=>false, "multi_session"=>true, "misc_reset"=>false, "eject"=>true, "select_speed"=>false, "file"=>false}, "read"=>{"dvd-rw"=>false, "audio"=>true, "c2_errs"=>false, "dvd-r"=>false, "cd-da"=>true, "dvd-rom"=>false, "cd-r"=>true, "dvd-ram"=>false, "dvr+r"=>false, "cd+g"=>false, "dvd+rw"=>false, "cd-rw"=>true}, "write"=>{"dvd-rw"=>false, "cd"=>false, "dvd-r"=>false, "burn_proof"=>false, "dvd+r"=>false, "cd-r"=>false, "dvd"=>false, "dvd-ram"=>false, "dvd+rw"=>false, "mount_rainier"=>false, "cd-rw"=>false}} # def CdIo.drive_cap_dev(device) end # Returns the description for the driver id # # CdIo.driver_describe(CdIo::DRIVER_LINUX) #=>"GNU/Linux ioctl and MMC driver" def CdIo.driver_describe(driver) end # Returns the description for the discmode id # # CdIo.discmode_describe(CdIo::CDIO_DISC_MODE_CD_DA) #=> "CD-DA" def CdIo.discmode_describe(driver) end # Returns the description for the track_format id # # CdIo.track_format_describe(CdIo::TRACK_FORMAT_XA) #=> "XA" def CdIo.track_format_describe(track_format) end # Returns the description for the type of a CdIo::Track object # # CdIo.track_type_describe(cd.tracks[1]) #=> "audio" def CdIo.track_type_describe(track) end # Create a CdIo::Cd object. # # * With no device, use the default device # * With no driver, use CdIo::DRIVER_UNKNOWN # If you provide a block, the argument will be a CdIo::Cd object # it will be freed at the end of the block. # # CdIo.open("/dev/cdrom") #=> # # CdIo.open() {|cd| p cd} #=> # def CdIo.open(device=nil,driver=nil,&block) end class Cd attr_reader :device, :mcn, :driver_name, :driver_id, :first_track_num, :disc_mode, :num_tracks, :stat_size, :cddb_id # # Create a new Cd::CdIo object. # The first argument is an String for a device or a cue/bin/toc/nrg file # The seconf argument is the constant for a Driver (default CdIo::DRIVER_UNKNOWN) # * CdIo::Cd.new() # * CdIo::Cd.new("/dev/cdrom") # * CdIo::Cd.new("/dev/cdrom", CdIo::DRIVER_UNKNOWN) # def initialize(device,driver) end # Returns a hash with cdtext data for the cd, nil if doesn't exists # # cd.cdtext # =>cdtext information def cdtext(track) end # Returns an array of CdIo::Track for the cd # # cd.tracks #=>[#] def tracks end # Returns true if CdIo::Cd is a cd, else otherwise def is_cd? end # Returns true if CdIo::Cd is a dvd, else otherwise def is_dvd? end # Returns a hash with the capabilities of the device. # See CdIo.drive_cap_dev def drive_cap end # Return a hash with information for the hardware # # cd.hwinfo #=>{"revision"=>"1.00", "vendor"=>"HL-DT-ST", "model"=>"CD-ROM GCR-8520B"} def hwinfo end # Closes the device. # Actually, do nothing :P def close end end # Provides access to the tracks of a CdIo::Cd object class Tracks # Returns a CdIo::Tracks object por a given CdIo::Cd include Enumerable def initialize(cd) end # Iterates through the tracks # # tracks.each {|track| p track} def each(&block) end # Returns a track by the index. # You can use CdIo::CDIO_CDROM_LEADOUT_TRACK to get the # leadout track # # tracks[CdIo::CDIO_CDROM_LEADOUT_TRACK] => #, @lba=312022> def [](index) end end # Representation of a track for a CdIo::Cd object class Track attr_reader :cd, :number, :format, :lba,:lsn,:min,:sec,:frames,:sec_count, :leadout # Returns a track for a given CdIo::Cd object and a number track. # # Use CdIo::Cd.tracks instead # def initialize(cd,track) end # Returns true if track is a green track type (mode 2) def green? end # Returns a hash with the cdtext data, or nil if doesn't exists. def cdtext end end # Representation of a Iso 9660 Track for a CdIo::Cd object. # Have some extra attributes, like system_id, volume_id.... class TrackIso9660 < Track attr_reader :system_id, :volume_id, :volumeset_id, :preparer_id, :publisher_id, :application_id end end