Mikhail Chichaykin


I'd like to check how many files will be placed on media. So how to transalte value returned by IFileSystemImage:Stick out tongueut_FreeMediaBlocks - Number of blocks to bytes

How to translate returned value from IDiscFormat2Data::get_CurrentWriteSpeed - sectors per second to byte per second or interpret it like speed 2x, 4x, 8x, 16x




Re: Optical Platform Discussion IMAPI measuring questions

David Burg - MSFT

One block is 2kb. I wonder however if there is a confusion on the purpose of put_FreeMediaBlocks. Its purpose is to give the file system interface an upper limit to the quantity of data it can place on the disc. It is not a count of number of files in the image.

I will check with another team member regarding the translation from Kbps to optical device fuzzy 'X' speeds.




Re: Optical Platform Discussion IMAPI measuring questions

Mikhail Chichaykin

David, I undestand that. I did mean that I intended to check available free storage space calling get_FreeMediaBlocks everytime before adding a file to it.





Re: Optical Platform Discussion IMAPI measuring questions

Garrett - MSFT

Hello Mikhail!

Unfortunately, there is not a direct way to ask how many blocks are left on the media. The way putting files into the image was designed to work is as follows:

1. call put_FreeMediaBlocks to put the maximum size of the resulting image (typically the amount of space left on the disc)

2. add files until you recieve IMAPI_E_IMAGE_SIZE_LIMIT, which indicates adding that file would put you beyond the file system limit size

We have simplified this process by adding a function which helps set the put_FreeMediaBlocks value based on a media type or the media in an IDiscRecorder2 object. You can see IFileSystemImage::ChooseImageDefaults and IFileSystemImage::ChooseImageDefaultsForMediaType...

As for your second question, the best way currently to translate get_CurrentWriteSpeed's sectors per second value to an x-speed is using the two constants we've defined for this purpose: IMAPI_SECTORS_PER_SECOND_AT_1X_CD, IMAPI_SECTORS_PER_SECOND_AT_1X_DVD. Simply divide the number you get from get_CurrentWriteSpeed by the appropriate constant and you will get the approximate x-speed. You may need to check it and round it appropriately, but be careful as simple integer division will sometimes produce incorrect x-speeds!

Please let me know if you have any more questions!

thanks,

Garrett Jacobson

SDE, Optical Platform Group