As I previously mentioned, files take up more space than their file size.
+----+----+----+----+----+ | |XXXX|XXXX|XX**| | +----+----+----+----+----+ | | = Disk block XX = File ** = Wasted space
You need to round up file sizes to the next multiple of a block size.
use POSIX qw( ceil ); $filesize = ceil($filesize / BLOCK_SIZE) * BLOCK_SIZE;
Directories also take up space, but I have no idea how much. Unless you plan on having lots of directories, the simplest solution might be to lower DVD_CAP by a bit. I have no idea what's reasonable, but 64k is probably not a bad start.
# Space for directories. No idea what's reasonable. use constant DIR_BUF => 64*1024; use constant DVD_CAP => 4707319808 - DIR_BUF;
In reply to Re: BinPack Algorithm Use To Pack Files In a DVD
by ikegami
in thread BinPack Algorithm Use To Pack Files In a DVD
by mgrangeiro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |