GNOME Bugzilla – Bug 148274
Get disc size
Last modified: 2004-12-22 21:47:04 UTC
Attached patch implements cd_drive_get_media_size_from_path and cd_drive_get_media_size using ATIP MMC command. It also adds a read/write MMC function and moves cd-drive to it.
Created attachment 29830 [details] [review] Patch adding size functions and moving read/write speed discovering to MMC instead of cdrecord -prcap Notice that "cdrecord -prcap" is still used in non-linux in get_cd_properties for getting drive_cap. This should be also moved to MMC commands.
CD_MEDIA_SIZE_UNKNOWN should be negative. I'd rather get_disc_size returned the media size in whatever format, so that we can also gather the size in megs rather than convert from atip to minutes then megs.
Created attachment 29834 [details] [review] Updated patch I've put UNKNOWN_SIZE to -1, but I haven't changed the format of retrieved atip information, because that is the only that atip returns: mins, secs, start_frame. Frames should be calculated like (secs + 150 ) * 75, so it doesn't make sense. I've added a macro to convert secs to megs, that it is not 100% accurate (notice that 700 Mg = 80 mins, 650 Mg = 74 mins are not equivalent). cdrecord is also getting disc size from this mins+secs atip field but to check if tracks will fit on current space, it converts secs+mins to frames, and then does some tack size calculation (pregap, etc...) Maybe a cdrecorder_calculate_tracks_size with this code ripped would be insteresting.
Simply add some printf's to print out the size of the current medium, if there's one, and you're OK to commit. Cheers
2004-07-26 Bastien Nocera <hadess@hadess.net> * list_cddrives.c: (list_cdroms): print out the size, and length in minutes/seconds of the media in the drive (Closes: #148274) 2004-07-23 Fernando Herrera <fherrera@onirica.com> * dvd_plus_rw_utils.cpp: MMC functions to get read/write speed and blank disc size * cd-drive.c: (get_cd_properties): (get_device_max_read_speed), (get_device_max_write_speed), (add_linux_cd_recorder), (freebsd_scan), (cdrecord_scan): Use MMC functions to get speeds. (cd_drive_get_media_size_from_path), (cd_drive_get_media_size), * cd-drive.h: New functions to get media size.