[libdvdnav-devel] Fix DVDDiscID from reading non-existent IFO files
Steve Dibb
git at videolan.org
Tue Feb 18 16:40:37 CET 2014
libdvdread | branch: master | Steve Dibb <steve.dibb at gmail.com> | Mon Feb 17 00:14:04 2014 +0000| [c820067e14e097fb6a4fee0929bea2937d7cb473] | committer: 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 <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=c820067e14e097fb6a4fee0929bea2937d7cb473
---
src/dvd_reader.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/dvd_reader.c b/src/dvd_reader.c
index 2a231ac..07ac864 100644
--- a/src/dvd_reader.c
+++ b/src/dvd_reader.c
@@ -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;
More information about the libdvdnav-devel
mailing list