From 986d1706ac9bec09d2a959d020bce11542a00b03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 16 Aug 2010 02:03:37 +0200 Subject: [PATCH] Add Media-Protect patch for libdvdread-4.1.3. --- media-libs/libdvdread/Manifest | 5 + .../files/libdvdread-0.9.6-udfsymbols.patch | 21 ++++ .../files/libdvdread-0.9.7-udfsymbols.patch | 19 ++++ .../files/libdvdread-4.1.3-media-protect.patch | 125 +++++++++++++++++++++ .../libdvdread/libdvdread-4.1.3_p1168.ebuild | 32 ++++++ 5 files changed, 202 insertions(+) create mode 100644 media-libs/libdvdread/Manifest create mode 100644 media-libs/libdvdread/files/libdvdread-0.9.6-udfsymbols.patch create mode 100644 media-libs/libdvdread/files/libdvdread-0.9.7-udfsymbols.patch create mode 100644 media-libs/libdvdread/files/libdvdread-4.1.3-media-protect.patch create mode 100644 media-libs/libdvdread/libdvdread-4.1.3_p1168.ebuild diff --git a/media-libs/libdvdread/Manifest b/media-libs/libdvdread/Manifest new file mode 100644 index 0000000..4e7cefb --- /dev/null +++ b/media-libs/libdvdread/Manifest @@ -0,0 +1,5 @@ +AUX libdvdread-0.9.6-udfsymbols.patch 1018 RMD160 269e47ca7c6515b0b793967578891bd9ae4f22d6 SHA1 7dc44a9ade985f81a467ad49be494b9ffd32e4ba SHA256 4fef1caa5df5f3c1db69066dbb80bf0586f25ca70c3f073e7009899a5f2c70bd +AUX libdvdread-0.9.7-udfsymbols.patch 903 RMD160 a20cadcd8314a0875fc2f901868e1757c856eed3 SHA1 7b848f55120c0429b33594fc2431cd98e3b840a6 SHA256 191070f76b8d65c0b5a4235acf1dec2c6a0fa624b2e0f93712af8b456fe89adc +AUX libdvdread-4.1.3-media-protect.patch 3725 RMD160 30bf39633f21a55a9f03da0c0738709f2d69cc5e SHA1 678a21cd28167b588d92167131422c120508d3c6 SHA256 f36b063b9931b5755bd827a6976fe418b8d54a2a0544e10d1c32c8247a3a8b55 +DIST libdvdread-4.1.3_p1168.tar.bz2 95537 RMD160 b262471dd4136c0537558dcb28c674dae0ba641b SHA1 0a462063a168a99c183e06938f7f9894da700434 SHA256 6067dbf5fdd34d0362fdea4f4c5b86cf3e1cff5d1db58a7bf459bd0a4a0c37db +EBUILD libdvdread-4.1.3_p1168.ebuild 938 RMD160 dd49d6ee6ce7f244bc67cf64c58fc39ceb175ffd SHA1 9a19a00a78ba74b94572d03a521157e639c6e4b3 SHA256 15fb182d477064f0b1be224f7cfcf78fda004705a6be5a089e61d178abca3523 diff --git a/media-libs/libdvdread/files/libdvdread-0.9.6-udfsymbols.patch b/media-libs/libdvdread/files/libdvdread-0.9.6-udfsymbols.patch new file mode 100644 index 0000000..2fbd3a7 --- /dev/null +++ b/media-libs/libdvdread/files/libdvdread-0.9.6-udfsymbols.patch @@ -0,0 +1,21 @@ +Index: libdvdread-0.9.5/dvdread/Makefile.am +=================================================================== +--- libdvdread-0.9.5.orig/dvdread/Makefile.am ++++ libdvdread-0.9.5/dvdread/Makefile.am +@@ -2,13 +2,13 @@ INCLUDES = -I$(top_srcdir) @CSS_CFLAGS@ + + lib_LTLIBRARIES = libdvdread.la + libdvdread_la_SOURCES = dvd_input.c dvd_reader.c dvd_udf.c ifo_read.c \ +- ifo_print.c nav_read.c nav_print.c bswap.h dvd_udf.h dvd_input.h \ ++ ifo_print.c nav_read.c nav_print.c bswap.h dvd_input.h \ + dvdread_internal.h cmd_print.c \ + md5.c md5.h + libdvdread_la_LIBADD = @DL_LIBS@ @CSS_LIBS@ +-libdvdread_la_LDFLAGS = -version-info 5:0:2 -export-symbols-regex "(DVD.*|ifo.*|nav.*|cmd.*)" ++libdvdread_la_LDFLAGS = -version-info 5:0:2 -export-symbols-regex "(DVD.*|UDF.*|ifo.*|nav.*|cmd.*)" + + pkgincludedir = $(includedir)/dvdread + +-pkginclude_HEADERS = dvd_reader.h ifo_types.h ifo_read.h \ ++pkginclude_HEADERS = dvd_reader.h ifo_types.h ifo_read.h dvd_udf.h \ + ifo_print.h nav_types.h nav_read.h nav_print.h cmd_print.h diff --git a/media-libs/libdvdread/files/libdvdread-0.9.7-udfsymbols.patch b/media-libs/libdvdread/files/libdvdread-0.9.7-udfsymbols.patch new file mode 100644 index 0000000..30936e1 --- /dev/null +++ b/media-libs/libdvdread/files/libdvdread-0.9.7-udfsymbols.patch @@ -0,0 +1,19 @@ +--- dvdread/Makefile.am.orig 2006-10-06 22:24:39.000000000 +0200 ++++ dvdread/Makefile.am 2006-10-06 22:25:35.000000000 +0200 +@@ -2,13 +2,13 @@ + + lib_LTLIBRARIES = libdvdread.la + libdvdread_la_SOURCES = dvd_input.c dvd_reader.c dvd_udf.c ifo_read.c \ +- ifo_print.c nav_read.c nav_print.c bswap.h dvd_udf.h dvd_input.h \ ++ ifo_print.c nav_read.c nav_print.c bswap.h dvd_input.h \ + dvdread_internal.h cmd_print.c \ + md5.c md5.h + libdvdread_la_LIBADD = @DL_LIBS@ @CSS_LIBS@ +-libdvdread_la_LDFLAGS = -version-info 5:1:2 -export-symbols-regex "(DVD.*|ifo.*|nav.*|cmd.*)" ++libdvdread_la_LDFLAGS = -version-info 5:1:2 -export-symbols-regex "(DVD.*|UDF.*|ifo.*|nav.*|cmd.*)" + + pkgincludedir = $(includedir)/dvdread + +-pkginclude_HEADERS = dvd_reader.h ifo_types.h ifo_read.h \ ++pkginclude_HEADERS = dvd_reader.h ifo_types.h ifo_read.h dvd_udf.h \ + ifo_print.h nav_types.h nav_read.h nav_print.h cmd_print.h diff --git a/media-libs/libdvdread/files/libdvdread-4.1.3-media-protect.patch b/media-libs/libdvdread/files/libdvdread-4.1.3-media-protect.patch new file mode 100644 index 0000000..4132c14 --- /dev/null +++ b/media-libs/libdvdread/files/libdvdread-4.1.3-media-protect.patch @@ -0,0 +1,125 @@ +diff -Nur libdvdread-4.1.3_p1168-orig/src/dvd_input.c libdvdread-4.1.3_p1168/src/dvd_input.c +--- libdvdread-4.1.3_p1168-orig/src/dvd_input.c 2009-03-09 18:41:50.000000000 +0100 ++++ libdvdread-4.1.3_p1168/src/dvd_input.c 2010-08-16 01:52:24.000000000 +0200 +@@ -332,6 +332,8 @@ + } + #endif /* HAVE_DVDCSS_DVDCSS_H */ + ++ fprintf(stderr, "libdvdread patched to play DVDs with DVD-Movie-Protect\n"); ++ + if(dvdcss_library != NULL) { + /* + char *psz_method = getenv( "DVDCSS_METHOD" ); +diff -Nur libdvdread-4.1.3_p1168-orig/src/dvd_udf.c libdvdread-4.1.3_p1168/src/dvd_udf.c +--- libdvdread-4.1.3_p1168-orig/src/dvd_udf.c 2009-03-09 18:41:50.000000000 +0100 ++++ libdvdread-4.1.3_p1168/src/dvd_udf.c 2010-08-16 01:53:03.000000000 +0200 +@@ -38,10 +38,16 @@ + #include + #include + #include ++#ifndef __WIN32__ ++#include ++#endif + + #include "dvdread/dvd_reader.h" + #include "dvdread/dvd_udf.h" + ++#include "dvdread/ifo_types.h" ++#include "dvdread/ifo_read.h" ++ + /* Private but located in/shared with dvd_reader.c */ + extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number, + size_t block_count, unsigned char *data, +@@ -784,7 +790,7 @@ + return part->valid; + } + +-uint32_t UDFFindFile( dvd_reader_t *device, char *filename, ++static uint32_t UDFFindFileReal( dvd_reader_t *device, char *filename, + uint32_t *filesize ) + { + uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ]; +@@ -863,6 +869,83 @@ + return partition.Start + File.Location; + } + ++/** ++ * 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 ) ++{ ++#ifndef __WIN32__ ++ 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_")) ) { ++#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; itt_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); ++} + + + /** diff --git a/media-libs/libdvdread/libdvdread-4.1.3_p1168.ebuild b/media-libs/libdvdread/libdvdread-4.1.3_p1168.ebuild new file mode 100644 index 0000000..a3a3404 --- /dev/null +++ b/media-libs/libdvdread/libdvdread-4.1.3_p1168.ebuild @@ -0,0 +1,32 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-libs/libdvdread/libdvdread-4.1.3_p1168.ebuild,v 1.10 2010/07/31 19:54:25 armin76 Exp $ + +EAPI="2" +WANT_AUTOCONF="2.5" +inherit eutils autotools multilib + +DESCRIPTION="Library for DVD navigation tools" +HOMEPAGE="http://www.mplayerhq.hu/" +SRC_URI="mirror://gentoo/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm ~hppa ia64 ~mips ppc ~ppc64 sh sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris" +IUSE="+css" + +DEPEND="!<=media-libs/libdvdnav-4.1.2 + css? ( media-libs/libdvdcss )" +RDEPEND="$DEPEND" + +src_prepare() { + EPATCH_OPTS="-d ${S}/src" + epatch "${FILESDIR}/${PN}-4.1.3-media-protect.patch" + elibtoolize + eautoreconf +} + +src_install () { + emake DESTDIR="${D}" install || die + dodoc AUTHORS DEVELOPMENT-POLICY.txt ChangeLog TODO README || die +} -- 2.7.4