1 *** dvd_reader.c 2008-09-06 16:55:51.000000000 -0500
2 --- dvd_reader.c 2009-09-09 11:48:38.708607415 -0500
9 + static int DVDFileStatVOBUDF(dvd_reader_t *dvd, int title,
10 + int menu, dvd_stat_t *statbuf)
12 + char filename[ MAX_UDF_FILE_NAME_LEN ];
15 + off_t parts_size[9];
20 + sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
22 + sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
24 + if(!UDFFindFile( dvd, filename, &size )) {
29 + parts_size[0] = size;
34 + for( cur = 2; cur < 10; cur++ ) {
35 + sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, cur );
36 + if( !UDFFindFile( dvd, filename, &size ) ) {
39 + parts_size[nr_parts] = size;
45 + statbuf->size = tot_size;
46 + statbuf->nr_parts = nr_parts;
47 + for(n = 0; n < nr_parts; n++) {
48 + statbuf->parts_size[n] = parts_size[n];
54 + static int DVDFileStatVOBPath( dvd_reader_t *dvd, int title,
55 + int menu, dvd_stat_t *statbuf )
57 + char filename[ MAX_UDF_FILE_NAME_LEN ];
58 + char full_path[ PATH_MAX + 1 ];
59 + struct stat fileinfo;
61 + off_t parts_size[9];
68 + sprintf( filename, "VIDEO_TS.VOB" );
70 + sprintf( filename, "VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
72 + if( !findDVDFile( dvd, filename, full_path ) ) {
76 + if( stat( full_path, &fileinfo ) < 0 ) {
77 + fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
82 + tot_size = fileinfo.st_size;
84 + parts_size[0] = fileinfo.st_size;
89 + for( cur = 2; cur < 10; cur++ ) {
91 + sprintf( filename, "VTS_%02d_%d.VOB", title, cur );
92 + if( !findDVDFile( dvd, filename, full_path ) ) {
96 + if( stat( full_path, &fileinfo ) < 0 ) {
97 + fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
101 + parts_size[nr_parts] = fileinfo.st_size;
102 + tot_size += parts_size[nr_parts];
107 + statbuf->size = tot_size;
108 + statbuf->nr_parts = nr_parts;
109 + for(n = 0; n < nr_parts; n++) {
110 + statbuf->parts_size[n] = parts_size[n];
116 + int DVDFileStat(dvd_reader_t *dvd, int titlenum,
117 + dvd_read_domain_t domain, dvd_stat_t *statbuf)
119 + char filename[ MAX_UDF_FILE_NAME_LEN ];
120 + char full_path[ PATH_MAX + 1 ];
121 + struct stat fileinfo;
124 + /* Check arguments. */
125 + if( dvd == NULL || titlenum < 0 ) {
131 + case DVD_READ_INFO_FILE:
132 + if( titlenum == 0 ) {
133 + sprintf( filename, "/VIDEO_TS/VIDEO_TS.IFO" );
135 + sprintf( filename, "/VIDEO_TS/VTS_%02i_0.IFO", titlenum );
138 + case DVD_READ_INFO_BACKUP_FILE:
139 + if( titlenum == 0 ) {
140 + sprintf( filename, "/VIDEO_TS/VIDEO_TS.BUP" );
142 + sprintf( filename, "/VIDEO_TS/VTS_%02i_0.BUP", titlenum );
145 + case DVD_READ_MENU_VOBS:
146 + if( dvd->isImageFile ) {
147 + return DVDFileStatVOBUDF( dvd, titlenum, 1, statbuf );
149 + return DVDFileStatVOBPath( dvd, titlenum, 1, statbuf );
152 + case DVD_READ_TITLE_VOBS:
153 + if( titlenum == 0 ) {
156 + if( dvd->isImageFile ) {
157 + return DVDFileStatVOBUDF( dvd, titlenum, 0, statbuf );
159 + return DVDFileStatVOBPath( dvd, titlenum, 0, statbuf );
163 + fprintf( stderr, "libdvdread: Invalid domain for file stat.\n" );
168 + if( dvd->isImageFile ) {
169 + if( UDFFindFile( dvd, filename, &size ) ) {
170 + statbuf->size = size;
171 + statbuf->nr_parts = 1;
172 + statbuf->parts_size[0] = size;
176 + if( findDVDFile( dvd, filename, full_path ) ) {
177 + if( stat( full_path, &fileinfo ) < 0 ) {
178 + fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
180 + statbuf->size = fileinfo.st_size;
181 + statbuf->nr_parts = 1;
182 + statbuf->parts_size[0] = statbuf->size;
192 /* Internal, but used from dvd_udf.c */
193 int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
194 size_t block_count, unsigned char *data,