|
Lines 42-47
Link Here
|
| 42 |
#include "dvd_reader.h" |
42 |
#include "dvd_reader.h" |
| 43 |
#include "dvd_udf.h" |
43 |
#include "dvd_udf.h" |
| 44 |
|
44 |
|
|
|
45 |
/* libdvdread_udf.patch start */ |
| 46 |
#include "ifo_types.h" |
| 47 |
#include "ifo_read.h" |
| 48 |
#include <fnmatch.h> |
| 49 |
/* libdvdread_udf.patch end */ |
| 50 |
|
| 45 |
/* Private but located in/shared with dvd_reader.c */ |
51 |
/* Private but located in/shared with dvd_reader.c */ |
| 46 |
extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number, |
52 |
extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number, |
| 47 |
size_t block_count, unsigned char *data, |
53 |
size_t block_count, unsigned char *data, |
|
Lines 777-782
Link Here
|
| 777 |
uint32_t UDFFindFile( dvd_reader_t *device, char *filename, |
783 |
uint32_t UDFFindFile( dvd_reader_t *device, char *filename, |
| 778 |
uint32_t *filesize ) |
784 |
uint32_t *filesize ) |
| 779 |
{ |
785 |
{ |
|
|
786 |
/* libdvdread_udf.patch start */ |
| 787 |
uint32_t offset=0; |
| 788 |
#ifndef __WIN32__ |
| 789 |
if (!fnmatch("/VIDEO_TS/VTS_[0-9][0-9]_[0-9].???", filename, FNM_PATHNAME)) { |
| 790 |
#else |
| 791 |
if (strlen("/VIDEO_TS/VTS_01_1.VOB") == strlen(filename) |
| 792 |
&& !strncmp(filename, "/VIDEO_TS/VTS_", strlen("/VIDEO_TS/VTS_")) ) { |
| 793 |
#endif |
| 794 |
size_t len = strlen(filename); |
| 795 |
char *extension = &filename[len-3]; |
| 796 |
if (!strcmp(extension, "IFO") || !strcmp(extension, "VOB")) { |
| 797 |
int title = atoi(&filename[len-8]); |
| 798 |
int part = atoi(&filename[len-5]); |
| 799 |
|
| 800 |
ifo_handle_t *ifo_handle = ifoOpen(device, 0); |
| 801 |
if (0 == ifo_handle) |
| 802 |
return 0; |
| 803 |
|
| 804 |
if (title > ifo_handle->tt_srpt->nr_of_srpts) { |
| 805 |
ifoClose(ifo_handle); |
| 806 |
return 0; |
| 807 |
|
| 808 |
} |
| 809 |
|
| 810 |
uint32_t tmp_filesize; |
| 811 |
offset += UDFFindFile(device, "/VIDEO_TS/VIDEO_TS.IFO", &tmp_filesize); |
| 812 |
|
| 813 |
|
| 814 |
int i; |
| 815 |
for (i=0; i<ifo_handle->tt_srpt->nr_of_srpts; i++) |
| 816 |
if (title == ifo_handle->tt_srpt->title[i].title_set_nr) |
| 817 |
break; |
| 818 |
|
| 819 |
if (i == ifo_handle->tt_srpt->nr_of_srpts) { |
| 820 |
/* not found */ |
| 821 |
ifoClose(ifo_handle); |
| 822 |
return 0; |
| 823 |
} |
| 824 |
offset += ifo_handle->tt_srpt->title[i].title_set_sector; |
| 825 |
|
| 826 |
ifoClose(ifo_handle); |
| 827 |
|
| 828 |
if (!strcmp(extension, "VOB")) { |
| 829 |
ifo_handle = ifoOpen(device, title); |
| 830 |
if (0 == ifo_handle) |
| 831 |
return 0; |
| 832 |
|
| 833 |
switch(part) { |
| 834 |
case 0: |
| 835 |
if (0 == ifo_handle->vtsi_mat->vtsm_vobs) |
| 836 |
return 0; |
| 837 |
offset += ifo_handle->vtsi_mat->vtsm_vobs; |
| 838 |
break; |
| 839 |
case 1: |
| 840 |
if (0 == ifo_handle->vtsi_mat->vtstt_vobs) |
| 841 |
return 0; |
| 842 |
offset += ifo_handle->vtsi_mat->vtstt_vobs; |
| 843 |
break; |
| 844 |
default: /* can't get other parts (also no need to) */ |
| 845 |
offset = 0; |
| 846 |
break; |
| 847 |
} |
| 848 |
|
| 849 |
ifoClose(ifo_handle); |
| 850 |
} |
| 851 |
|
| 852 |
} |
| 853 |
|
| 854 |
*filesize = 1000000; /* File size unknown */ |
| 855 |
if (offset != 0) |
| 856 |
return offset; |
| 857 |
} |
| 858 |
/* libdvdread_udf.patch end */ |
| 859 |
|
| 780 |
uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ]; |
860 |
uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ]; |
| 781 |
uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048); |
861 |
uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048); |
| 782 |
uint32_t lbnum; |
862 |
uint32_t lbnum; |