Available dvd / blu-ray blank space (IMAPI)

Since my initial question was too vague, let me clarify.

My goals:

  • to estimate the size of a blank disk after selecting a file system via IMAPI
  • to estimate the space that my file will consume on this disk if I burn it.

What I would like to know:

  • Is it possible to programmatically obtain bytes for the sector for the selected file system.
  • If not, is there a default value for bytes for each sector that IMAPI uses for different file systems / media types and is documented somewhere.
+8
c # imapi
source share
3 answers

So, a short answer to my question: we can safely assume that the sector size for DVD / BD is 2048 bytes.

The reason I got different sizes during debugging sessions was due to an error in the code that counted sectors :)

The mentioned block of code was copied from http://www.codeproject.com/Articles/24544/Burning-and-Erasing-CD-DVD-Blu-ray-Media-with-C-an , so in case you post a quick correction.

source:

discFormatData = new MsftDiscFormat2Data(); discFormatData.Recorder = discRecorder; IMAPI_MEDIA_PHYSICAL_TYPE mediaType = discFormatData.CurrentPhysicalMediaType; fileSystemImage = new MsftFileSystemImage(); fileSystemImage.ChooseImageDefaultsForMediaType(mediaType); if (!discFormatData.MediaHeuristicallyBlank) { fileSystemImage.MultisessionInterfaces = discFormatData.MultisessionInterfaces; fileSystemImage.ImportFileSystem(); } Int64 freeMediaBlocks = fileSystemImage.FreeMediaBlocks; 

fixed code:

 discFormatData = new MsftDiscFormat2Data { Recorder = discRecorder }; fileSystemImage = new MsftFileSystemImage(); fileSystemImage.ChooseImageDefaults(discRecorder); if (!discFormatData.MediaHeuristicallyBlank) { fileSystemImage.MultisessionInterfaces = discFormatData.MultisessionInterfaces; fileSystemImage.ImportFileSystem(); } Int64 freeMediaBlocks = fileSystemImage.FreeMediaBlocks; 
+4
source share

If you know the free / used blocks and the total size of the storage volume (ignoring the used / free space), you can calculate the size of each block and then work with the rest.

 block size = total size / (blocks used + blocks free) free space = size per block * blocks free 

I would be surprised if you find that the block size was something other than 1K, although

0
source share

via IMAPI - IWriteEngine2 :: get_BytesPerSector

http://msdn.microsoft.com/en-us/library/windows/desktop/aa832661(v=vs.85).aspx

This project uses the IMAPI2 managed wrapper to make life easier - http://www.codeproject.com/Articles/24544/Burning-and-Erasing-CD-DVD-Blu-ray-Media-with-C-an

0
source share

All Articles