From 19259d42bac960ed6554e20c11562268880a4408 Mon Sep 17 00:00:00 2001 From: Karlson2k Date: Mon, 17 Nov 2014 18:12:56 +0300 Subject: libdvdcss: add custom patches as files to lib/libdvd/patches/ --- ...5-libdvdcss-fix-positioning-with-part-read.diff | 18 ++++++++++++ lib/libdvd/patches/06-libdvdcss-fix-part-read.diff | 32 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 lib/libdvd/patches/05-libdvdcss-fix-positioning-with-part-read.diff create mode 100644 lib/libdvd/patches/06-libdvdcss-fix-part-read.diff (limited to 'lib') 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 */ -- cgit v1.2.3