[libdvdcss-devel] Fix CSS key caching on Android

Romain Bentz git at videolan.org
Tue Oct 27 18:41:12 CET 2015


libdvdcss | branch: master | Romain Bentz <bentz.romain at gmail.com> | Tue Oct 27 18:17:09 2015 +0100| [50a9209451c63397a2aaccf9a3ae11ae29d3d707] | committer: Jean-Baptiste Kempf

Fix CSS key caching on Android

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=50a9209451c63397a2aaccf9a3ae11ae29d3d707
---

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

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 3f4f7e6..9a3d8ab 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 = "/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" );



More information about the libdvdcss-devel mailing list