[SCM] kodi/experimental: Use patches from libdvdread package

rbalint at users.alioth.debian.org rbalint at users.alioth.debian.org
Tue Oct 25 22:12:13 UTC 2016


The following commit has been merged in the experimental branch:
commit 3e939aa533e79c358bcedc4ac6632272abb81b36
Author: Balint Reczey <balint at balintreczey.hu>
Date:   Wed Oct 12 14:46:02 2016 +0200

    Use patches from libdvdread package

diff --git a/debian/patches/disabled-libdvdread-debian-0005-hurd.patch b/debian/patches/disabled-libdvdread-debian-0005-hurd.patch
new file mode 100644
index 0000000..a42ea6a
--- /dev/null
+++ b/debian/patches/disabled-libdvdread-debian-0005-hurd.patch
@@ -0,0 +1,278 @@
+From: Svante Signell <svante.signell at telia.com>
+Date: Tue, 22 Apr 2014 11:47:57 +0200
+Subject: hurd
+
+libdvdread FTBFS on hurd-i386 due to PATH_MAX usage,
+which is not defined on GNU/Hurd.
+The attached patch fixes these problems by using
+dynamic buffer allocation.
+
+Closes: #640803
+
+Signed-off-by: Matteo F. Vescovi <mfvescovi at gmail.com>
+---
+ src/dvd_reader.c | 62 +++++++++++++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 48 insertions(+), 14 deletions(-)
+
+--- a/src/dvd_reader.c
++++ b/src/dvd_reader.c
+@@ -29,6 +29,7 @@
+ #include <stdio.h>          /* fprintf */
+ #include <errno.h>          /* errno, EIN* */
+ #include <string.h>         /* memcpy, strlen */
++#define _GNU_SOURCE         /* Hurd support */
+ #include <unistd.h>         /* chdir, getcwd */
+ #include <limits.h>         /* PATH_MAX */
+ #include <dirent.h>         /* opendir, readdir */
+@@ -452,6 +453,12 @@
+         if( chdir( path_copy ) == -1 ) {
+           goto DVDOpen_error;
+         }
++#ifdef __GLIBC__
++        new_path = get_current_dir_name();
++        if(new_path == NULL) {
++          goto DVDOpen_error;
++        }
++#else
+         new_path = malloc(PATH_MAX+1);
+         if(!new_path) {
+           goto DVDOpen_error;
+@@ -459,6 +466,7 @@
+         if( getcwd( new_path, PATH_MAX ) == NULL ) {
+           goto DVDOpen_error;
+         }
++#endif
+         retval = fchdir( cdir );
+         close( cdir );
+         cdir = -1;
+@@ -703,17 +711,23 @@
+  *     or -1 on file not found.
+  *     or -2 on path not found.
+  */
+-static int findDirFile( const char *path, const char *file, char *filename )
++static int findDirFile( const char *path, const char *file, char **filename )
+ {
+   DIR *dir;
+   struct dirent *ent;
++  *filename = NULL;
+ 
+   dir = opendir( path );
+   if( !dir ) return -2;
+ 
+   while( ( ent = readdir( dir ) ) != NULL ) {
+     if( !strcasecmp( ent->d_name, file ) ) {
+-      sprintf( filename, "%s%s%s", path,
++      *filename = malloc( strlen( path ) + 1 + strlen( ent->d_name ) + 1 );
++      if( *filename == NULL ) {
++        closedir(dir);
++        return -1;
++      }
++      sprintf( *filename, "%s%s%s", path,
+                ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
+                ent->d_name );
+       closedir(dir);
+@@ -724,7 +738,7 @@
+   return -1;
+ }
+ 
+-static int findDVDFile( dvd_reader_t *dvd, const char *file, char *filename )
++static int findDVDFile( dvd_reader_t *dvd, const char *file, char **filename )
+ {
+   const char *nodirfile;
+   int ret;
+@@ -738,9 +752,11 @@
+ 
+   ret = findDirFile( dvd->path_root, nodirfile, filename );
+   if( ret < 0 ) {
+-    char video_path[ PATH_MAX + 1 ];
++    char *video_path = NULL;
+ 
+     /* Try also with adding the path, just in case. */
++    video_path = malloc( strlen( dvd->path_root ) + 10 + 1 );
++    if( video_path == NULL ) return 0;
+     sprintf( video_path, "%s/VIDEO_TS/", dvd->path_root );
+     ret = findDirFile( video_path, nodirfile, filename );
+     if( ret < 0 ) {
+@@ -748,9 +764,11 @@
+       sprintf( video_path, "%s/video_ts/", dvd->path_root );
+       ret = findDirFile( video_path, nodirfile, filename );
+       if( ret < 0 ) {
++        free( video_path );
+         return 0;
+       }
+     }
++    free( video_path );
+   }
+ 
+   return 1;
+@@ -761,20 +779,22 @@
+  */
+ static dvd_file_t *DVDOpenFilePath( dvd_reader_t *dvd, char *filename )
+ {
+-  char full_path[ PATH_MAX + 1 ];
++  char *full_path = NULL;
+   dvd_file_t *dvd_file;
+   struct stat fileinfo;
+   dvd_input_t dev;
+ 
+   /* Get the full path of the file. */
+-  if( !findDVDFile( dvd, filename, full_path ) ) {
++  if( !findDVDFile( dvd, filename, &full_path ) ) {
+     fprintf( stderr, "libdvdread:DVDOpenFilePath:findDVDFile %s failed\n", filename );
++    free( full_path );
+     return NULL;
+   }
+ 
+   dev = dvdinput_open( full_path, NULL, NULL );
+   if( !dev ) {
+     fprintf( stderr, "libdvdread:DVDOpenFilePath:dvdinput_open %s failed\n", full_path );
++    free( full_path );
+     return NULL;
+   }
+ 
+@@ -782,6 +802,7 @@
+   if( !dvd_file ) {
+     fprintf( stderr, "libdvdread:DVDOpenFilePath:dvd_file malloc failed\n" );
+     dvdinput_close(dev);
++    free( full_path );
+     return NULL;
+   }
+   dvd_file->dvd = dvd;
+@@ -794,6 +815,7 @@
+ 
+   if( stat( full_path, &fileinfo ) < 0 ) {
+     fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
++    free( full_path );
+     free( dvd_file );
+     dvdinput_close( dev );
+     return NULL;
+@@ -802,6 +824,7 @@
+   dvd_file->title_devs[ 0 ] = dev;
+   dvd_file->filesize = dvd_file->title_sizes[ 0 ];
+ 
++  free( full_path );
+   return dvd_file;
+ }
+ 
+@@ -858,7 +881,7 @@
+ static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *dvd, int title, int menu )
+ {
+   char filename[ MAX_UDF_FILE_NAME_LEN ];
+-  char full_path[ PATH_MAX + 1 ];
++  char *full_path = NULL;
+   struct stat fileinfo;
+   dvd_file_t *dvd_file;
+ 
+@@ -881,13 +904,15 @@
+     } else {
+       sprintf( filename, "VTS_%02i_0.VOB", title );
+     }
+-    if( !findDVDFile( dvd, filename, full_path ) ) {
++    if( !findDVDFile( dvd, filename, &full_path ) ) {
++      free( full_path );
+       free( dvd_file );
+       return NULL;
+     }
+ 
+     dev = dvdinput_open( full_path, NULL, NULL );
+     if( dev == NULL ) {
++      free( full_path );
+       free( dvd_file );
+       return NULL;
+     }
+@@ -895,6 +920,7 @@
+     if( stat( full_path, &fileinfo ) < 0 ) {
+       fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+       dvdinput_close(dev);
++      free( full_path );
+       free( dvd_file );
+       return NULL;
+     }
+@@ -909,7 +935,7 @@
+     for( i = 0; i < TITLES_MAX; ++i ) {
+ 
+       sprintf( filename, "VTS_%02i_%i.VOB", title, i + 1 );
+-      if( !findDVDFile( dvd, filename, full_path ) ) {
++      if( !findDVDFile( dvd, filename, &full_path ) ) {
+         break;
+       }
+ 
+@@ -924,11 +950,13 @@
+       dvd_file->filesize += dvd_file->title_sizes[ i ];
+     }
+     if( !dvd_file->title_devs[ 0 ] ) {
++      free( full_path );
+       free( dvd_file );
+       return NULL;
+     }
+   }
+ 
++  free( full_path );
+   return dvd_file;
+ }
+ 
+@@ -1054,7 +1082,7 @@
+                                int menu, dvd_stat_t *statbuf )
+ {
+   char filename[ MAX_UDF_FILE_NAME_LEN ];
+-  char full_path[ PATH_MAX + 1 ];
++  char *full_path = NULL;
+   struct stat fileinfo;
+   off_t tot_size;
+   off_t parts_size[ 9 ];
+@@ -1066,11 +1094,14 @@
+   else
+     sprintf( filename, "VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
+ 
+-  if( !findDVDFile( dvd, filename, full_path ) )
++  if( !findDVDFile( dvd, filename, &full_path ) ) {
++    free( full_path );
+     return -1;
++  }
+ 
+   if( stat( full_path, &fileinfo ) < 0 ) {
+     fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
++    free( full_path );
+     return -1;
+   }
+ 
+@@ -1082,7 +1113,7 @@
+     int cur;
+     for( cur = 2; cur < 10; cur++ ) {
+       sprintf( filename, "VTS_%02d_%d.VOB", title, cur );
+-      if( !findDVDFile( dvd, filename, full_path ) )
++      if( !findDVDFile( dvd, filename, &full_path ) )
+         break;
+ 
+       if( stat( full_path, &fileinfo ) < 0 ) {
+@@ -1101,6 +1132,7 @@
+   for( n = 0; n < nr_parts; n++ )
+     statbuf->parts_size[ n ] = parts_size[ n ];
+ 
++  free( full_path );
+   return 0;
+ }
+ 
+@@ -1164,18 +1196,20 @@
+       return 0;
+     }
+   } else {
+-    char full_path[ PATH_MAX + 1 ];
++    char *full_path = NULL;
+ 
+-    if( findDVDFile( dvd, filename, full_path ) ) {
++    if( findDVDFile( dvd, filename, &full_path ) ) {
+       if( stat( full_path, &fileinfo ) < 0 )
+         fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+       else {
+         statbuf->size = fileinfo.st_size;
+         statbuf->nr_parts = 1;
+         statbuf->parts_size[ 0 ] = statbuf->size;
++        free( full_path );
+         return 0;
+       }
+     }
++    free( full_path );
+   }
+   return -1;
+ }
diff --git a/debian/patches/disabled-libdvdread-debian-0007-segfault.patch b/debian/patches/disabled-libdvdread-debian-0007-segfault.patch
new file mode 100644
index 0000000..c992c39
--- /dev/null
+++ b/debian/patches/disabled-libdvdread-debian-0007-segfault.patch
@@ -0,0 +1,25 @@
+From: Peter Van Eynde <pvaneynd at debian.org>
+Date: Tue, 22 Apr 2014 11:52:53 +0200
+Subject: segfault
+
+Fix miscompilation leading to a segfault.
+
+Closes: #688574
+
+Signed-off-by: Matteo F. Vescovi <mfvescovi at gmail.com>
+---
+ src/dvd_reader.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/dvd_reader.c b/src/dvd_reader.c
+index fbdabb0..4db135d 100644
+--- a/src/dvd_reader.c
++++ b/src/dvd_reader.c
+@@ -30,6 +30,7 @@
+ #include <errno.h>          /* errno, EIN* */
+ #include <string.h>         /* memcpy, strlen */
+ #define _GNU_SOURCE         /* Hurd support */
++#define __USE_GNU           /* Fix segfault */
+ #include <unistd.h>         /* chdir, getcwd */
+ #include <limits.h>         /* PATH_MAX */
+ #include <dirent.h>         /* opendir, readdir */
diff --git a/debian/patches/libdvdread-debian-0001-libdvdcss.patch b/debian/patches/libdvdread-debian-0001-libdvdcss.patch
new file mode 100644
index 0000000..78ad091
--- /dev/null
+++ b/debian/patches/libdvdread-debian-0001-libdvdcss.patch
@@ -0,0 +1,27 @@
+From: Daniel Baumann <mail at daniel-baumann.ch>
+Date: Tue, 22 Apr 2014 11:14:26 +0200
+Subject: libdvdcss
+
+Print information about the CSS README.
+---
+ src/dvd_input.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/src/dvd_input.c
++++ b/src/dvd_input.c
+@@ -366,7 +366,14 @@
+     return 1;
+ 
+   } else {
+-    fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n");
++    fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n"
++                    "************************************************\n"
++                    "**                                            **\n"
++                    "**  No css library available. See             **\n"
++                    "**  /usr/share/doc/libdvdread4/README.css     **\n"
++                    "**  for more information.                     **\n"
++                    "**                                            **\n"
++                    "************************************************\n");
+ 
+     /* libdvdcss replacement functions */
+     dvdinput_open  = file_open;
diff --git a/debian/patches/libdvdread-debian-0006-descriptor.patch b/debian/patches/libdvdread-debian-0006-descriptor.patch
new file mode 100644
index 0000000..f0dbb10
--- /dev/null
+++ b/debian/patches/libdvdread-debian-0006-descriptor.patch
@@ -0,0 +1,101 @@
+From: Mario Holbe <mario.holbe at tu-ilmenau.de>
+Date: Tue, 22 Apr 2014 11:49:42 +0200
+Subject: descriptor
+
+libdvdread is very likely to fail on discs/images that store their File
+System Descriptor at the end of the disc/image rather than at the
+beginning. This is due to the "strategy" libdvdread uses to find it:
+libdvdread scans sequentially from the beginning of the disc/image for
+the File System Descriptor and identifies it by a single byte tag.
+
+Aside from wasting lots of time on discs/images that store their File
+System Descriptor at the end there is quite a good chance to stumble
+across a random data block that accidentally starts with this tag (and
+failing on it) before finding the real File System Descriptor.
+
+As far as I can see, at least CDBurnerXP seems to (be able to) create
+such images - at least if my interpretation of the Implementation
+Identifier "NMS DVDProLib" is correct.
+
+This... well, let's call it ugly hack fixes this by obtaining
+the File System Descriptor location from the Logical Volume Descriptor
+
+Closes: #663512
+---
+ src/dvd_udf.c | 37 ++++++++++++++++++++++++++++++++++---
+ 1 file changed, 34 insertions(+), 3 deletions(-)
+
+--- a/src/dvd_udf.c
++++ b/src/dvd_udf.c
+@@ -82,6 +82,8 @@
+   uint32_t AccessType;
+   uint32_t Start;
+   uint32_t Length;
++  uint32_t FSD_Location;
++  uint32_t FSD_Length;
+ };
+ 
+ struct AD {
+@@ -101,6 +103,12 @@
+   struct extent_ad rvds;
+ };
+ 
++struct fsd_t {
++  uint16_t Partition;
++  uint32_t Location;
++  uint32_t Length;
++};
++
+ struct pvd_t {
+   uint8_t VolumeIdentifier[32];
+   uint8_t VolumeSetIdentifier[128];
+@@ -427,6 +435,16 @@
+   return 0;
+ }
+ 
++/**
++ * Reads the File Set Descriptor from the Logical Volume Descriptor.
++ */
++static void UDFFSD( uint8_t *data, struct fsd_t *fsd )
++{
++  fsd->Length = GETN4(248);    /* always 2048? */
++  fsd->Location = GETN4(252);
++  fsd->Partition = GETN2(256); /* always 0? */
++}
++
+ static int UDFFileEntry( uint8_t *data, uint8_t *FileType,
+                          struct Partition *partition, struct AD *ad )
+ {
+@@ -775,8 +793,18 @@
+         /* Logical Volume Descriptor */
+         if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) {
+           /* TODO: sector size wrong! */
+-        } else
+-          volvalid = 1;
++        } else {
++          struct fsd_t fsd;
++
++          UDFFSD(LogBlock, &fsd);
++          if(part->Number == fsd.Partition) {
++            part->FSD_Location = fsd.Location;
++            part->FSD_Length = fsd.Length;
++            volvalid = 1;
++          } else {
++            /* TODO: Oups, how to handle this? */
++          }
++        }
+       }
+ 
+     } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
+@@ -818,7 +846,10 @@
+     SetUDFCache(device, PartitionCache, 0, &partition);
+ 
+     /* Find root dir ICB */
+-    lbnum = partition.Start;
++    lbnum = partition.Start + partition.FSD_Location;
++    /*
++    fprintf(stderr, "Looking for FSD at 0x%x\n", lbnum);
++    */
+     do {
+       if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
+         TagID = 0;
diff --git a/debian/rules b/debian/rules
index e79e184..e0851ea 100755
--- a/debian/rules
+++ b/debian/rules
@@ -83,9 +83,9 @@ override_dh_clean:
 	find . -name config.status -o -name config.cache -o -name config.log \
 		-exec rm -f "{}" \;
 	rm -rf tools/depends/target; \
-	ls $(CURDIR)/debian/patches/libdvdnav-0* | tac | xargs cat | patch -R -r - -s -p1 \
+	ls $(CURDIR)/debian/patches/libdvdnav-* | tac | xargs cat | patch -R --no-backup-if-mismatch -r - -s -p1 \
 		-d $(DVDNAV_COMPONENT) || true
-	ls $(CURDIR)/debian/patches/libdvdread-0* | tac | xargs cat | patch -R -r - -s -p1 \
+	ls $(CURDIR)/debian/patches/libdvdread-* | tac | xargs cat | patch -R --no-backup-if-mismatch -r - -s -p1 \
 		-d $(DVDREAD_COMPONENT) || true
 
 override_dh_auto_clean:
@@ -104,8 +104,8 @@ DEJAVUSANS=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
 endif
 
 override_dh_auto_configure: configure
-	cat $(CURDIR)/debian/patches/libdvdnav-0* | patch -p1 -d $(DVDNAV_COMPONENT)
-	cat $(CURDIR)/debian/patches/libdvdread-0* | patch -p1 -d $(DVDREAD_COMPONENT)
+	cat $(CURDIR)/debian/patches/libdvdnav-* | patch -p1 -d $(DVDNAV_COMPONENT)
+	cat $(CURDIR)/debian/patches/libdvdread-* | patch -p1 -d $(DVDREAD_COMPONENT)
 	sed -i 's/DEB_VERSION/"'$(VERSION)'"/' xbmc/Application.cpp xbmc/utils/SystemInfo.cpp
 	fontforge -script $(CURDIR)/debian/mergefonts.ff \
 		/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf \

-- 
kodi packaging



More information about the pkg-multimedia-commits mailing list