libdvdcss on iOS
#1
Hi Everyone,
I have managed to compile libdvdcss for iOS, I just hacked out all the ioctl related stuff and made _dvdcss_use_ioctls return 0, since we will always be using a file they shouldn't be needed should they?

So I am able to play an encoded DVD from the local disk, but if I try to play from an SMB share on my airport extreme it fails.

This is the log.

07:08:34 T:124162048 NOTICE: Creating InputStream
07:08:34 T:124162048 INFO: msg: libdvdnav: Using dvdnav version 4.1.3
07:08:34 T:124162048 INFO: msg: libdvdread: Using libdvdcss version 1.2.10 for DVD access
07:08:34 T:124162048 INFO: msg: libdvdread: Could not open smb://wayne:[email protected]/DVD's/A Bug's Life Disk 1.iso with libdvdcs
s.
07:08:34 T:124162048 INFO: msg: libdvdread: Can't open smb://wayne:[email protected]/DVD's/A Bug's Life Disk 1.iso for reading
07:08:34 T:124162048 DEBUG: libdvdnav: vm: failed to open/read the DVD
07:08:34 T:124162048 ERROR: Error on dvdnav_open
07:08:34 T:124162048 ERROR: CDVDPlayer::OpenInputStream - failed to open [smb://wayne:[email protected]/DVD's/A Bug's Life Disk 1.iso]
as DVD ISO, trying Bluray


Any suggestions for how I might be able to fix this?
Thanks,
Wayne
Reply
#2
Would have to see the patch you did.
Reply
#3
This is the patch against libdvdcss 1.2.10, a complete hack.

I just copied the libraries over to the apple TV and xbmc found them.

I made up a script to set up the environment to compile for arm if you need that as well.

Code:
diff -ru libdvdcss-1.2.10/src/device.c libdvdcss-1.2.10-iOS/src/device.c
--- libdvdcss-1.2.10/src/device.c    2008-07-13 22:25:49.000000000 +1000
+++ libdvdcss-1.2.10-iOS/src/device.c    2011-10-23 09:34:36.000000000 +1000
@@ -95,6 +95,7 @@

int _dvdcss_use_ioctls( dvdcss_t dvdcss )
{
+    return 0;
#if defined( WIN32 )
     if( dvdcss->b_file )
     {
diff -ru libdvdcss-1.2.10/src/ioctl.c libdvdcss-1.2.10-iOS/src/ioctl.c
--- libdvdcss-1.2.10/src/ioctl.c    2008-08-30 04:39:51.000000000 +1000
+++ libdvdcss-1.2.10-iOS/src/ioctl.c    2011-10-29 11:40:28.000000000 +1000
@@ -270,7 +270,9 @@
     *pi_copyright = p_buffer[ 4 ];

#else
-#   error "DVD ioctls are unavailable on this system"
+//#   error "DVD ioctls are unavailable on this system"
+    *pi_copyright = 0;
+    i_ret = 0;

#endif
     return i_ret;
@@ -442,8 +444,8 @@

     memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+// #   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -606,8 +608,8 @@

     memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif

@@ -730,8 +732,8 @@

     *pi_agid = p_buffer[ 7 ] >> 6;

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -864,8 +866,8 @@

     memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -997,8 +999,8 @@

     *pi_asf = p_buffer[ 7 ] & 1;

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1126,8 +1128,8 @@

     memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1237,8 +1239,8 @@
     i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
                         &sdc, sizeof(sdc), &ulParamLen,
                         NULL, 0, &ulDataLen);
-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1374,8 +1376,8 @@
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1511,8 +1513,8 @@
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1666,8 +1668,8 @@
     *p_mask = p_buffer[ 5 ];
     *p_scheme = p_buffer[ 6 ];

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1793,8 +1795,8 @@
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
Reply
#4
I would patch against the libdvd in xbmc source code, it's been modified to support our vfs which is how smb works. Also during link time, fileio calls are interposed to our vfs. I think that's why it works for local but not smb.
Reply
#5
That makes sense now, I was wondering why it was using a URL.
By the sounds of it, libdvdcss isn't included in the iOS build what do I need to change to have it included? I have the ATV2 git repository.
Thanks,
Wayne
Reply
#6
I have worked out how to enable it, modify configure.in in the xbmc directory.

But now it won't compile, it is discovering IODVDMediaBSDClient.h in the configure script, which sets a flag that then includes that file in the source.

IODVDMediaBSDClient.h exists in the Mac OS X SDK's but not the iOS SDK.

When I compile with an original version of libdvdcss it doesn't detect it.

My thought is that there is something in the xbmc build environment that causes it to look in the mac os sdk.


Code:
checking for sys/scsi.h... no
checking IOKit/storage/IODVDMediaBSDClient.h usability... no
checking IOKit/storage/IODVDMediaBSDClient.h presence... yes
configure: WARNING: IOKit/storage/IODVDMediaBSDClient.h: present but cannot be compiled
configure: WARNING: IOKit/storage/IODVDMediaBSDClient.h:     check for missing prerequisite headers?
configure: WARNING: IOKit/storage/IODVDMediaBSDClient.h: see the Autoconf documentation
configure: WARNING: IOKit/storage/IODVDMediaBSDClient.h:     section "Present But Cannot Be Compiled"
configure: WARNING: IOKit/storage/IODVDMediaBSDClient.h: proceeding with the preprocessor's result
configure: WARNING: IOKit/storage/IODVDMediaBSDClient.h: in the future, the compiler will take precedence
checking for IOKit/storage/IODVDMediaBSDClient.h... yes

Any thoughts on what might be going on?
Reply
#7
a) never run bootstrap/configure directly.

Doing this will escape the configure jail that has been setup. Always make -C tools/darwin/depends/xbmc and let it handle bootstrap/configure and the sub-configures.

there is no b) Smile

Look at the config.log files, those will have info regarding paths and how configure finds things.
Reply
#8
I was just running through as described in the README.ios, is that incorrect?

I created a fresh copy of the repository and ran that make command but got the following:

Code:
Waynes-MacBook-Pro:xbmc2 wayne$ make -C tools/darwin/depends/xbmc
Makefile:1: ../Makefile.include: No such file or directory
make: *** No rule to make target `../Makefile.include'.  Stop.

Surely it has to set the build target arch etc somewhere?
Reply
#9
WayneP Wrote:I was just running through as described in the README.ios, is that incorrect?

I created a fresh copy of the repository and ran that make command but got the following:

Code:
Waynes-MacBook-Pro:xbmc2 wayne$ make -C tools/darwin/depends/xbmc
Makefile:1: ../Makefile.include: No such file or directory
make: *** No rule to make target `../Makefile.include'.  Stop.

Surely it has to set the build target arch etc somewhere?

cat README.ios or
cat tools/darwin/depends/README Smile

you have to bootstrap/configure the depends
Reply
#10
So I have managed to make it work, CPP and CPPFLAGS weren't being set correctly in the config.site templates, so when it used cpp to look for IODVDMediaBSDClient.h it found the regular OS X version.

When I use my version from source the menu backgrounds don't appear and when I play an ISO it is very jumpy, but that might be caused by other issues that people have been talking about?

So here is the diff, I can probably clean up the libdvdcss related stuff so it is a bit nicer.

Code:
diff --git a/configure.in b/configure.in
index 83840a8..cf96a2c 100755
--- a/configure.in
+++ b/configure.in
@@ -461,7 +461,7 @@ case $host in
      use_vdadecoder=no
      use_vtbdecoder=yes
      use_optical_drive=no
-     use_dvdcss=no
+     use_dvdcss=yes
      use_gles=yes
      use_cpu=cortex-a8
      check_sdl_arch=[`file /opt/local/lib/libSDL_image.dylib | awk '{V=7; print $V}'`]
diff --git a/lib/libdvd/libdvdcss/src/device.c b/lib/libdvd/libdvdcss/src/device.c
index 45d6f0d..aa2b86d 100644
--- a/lib/libdvd/libdvdcss/src/device.c
+++ b/lib/libdvd/libdvdcss/src/device.c
@@ -99,6 +99,7 @@ static int aspi_read_internal  ( int, void *, int );

int _dvdcss_use_ioctls( dvdcss_t dvdcss )
{
+    return 0;
#if defined( WIN32 )
     if( dvdcss->b_file )
     {
diff --git a/lib/libdvd/libdvdcss/src/ioctl.c b/lib/libdvd/libdvdcss/src/ioctl.c
index 1e5ebea..26b89b2 100644
--- a/lib/libdvd/libdvdcss/src/ioctl.c
+++ b/lib/libdvd/libdvdcss/src/ioctl.c
@@ -270,7 +270,9 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
     *pi_copyright = p_buffer[ 4 ];

#else
-#   error "DVD ioctls are unavailable on this system"
+//#   error "DVD ioctls are unavailable on this system"
+    *pi_copyright = 0;
+    i_ret = 0;

#endif
     return i_ret;
@@ -473,8 +475,8 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )

     memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+// #   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -656,8 +658,8 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )

     memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif

@@ -785,8 +787,8 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )

     *pi_agid = p_buffer[ 7 ] >> 6;

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -919,8 +921,8 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

     memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1052,8 +1054,8 @@ int ioctl_ReportASF( int i_fd, int *pi_remove_me, int *pi_asf )

     *pi_asf = p_buffer[ 7 ] & 1;

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1181,8 +1183,8 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )

     memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1292,8 +1294,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);
-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1434,8 +1436,8 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1571,8 +1573,8 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1726,8 +1728,8 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
     *p_mask = p_buffer[ 5 ];
     *p_scheme = p_buffer[ 6 ];

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
@@ -1853,8 +1855,8 @@ int ioctl_SendRPC( int i_fd, int i_pdrc )
                          &sdc, sizeof(sdc), &ulParamLen,
                          p_buffer, sizeof(p_buffer), &ulDataLen );

-#else
-#   error "DVD ioctls are unavailable on this system"
+//#else
+//#   error "DVD ioctls are unavailable on this system"

#endif
     return i_ret;
diff --git a/tools/darwin/depends/config.site_ios.in b/tools/darwin/depends/config.site_ios.in
index cd6dbef..47492d4 100644
--- a/tools/darwin/depends/config.site_ios.in
+++ b/tools/darwin/depends/config.site_ios.in
@@ -10,9 +10,9 @@ platform_os_ldflags="-arch @use_arch@ -mcpu=cortex-a8"
platform_sdk_path="${platform_path}/SDKs/iPhoneOS${platform_sdk_version}.sdk"

export NM=/usr/bin/nm
-export CPP=/usr/bin/cpp-${platform_gcc_version}
+export CPP=${platform_path}/usr/bin/cpp-${platform_gcc_version}
export CXXCPP=${CPP}
-export CPPFLAGS="${CPPFLAGS} -no-cpp-precomp -I${prefix}/include"
+export CPPFLAGS="${CPPFLAGS} -no-cpp-precomp -I${prefix}/include -m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags}"
export CC=${platform_path}/usr/bin/gcc-${platform_gcc_version}
export CFLAGS="${CFLAGS} -std=gnu99 -no-cpp-precomp -m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags} -I${platform_sdk_path}/usr/include"
export LD=${platform_path}/usr/bin/ld
diff --git a/tools/darwin/depends/config.site_ios.mk.in b/tools/darwin/depends/config.site_ios.mk.in
index a0507c9..1f118a9 100644
--- a/tools/darwin/depends/config.site_ios.mk.in
+++ b/tools/darwin/depends/config.site_ios.mk.in
@@ -10,9 +10,9 @@ platform_os_ldflags=-arch @use_arch@ -mcpu=cortex-a8
platform_sdk_path=${platform_path}/SDKs/iPhoneOS${platform_sdk_version}.sdk

export NM=/usr/bin/nm
-export CPP=/usr/bin/cpp-${platform_gcc_version}
+export CPP=${platform_path}/usr/bin/cpp-${platform_gcc_version}
export CXXCPP=${CPP}
-export CPPFLAGS+=-no-cpp-precomp -I${PREFIX}/include
+export CPPFLAGS+=-no-cpp-precomp -I${PREFIX}/include -m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags}
export CC=${platform_path}/usr/bin/gcc-${platform_gcc_version}
export CFLAGS+=-std=gnu99 -no-cpp-precomp -m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags} -I${platform_sdk_path}/usr/include
export LD=${platform_path}/usr/bin/ld
Reply
#11
config.site fixes are pushed into trunk.
Reply

Logout Mark Read Team Forum Stats Members Help
libdvdcss on iOS0