Commit 58c21da6 authored by Mehdi Sabwat's avatar Mehdi Sabwat
Browse files

add libdvd patches

parent 513cb587
From 2771d46fcab019b996c80fbddd130f0a78697962 Mon Sep 17 00:00:00 2001
From: Mehdi Sabwat <mehdisabwat@gmail.com>
Date: Wed, 23 Oct 2019 19:47:30 +0200
Subject: [PATCH 1/3] add dvdcss emscripten support
---
...-add-emscripten-support-for-vlc.wasm.patch | 125 ++++++++++++++++++
contrib/src/dvdcss/rules.mak | 1 +
2 files changed, 126 insertions(+)
create mode 100644 contrib/src/dvdcss/0001-add-emscripten-support-for-vlc.wasm.patch
diff --git a/contrib/src/dvdcss/0001-add-emscripten-support-for-vlc.wasm.patch b/contrib/src/dvdcss/0001-add-emscripten-support-for-vlc.wasm.patch
new file mode 100644
index 0000000000..fbcbaad5fa
--- /dev/null
+++ b/contrib/src/dvdcss/0001-add-emscripten-support-for-vlc.wasm.patch
@@ -0,0 +1,125 @@
+From 5549d8efe4ef57c0f7732e1fe40e2feca493ba21 Mon Sep 17 00:00:00 2001
+From: Mehdi Sabwat <mehdisabwat@gmail.com>
+Date: Wed, 23 Oct 2019 13:53:52 +0200
+Subject: [PATCH 1/1] add emscripten support for vlc.wasm
+
+---
+ src/ioctl.c | 32 ++++++++++++++++++++++----------
+ 1 file changed, 22 insertions(+), 10 deletions(-)
+
+diff --git a/src/ioctl.c b/src/ioctl.c
+index 07bcb0d..ca9b364 100644
+--- a/src/ioctl.c
++++ b/src/ioctl.c
+@@ -218,7 +218,8 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
+ p_buffer, sizeof(p_buffer), &ulDataLen);
+
+ *pi_copyright = p_buffer[ 4 ];
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -351,7 +352,8 @@ int ioctl_ReadDiscKey( int i_fd, const int *pi_agid, uint8_t *p_key )
+ }
+
+ memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -481,7 +483,8 @@ int ioctl_ReadTitleKey( int i_fd, const int *pi_agid, int i_pos, uint8_t *p_key
+ p_buffer, sizeof(p_buffer), &ulDataLen);
+
+ memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -578,7 +581,8 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
+ p_buffer, sizeof(p_buffer), &ulDataLen);
+
+ *pi_agid = p_buffer[ 7 ] >> 6;
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -686,7 +690,8 @@ int ioctl_ReportChallenge( int i_fd, const int *pi_agid, uint8_t *p_challenge )
+ p_buffer, sizeof(p_buffer), &ulDataLen);
+
+ memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -796,7 +801,8 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
+ p_buffer, sizeof(p_buffer), &ulDataLen);
+
+ *pi_asf = p_buffer[ 7 ] & 1;
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -899,7 +905,8 @@ int ioctl_ReportKey1( int i_fd, const int *pi_agid, uint8_t *p_key )
+ p_buffer, sizeof(p_buffer), &ulDataLen);
+
+ memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -983,6 +990,8 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
+ i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
+ &sdc, sizeof(sdc), &ulParamLen,
+ NULL, 0, &ulDataLen);
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -1091,7 +1100,8 @@ int ioctl_SendChallenge( int i_fd, const int *pi_agid, const uint8_t *p_challeng
+ i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
+ &sdc, sizeof(sdc), &ulParamLen,
+ p_buffer, sizeof(p_buffer), &ulDataLen );
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -1200,7 +1210,8 @@ int ioctl_SendKey2( int i_fd, const int *pi_agid, const uint8_t *p_key )
+ i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
+ &sdc, sizeof(sdc), &ulParamLen,
+ p_buffer, sizeof(p_buffer), &ulDataLen );
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+@@ -1327,7 +1338,8 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
+ *p_type = p_buffer[ 4 ] >> 6;
+ *p_mask = p_buffer[ 5 ];
+ *p_scheme = p_buffer[ 6 ];
+-
++#elif defined(__EMSCRIPTEN__)
++ i_ret = -1;
+ #else
+ # error "DVD ioctls are unavailable on this system"
+
+--
+2.23.0
+
diff --git a/contrib/src/dvdcss/rules.mak b/contrib/src/dvdcss/rules.mak
index 26bdae3f62..ecf7ef2b88 100644
--- a/contrib/src/dvdcss/rules.mak
+++ b/contrib/src/dvdcss/rules.mak
@@ -14,6 +14,7 @@ $(TARBALLS)/libdvdcss-$(DVDCSS_VERSION).tar.bz2:
dvdcss: libdvdcss-$(DVDCSS_VERSION).tar.bz2 .sum-dvdcss
$(UNPACK)
+ $(APPLY) $(SRC)/dvdcss/0001-add-emscripten-support-for-vlc.wasm.patch
$(MOVE)
.dvdcss: dvdcss
--
2.23.0
From b93ff01e3e1e3e3131b46f59f3d74b4c5129e735 Mon Sep 17 00:00:00 2001
From: Mehdi Sabwat <mehdisabwat@gmail.com>
Date: Wed, 23 Oct 2019 19:54:13 +0200
Subject: [PATCH 2/3] add dvdnav emscripten support
---
.../0001-add-emscripten-pthread-support.patch | 26 +++++++++++++++++++
contrib/src/dvdnav/rules.mak | 3 ++-
2 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644 contrib/src/dvdnav/0001-add-emscripten-pthread-support.patch
diff --git a/contrib/src/dvdnav/0001-add-emscripten-pthread-support.patch b/contrib/src/dvdnav/0001-add-emscripten-pthread-support.patch
new file mode 100644
index 0000000000..216b2cc6d8
--- /dev/null
+++ b/contrib/src/dvdnav/0001-add-emscripten-pthread-support.patch
@@ -0,0 +1,26 @@
+From cf380d0f3739e7db5e6b5fa9e4be2d9255c6f879 Mon Sep 17 00:00:00 2001
+From: Mehdi Sabwat <mehdisabwat@gmail.com>
+Date: Wed, 23 Oct 2019 16:15:50 +0200
+Subject: [PATCH 1/1] add emscripten pthread support
+
+---
+ configure.ac | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 99d62ed..08f2f72 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -85,6 +85,9 @@ case $host in
+ ;;
+ *android*)
+ ;;
++ *emscripten*)
++ CFLAGS="-pthread"
++ ;;
+ *)
+ AC_CHECK_LIB(pthread, pthread_create,
+ [THREAD_LIBS="-lpthread"],
+--
+2.23.0
+
diff --git a/contrib/src/dvdnav/rules.mak b/contrib/src/dvdnav/rules.mak
index 334ccfb198..10fd9c87f9 100644
--- a/contrib/src/dvdnav/rules.mak
+++ b/contrib/src/dvdnav/rules.mak
@@ -22,6 +22,7 @@ $(TARBALLS)/libdvdnav-$(LIBDVDNAV_VERSION).tar.bz2:
dvdnav: libdvdnav-$(LIBDVDNAV_VERSION).tar.bz2 .sum-dvdnav
$(UNPACK)
cd $(UNPACK_DIR) && sed -i -e 's,Requires.private,Requires,g' misc/*.pc.in
+ $(APPLY) $(SRC)/dvdnav/0001-add-emscripten-pthread-support.patch
$(MOVE)
DEPS_dvdnav = dvdread $(DEPS_dvdread)
@@ -29,6 +30,6 @@ DEPS_dvdnav = dvdread $(DEPS_dvdread)
.dvdnav: dvdnav
$(REQUIRE_GPL)
$(RECONF) -I m4
- cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-examples
+ cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-examples --enable-pthreads
cd $< && $(MAKE) install
touch $@
--
2.23.0
From a86f4348e52e510e8002a437906ef7850786f18b Mon Sep 17 00:00:00 2001
From: Mehdi Sabwat <mehdisabwat@gmail.com>
Date: Wed, 23 Oct 2019 19:55:04 +0200
Subject: [PATCH 3/3] add dvdread emscripten support
---
...support-for-emscripten-little-endian.patch | 25 +++++++++++++++++++
contrib/src/dvdread/rules.mak | 1 +
2 files changed, 26 insertions(+)
create mode 100644 contrib/src/dvdread/0001-add-support-for-emscripten-little-endian.patch
diff --git a/contrib/src/dvdread/0001-add-support-for-emscripten-little-endian.patch b/contrib/src/dvdread/0001-add-support-for-emscripten-little-endian.patch
new file mode 100644
index 0000000000..5f2e9253ab
--- /dev/null
+++ b/contrib/src/dvdread/0001-add-support-for-emscripten-little-endian.patch
@@ -0,0 +1,25 @@
+From f4d9c8ebb212e409f9960dfe45b77fae1f4add93 Mon Sep 17 00:00:00 2001
+From: Mehdi Sabwat <mehdisabwat@gmail.com>
+Date: Wed, 23 Oct 2019 15:24:04 +0200
+Subject: [PATCH 1/1] add support for emscripten little endian
+
+---
+ src/bswap.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bswap.h b/src/bswap.h
+index 44c2862..f671d8f 100644
+--- a/src/bswap.h
++++ b/src/bswap.h
+@@ -37,7 +37,7 @@
+ #include <sys/param.h>
+ #endif
+
+-#if defined(__linux__) || defined(__GLIBC__)
++#if defined(__linux__) || defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+ #include <byteswap.h>
+ #define B2N_16(x) x = bswap_16(x)
+ #define B2N_32(x) x = bswap_32(x)
+--
+2.23.0
+
diff --git a/contrib/src/dvdread/rules.mak b/contrib/src/dvdread/rules.mak
index 1120519b99..731ca41881 100644
--- a/contrib/src/dvdread/rules.mak
+++ b/contrib/src/dvdread/rules.mak
@@ -21,6 +21,7 @@ $(TARBALLS)/libdvdread-$(LIBDVDREAD_VERSION).tar.bz2:
dvdread: libdvdread-$(LIBDVDREAD_VERSION).tar.bz2 .sum-dvdread
$(UNPACK)
cd $(UNPACK_DIR) && sed -i -e 's,Requires.private,Requires,g' misc/*.pc.in
+ $(APPLY) $(SRC)/dvdread/0001-add-support-for-emscripten-little-endian.patch
$(MOVE)
DEPS_dvdread = dvdcss $(DEPS_dvdcss)
--
2.23.0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment