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