Commit c820067e authored by Steve Dibb's avatar Steve Dibb Committed by Jean-Baptiste Kempf

Fix DVDDiscID from reading non-existent IFO files

In dvd_reader.c, the DVDDiscID function gets the MD5 from the total contents
of the IFO files on the disc.  However, it gets it by looping through the
the first ten IFO files, whether they exist or not.

This results in spewage, where a disc has less than ten.  In this case,
Dragonheart only has two:

libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VTS_03_0.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VTS_04_0.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VTS_05_0.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VTS_06_0.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VTS_07_0.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VTS_08_0.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VTS_09_0.IFO failed

Instead of using a set limit of 10 IFOs, this patch counts the number of
VTSes existing on the DVD, and will use that number instead if it is less
than 10.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent a2f211a6
......@@ -73,6 +73,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz )
#include "dvd_input.h"
#include "dvdread_internal.h"
#include "md5.h"
#include "dvdread/ifo_read.h"
#define DEFAULT_UDF_CACHE_LEVEL 1
......@@ -1358,16 +1359,31 @@ int DVDDiscID( dvd_reader_t *dvd, unsigned char *discid )
{
struct md5_ctx ctx;
int title;
int title_sets;
int nr_of_files = 0;
ifo_handle_t *vmg_ifo;
/* Check arguments. */
if( dvd == NULL || discid == NULL )
return 0;
/* Go through the first 10 IFO:s, in order,
vmg_ifo = ifoOpen( dvd, 0 );
if( !vmg_ifo ) {
fprintf( stderr, "libdvdread: DVDDiscId, failed to "
"open VMG IFO!\n" );
return -1;
}
title_sets = vmg_ifo->vmgi_mat->vmg_nr_of_title_sets + 1;
ifoClose( vmg_ifo );
if( title_sets > 10 )
title_sets = 10;
/* Go through the first IFO:s, in order, up until the tenth,
* and md5sum them, i.e VIDEO_TS.IFO and VTS_0?_0.IFO */
md5_init_ctx( &ctx );
for( title = 0; title < 10; title++ ) {
for( title = 0; title < title_sets; title++ ) {
dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE );
if( dvd_file != NULL ) {
ssize_t bytes_read;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment