[libdvdcss-devel] [PATCH] Fix CSS key caching on Android

hackndo hackndo at gmail.com
Tue Oct 27 18:17:09 CET 2015


From: Romain Bentz <bentz.romain at gmail.com>

---
 src/libdvdcss.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 3f4f7e6..febdff2 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -216,6 +216,18 @@ static int set_cache_directory( dvdcss_t dvdcss )
             psz_cache = dvdcss->psz_cachefile;
         }
 #else
+#ifdef __ANDROID__
+        /* $HOME is not writable on __ANDROID__ so we have to create a custom
+         * directory in userland */
+        char *psz_home = strdup("/sdcard/Android/data/org.videolan.dvdcss");
+
+        int i_ret = mkdir( psz_home, 0755 );
+        if( i_ret < 0 && errno != EEXIST )
+        {
+            print_error( dvdcss, "failed creating home directory" );
+            psz_home = NULL;
+        }
+#else
         char *psz_home = NULL;
 #ifdef HAVE_PWD_H
         struct passwd *p_pwd;
@@ -228,6 +240,8 @@ static int set_cache_directory( dvdcss_t dvdcss )
         }
 #endif /* HAVE_PWD_H */
 
+#endif /* __ANDROID__ */
+
         if( psz_home == NULL )
         {
             psz_home = getenv( "HOME" );
-- 
2.4.9 (Apple Git-60)



More information about the libdvdcss-devel mailing list