[vlc-devel] [PATCH] dvdnav cannot be trusted to open regular files (fix #4741)
juha.jeronen at jyu.fi
Sun May 8 00:57:22 CEST 2011
On 05/08/2011 01:24 AM, Jean-Baptiste Kempf wrote:
> On Sat, May 07, 2011 at 08:23:54PM +0300, Juha Jeronen wrote :
>> Alternative idea: require the user to open DVD image files as
>> dvd:///path/to/file instead of file:///path/to/file. However, in this
> This doesn't work if you open a .iso file.
True, not from the regular file open dialog.
However, the URI seems to work. It would need another dialog, which is
(I tested by choosing Media > Open Disc, typing in (or pasting) a path
to an ISO file as the disc device, and hitting play. What gets saved in
recent media by doing this is "dvd:///path/to/file.ISO".)
>> (I think the feature of playing DVD images is semi-important for "plays
>> almost anything". Not absolutely critical, but nice to have...)
> Playing .iso of DVDs (and maybe soon BDs) is a quite important feature
> of VLC and VLC is often praised on reviews for this capability.
It also makes filter testing much more convenient, but that's probably
not of major importance for most users ;)
About recognizing DVD ISO files, I did some testing. Judging by a small
sample, they seem to have this in common:
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00008000 01 43 44 30 30 31 01 00 20 20 20 20 20 20 20 20
That is, 32768 (0x8000) bytes of zeroes, and then the sequence 01 43 44
30 30 31 01 00 (i.e. 0x01, "CD001", 0x01, 0x00).
The "CD001" looks like a block identifier. At further offsets, I'm
seeing blocks like "BEA01", "NSR02" and "TEA01" (Earl Grey? Hot?). Each
identifier is exactly 5 ASCII-representable characters, enclosed as 0x01
STRING 0x01 0x00. Some blocks seem to be terminated by 0xFF STRING 0x01
0x00 (with matching string).
For the curious: the DVD LBA length is 2048 (dvdnav.h), so 32768
corresponds to LBA 16. The first 16 logical blocks are blank...
I think that if we want to detect DVD ISO files in ProbeDVD(), we could
check for 0x0000 at the start of the file, and then 0x01 x x x x x 0x01
0x00 at offset 32768 (or LBA 16 to match the style of the existing
code), and if these match, then check for the anchor. It's not perfect,
but it should at least cut down on the amount of false positives.
What about other disc image formats? Do we support them?
More information about the vlc-devel