aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKarlson2k <k2k@narod.ru>2014-11-17 18:12:56 +0300
committerKarlson2k <k2k@narod.ru>2014-11-17 18:14:15 +0300
commit19259d42bac960ed6554e20c11562268880a4408 (patch)
treeea33dbb5a5803b54f144b54fdbcea0afd937975d /lib
parentbc67f8c9e552d6440dc284d479c5c570e64f7fde (diff)
libdvdcss: add custom patches as files to lib/libdvd/patches/
Diffstat (limited to 'lib')
-rw-r--r--lib/libdvd/patches/05-libdvdcss-fix-positioning-with-part-read.diff18
-rw-r--r--lib/libdvd/patches/06-libdvdcss-fix-part-read.diff32
2 files changed, 50 insertions, 0 deletions
diff --git a/lib/libdvd/patches/05-libdvdcss-fix-positioning-with-part-read.diff b/lib/libdvd/patches/05-libdvdcss-fix-positioning-with-part-read.diff
new file mode 100644
index 0000000000..6dfc875855
--- /dev/null
+++ b/lib/libdvd/patches/05-libdvdcss-fix-positioning-with-part-read.diff
@@ -0,0 +1,18 @@
+diff --git a/lib/libdvd/libdvdcss/src/device.c b/lib/libdvd/libdvdcss/src/device.c
+index 2395ab5..3de1879 100644
+--- a/lib/libdvd/libdvdcss/src/device.c
++++ b/lib/libdvd/libdvdcss/src/device.c
+@@ -828,10 +828,11 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
+ /* Handle partial reads */
+ if( i_ret != i_size )
+ {
+- int i_seek;
++ int i_seek, i_set_pos;
+
++ i_set_pos = dvdcss->i_pos + i_ret / DVDCSS_BLOCK_SIZE;
+ dvdcss->i_pos = -1;
+- i_seek = libc_seek( dvdcss, i_ret / DVDCSS_BLOCK_SIZE );
++ i_seek = libc_seek( dvdcss, i_set_pos );
+ if( i_seek < 0 )
+ {
+ return i_seek;
diff --git a/lib/libdvd/patches/06-libdvdcss-fix-part-read.diff b/lib/libdvd/patches/06-libdvdcss-fix-part-read.diff
new file mode 100644
index 0000000000..318b7a4c7a
--- /dev/null
+++ b/lib/libdvd/patches/06-libdvdcss-fix-part-read.diff
@@ -0,0 +1,32 @@
+diff --git a/lib/libdvd/libdvdcss/src/device.c b/lib/libdvd/libdvdcss/src/device.c
+index 3de1879..53d1fdf 100644
+--- a/lib/libdvd/libdvdcss/src/device.c
++++ b/lib/libdvd/libdvdcss/src/device.c
+@@ -816,13 +816,21 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
+ off_t i_size, i_ret;
+
+ i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
+- i_ret = read( dvdcss->i_read_fd, p_buffer, i_size );
+-
+- if( i_ret < 0 )
++ i_ret = 0;
++ while( i_ret < i_size )
+ {
+- print_error( dvdcss, "read error" );
+- dvdcss->i_pos = -1;
+- return i_ret;
++ off_t i_r;
++ i_r = read( dvdcss->i_read_fd, ((char*)p_buffer) + i_ret, i_size - i_ret );
++ if( i_r < 0 )
++ {
++ print_error(dvdcss, "read error");
++ dvdcss->i_pos = -1;
++ return i_r;
++ }
++ if( i_r == 0 )
++ break;
++
++ i_ret += i_r;
+ }
+
+ /* Handle partial reads */