I'm a newbie to this Disc Recording stuff, and after having read the below I
changed some of my code but apparently I didn't change it correctly and thus
my "free space" calculations didn't work out. So, I'm seeking clarification.
I tried searching the mailing list archives and the docs (pity those
conceptual docs got put on the backburner), but didn't see an answer to my
> On Nov 15, 2005, at 2:19 PM, Benjámin Salánki wrote:
>> I have a method that checks if there is available free space on a
>> disc to fit my data on it.
>> But if a rewritable disc is inserted into the drive and i choose
>> erase before burn my app still calculates the free space that is
>> available on the yet unerased disc.
>> My question is if i can somehow query if the erase before burn
>> option was selected in the DRBurnSetupPanel, as I have my method
>> check for the size right after the setup panel ended.
>> Or should I check at some other point before the burning starts?
> You should check the (k)DRDeviceMediaBlocksOverwritable instead of
> the free space. For rewritable media, overwritable will be the value
> of free space** after the disc has been erased.
> ** Due to uncontrollable drive lameness, it may be off by +/- a few
I have a method that calculates the free space on a device. I'm using the
C/Carbon DiscRecording API. So I have my DRDeviceRef, I
DRDeviceCopyStatus(), I then get the kDRDeviceMediaInfoKey. Then, I obtain
the kDRDeviceMediaBlocksFreeKey and do my math.
Based on the above message, I changed my code from using the
kDRDeviceMediaBlocksFreeKey to use the kDRDeviceMediaBlocksOverwritableKey.
And that seemed to work out ok when burning to a CD-R the first time. But if
we then tried to append to the same CD-R, it would fail saying there's not
enough disk space (the appends worked fine with
Rereading the above, it sounds like one should only use BlocksOverwritable
if you know the media is rewritable (and then, I assume if the user
specified to erase before burning). So is that the case? That I should check
what type of media it is first, then based on the media type (and perhaps
the options the user set in the burn setup dialog) I determine which key to
Bottom line: just how is one to determine the free space on the burnable
media? What's the procedure, what keys/data are we to check, any special
math considerations (e.g. to deal with that uncontrollable drive lameness