Lines 39-44
Link Here
|
39 |
#include <sys/stat.h> |
39 |
#include <sys/stat.h> |
40 |
#include <unistd.h> |
40 |
#include <unistd.h> |
41 |
#include <errno.h> |
41 |
#include <errno.h> |
|
|
42 |
#include <fnmatch.h> |
42 |
|
43 |
|
43 |
#if defined(HAVE_INTTYPES_H) |
44 |
#if defined(HAVE_INTTYPES_H) |
44 |
#include <inttypes.h> |
45 |
#include <inttypes.h> |
Lines 50-55
Link Here
|
50 |
#include "dvd_udf.h" |
51 |
#include "dvd_udf.h" |
51 |
#include "dvdread_internal.h" |
52 |
#include "dvdread_internal.h" |
52 |
|
53 |
|
|
|
54 |
#include "ifo_types.h" |
55 |
#include "ifo_read.h" |
56 |
|
53 |
#ifndef EMEDIUMTYPE |
57 |
#ifndef EMEDIUMTYPE |
54 |
#define EMEDIUMTYPE ENOENT |
58 |
#define EMEDIUMTYPE ENOENT |
55 |
#endif |
59 |
#endif |
Lines 965-970
Link Here
|
965 |
uint32_t UDFFindFile( dvd_reader_t *device, char *filename, |
969 |
uint32_t UDFFindFile( dvd_reader_t *device, char *filename, |
966 |
uint32_t *filesize ) |
970 |
uint32_t *filesize ) |
967 |
{ |
971 |
{ |
|
|
972 |
uint32_t offset=0; |
973 |
if (!fnmatch("/VIDEO_TS/VTS_[0-9][0-9]_[0-9].???", filename, FNM_PATHNAME)) { |
974 |
size_t len = strlen(filename); |
975 |
char *extension = &filename[len-3]; |
976 |
if (!strcmp(extension, "IFO") || !strcmp(extension, "VOB")) { |
977 |
int title = atoi(&filename[len-8]); |
978 |
int part = atoi(&filename[len-5]); |
979 |
|
980 |
ifo_handle_t *ifo_handle = ifoOpen(device, 0); |
981 |
if (0 == ifo_handle) |
982 |
return 0; |
983 |
|
984 |
if (title > ifo_handle->tt_srpt->nr_of_srpts) { |
985 |
ifoClose(ifo_handle); |
986 |
return 0; |
987 |
|
988 |
} |
989 |
|
990 |
uint32_t tmp_filesize; |
991 |
offset += UDFFindFile(device, "/VIDEO_TS/VIDEO_TS.IFO", &tmp_filesize); |
992 |
|
993 |
int i; |
994 |
for (i=0; i<ifo_handle->tt_srpt->nr_of_srpts; i++) |
995 |
if (title == ifo_handle->tt_srpt->title[i].title_set_nr) |
996 |
break; |
997 |
|
998 |
if (i == ifo_handle->tt_srpt->nr_of_srpts) { |
999 |
/* not found */ |
1000 |
ifoClose(ifo_handle); |
1001 |
return 0; |
1002 |
} |
1003 |
offset += ifo_handle->tt_srpt->title[i].title_set_sector; |
1004 |
|
1005 |
ifoClose(ifo_handle); |
1006 |
|
1007 |
if (!strcmp(extension, "VOB")) { |
1008 |
ifo_handle = ifoOpen(device, title); |
1009 |
if (0 == ifo_handle) |
1010 |
return 0; |
1011 |
|
1012 |
switch(part) { |
1013 |
case 0: |
1014 |
if (0 == ifo_handle->vtsi_mat->vtsm_vobs) |
1015 |
return 0; |
1016 |
offset += ifo_handle->vtsi_mat->vtsm_vobs; |
1017 |
break; |
1018 |
case 1: |
1019 |
if (0 == ifo_handle->vtsi_mat->vtstt_vobs) |
1020 |
return 0; |
1021 |
offset += ifo_handle->vtsi_mat->vtstt_vobs; |
1022 |
break; |
1023 |
default: /* can't get other parts (also no need to) */ |
1024 |
offset = 0; |
1025 |
break; |
1026 |
} |
1027 |
ifoClose(ifo_handle); |
1028 |
} |
1029 |
} |
1030 |
|
1031 |
*filesize = 1000000; /* File size unknown */ |
1032 |
if (offset != 0) |
1033 |
return offset; |
1034 |
} |
1035 |
|
1036 |
|
968 |
uint8_t *LogBlock; |
1037 |
uint8_t *LogBlock; |
969 |
uint32_t lbnum; |
1038 |
uint32_t lbnum; |
970 |
uint16_t TagID; |
1039 |
uint16_t TagID; |