[-]
[+]
|
Changed |
libdvdread.spec
|
|
[-]
[+]
|
Added |
03-udf.patch
^
|
@@ -0,0 +1,77 @@
+diff -Naurp libdvdread-0.9.7.orig/dvdread/dvd_reader.c libdvdread-0.9.7/dvdread/dvd_reader.c
+--- libdvdread-0.9.7.orig/dvdread/dvd_reader.c 2006-10-06 07:58:03.000000000 +0000
++++ libdvdread-0.9.7/dvdread/dvd_reader.c 2008-02-22 19:42:47.000000000 +0000
+@@ -1393,6 +1393,28 @@ int DVDFileSeek( dvd_file_t *dvd_file, i
+ return offset;
+ }
+
++int DVDFileSeekForce( dvd_file_t *dvd_file, int offset, int force_size )
++{
++ /* Check arguments. */
++ if( dvd_file == NULL || offset < 0 )
++ return -1;
++
++ if( dvd_file->dvd->isImageFile ) {
++ if( force_size < 0 )
++ force_size = (offset - 1) / DVD_VIDEO_LB_LEN + 1;
++ if( dvd_file->filesize < force_size ) {
++ dvd_file->filesize = force_size;
++ fprintf(stderr, "libdvdread: Ignored UDF provided size of file.\n");
++ }
++ }
++
++ if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {
++ return -1;
++ }
++ dvd_file->seek_pos = (uint32_t) offset;
++ return offset;
++}
++
+ #ifndef HAVE_UINTPTR_T
+ #warning "Assuming that (unsigned long) can hold (void *)"
+ typedef unsigned long uintptr_t;
+@@ -1444,7 +1466,7 @@ ssize_t DVDReadBytes( dvd_file_t *dvd_fi
+ memcpy( data, &(secbuf[ seek_byte ]), byte_size );
+ free( secbuf_start );
+
+- dvd_file->seek_pos += byte_size;
++ DVDFileSeekForce(dvd_file, dvd_file->seek_pos + byte_size, -1);
+ return byte_size;
+ }
+
+diff -Naurp libdvdread-0.9.7.orig/dvdread/dvd_reader.h libdvdread-0.9.7/dvdread/dvd_reader.h
+--- libdvdread-0.9.7.orig/dvdread/dvd_reader.h 2006-10-06 08:12:31.000000000 +0000
++++ libdvdread-0.9.7/dvdread/dvd_reader.h 2008-02-22 19:42:28.000000000 +0000
+@@ -240,6 +240,8 @@ ssize_t DVDReadBlocks( dvd_file_t *, int
+ */
+ int DVDFileSeek( dvd_file_t *, int );
+
++int DVDFileSeekForce( dvd_file_t *, int, int );
++
+ /**
+ * Reads the given number of bytes from the file. This call can only be used
+ * on the information files, and may not be used for reading from a VOB. This
+diff -Naurp libdvdread-0.9.7.orig/dvdread/ifo_read.c libdvdread-0.9.7/dvdread/ifo_read.c
+--- libdvdread-0.9.7.orig/dvdread/ifo_read.c 2006-01-22 12:19:19.000000000 +0000
++++ libdvdread-0.9.7/dvdread/ifo_read.c 2008-02-22 19:42:28.000000000 +0000
+@@ -106,6 +106,10 @@ static inline int DVDFileSeek_( dvd_file
+ return (DVDFileSeek(dvd_file, (int)offset) == (int)offset);
+ }
+
++static inline int DVDFileSeekForce_( dvd_file_t *dvd_file, uint32_t offset, int force_size ) {
++ return (DVDFileSeekForce(dvd_file, (int)offset, force_size) == (int)offset);
++}
++
+
+ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
+ ifo_handle_t *ifofile;
+@@ -1659,7 +1663,7 @@ static int ifoRead_VOBU_ADMAP_internal(i
+ unsigned int i;
+ int info_length;
+
+- if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN))
++ if(!DVDFileSeekForce_(ifofile->file, sector * DVD_BLOCK_LEN, sector))
+ return 0;
+
+ if(!(DVDReadBytes(ifofile->file, vobu_admap, VOBU_ADMAP_SIZE)))
+
|
[-]
[+]
|
Added |
libdvdread-strict-aliasing.patch
^
|
@@ -0,0 +1,11 @@
+--- dvdread/nav_print.c
++++ dvdread/nav_print.c
+@@ -72,7 +72,7 @@
+ printf("pci_gi:\n");
+ printf("nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn);
+ printf("vobu_cat 0x%04x\n", pci_gi->vobu_cat);
+- printf("vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl);
++ printf("vobu_uop_ctl 0x%08x\n", pci_gi->vobu_uop_ctl);
+ printf("vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm);
+ printf("vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm);
+ printf("vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm);
|
[-]
[+]
|
Changed |
libdvdread_udf.patch
^
|
@@ -1,18 +1,19 @@
-diff -ru libdvdread-0.9.7.orig/dvdread/dvd_input.c libdvdread-0.9.7/dvdread/dvd_input.c
+diff -ur libdvdread-0.9.7.orig/dvdread/dvd_input.c libdvdread-0.9.7/dvdread/dvd_input.c
--- libdvdread-0.9.7.orig/dvdread/dvd_input.c 2005-09-19 15:43:08.000000000 +0200
-+++ libdvdread-0.9.7/dvdread/dvd_input.c 2008-02-21 09:42:01.000000000 +0100
-@@ -376,6 +376,8 @@
++++ libdvdread-0.9.7/dvdread/dvd_input.c 2008-02-02 16:23:24.000000000 +0100
+@@ -376,6 +376,9 @@
}
#endif /* HAVE_DVDCSS_DVDCSS_H */
++
+ fprintf(stderr, "libdvdread patched to play DVDs with DVD-Movie-Protect\n");
+
dvdcss_library_init = 1;
if(dvdcss_library) {
-diff -ru libdvdread-0.9.7.orig/dvdread/dvd_udf.c libdvdread-0.9.7/dvdread/dvd_udf.c
+diff -ur libdvdread-0.9.7.orig/dvdread/dvd_udf.c libdvdread-0.9.7/dvdread/dvd_udf.c
--- libdvdread-0.9.7.orig/dvdread/dvd_udf.c 2005-09-19 15:43:08.000000000 +0200
-+++ libdvdread-0.9.7/dvdread/dvd_udf.c 2008-02-21 09:42:01.000000000 +0100
++++ libdvdread-0.9.7/dvdread/dvd_udf.c 2008-02-03 13:24:40.000000000 +0100
@@ -39,6 +39,9 @@
#include <sys/stat.h>
#include <unistd.h>
@@ -33,96 +34,84 @@
#ifndef EMEDIUMTYPE
#define EMEDIUMTYPE ENOENT
#endif
-@@ -962,7 +968,7 @@
- return part->valid;
- }
-
--uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
-+static uint32_t UDFFindFileReal( dvd_reader_t *device, char *filename,
+@@ -965,6 +971,80 @@
+ uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
uint32_t *filesize )
{
- uint8_t *LogBlock;
-@@ -1065,6 +1071,83 @@
- }
- }
-
-+/**
-+ * Get the offset from the ifo files to allow playback of DVDs
-+ * with a deliberately broken UDF file system (aka DVD-Movie-Protect).
-+ * When the file is not an IFO or VOB, it calls the real UDF routine.
-+ */
-+uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
-+ uint32_t *filesize )
-+{
++ uint32_t offset=0;
++ if( filesize == NULL || *filesize < 1 || *filesize > 1073741824) {
++ // only when filesize is invalid
+#ifndef __WIN32__
-+ if (!fnmatch("/VIDEO_TS/VTS_[0-9][0-9]_[0-9].???", filename, FNM_PATHNAME)) {
++ if (!fnmatch("/VIDEO_TS/VTS_[0-9][0-9]_[0-9].???", filename, FNM_PATHNAME)) {
+#else
-+ if (strlen("/VIDEO_TS/VTS_01_1.VOB") == strlen(filename)
-+ && !strncmp(filename, "/VIDEO_TS/VTS_", strlen("/VIDEO_TS/VTS_")) ) {
++ if (strlen("/VIDEO_TS/VTS_01_1.VOB") == strlen(filename)
++ && !strncmp(filename, "/VIDEO_TS/VTS_", strlen("/VIDEO_TS/VTS_")) ) {
+#endif
-+ size_t len = strlen(filename);
-+ char *extension = &filename[len-3];
-+ if (!strcmp(extension, "IFO") || !strcmp(extension, "VOB")) {
-+ int title = atoi(&filename[len-8]);
-+ int part = atoi(&filename[len-5]);
-+
-+ ifo_handle_t *ifo_handle = ifoOpen(device, 0);
-+ if (0 == ifo_handle)
-+ return 0;
-+
-+ uint32_t tmp_filesize;
-+ uint32_t offset = UDFFindFileReal(device, "/VIDEO_TS/VIDEO_TS.IFO", &tmp_filesize);
-+
-+ int i;
-+ for (i=0; i<ifo_handle->tt_srpt->nr_of_srpts; i++)
-+ if (title == ifo_handle->tt_srpt->title[i].title_set_nr)
-+ break;
-+
-+ if (i == ifo_handle->tt_srpt->nr_of_srpts) {
-+ /* not found */
-+ ifoClose(ifo_handle);
-+ return 0;
-+ }
-+ offset += ifo_handle->tt_srpt->title[i].title_set_sector;
-+ ifoClose(ifo_handle);
-+
-+ if (!strcmp(extension, "VOB")) {
-+ ifo_handle = ifoOpen(device, title);
-+ if (0 == ifo_handle)
-+ return 0;
-+
-+ switch(part) {
-+ case 0:
-+ if (0 == ifo_handle->vtsi_mat->vtsm_vobs) {
-+ ifoClose(ifo_handle);
-+ return 0;
-+ }
-+ offset += ifo_handle->vtsi_mat->vtsm_vobs;
-+ break;
-+ case 1:
-+ if (0 == ifo_handle->vtsi_mat->vtstt_vobs) {
-+ ifoClose(ifo_handle);
-+ return 0;
-+ }
-+ offset += ifo_handle->vtsi_mat->vtstt_vobs;
-+ break;
-+ default: /* can't get other parts (also no need to) */
-+ offset = 0;
-+ break;
-+ }
-+
-+ ifoClose(ifo_handle);
-+ }
-+
-+
-+ *filesize = 1000000; /* File size unknown */
-+ if (offset != 0)
-+ return offset;
-+ }
-+ }
-+
-+ return UDFFindFileReal( device, filename, filesize);
-+}
-
-
- /**
++ size_t len = strlen(filename);
++ char *extension = &filename[len-3];
++ if (!strcmp(extension, "IFO") || !strcmp(extension, "VOB")) {
++ int title = atoi(&filename[len-8]);
++ int part = atoi(&filename[len-5]);
++
++ ifo_handle_t *ifo_handle = ifoOpen(device, 0);
++ if (0 == ifo_handle)
++ return 0;
++
++ if (title > ifo_handle->tt_srpt->nr_of_srpts) {
++ ifoClose(ifo_handle);
++ return 0;
++
++ }
++
++ uint32_t tmp_filesize;
++ offset += UDFFindFile(device, "/VIDEO_TS/VIDEO_TS.IFO", &tmp_filesize);
++
++
++ int i;
++ for (i=0; i<ifo_handle->tt_srpt->nr_of_srpts; i++)
++ if (title == ifo_handle->tt_srpt->title[i].title_set_nr)
++ break;
++
++ if (i == ifo_handle->tt_srpt->nr_of_srpts) {
++ /* not found */
++ ifoClose(ifo_handle);
++ return 0;
++ }
++ offset += ifo_handle->tt_srpt->title[i].title_set_sector;
++
++ ifoClose(ifo_handle);
++
++ if (!strcmp(extension, "VOB")) {
++ ifo_handle = ifoOpen(device, title);
++ if (0 == ifo_handle)
++ return 0;
++
++ switch(part) {
++ case 0:
++ if (0 == ifo_handle->vtsi_mat->vtsm_vobs)
++ return 0;
++ offset += ifo_handle->vtsi_mat->vtsm_vobs;
++ break;
++ case 1:
++ if (0 == ifo_handle->vtsi_mat->vtstt_vobs)
++ return 0;
++ offset += ifo_handle->vtsi_mat->vtstt_vobs;
++ break;
++ default: /* can't get other parts (also no need to) */
++ offset = 0;
++ break;
++ }
++
++ ifoClose(ifo_handle);
++ }
++
++ }
++
++ *filesize = 1000000; /* File size unknown */
++ if (offset != 0)
++ return offset;
++ }
++ }
+ uint8_t *LogBlock;
+ uint32_t lbnum;
+ uint16_t TagID;
|