[arch-commits] Commit in libdvdread/trunk (DVDFileStat.patch PKGBUILD)
Date: Monday, December 5, 2011 @ 07:48:59 Author: jgc Revision: 144376 upgpkg: libdvdread 4.2.0-1 Update to 4.2.0 Modified: libdvdread/trunk/PKGBUILD Deleted: libdvdread/trunk/DVDFileStat.patch ---+ DVDFileStat.patch | 237 PKGBUILD | 21 +--- 2 files changed, 9 insertions(+), 249 deletions(-) Deleted: DVDFileStat.patch === --- DVDFileStat.patch 2011-12-05 12:44:46 UTC (rev 144375) +++ DVDFileStat.patch 2011-12-05 12:48:59 UTC (rev 144376) @@ -1,237 +0,0 @@ -diff -pruN libdvdread-4.1.3/src/dvd_reader.c libdvdread-4.1.3.new/src/dvd_reader.c libdvdread-4.1.3/src/dvd_reader.c 2008-09-06 23:55:51.0 +0200 -+++ libdvdread-4.1.3.new/src/dvd_reader.c 2009-02-28 01:36:20.0 +0100 -@@ -889,6 +889,187 @@ void DVDCloseFile( dvd_file_t *dvd_file - } - } - -+static int DVDFileStatVOBUDF(dvd_reader_t *dvd, int title, -+ int menu, dvd_stat_t *statbuf) -+{ -+ char filename[ MAX_UDF_FILE_NAME_LEN ]; -+ uint32_t size; -+ off_t tot_size; -+ off_t parts_size[9]; -+ int nr_parts = 0; -+ int n; -+ -+ if( title == 0 ) { -+sprintf( filename, /VIDEO_TS/VIDEO_TS.VOB ); -+ } else { -+sprintf( filename, /VIDEO_TS/VTS_%02d_%d.VOB, title, menu ? 0 : 1 ); -+ } -+ if(!UDFFindFile( dvd, filename, size )) { -+return -1; -+ } -+ tot_size = size; -+ nr_parts = 1; -+ parts_size[0] = size; -+ -+ if( !menu ) { -+int cur; -+ -+for( cur = 2; cur 10; cur++ ) { -+ sprintf( filename, /VIDEO_TS/VTS_%02d_%d.VOB, title, cur ); -+ if( !UDFFindFile( dvd, filename, size ) ) { -+break; -+ } -+ parts_size[nr_parts] = size; -+ tot_size += size; -+ nr_parts++; -+} -+ } -+ -+ statbuf-size = tot_size; -+ statbuf-nr_parts = nr_parts; -+ for(n = 0; n nr_parts; n++) { -+statbuf-parts_size[n] = parts_size[n]; -+ } -+ return 0; -+} -+ -+ -+static int DVDFileStatVOBPath( dvd_reader_t *dvd, int title, -+ int menu, dvd_stat_t *statbuf ) -+{ -+ char filename[ MAX_UDF_FILE_NAME_LEN ]; -+ char full_path[ PATH_MAX + 1 ]; -+ struct stat fileinfo; -+ off_t tot_size; -+ off_t parts_size[9]; -+ int nr_parts = 0; -+ int n; -+ -+ -+ -+ if( title == 0 ) { -+sprintf( filename, VIDEO_TS.VOB ); -+ } else { -+sprintf( filename, VTS_%02d_%d.VOB, title, menu ? 0 : 1 ); -+ } -+ if( !findDVDFile( dvd, filename, full_path ) ) { -+return -1; -+ } -+ -+ if( stat( full_path, fileinfo ) 0 ) { -+fprintf( stderr, libdvdread: Can't stat() %s.\n, filename ); -+return -1; -+ } -+ -+ -+ tot_size = fileinfo.st_size; -+ nr_parts = 1; -+ parts_size[0] = fileinfo.st_size; -+ -+ if( !menu ) { -+int cur; -+ -+for( cur = 2; cur 10; cur++ ) { -+ -+ sprintf( filename, VTS_%02d_%d.VOB, title, cur ); -+ if( !findDVDFile( dvd, filename, full_path ) ) { -+break; -+ } -+ -+ if( stat( full_path, fileinfo ) 0 ) { -+fprintf( stderr, libdvdread: Can't stat() %s.\n, filename ); -+break; -+ } -+ -+ parts_size[nr_parts] = fileinfo.st_size; -+ tot_size += parts_size[nr_parts]; -+ nr_parts++; -+} -+ } -+ -+ statbuf-size = tot_size; -+ statbuf-nr_parts = nr_parts; -+ for(n = 0; n nr_parts; n++) { -+statbuf-parts_size[n] = parts_size[n]; -+ } -+ return 0; -+} -+ -+ -+int DVDFileStat(dvd_reader_t *dvd, int titlenum, -+dvd_read_domain_t domain, dvd_stat_t *statbuf) -+{ -+ char filename[ MAX_UDF_FILE_NAME_LEN ]; -+ char full_path[ PATH_MAX + 1 ]; -+ struct stat fileinfo; -+ uint32_t size; -+ -+ /* Check arguments. */ -+ if( dvd == NULL || titlenum 0 ) { -+errno = EINVAL; -+return -1; -+ } -+ -+ switch( domain ) { -+ case DVD_READ_INFO_FILE: -+if( titlenum == 0 ) { -+ sprintf( filename, /VIDEO_TS/VIDEO_TS.IFO ); -+} else { -+ sprintf( filename, /VIDEO_TS/VTS_%02i_0.IFO, titlenum ); -+} -+break; -+ case DVD_READ_INFO_BACKUP_FILE: -+if( titlenum == 0 ) { -+ sprintf( filename, /VIDEO_TS/VIDEO_TS.BUP ); -+} else { -+ sprintf( filename, /VIDEO_TS/VTS_%02i_0.BUP, titlenum ); -+} -+break; -+ case DVD_READ_MENU_VOBS: -+if( dvd-isImageFile ) { -+ return DVDFileStatVOBUDF( dvd, titlenum, 1, statbuf ); -+} else { -+ return DVDFileStatVOBPath( dvd, titlenum, 1, statbuf ); -+} -+break; -+ case DVD_READ_TITLE_VOBS: -+if( titlenum == 0 ) { -+ return -1; -+} -+if( dvd-isImageFile ) { -+ return DVDFileStatVOBUDF( dvd, titlenum, 0, statbuf ); -+} else { -+ return DVDFileStatVOBPath( dvd, titlenum, 0, statbuf ); -+} -+break; -+ default: -+fprintf( stderr, libdvdread: Invalid domain for file stat.\n ); -+errno = EINVAL; -+return -1; -+ } -+ -+ if( dvd-isImageFile ) { -+if(
[arch-commits] Commit in libdvdread/trunk (DVDFileStat.patch PKGBUILD)
Date: Thursday, May 13, 2010 @ 11:59:09 Author: andrea Revision: 80196 upgpkg: libdvdread 4.1.3-2 apply DVDFileStat patch (FS#19324) Added: libdvdread/trunk/DVDFileStat.patch Modified: libdvdread/trunk/PKGBUILD ---+ DVDFileStat.patch | 237 PKGBUILD | 21 +++- 2 files changed, 253 insertions(+), 5 deletions(-) Added: DVDFileStat.patch === --- DVDFileStat.patch (rev 0) +++ DVDFileStat.patch 2010-05-13 15:59:09 UTC (rev 80196) @@ -0,0 +1,237 @@ +diff -pruN libdvdread-4.1.3/src/dvd_reader.c libdvdread-4.1.3.new/src/dvd_reader.c +--- libdvdread-4.1.3/src/dvd_reader.c 2008-09-06 23:55:51.0 +0200 libdvdread-4.1.3.new/src/dvd_reader.c 2009-02-28 01:36:20.0 +0100 +@@ -889,6 +889,187 @@ void DVDCloseFile( dvd_file_t *dvd_file + } + } + ++static int DVDFileStatVOBUDF(dvd_reader_t *dvd, int title, ++ int menu, dvd_stat_t *statbuf) ++{ ++ char filename[ MAX_UDF_FILE_NAME_LEN ]; ++ uint32_t size; ++ off_t tot_size; ++ off_t parts_size[9]; ++ int nr_parts = 0; ++ int n; ++ ++ if( title == 0 ) { ++sprintf( filename, /VIDEO_TS/VIDEO_TS.VOB ); ++ } else { ++sprintf( filename, /VIDEO_TS/VTS_%02d_%d.VOB, title, menu ? 0 : 1 ); ++ } ++ if(!UDFFindFile( dvd, filename, size )) { ++return -1; ++ } ++ tot_size = size; ++ nr_parts = 1; ++ parts_size[0] = size; ++ ++ if( !menu ) { ++int cur; ++ ++for( cur = 2; cur 10; cur++ ) { ++ sprintf( filename, /VIDEO_TS/VTS_%02d_%d.VOB, title, cur ); ++ if( !UDFFindFile( dvd, filename, size ) ) { ++break; ++ } ++ parts_size[nr_parts] = size; ++ tot_size += size; ++ nr_parts++; ++} ++ } ++ ++ statbuf-size = tot_size; ++ statbuf-nr_parts = nr_parts; ++ for(n = 0; n nr_parts; n++) { ++statbuf-parts_size[n] = parts_size[n]; ++ } ++ return 0; ++} ++ ++ ++static int DVDFileStatVOBPath( dvd_reader_t *dvd, int title, ++ int menu, dvd_stat_t *statbuf ) ++{ ++ char filename[ MAX_UDF_FILE_NAME_LEN ]; ++ char full_path[ PATH_MAX + 1 ]; ++ struct stat fileinfo; ++ off_t tot_size; ++ off_t parts_size[9]; ++ int nr_parts = 0; ++ int n; ++ ++ ++ ++ if( title == 0 ) { ++sprintf( filename, VIDEO_TS.VOB ); ++ } else { ++sprintf( filename, VTS_%02d_%d.VOB, title, menu ? 0 : 1 ); ++ } ++ if( !findDVDFile( dvd, filename, full_path ) ) { ++return -1; ++ } ++ ++ if( stat( full_path, fileinfo ) 0 ) { ++fprintf( stderr, libdvdread: Can't stat() %s.\n, filename ); ++return -1; ++ } ++ ++ ++ tot_size = fileinfo.st_size; ++ nr_parts = 1; ++ parts_size[0] = fileinfo.st_size; ++ ++ if( !menu ) { ++int cur; ++ ++for( cur = 2; cur 10; cur++ ) { ++ ++ sprintf( filename, VTS_%02d_%d.VOB, title, cur ); ++ if( !findDVDFile( dvd, filename, full_path ) ) { ++break; ++ } ++ ++ if( stat( full_path, fileinfo ) 0 ) { ++fprintf( stderr, libdvdread: Can't stat() %s.\n, filename ); ++break; ++ } ++ ++ parts_size[nr_parts] = fileinfo.st_size; ++ tot_size += parts_size[nr_parts]; ++ nr_parts++; ++} ++ } ++ ++ statbuf-size = tot_size; ++ statbuf-nr_parts = nr_parts; ++ for(n = 0; n nr_parts; n++) { ++statbuf-parts_size[n] = parts_size[n]; ++ } ++ return 0; ++} ++ ++ ++int DVDFileStat(dvd_reader_t *dvd, int titlenum, ++dvd_read_domain_t domain, dvd_stat_t *statbuf) ++{ ++ char filename[ MAX_UDF_FILE_NAME_LEN ]; ++ char full_path[ PATH_MAX + 1 ]; ++ struct stat fileinfo; ++ uint32_t size; ++ ++ /* Check arguments. */ ++ if( dvd == NULL || titlenum 0 ) { ++errno = EINVAL; ++return -1; ++ } ++ ++ switch( domain ) { ++ case DVD_READ_INFO_FILE: ++if( titlenum == 0 ) { ++ sprintf( filename, /VIDEO_TS/VIDEO_TS.IFO ); ++} else { ++ sprintf( filename, /VIDEO_TS/VTS_%02i_0.IFO, titlenum ); ++} ++break; ++ case DVD_READ_INFO_BACKUP_FILE: ++if( titlenum == 0 ) { ++ sprintf( filename, /VIDEO_TS/VIDEO_TS.BUP ); ++} else { ++ sprintf( filename, /VIDEO_TS/VTS_%02i_0.BUP, titlenum ); ++} ++break; ++ case DVD_READ_MENU_VOBS: ++if( dvd-isImageFile ) { ++ return DVDFileStatVOBUDF( dvd, titlenum, 1, statbuf ); ++} else { ++ return DVDFileStatVOBPath( dvd, titlenum, 1, statbuf ); ++} ++break; ++ case DVD_READ_TITLE_VOBS: ++if( titlenum == 0 ) { ++ return -1; ++} ++if( dvd-isImageFile ) { ++ return DVDFileStatVOBUDF( dvd, titlenum, 0, statbuf ); ++} else { ++ return DVDFileStatVOBPath( dvd, titlenum, 0, statbuf ); ++} ++break; ++ default: ++fprintf( stderr, libdvdread: Invalid domain for file stat.\n ); ++errno = EINVAL; ++return -1; ++ } ++ ++ if( dvd-isImageFile ) { ++