[Android] [PATCH 1/2] Move libVLC to a separate folder

Geoffrey Métais geoffrey.metais at gmail.com
Thu Nov 13 19:11:58 CET 2014


---
 .gitignore                                         |   1 +
 libVLC/.gitignore                                  |   6 +
 libVLC/AndroidManifest.xml                         |   7 +
 libVLC/build.gradle                                |  33 +
 libVLC/build.xml                                   |  92 +++
 libVLC/jni/Android.mk                              | 151 ++++
 libVLC/jni/Application.mk                          |   3 +
 libVLC/jni/aout.c                                  | 259 +++++++
 libVLC/jni/aout.h                                  |  35 +
 libVLC/jni/egl-android-info.txt                    |  23 +
 libVLC/jni/eventfd.c                               |  30 +
 libVLC/jni/libvlcjni-equalizer.c                   | 120 +++
 libVLC/jni/libvlcjni-medialist.c                   | 124 +++
 libVLC/jni/libvlcjni-track.c                       | 462 +++++++++++
 libVLC/jni/libvlcjni-util.c                        | 330 ++++++++
 libVLC/jni/libvlcjni.c                             | 632 +++++++++++++++
 libVLC/jni/log.h                                   |  42 +
 libVLC/jni/native_crash_handler.c                  |  97 +++
 libVLC/jni/native_crash_handler.h                  |  29 +
 libVLC/jni/pipe2.c                                 |  30 +
 libVLC/jni/pthread-condattr.c                      |  70 ++
 libVLC/jni/pthread-once.c                          |  84 ++
 libVLC/jni/pthread-rwlocks.c                       | 349 +++++++++
 libVLC/jni/sem.c                                   |  51 ++
 libVLC/jni/thumbnailer.c                           | 318 ++++++++
 libVLC/jni/utils.h                                 |  48 ++
 libVLC/jni/vout.c                                  | 191 +++++
 libVLC/jni/vout.h                                  |  28 +
 libVLC/jni/wchar/wcpcpy.c                          |  46 ++
 libVLC/jni/wchar/wcpncpy.c                         |  45 ++
 libVLC/jni/wchar/wcscasecmp.c                      |  45 ++
 libVLC/jni/wchar/wcscat.c                          |  51 ++
 libVLC/jni/wchar/wcschr.c                          |  41 +
 libVLC/jni/wchar/wcscmp.c                          |  56 ++
 libVLC/jni/wchar/wcscoll.c                         |  39 +
 libVLC/jni/wchar/wcscpy.c                          |  49 ++
 libVLC/jni/wchar/wcscspn.c                         |  58 ++
 libVLC/jni/wchar/wcsdup.c                          |  43 ++
 libVLC/jni/wchar/wcslcat.c                         |  74 ++
 libVLC/jni/wchar/wcslcpy.c                         |  70 ++
 libVLC/jni/wchar/wcslen.c                          |  49 ++
 libVLC/jni/wchar/wcsncasecmp.c                     |  49 ++
 libVLC/jni/wchar/wcsncat.c                         |  57 ++
 libVLC/jni/wchar/wcsncmp.c                         |  57 ++
 libVLC/jni/wchar/wcsncpy.c                         |  64 ++
 libVLC/jni/wchar/wcsnlen.c                         |  42 +
 libVLC/jni/wchar/wcspbrk.c                         |  58 ++
 libVLC/jni/wchar/wcsrchr.c                         |  47 ++
 libVLC/jni/wchar/wcsspn.c                          |  60 ++
 libVLC/jni/wchar/wcsstr.c                          |  63 ++
 libVLC/jni/wchar/wcstok.c                          |  86 +++
 libVLC/jni/wchar/wcswidth.c                        |  57 ++
 libVLC/jni/wchar/wcsxfrm.c                         |  57 ++
 libVLC/jni/wchar/wmemchr.c                         |  52 ++
 libVLC/jni/wchar/wmemcmp.c                         |  53 ++
 libVLC/jni/wchar/wmemcpy.c                         |  44 ++
 libVLC/jni/wchar/wmemmove.c                        |  44 ++
 libVLC/jni/wchar/wmemset.c                         |  51 ++
 libVLC/project.properties                          |  17 +
 libVLC/src/org/videolan/libvlc/AudioOutput.java    |  74 ++
 libVLC/src/org/videolan/libvlc/EventHandler.java   | 131 ++++
 libVLC/src/org/videolan/libvlc/HWDecoderUtil.java  | 125 +++
 libVLC/src/org/videolan/libvlc/IVideoPlayer.java   |  39 +
 libVLC/src/org/videolan/libvlc/LibVLC.java         | 859 +++++++++++++++++++++
 .../src/org/videolan/libvlc/LibVlcException.java   |  62 ++
 libVLC/src/org/videolan/libvlc/LibVlcUtil.java     | 539 +++++++++++++
 libVLC/src/org/videolan/libvlc/Media.java          | 433 +++++++++++
 libVLC/src/org/videolan/libvlc/MediaList.java      | 236 ++++++
 libVLC/src/org/videolan/libvlc/TrackInfo.java      |  53 ++
 settings.gradle                                    |   1 +
 vlc-android/build.gradle                           |   3 +-
 vlc-android/jni/Android.mk                         | 151 ----
 vlc-android/jni/Application.mk                     |   3 -
 vlc-android/jni/aout.c                             | 259 -------
 vlc-android/jni/aout.h                             |  35 -
 vlc-android/jni/egl-android-info.txt               |  23 -
 vlc-android/jni/eventfd.c                          |  30 -
 vlc-android/jni/libvlcjni-equalizer.c              | 120 ---
 vlc-android/jni/libvlcjni-medialist.c              | 124 ---
 vlc-android/jni/libvlcjni-track.c                  | 462 -----------
 vlc-android/jni/libvlcjni-util.c                   | 330 --------
 vlc-android/jni/libvlcjni.c                        | 632 ---------------
 vlc-android/jni/log.h                              |  42 -
 vlc-android/jni/native_crash_handler.c             |  97 ---
 vlc-android/jni/native_crash_handler.h             |  29 -
 vlc-android/jni/pipe2.c                            |  30 -
 vlc-android/jni/pthread-condattr.c                 |  70 --
 vlc-android/jni/pthread-once.c                     |  84 --
 vlc-android/jni/pthread-rwlocks.c                  | 349 ---------
 vlc-android/jni/sem.c                              |  51 --
 vlc-android/jni/thumbnailer.c                      | 318 --------
 vlc-android/jni/utils.h                            |  48 --
 vlc-android/jni/vout.c                             | 191 -----
 vlc-android/jni/vout.h                             |  28 -
 vlc-android/jni/wchar/wcpcpy.c                     |  46 --
 vlc-android/jni/wchar/wcpncpy.c                    |  45 --
 vlc-android/jni/wchar/wcscasecmp.c                 |  45 --
 vlc-android/jni/wchar/wcscat.c                     |  51 --
 vlc-android/jni/wchar/wcschr.c                     |  41 -
 vlc-android/jni/wchar/wcscmp.c                     |  56 --
 vlc-android/jni/wchar/wcscoll.c                    |  39 -
 vlc-android/jni/wchar/wcscpy.c                     |  49 --
 vlc-android/jni/wchar/wcscspn.c                    |  58 --
 vlc-android/jni/wchar/wcsdup.c                     |  43 --
 vlc-android/jni/wchar/wcslcat.c                    |  74 --
 vlc-android/jni/wchar/wcslcpy.c                    |  70 --
 vlc-android/jni/wchar/wcslen.c                     |  49 --
 vlc-android/jni/wchar/wcsncasecmp.c                |  49 --
 vlc-android/jni/wchar/wcsncat.c                    |  57 --
 vlc-android/jni/wchar/wcsncmp.c                    |  57 --
 vlc-android/jni/wchar/wcsncpy.c                    |  64 --
 vlc-android/jni/wchar/wcsnlen.c                    |  42 -
 vlc-android/jni/wchar/wcspbrk.c                    |  58 --
 vlc-android/jni/wchar/wcsrchr.c                    |  47 --
 vlc-android/jni/wchar/wcsspn.c                     |  60 --
 vlc-android/jni/wchar/wcsstr.c                     |  63 --
 vlc-android/jni/wchar/wcstok.c                     |  86 ---
 vlc-android/jni/wchar/wcswidth.c                   |  57 --
 vlc-android/jni/wchar/wcsxfrm.c                    |  57 --
 vlc-android/jni/wchar/wmemchr.c                    |  52 --
 vlc-android/jni/wchar/wmemcmp.c                    |  53 --
 vlc-android/jni/wchar/wmemcpy.c                    |  44 --
 vlc-android/jni/wchar/wmemmove.c                   |  44 --
 vlc-android/jni/wchar/wmemset.c                    |  51 --
 vlc-android/project.properties                     |   3 +
 .../src/org/videolan/libvlc/AudioOutput.java       |  74 --
 .../src/org/videolan/libvlc/EventHandler.java      | 131 ----
 .../src/org/videolan/libvlc/HWDecoderUtil.java     | 125 ---
 .../src/org/videolan/libvlc/IVideoPlayer.java      |  39 -
 vlc-android/src/org/videolan/libvlc/LibVLC.java    | 859 ---------------------
 .../src/org/videolan/libvlc/LibVlcException.java   |  62 --
 .../src/org/videolan/libvlc/LibVlcUtil.java        | 539 -------------
 vlc-android/src/org/videolan/libvlc/Media.java     | 433 -----------
 vlc-android/src/org/videolan/libvlc/MediaList.java | 236 ------
 vlc-android/src/org/videolan/libvlc/TrackInfo.java |  53 --
 135 files changed, 7825 insertions(+), 7666 deletions(-)
 create mode 100644 libVLC/.gitignore
 create mode 100644 libVLC/AndroidManifest.xml
 create mode 100644 libVLC/build.gradle
 create mode 100644 libVLC/build.xml
 create mode 100644 libVLC/jni/Android.mk
 create mode 100644 libVLC/jni/Application.mk
 create mode 100644 libVLC/jni/aout.c
 create mode 100644 libVLC/jni/aout.h
 create mode 100644 libVLC/jni/egl-android-info.txt
 create mode 100644 libVLC/jni/eventfd.c
 create mode 100644 libVLC/jni/libvlcjni-equalizer.c
 create mode 100644 libVLC/jni/libvlcjni-medialist.c
 create mode 100644 libVLC/jni/libvlcjni-track.c
 create mode 100644 libVLC/jni/libvlcjni-util.c
 create mode 100644 libVLC/jni/libvlcjni.c
 create mode 100644 libVLC/jni/log.h
 create mode 100644 libVLC/jni/native_crash_handler.c
 create mode 100644 libVLC/jni/native_crash_handler.h
 create mode 100644 libVLC/jni/pipe2.c
 create mode 100644 libVLC/jni/pthread-condattr.c
 create mode 100644 libVLC/jni/pthread-once.c
 create mode 100644 libVLC/jni/pthread-rwlocks.c
 create mode 100644 libVLC/jni/sem.c
 create mode 100644 libVLC/jni/thumbnailer.c
 create mode 100644 libVLC/jni/utils.h
 create mode 100644 libVLC/jni/vout.c
 create mode 100644 libVLC/jni/vout.h
 create mode 100644 libVLC/jni/wchar/wcpcpy.c
 create mode 100644 libVLC/jni/wchar/wcpncpy.c
 create mode 100644 libVLC/jni/wchar/wcscasecmp.c
 create mode 100644 libVLC/jni/wchar/wcscat.c
 create mode 100644 libVLC/jni/wchar/wcschr.c
 create mode 100644 libVLC/jni/wchar/wcscmp.c
 create mode 100644 libVLC/jni/wchar/wcscoll.c
 create mode 100644 libVLC/jni/wchar/wcscpy.c
 create mode 100644 libVLC/jni/wchar/wcscspn.c
 create mode 100644 libVLC/jni/wchar/wcsdup.c
 create mode 100644 libVLC/jni/wchar/wcslcat.c
 create mode 100644 libVLC/jni/wchar/wcslcpy.c
 create mode 100644 libVLC/jni/wchar/wcslen.c
 create mode 100644 libVLC/jni/wchar/wcsncasecmp.c
 create mode 100644 libVLC/jni/wchar/wcsncat.c
 create mode 100644 libVLC/jni/wchar/wcsncmp.c
 create mode 100644 libVLC/jni/wchar/wcsncpy.c
 create mode 100644 libVLC/jni/wchar/wcsnlen.c
 create mode 100644 libVLC/jni/wchar/wcspbrk.c
 create mode 100644 libVLC/jni/wchar/wcsrchr.c
 create mode 100644 libVLC/jni/wchar/wcsspn.c
 create mode 100644 libVLC/jni/wchar/wcsstr.c
 create mode 100644 libVLC/jni/wchar/wcstok.c
 create mode 100644 libVLC/jni/wchar/wcswidth.c
 create mode 100644 libVLC/jni/wchar/wcsxfrm.c
 create mode 100644 libVLC/jni/wchar/wmemchr.c
 create mode 100644 libVLC/jni/wchar/wmemcmp.c
 create mode 100644 libVLC/jni/wchar/wmemcpy.c
 create mode 100644 libVLC/jni/wchar/wmemmove.c
 create mode 100644 libVLC/jni/wchar/wmemset.c
 create mode 100644 libVLC/project.properties
 create mode 100644 libVLC/src/org/videolan/libvlc/AudioOutput.java
 create mode 100644 libVLC/src/org/videolan/libvlc/EventHandler.java
 create mode 100644 libVLC/src/org/videolan/libvlc/HWDecoderUtil.java
 create mode 100644 libVLC/src/org/videolan/libvlc/IVideoPlayer.java
 create mode 100644 libVLC/src/org/videolan/libvlc/LibVLC.java
 create mode 100644 libVLC/src/org/videolan/libvlc/LibVlcException.java
 create mode 100644 libVLC/src/org/videolan/libvlc/LibVlcUtil.java
 create mode 100644 libVLC/src/org/videolan/libvlc/Media.java
 create mode 100644 libVLC/src/org/videolan/libvlc/MediaList.java
 create mode 100644 libVLC/src/org/videolan/libvlc/TrackInfo.java
 delete mode 100644 vlc-android/jni/Android.mk
 delete mode 100644 vlc-android/jni/Application.mk
 delete mode 100644 vlc-android/jni/aout.c
 delete mode 100644 vlc-android/jni/aout.h
 delete mode 100644 vlc-android/jni/egl-android-info.txt
 delete mode 100644 vlc-android/jni/eventfd.c
 delete mode 100644 vlc-android/jni/libvlcjni-equalizer.c
 delete mode 100644 vlc-android/jni/libvlcjni-medialist.c
 delete mode 100644 vlc-android/jni/libvlcjni-track.c
 delete mode 100644 vlc-android/jni/libvlcjni-util.c
 delete mode 100644 vlc-android/jni/libvlcjni.c
 delete mode 100644 vlc-android/jni/log.h
 delete mode 100644 vlc-android/jni/native_crash_handler.c
 delete mode 100644 vlc-android/jni/native_crash_handler.h
 delete mode 100644 vlc-android/jni/pipe2.c
 delete mode 100644 vlc-android/jni/pthread-condattr.c
 delete mode 100644 vlc-android/jni/pthread-once.c
 delete mode 100644 vlc-android/jni/pthread-rwlocks.c
 delete mode 100644 vlc-android/jni/sem.c
 delete mode 100644 vlc-android/jni/thumbnailer.c
 delete mode 100644 vlc-android/jni/utils.h
 delete mode 100644 vlc-android/jni/vout.c
 delete mode 100644 vlc-android/jni/vout.h
 delete mode 100644 vlc-android/jni/wchar/wcpcpy.c
 delete mode 100644 vlc-android/jni/wchar/wcpncpy.c
 delete mode 100644 vlc-android/jni/wchar/wcscasecmp.c
 delete mode 100644 vlc-android/jni/wchar/wcscat.c
 delete mode 100644 vlc-android/jni/wchar/wcschr.c
 delete mode 100644 vlc-android/jni/wchar/wcscmp.c
 delete mode 100644 vlc-android/jni/wchar/wcscoll.c
 delete mode 100644 vlc-android/jni/wchar/wcscpy.c
 delete mode 100644 vlc-android/jni/wchar/wcscspn.c
 delete mode 100644 vlc-android/jni/wchar/wcsdup.c
 delete mode 100644 vlc-android/jni/wchar/wcslcat.c
 delete mode 100644 vlc-android/jni/wchar/wcslcpy.c
 delete mode 100644 vlc-android/jni/wchar/wcslen.c
 delete mode 100644 vlc-android/jni/wchar/wcsncasecmp.c
 delete mode 100644 vlc-android/jni/wchar/wcsncat.c
 delete mode 100644 vlc-android/jni/wchar/wcsncmp.c
 delete mode 100644 vlc-android/jni/wchar/wcsncpy.c
 delete mode 100644 vlc-android/jni/wchar/wcsnlen.c
 delete mode 100644 vlc-android/jni/wchar/wcspbrk.c
 delete mode 100644 vlc-android/jni/wchar/wcsrchr.c
 delete mode 100644 vlc-android/jni/wchar/wcsspn.c
 delete mode 100644 vlc-android/jni/wchar/wcsstr.c
 delete mode 100644 vlc-android/jni/wchar/wcstok.c
 delete mode 100644 vlc-android/jni/wchar/wcswidth.c
 delete mode 100644 vlc-android/jni/wchar/wcsxfrm.c
 delete mode 100644 vlc-android/jni/wchar/wmemchr.c
 delete mode 100644 vlc-android/jni/wchar/wmemcmp.c
 delete mode 100644 vlc-android/jni/wchar/wmemcpy.c
 delete mode 100644 vlc-android/jni/wchar/wmemmove.c
 delete mode 100644 vlc-android/jni/wchar/wmemset.c
 delete mode 100644 vlc-android/src/org/videolan/libvlc/AudioOutput.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/EventHandler.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/HWDecoderUtil.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/IVideoPlayer.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/LibVLC.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/LibVlcException.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/Media.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/MediaList.java
 delete mode 100644 vlc-android/src/org/videolan/libvlc/TrackInfo.java

diff --git a/.gitignore b/.gitignore
index ebc15f3..dc07876 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,4 @@ java-libs/appcompat/.project
 build/
 vlc-android/build/
 java-libs/WheelView/build/
+libVLC/build/
diff --git a/libVLC/.gitignore b/libVLC/.gitignore
new file mode 100644
index 0000000..cc7e761
--- /dev/null
+++ b/libVLC/.gitignore
@@ -0,0 +1,6 @@
+bin/
+gen/
+libs/
+obj/
+jni/libvlcjni.h
+.settings
diff --git a/libVLC/AndroidManifest.xml b/libVLC/AndroidManifest.xml
new file mode 100644
index 0000000..6a30350
--- /dev/null
+++ b/libVLC/AndroidManifest.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="org.videolan" android:versionCode="2" android:versionName="2.1">
+    <application>
+    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="21"/>
+</application>
+</manifest> 
diff --git a/libVLC/build.gradle b/libVLC/build.gradle
new file mode 100644
index 0000000..c820820
--- /dev/null
+++ b/libVLC/build.gradle
@@ -0,0 +1,33 @@
+apply plugin: 'com.android.library'
+
+android {
+    compileSdkVersion 21
+    buildToolsVersion "21.0.2"
+
+    sourceSets {
+    main {
+        jni.srcDirs = [] //this prevents gradle to build native code with ndk, we have our own MakeFile for it.
+        jniLibs.srcDir 'libs' //that's were generated .so files are put.
+        manifest.srcFile 'AndroidManifest.xml'
+        java.srcDirs = ['src']
+        resources.srcDirs = ['src']
+        aidl.srcDirs = ['src']
+        renderscript.srcDirs = ['src']
+        res.srcDirs = ['res']
+        assets.srcDirs = ['assets']
+    }
+    }
+
+    defaultConfig {
+        applicationId "org.videolan"
+        minSdkVersion 7
+        targetSdkVersion 21
+    }
+
+    buildTypes {
+        release {
+            runProguard false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+        }
+    }
+}
diff --git a/libVLC/build.xml b/libVLC/build.xml
new file mode 100644
index 0000000..65eae4e
--- /dev/null
+++ b/libVLC/build.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="libVLC" default="help">
+
+    <!-- The local.properties file is created and updated by the 'android' tool.
+         It contains the path to the SDK. It should *NOT* be checked into
+         Version Control Systems. -->
+    <property file="local.properties" />
+
+    <!-- The ant.properties file can be created by you. It is only edited by the
+         'android' tool to add properties to it.
+         This is the place to change some Ant specific build properties.
+         Here are some properties you may want to change/update:
+
+         source.dir
+             The name of the source directory. Default is 'src'.
+         out.dir
+             The name of the output directory. Default is 'bin'.
+
+         For other overridable properties, look at the beginning of the rules
+         files in the SDK, at tools/ant/build.xml
+
+         Properties related to the SDK location or the project target should
+         be updated using the 'android' tool with the 'update' action.
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems.
+
+         -->
+    <property file="ant.properties" />
+
+    <!-- if sdk.dir was not set from one of the property file, then
+         get it from the ANDROID_HOME env var.
+         This must be done before we load project.properties since
+         the proguard config can use sdk.dir -->
+    <property environment="env" />
+    <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+        <isset property="env.ANDROID_HOME" />
+    </condition>
+
+    <!-- The project.properties file is created and updated by the 'android'
+         tool, as well as ADT.
+
+         This contains project specific properties such as project target, and library
+         dependencies. Lower level build properties are stored in ant.properties
+         (or in .classpath for Eclipse projects).
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems. -->
+    <loadproperties srcFile="project.properties" />
+
+    <!-- quick check on sdk.dir -->
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+            unless="sdk.dir"
+    />
+
+    <!--
+        Import per project custom build rules if present at the root of the project.
+        This is the place to put custom intermediary targets such as:
+            -pre-build
+            -pre-compile
+            -post-compile (This is typically used for code obfuscation.
+                           Compiled code location: ${out.classes.absolute.dir}
+                           If this is not done in place, override ${out.dex.input.absolute.dir})
+            -post-package
+            -post-build
+            -pre-clean
+    -->
+    <import file="custom_rules.xml" optional="true" />
+
+    <!-- Import the actual build file.
+
+         To customize existing targets, there are two options:
+         - Customize only one target:
+             - copy/paste the target into this file, *before* the
+               <import> task.
+             - customize it to your needs.
+         - Customize the whole content of build.xml
+             - copy/paste the content of the rules files (minus the top node)
+               into this file, replacing the <import> task.
+             - customize to your needs.
+
+         ***********************
+         ****** IMPORTANT ******
+         ***********************
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+         in order to avoid having your file be overridden by tools such as "android update project"
+    -->
+    <!-- version-tag: 1 -->
+    <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
diff --git a/libVLC/jni/Android.mk b/libVLC/jni/Android.mk
new file mode 100644
index 0000000..0ce845e
--- /dev/null
+++ b/libVLC/jni/Android.mk
@@ -0,0 +1,151 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := libvlcjni
+
+LOCAL_SRC_FILES := libvlcjni.c libvlcjni-util.c libvlcjni-track.c libvlcjni-medialist.c aout.c vout.c libvlcjni-equalizer.c native_crash_handler.c
+LOCAL_SRC_FILES += thumbnailer.c
+ifneq ($(ANDROID_API),android-21)
+# compat functions not needed after android-21
+LOCAL_SRC_FILES += pthread-condattr.c pthread-rwlocks.c pthread-once.c eventfd.c sem.c pipe2.c
+endif
+LOCAL_SRC_FILES += wchar/wcpcpy.c
+LOCAL_SRC_FILES += wchar/wcpncpy.c
+LOCAL_SRC_FILES += wchar/wcscasecmp.c
+LOCAL_SRC_FILES += wchar/wcscat.c
+LOCAL_SRC_FILES += wchar/wcschr.c
+LOCAL_SRC_FILES += wchar/wcscmp.c
+LOCAL_SRC_FILES += wchar/wcscoll.c
+LOCAL_SRC_FILES += wchar/wcscpy.c
+LOCAL_SRC_FILES += wchar/wcscspn.c
+LOCAL_SRC_FILES += wchar/wcsdup.c
+LOCAL_SRC_FILES += wchar/wcslcat.c
+LOCAL_SRC_FILES += wchar/wcslcpy.c
+LOCAL_SRC_FILES += wchar/wcslen.c
+LOCAL_SRC_FILES += wchar/wcsncasecmp.c
+LOCAL_SRC_FILES += wchar/wcsncat.c
+LOCAL_SRC_FILES += wchar/wcsncmp.c
+LOCAL_SRC_FILES += wchar/wcsncpy.c
+LOCAL_SRC_FILES += wchar/wcsnlen.c
+LOCAL_SRC_FILES += wchar/wcspbrk.c
+LOCAL_SRC_FILES += wchar/wcsrchr.c
+LOCAL_SRC_FILES += wchar/wcsspn.c
+LOCAL_SRC_FILES += wchar/wcsstr.c
+LOCAL_SRC_FILES += wchar/wcstok.c
+LOCAL_SRC_FILES += wchar/wcswidth.c
+LOCAL_SRC_FILES += wchar/wcsxfrm.c
+LOCAL_SRC_FILES += wchar/wmemchr.c
+LOCAL_SRC_FILES += wchar/wmemcmp.c
+LOCAL_SRC_FILES += wchar/wmemcpy.c
+LOCAL_SRC_FILES += wchar/wmemmove.c
+LOCAL_SRC_FILES += wchar/wmemset.c
+
+
+LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include
+
+ARCH=$(ANDROID_ABI)
+
+CPP_STATIC=$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++$(CXXSTL)/libs/$(ARCH)/libgnustl_static.a
+
+LOCAL_CFLAGS := -std=gnu99
+ifeq ($(ARCH), armeabi)
+	LOCAL_CFLAGS += -DHAVE_ARMEABI
+	# Needed by ARMv6 Thumb1 (the System Control coprocessor/CP15 is mandatory on ARMv6)
+	# On newer ARM architectures we can use Thumb2
+	LOCAL_ARM_MODE := arm
+endif
+ifeq ($(ARCH), armeabi-v7a)
+	LOCAL_CFLAGS += -DHAVE_ARMEABI_V7A
+endif
+ifneq (,$(wildcard $(LOCAL_PATH)/../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c))
+	LOCAL_CFLAGS += -DHAVE_IOMX_DR
+endif
+LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
+	$(VLC_MODULES) \
+	$(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
+	$(VLC_BUILD_DIR)/src/.libs/libvlccore.a \
+	$(VLC_BUILD_DIR)/compat/.libs/libcompat.a \
+	-ldl -lz -lm -llog \
+	-ldvbpsi -lebml -lmatroska -ltag \
+	-logg -lFLAC -ltheora -lvorbis \
+	-lmpeg2 -la52 \
+	-lavformat -lavcodec -lswscale -lavutil -lpostproc -lgsm -lopenjpeg \
+	-lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \
+	-lspeex -lspeexdsp \
+	-lxml2 -lpng -lgnutls -lgcrypt -lgpg-error \
+	-lnettle -lhogweed -lgmp \
+	-lfreetype -liconv -lass -lfribidi -lopus \
+	-lEGL -lGLESv2 -ljpeg \
+	-ldvdnav -ldvdread -ldvdcss \
+	-lmad \
+	$(CPP_STATIC)
+
+include $(BUILD_SHARED_LIBRARY)
+
+# libiomx-* build
+
+LIBIOMX_SRC_FILES_COMMON := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
+LIBIOMX_INCLUDES_COMMON := $(VLC_SRC_DIR)/modules/codec/omxil
+LIBIOMX_LDLIBS_COMMON := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder -llog -lcutils -lui
+LIBIOMX_CFLAGS_COMMON := -Wno-psabi
+# Once we always build this with a version of vlc that contains nativewindowpriv.c,
+# we can remove this condition
+ifneq (,$(wildcard $(LOCAL_PATH)/../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c))
+LIBIOMX_SRC_FILES_COMMON += ../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c
+endif
+
+# no hwbuffer for gingerbread
+LIBIOMX_INCLUDES_gingerbread := $(LIBIOMX_INCLUDES_COMMON) \
+	$(ANDROID_SYS_HEADERS_GINGERBREAD)/frameworks/base/include \
+	$(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include \
+	$(ANDROID_SYS_HEADERS_GINGERBREAD)/hardware/libhardware/include
+LIBIOMX_LDLIBS_gingerbread := $(LIBIOMX_LDLIBS_COMMON)
+LIBIOMX_CFLAGS_gingerbread := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=10
+
+LIBIOMX_INCLUDES_hc := $(LIBIOMX_INCLUDES_COMMON) \
+	$(ANDROID_SYS_HEADERS_HC)/frameworks/base/include \
+	$(ANDROID_SYS_HEADERS_HC)/frameworks/base/native/include \
+	$(ANDROID_SYS_HEADERS_HC)/system/core/include \
+	$(ANDROID_SYS_HEADERS_HC)/hardware/libhardware/include
+LIBIOMX_LDLIBS_hc := $(LIBIOMX_LDLIBS_COMMON)
+LIBIOMX_CFLAGS_hc := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=13
+
+LIBIOMX_INCLUDES_ics := $(LIBIOMX_INCLUDES_COMMON) \
+	$(ANDROID_SYS_HEADERS_ICS)/frameworks/base/include \
+	$(ANDROID_SYS_HEADERS_ICS)/frameworks/base/native/include \
+	$(ANDROID_SYS_HEADERS_ICS)/system/core/include \
+	$(ANDROID_SYS_HEADERS_ICS)/hardware/libhardware/include
+LIBIOMX_LDLIBS_ics := $(LIBIOMX_LDLIBS_COMMON) $(LIBIOMX_LDLIBS_HWBUFFER)
+LIBIOMX_CFLAGS_ics := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=14
+
+LIBIOMX_SRC_FILES_jbmr2 := $(LIBIOMX_SRC_FILES_COMMON) $(LIBIOMX_SRC_FILES_HWBUFFER)
+LIBIOMX_INCLUDES_jbmr2 := $(LIBIOMX_INCLUDES_COMMON) \
+	$(ANDROID_SYS_HEADERS_JBMR2)/frameworks/native/include \
+	$(ANDROID_SYS_HEADERS_JBMR2)/frameworks/av/include \
+	$(ANDROID_SYS_HEADERS_JBMR2)/system/core/include \
+	$(ANDROID_SYS_HEADERS_JBMR2)/hardware/libhardware/include
+LIBIOMX_LDLIBS_jbmr2 := $(LIBIOMX_LDLIBS_COMMON) $(LIBIOMX_LDLIBS_HWBUFFER)
+LIBIOMX_CFLAGS_jbmr2 := $(LIBIOMX_CFLAGS_COMMON) $(LIBIOMX_CFLAGS_HWBUFFER) -DANDROID_API=18
+
+LIBIOMX_SRC_FILES_kk := $(LIBIOMX_SRC_FILES_COMMON) $(LIBIOMX_SRC_FILES_HWBUFFER)
+LIBIOMX_INCLUDES_kk := $(LIBIOMX_INCLUDES_COMMON) \
+	$(ANDROID_SYS_HEADERS_KK)/frameworks/native/include \
+	$(ANDROID_SYS_HEADERS_KK)/frameworks/av/include \
+	$(ANDROID_SYS_HEADERS_KK)/system/core/include \
+	$(ANDROID_SYS_HEADERS_KK)/hardware/libhardware/include
+LIBIOMX_LDLIBS_kk := $(LIBIOMX_LDLIBS_COMMON) $(LIBIOMX_LDLIBS_HWBUFFER)
+LIBIOMX_CFLAGS_kk := $(LIBIOMX_CFLAGS_COMMON) $(LIBIOMX_CFLAGS_HWBUFFER) -DANDROID_API=19
+
+define build_iomx
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(1)
+LOCAL_SRC_FILES  := $(LIBIOMX_SRC_FILES_COMMON)
+LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
+LOCAL_LDLIBS     := $(LIBIOMX_LDLIBS_$(2))
+LOCAL_CFLAGS     := $(LIBIOMX_CFLAGS_$(2))
+include $(BUILD_SHARED_LIBRARY)
+endef
+
+# call build_iomx for each libiomx-* in LIBVLC_LIBS
+$(foreach IOMX_MODULE,$(filter libiomx-%,$(LIBVLC_LIBS)), \
+	$(eval $(call build_iomx,$(IOMX_MODULE),$(subst libiomx-,,$(IOMX_MODULE)))))
diff --git a/libVLC/jni/Application.mk b/libVLC/jni/Application.mk
new file mode 100644
index 0000000..9e30f15
--- /dev/null
+++ b/libVLC/jni/Application.mk
@@ -0,0 +1,3 @@
+APP_PLATFORM := $(ANDROID_API)
+APP_ABI := $(ANDROID_ABI)
+NDK_TOOLCHAIN_VERSION=$(GCCVER)
diff --git a/libVLC/jni/aout.c b/libVLC/jni/aout.c
new file mode 100644
index 0000000..af13111
--- /dev/null
+++ b/libVLC/jni/aout.c
@@ -0,0 +1,259 @@
+/*****************************************************************************
+ * aout.c
+ *****************************************************************************
+ * Copyright © 2011-2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <stdint.h>
+
+#include <jni.h>
+
+#include <vlc/vlc.h>
+
+#include "aout.h"
+
+#define LOG_TAG "VLC/JNI/aout"
+#include "log.h"
+
+// An audio frame will contain FRAME_SIZE samples
+#define FRAME_SIZE (4096*2)
+
+typedef struct
+{
+    jobject j_libVlc;   /// Pointer to the LibVLC Java object
+    jmethodID play;     /// Java method to play audio buffers
+    jbyteArray buffer;  /// Raw audio data to be played
+} aout_sys_t;
+
+#define THREAD_NAME "jni_aout"
+extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
+extern void jni_detach_thread();
+
+int aout_open(void **opaque, char *format, unsigned *rate, unsigned *nb_channels)
+{
+    LOGI ("Opening the JNI audio output");
+
+    aout_sys_t *p_sys = calloc (1, sizeof (*p_sys));
+    if (!p_sys)
+        goto enomem;
+
+    p_sys->j_libVlc = *opaque;       // Keep a reference to our Java object
+    *opaque         = (void*) p_sys; // The callback will need aout_sys_t
+
+    LOGI ("Parameters: %u channels, FOURCC '%4.4s',  sample rate: %uHz",
+          *nb_channels, format, *rate);
+
+    JNIEnv *p_env;
+    if (jni_attach_thread (&p_env, THREAD_NAME) != 0)
+    {
+        LOGE("Could not attach the display thread to the JVM !");
+        goto eattach;
+    }
+
+    // Call the init function.
+    jclass cls = (*p_env)->GetObjectClass (p_env, p_sys->j_libVlc);
+    jmethodID methodIdInitAout = (*p_env)->GetMethodID (p_env, cls,
+                                                        "initAout", "(III)V");
+    if (!methodIdInitAout)
+    {
+        LOGE ("Method initAout() could not be found!");
+        goto error;
+    }
+
+    LOGV ("Number of channels forced to 2, number of samples to %d", FRAME_SIZE);
+    *nb_channels = 2;
+
+    int aout_rate = *rate;
+    while (1) {
+        (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, methodIdInitAout,
+                                  aout_rate, *nb_channels, FRAME_SIZE);
+        if ((*p_env)->ExceptionCheck (p_env) == 0) {
+            *rate = aout_rate;
+            break;
+        }
+
+        if (aout_rate <= 0) {
+            LOGE ("initAout failed, invalid sample rate %dHz", aout_rate);
+        } else if (aout_rate != 44100) {
+            if (aout_rate < 4000) {
+                do {
+                    aout_rate *= 2;
+                } while (aout_rate < 4000);
+            } else if (aout_rate > 48000) {
+                do {
+                    aout_rate /= 2;
+                } while (aout_rate > 48000);
+            } else {
+                aout_rate = 44100;
+            }
+
+            LOGE ("initAout failed, try next sample rate %dHz", aout_rate);
+            (*p_env)->ExceptionClear (p_env);
+            continue;
+        }
+
+        LOGE ("Unable to create audio player!");
+#ifndef NDEBUG
+        (*p_env)->ExceptionDescribe (p_env);
+#endif
+        (*p_env)->ExceptionClear (p_env);
+        goto error;
+    }
+
+    /* Create a new byte array to store the audio data. */
+    jbyteArray buffer = (*p_env)->NewByteArray (p_env,
+                                                   *nb_channels *
+                                                   FRAME_SIZE *
+                                                   sizeof (uint16_t) /* =2 */);
+    if (buffer == NULL)
+    {
+        LOGE ("Could not allocate the Java byte array to store the audio data!");
+        goto error;
+    }
+
+    /* Use a global reference to not reallocate memory each time we run
+       the play function. */
+    p_sys->buffer = (*p_env)->NewGlobalRef (p_env, buffer);
+    /* The local reference is no longer useful. */
+    (*p_env)->DeleteLocalRef (p_env, buffer);
+    if (p_sys->buffer == NULL)
+    {
+        LOGE ("Could not create the global reference!");
+        goto error;
+    }
+
+    // Get the play methodId
+    p_sys->play = (*p_env)->GetMethodID (p_env, cls, "playAudio", "([BI)V");
+    assert (p_sys->play != NULL);
+    jni_detach_thread ();
+    return 0;
+
+error:
+    jni_detach_thread ();
+eattach:
+    *opaque = NULL;
+    free (p_sys);
+enomem:
+    return -1;
+}
+
+/**
+ * Play an audio frame
+ **/
+void aout_play(void *opaque, const void *samples, unsigned count, int64_t pts)
+{
+    aout_sys_t *p_sys = opaque;
+    JNIEnv *p_env;
+
+    /* How ugly: we constantly attach/detach this thread to/from the JVM
+     * because it will be killed before aout_close is called.
+     * aout_close will actually be called in an different thread!
+     */
+    jni_attach_thread (&p_env, THREAD_NAME);
+
+    (*p_env)->SetByteArrayRegion (p_env, p_sys->buffer, 0,
+                                  2 /*nb_channels*/ * count * sizeof (uint16_t),
+                                  (jbyte*) samples);
+    if ((*p_env)->ExceptionCheck (p_env))
+    {
+        // This can happen if for some reason the size of the input buffer
+        // is larger than the size of the output buffer
+        LOGE ("An exception occurred while calling SetByteArrayRegion");
+        (*p_env)->ExceptionDescribe (p_env);
+        (*p_env)->ExceptionClear (p_env);
+        return;
+    }
+
+    (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, p_sys->play,
+                              p_sys->buffer,
+                              2 /*nb_channels*/ * count * sizeof (uint16_t),
+                              FRAME_SIZE);
+    // FIXME: check for errors
+
+    jni_detach_thread ();
+}
+
+void aout_pause(void *opaque, int64_t pts)
+{
+    LOGI ("Pausing audio output");
+    aout_sys_t *p_sys = opaque;
+    assert(p_sys);
+
+    JNIEnv *p_env;
+    jni_attach_thread (&p_env, THREAD_NAME);
+
+    // Call the pause function.
+    jclass cls = (*p_env)->GetObjectClass (p_env, p_sys->j_libVlc);
+    jmethodID methodIdPauseAout = (*p_env)->GetMethodID (p_env, cls, "pauseAout", "()V");
+    if (!methodIdPauseAout)
+        LOGE ("Method pauseAout() could not be found!");
+    (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, methodIdPauseAout);
+    if ((*p_env)->ExceptionCheck (p_env))
+    {
+        LOGE ("Unable to pause audio player!");
+#ifndef NDEBUG
+        (*p_env)->ExceptionDescribe (p_env);
+#endif
+        (*p_env)->ExceptionClear (p_env);
+    }
+
+    jni_detach_thread ();
+}
+
+void aout_close(void *opaque)
+{
+    LOGI ("Closing audio output");
+    aout_sys_t *p_sys = opaque;
+    assert(p_sys);
+    assert(p_sys->buffer);
+
+    JNIEnv *p_env;
+    jni_attach_thread (&p_env, THREAD_NAME);
+
+    // Call the close function.
+    jclass cls = (*p_env)->GetObjectClass (p_env, p_sys->j_libVlc);
+    jmethodID methodIdCloseAout = (*p_env)->GetMethodID (p_env, cls, "closeAout", "()V");
+    if (!methodIdCloseAout)
+        LOGE ("Method closeAout() could not be found!");
+    (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, methodIdCloseAout);
+    if ((*p_env)->ExceptionCheck (p_env))
+    {
+        LOGE ("Unable to close audio player!");
+#ifndef NDEBUG
+        (*p_env)->ExceptionDescribe (p_env);
+#endif
+        (*p_env)->ExceptionClear (p_env);
+    }
+
+    (*p_env)->DeleteGlobalRef (p_env, p_sys->buffer);
+    jni_detach_thread ();
+    free (p_sys);
+}
+
+int aout_get_native_sample_rate(void)
+{
+    JNIEnv *p_env;
+    jni_attach_thread (&p_env, THREAD_NAME);
+    jclass cls = (*p_env)->FindClass (p_env, "android/media/AudioTrack");
+    jmethodID method = (*p_env)->GetStaticMethodID (p_env, cls, "getNativeOutputSampleRate", "(I)I");
+    int sample_rate = (*p_env)->CallStaticIntMethod (p_env, cls, method, 3); // AudioManager.STREAM_MUSIC
+    jni_detach_thread ();
+    return sample_rate;
+}
diff --git a/libVLC/jni/aout.h b/libVLC/jni/aout.h
new file mode 100644
index 0000000..3fa3833
--- /dev/null
+++ b/libVLC/jni/aout.h
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * aout.h
+ *****************************************************************************
+ * Copyright © 2011-2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef LIBVLCJNI_AOUT_H
+#define LIBVLCJNI_AOUT_H
+
+#include <stdint.h>
+
+#define AOUT_AUDIOTRACK_JAVA 0
+#define AOUT_AUDIOTRACK      1
+#define AOUT_OPENSLES        2
+
+int aout_open(void **opaque, char *format, unsigned *rate, unsigned *nb_channels);
+void aout_play(void *opaque, const void *samples, unsigned count, int64_t pts);
+void aout_pause(void *opaque, int64_t pts);
+void aout_close(void *opaque);
+
+#endif // LIBVLCJNI_AOUT_H
diff --git a/libVLC/jni/egl-android-info.txt b/libVLC/jni/egl-android-info.txt
new file mode 100644
index 0000000..9aaa1bc
--- /dev/null
+++ b/libVLC/jni/egl-android-info.txt
@@ -0,0 +1,23 @@
+Some information to reuse in the future if needed the egl-android vout.
+
+// Linking options.
+-lGLES_v1_CM -lEGL -landroid
+
+
+#include <android/native_window_jni.h>
+
+// Native android window to display the video.
+ANativeWindow *p_nativeWindow;
+
+void Java_vlc_android_LibVLC_setSurface(JNIEnv *env, jobject thiz, jobject surface)
+{
+    p_nativeWindow = ANativeWindow_fromSurface(env, surface);
+}
+
+
+char psz_pWin[255];
+snprintf(psz_pWin, 255, "%i", p_nativeWindow);
+
+const char *argv[] = { ....,
+                      "--vout", "egl_android",
+                      "--egl-android-window", psz_pWin};
diff --git a/libVLC/jni/eventfd.c b/libVLC/jni/eventfd.c
new file mode 100644
index 0000000..37b0e7a
--- /dev/null
+++ b/libVLC/jni/eventfd.c
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * eventfd.c
+ *****************************************************************************
+ * Copyright © 2012 Rafaël Carré
+ * Copyright © 2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <sys/linux-syscalls.h>
+
+//#include <sys/syscall.h>
+int syscall(int number, ...);
+
+int eventfd(unsigned int initval, int flags)
+{
+    return syscall(__NR_eventfd2, initval, flags);
+}
diff --git a/libVLC/jni/libvlcjni-equalizer.c b/libVLC/jni/libvlcjni-equalizer.c
new file mode 100644
index 0000000..2dad0e4
--- /dev/null
+++ b/libVLC/jni/libvlcjni-equalizer.c
@@ -0,0 +1,120 @@
+/*****************************************************************************
+ * libvlcjni-equalizer.c
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <vlc/vlc.h>
+#include <vlc_common.h>
+
+#include <jni.h>
+
+#include "utils.h"
+
+#define LOG_TAG "VLC/JNI/Equalizer"
+#include "log.h"
+
+/**
+ * return band list as float[]
+ */
+jfloatArray Java_org_videolan_libvlc_LibVLC_getBands(JNIEnv *env, jobject thiz)
+{
+    unsigned count = libvlc_audio_equalizer_get_band_count();
+    jfloatArray bands = (*env)->NewFloatArray(env, count);
+
+    for (unsigned i = 0; i < count; ++i)
+    {
+        jfloat band = libvlc_audio_equalizer_get_band_frequency(i);
+        (*env)->SetFloatArrayRegion(env, bands, i, 1, &band);
+    }
+    return bands;
+}
+
+/**
+ * return preset list as String[]
+ */
+jobjectArray Java_org_videolan_libvlc_LibVLC_getPresets(JNIEnv *env, jobject thiz)
+{
+    unsigned count = libvlc_audio_equalizer_get_preset_count();
+    jclass stringClass = (*env)->FindClass(env, "java/lang/String");
+    jobjectArray presets = (*env)->NewObjectArray(env, count, stringClass, NULL);
+
+    for (unsigned i = 0; i < count; ++i)
+    {
+        const char *name = libvlc_audio_equalizer_get_preset_name(i);
+        jstring jname = (*env)->NewStringUTF(env, name);
+        (*env)->SetObjectArrayElement(env, presets, i, jname);
+    }
+    return presets;
+}
+
+/**
+ * return preset n° <index> as float[] (first element is preamp, then bands)
+ */
+jfloatArray Java_org_videolan_libvlc_LibVLC_getPreset(JNIEnv *env, jobject thiz, jint index)
+{
+    unsigned count = libvlc_audio_equalizer_get_band_count();
+    jfloatArray array = (*env)->NewFloatArray(env, count + 1);
+    libvlc_equalizer_t *p_equalizer = libvlc_audio_equalizer_new_from_preset(index);
+    if (p_equalizer != NULL)
+    {
+        jfloat preamp = libvlc_audio_equalizer_get_preamp(p_equalizer);
+        (*env)->SetFloatArrayRegion(env, array, 0, 1, &preamp);
+
+        for (unsigned i = 0; i < count; ++i)
+        {
+            jfloat band = libvlc_audio_equalizer_get_amp_at_index(p_equalizer, i);
+            (*env)->SetFloatArrayRegion(env, array, i + 1, 1, &band);
+        }
+        libvlc_audio_equalizer_release(p_equalizer);
+    }
+    return array;
+}
+
+/**
+ * apply equalizer settings (param bands is float[] (first element is preamp, then bands))
+ */
+//"--audio-filter=equalizer", "--equalizer-bands=-3.5 -4.5 -1 0 0 5 8 8 8 8",
+jint Java_org_videolan_libvlc_LibVLC_setNativeEqualizer(JNIEnv *env, jobject thiz, jlong media_player, jfloatArray bands)
+{
+    jint res = -1;
+    libvlc_media_player_t *mp = (libvlc_media_player_t*)(intptr_t)media_player;
+    if (!mp)
+        return res;
+
+    if (bands == NULL)
+        return libvlc_media_player_set_equalizer(mp, NULL);
+
+    jfloat *cbands = (*env)->GetFloatArrayElements(env, bands, NULL);
+    if (cbands == NULL)
+        return res;
+
+    jsize input_count = (*env)->GetArrayLength(env, bands);
+    unsigned band_count = libvlc_audio_equalizer_get_band_count();
+    if (input_count == band_count+1) // first item is preamp
+    {
+        libvlc_equalizer_t *p_equalizer = libvlc_audio_equalizer_new();
+        libvlc_audio_equalizer_set_preamp(p_equalizer, cbands[0]);
+        for (unsigned i = 0; i < band_count; ++i)
+        {
+            libvlc_audio_equalizer_set_amp_at_index(p_equalizer, cbands[i+1], i);
+        }
+        res = libvlc_media_player_set_equalizer(mp, p_equalizer);
+        libvlc_audio_equalizer_release(p_equalizer);
+    }
+    return res;
+}
diff --git a/libVLC/jni/libvlcjni-medialist.c b/libVLC/jni/libvlcjni-medialist.c
new file mode 100644
index 0000000..257fadc
--- /dev/null
+++ b/libVLC/jni/libvlcjni-medialist.c
@@ -0,0 +1,124 @@
+/*****************************************************************************
+ * libvlcjni-medialist.c
+ *****************************************************************************
+ * Copyright © 2013 VLC authors and VideoLAN
+ * Copyright © 2013 Edward Wang
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#include <jni.h>
+#include <vlc/vlc.h>
+#include <vlc/libvlc_media_list.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+#include "utils.h"
+#define LOG_TAG "VLC/JNI/MediaList"
+#include "log.h"
+
+struct stopped_monitor {
+    pthread_mutex_t doneMutex;
+    pthread_cond_t doneCondVar;
+    bool stopped;
+};
+
+static void stopped_callback(const libvlc_event_t *ev, void *data)
+{
+    struct stopped_monitor* monitor = data;
+    pthread_mutex_lock(&monitor->doneMutex);
+    monitor->stopped = true;
+    pthread_cond_signal(&monitor->doneCondVar);
+    pthread_mutex_unlock(&monitor->doneMutex);
+}
+
+static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, jobject arrayList, libvlc_media_t* p_md) {
+    if(!p_md) {
+        return -1;
+    }
+    libvlc_media_list_t* p_subitems = libvlc_media_subitems(p_md);
+    libvlc_media_release(p_md);
+    if(p_subitems) {
+        // Expand any subitems if needed
+        int subitem_count = libvlc_media_list_count(p_subitems);
+        if(subitem_count > 0) {
+            LOGD("Found %d subitems, expanding", subitem_count);
+            jclass arrayListClass; jmethodID methodAdd;
+            arrayListGetIDs(env, &arrayListClass, &methodAdd, NULL);
+
+            for(int i = subitem_count - 1; i >= 0; i--) {
+                libvlc_media_t* p_subitem = libvlc_media_list_item_at_index(p_subitems, i);
+                char* p_subitem_uri = libvlc_media_get_mrl(p_subitem);
+                arrayListStringAdd(env, arrayListClass, methodAdd, arrayList, p_subitem_uri);
+                free(p_subitem_uri);
+            }
+        }
+        libvlc_media_list_release(p_subitems);
+        if(subitem_count > 0) {
+            return 0;
+        } else {
+            return -1;
+        }
+    } else {
+        return -1;
+    }
+}
+
+jint Java_org_videolan_libvlc_MediaList_expandMedia(JNIEnv *env, jobject thiz, jobject libvlcJava, jint position, jobject children) {
+    return (jint)expand_media_internal(env,
+        (libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"),
+        children,
+        (libvlc_media_t*)libvlc_media_player_get_media((libvlc_media_player_t*)(intptr_t)getLong(env, libvlcJava, "mInternalMediaPlayerInstance"))
+        );
+}
+
+void Java_org_videolan_libvlc_MediaList_loadPlaylist(JNIEnv *env, jobject thiz, jobject libvlcJava, jstring mrl, jobject items) {
+    const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, NULL);
+
+    libvlc_media_t *p_md = libvlc_media_new_location((libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"), p_mrl);
+    libvlc_media_add_option(p_md, ":demux=playlist,none");
+    libvlc_media_add_option(p_md, ":run-time=1");
+
+    struct stopped_monitor* monitor = malloc(sizeof(struct stopped_monitor));
+    pthread_mutex_init(&monitor->doneMutex, NULL);
+    pthread_cond_init(&monitor->doneCondVar, NULL);
+    monitor->stopped = false;
+    pthread_mutex_lock(&monitor->doneMutex);
+
+    libvlc_media_player_t* p_mp = libvlc_media_player_new((libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"));
+    libvlc_media_player_set_video_title_display(p_mp, libvlc_position_disable, 0);
+    libvlc_event_manager_t* ev = libvlc_media_player_event_manager(p_mp);
+    libvlc_event_attach(ev, libvlc_MediaPlayerEndReached, stopped_callback, monitor);
+    libvlc_media_player_set_media(p_mp, p_md);
+    libvlc_media_player_play(p_mp);
+
+    struct timespec deadline;
+    clock_gettime(CLOCK_REALTIME, &deadline);
+    deadline.tv_sec += 2; /* If "VLC can't open the file", return */
+    int mp_alive = 1;
+    while(!(monitor->stopped) && mp_alive) {
+        pthread_cond_timedwait(&monitor->doneCondVar, &monitor->doneMutex, &deadline);
+        mp_alive = libvlc_media_player_will_play(p_mp);
+    }
+    pthread_mutex_unlock(&monitor->doneMutex);
+    pthread_mutex_destroy(&monitor->doneMutex);
+    pthread_cond_destroy(&monitor->doneCondVar);
+    free(monitor);
+
+    libvlc_media_player_release(p_mp);
+
+    expand_media_internal(env, (libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"), items, p_md);
+
+    (*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
+}
diff --git a/libVLC/jni/libvlcjni-track.c b/libVLC/jni/libvlcjni-track.c
new file mode 100644
index 0000000..eba0b5c
--- /dev/null
+++ b/libVLC/jni/libvlcjni-track.c
@@ -0,0 +1,462 @@
+/*****************************************************************************
+ * libvlcjni-track.c
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_fourcc.h>
+
+#include <jni.h>
+
+#include "utils.h"
+
+#define LOG_TAG "VLC/JNI/track"
+#include "log.h"
+
+struct length_change_monitor {
+    pthread_mutex_t doneMutex;
+    pthread_cond_t doneCondVar;
+    bool length_changed;
+};
+
+static void length_changed_callback(const libvlc_event_t *ev, void *data)
+{
+    struct length_change_monitor *monitor = data;
+    pthread_mutex_lock(&monitor->doneMutex);
+    monitor->length_changed = true;
+    pthread_cond_signal(&monitor->doneCondVar);
+    pthread_mutex_unlock(&monitor->doneMutex);
+}
+
+jboolean Java_org_videolan_libvlc_LibVLC_hasVideoTrack(JNIEnv *env, jobject thiz,
+                                                       jlong i_instance, jstring fileLocation)
+{
+    /* Create a new item and assign it to the media player. */
+    libvlc_media_t *p_m = new_media(i_instance, env, thiz, fileLocation, false, false);
+    if (p_m == NULL)
+    {
+        LOGE("Could not create the media!");
+        return JNI_FALSE;
+    }
+
+    /* Get the tracks information of the media. */
+    libvlc_media_parse(p_m);
+
+    libvlc_media_player_t* p_mp = libvlc_media_player_new_from_media(p_m);
+    libvlc_media_player_set_video_title_display(p_mp, libvlc_position_disable, 0);
+
+    struct length_change_monitor* monitor;
+    monitor = malloc(sizeof(struct length_change_monitor));
+    if (!monitor) return 0;
+
+    /* Initialize pthread variables. */
+    pthread_mutex_init(&monitor->doneMutex, NULL);
+    pthread_cond_init(&monitor->doneCondVar, NULL);
+    monitor->length_changed = false;
+
+    libvlc_event_manager_t *ev = libvlc_media_player_event_manager(p_mp);
+    libvlc_event_attach(ev, libvlc_MediaPlayerLengthChanged, length_changed_callback, monitor);
+    libvlc_media_player_play( p_mp );
+
+    pthread_mutex_lock(&monitor->doneMutex);
+
+    struct timespec deadline;
+    clock_gettime(CLOCK_REALTIME, &deadline);
+    deadline.tv_sec += 2; /* If "VLC can't open the file", return */
+    int mp_alive = 1;
+    while( !monitor->length_changed && mp_alive ) {
+        pthread_cond_timedwait(&monitor->doneCondVar, &monitor->doneMutex, &deadline);
+        mp_alive = libvlc_media_player_will_play(p_mp);
+    }
+    pthread_mutex_unlock(&monitor->doneMutex);
+
+    int i_nbTracks;
+    if( mp_alive )
+        i_nbTracks = libvlc_video_get_track_count(p_mp);
+    else
+        i_nbTracks = -1;
+    LOGI("Number of video tracks: %d",i_nbTracks);
+
+    libvlc_event_detach(ev, libvlc_MediaPlayerLengthChanged, length_changed_callback, monitor);
+    libvlc_media_player_stop(p_mp);
+    libvlc_media_player_release(p_mp);
+    libvlc_media_release(p_m);
+
+    pthread_mutex_destroy(&monitor->doneMutex);
+    pthread_cond_destroy(&monitor->doneCondVar);
+    free(monitor);
+
+    if(i_nbTracks > 0)
+        return JNI_TRUE;
+    else if(i_nbTracks < 0)
+        (*env)->ThrowNew(env, (*env)->FindClass(env, "java/io/IOException"), "VLC can't open the file");
+    else
+        return JNI_FALSE;
+}
+
+jobjectArray read_track_info_internal(JNIEnv *env, jobject thiz, libvlc_media_t* p_m)
+{
+    /* get java class */
+    jclass cls = (*env)->FindClass( env, "org/videolan/libvlc/TrackInfo" );
+    if ( !cls )
+    {
+        LOGE("Failed to load class (org/videolan/libvlc/TrackInfo)" );
+        return NULL;
+    }
+
+    /* get java class contructor */
+    jmethodID clsCtor = (*env)->GetMethodID( env, cls, "<init>", "()V" );
+    if ( !clsCtor )
+    {
+        LOGE("Failed to find class constructor (org/videolan/libvlc/TrackInfo)" );
+        return NULL;
+    }
+
+    /* Get the tracks information of the media. */
+    libvlc_media_track_t **p_tracks;
+
+    int i_nbTracks = libvlc_media_tracks_get(p_m, &p_tracks);
+    jobjectArray array = (*env)->NewObjectArray(env, i_nbTracks + 1, cls, NULL);
+
+    unsigned i;
+    if (array != NULL)
+    {
+        for (i = 0; i <= i_nbTracks; ++i)
+        {
+            jobject item = (*env)->NewObject(env, cls, clsCtor);
+            if (item == NULL)
+                continue;
+            (*env)->SetObjectArrayElement(env, array, i, item);
+
+            // use last track for metadata
+            if (i == i_nbTracks)
+            {
+                setInt(env, item, "Type", 3 /* TYPE_META */);
+                setLong(env, item, "Length", libvlc_media_get_duration(p_m));
+                setString(env, item, "Title", libvlc_media_get_meta(p_m, libvlc_meta_Title));
+                setString(env, item, "Artist", libvlc_media_get_meta(p_m, libvlc_meta_Artist));
+                setString(env, item, "Album", libvlc_media_get_meta(p_m, libvlc_meta_Album));
+                setString(env, item, "Genre", libvlc_media_get_meta(p_m, libvlc_meta_Genre));
+                setString(env, item, "ArtworkURL", libvlc_media_get_meta(p_m, libvlc_meta_ArtworkURL));
+                continue;
+            }
+
+            setInt(env, item, "Id", p_tracks[i]->i_id);
+            setInt(env, item, "Type", p_tracks[i]->i_type);
+            setString(env, item, "Codec", (const char*)vlc_fourcc_GetDescription(0,p_tracks[i]->i_codec));
+            setString(env, item, "Language", p_tracks[i]->psz_language);
+            setInt(env, item, "Bitrate", p_tracks[i]->i_bitrate);
+
+            if (p_tracks[i]->i_type == libvlc_track_video)
+            {
+                setInt(env, item, "Height", p_tracks[i]->video->i_height);
+                setInt(env, item, "Width", p_tracks[i]->video->i_width);
+                setFloat(env, item, "Framerate", (float)p_tracks[i]->video->i_frame_rate_num / p_tracks[i]->video->i_frame_rate_den);
+            }
+            if (p_tracks[i]->i_type == libvlc_track_audio)
+            {
+                setInt(env, item, "Channels", p_tracks[i]->audio->i_channels);
+                setInt(env, item, "Samplerate", p_tracks[i]->audio->i_rate);
+            }
+        }
+    }
+
+    libvlc_media_tracks_release(p_tracks, i_nbTracks);
+    return array;
+}
+
+jobjectArray Java_org_videolan_libvlc_LibVLC_readTracksInfo(JNIEnv *env, jobject thiz,
+                                                            jlong instance, jstring mrl)
+{
+    /* Create a new item and assign it to the media player. */
+    libvlc_media_t *p_m = new_media(instance, env, thiz, mrl, false, false);
+    if (p_m == NULL)
+    {
+        LOGE("Could not create the media!");
+        return NULL;
+    }
+
+    libvlc_media_parse(p_m);
+    jobjectArray jar = read_track_info_internal(env, thiz, p_m);
+    libvlc_media_release(p_m);
+    return jar;
+}
+
+
+jobjectArray Java_org_videolan_libvlc_LibVLC_readTracksInfoInternal(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz);
+    if (p_mp == NULL) {
+        LOGE("No media player!");
+        return NULL;
+    }
+    libvlc_media_t *p_m = libvlc_media_player_get_media(p_mp);
+    if (p_m == NULL) {
+        LOGE("Could not load internal media!");
+        return NULL;
+    } else
+        return read_track_info_internal(env, thiz, p_m);
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getAudioTracksCount(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jint) libvlc_audio_get_track_count(mp);
+    return -1;
+}
+
+jobject Java_org_videolan_libvlc_LibVLC_getAudioTrackDescription(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (!mp)
+        return NULL;
+
+    int i_nbTracks = libvlc_audio_get_track_count(mp) - 1;
+    if (i_nbTracks < 0)
+        i_nbTracks = 0;
+    jclass mapClass = (*env)->FindClass(env, "java/util/Map");
+    jclass hashMapClass = (*env)->FindClass(env, "java/util/HashMap");
+    jmethodID mapPut = (*env)->GetMethodID(env, mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+    /*
+     * "What are you building? Lay your hand on it. Where is it?"
+     * We need a concrete map to start
+     */
+    jmethodID mapInit = (*env)->GetMethodID(env, hashMapClass, "<init>", "()V");
+    jclass integerCls = (*env)->FindClass(env, "java/lang/Integer");
+    jmethodID integerConstructor = (*env)->GetMethodID(env, integerCls, "<init>", "(I)V");
+
+    jobject audioTrackMap = (*env)->NewObject(env, hashMapClass, mapInit);
+
+    libvlc_track_description_t *first = libvlc_audio_get_track_description(mp);
+    libvlc_track_description_t *desc = first != NULL ? first->p_next : NULL;
+    unsigned i;
+    for (i = 0; i < i_nbTracks; ++i)
+    {
+        // store audio track ID and name in a map as <ID, Track Name>
+        jobject track_id = (*env)->NewObject(env, integerCls, integerConstructor, desc->i_id);
+        jstring name = (*env)->NewStringUTF(env, desc->psz_name);
+        (*env)->CallObjectMethod(env, audioTrackMap, mapPut, track_id, name);
+        desc = desc->p_next;
+    }
+    libvlc_track_description_list_release(first);
+
+    // Clean up local references
+    (*env)->DeleteLocalRef(env, mapClass);
+    (*env)->DeleteLocalRef(env, hashMapClass);
+    (*env)->DeleteLocalRef(env, integerCls);
+
+    return audioTrackMap;
+}
+
+jobject Java_org_videolan_libvlc_LibVLC_getStats(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (!mp)
+        return NULL;
+
+    libvlc_media_t *p_mp = libvlc_media_player_get_media(mp);
+    if (!p_mp)
+        return NULL;
+
+    libvlc_media_stats_t p_stats;
+    libvlc_media_get_stats(p_mp, &p_stats);
+
+    jclass mapClass = (*env)->FindClass(env, "java/util/Map");
+    jclass hashMapClass = (*env)->FindClass(env, "java/util/HashMap");
+    jmethodID mapPut = (*env)->GetMethodID(env, mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+    /* We need a concrete map to start */
+    jmethodID mapInit = (*env)->GetMethodID(env, hashMapClass, "<init>", "()V");
+    jclass integerCls = (*env)->FindClass(env, "java/lang/Integer");
+    jmethodID integerConstructor = (*env)->GetMethodID(env, integerCls, "<init>", "(I)V");
+    jclass floatCls = (*env)->FindClass(env, "java/lang/Float");
+    jmethodID floatConstructor = (*env)->GetMethodID(env, floatCls, "<init>", "(F)V");
+
+    jobject statistics = (*env)->NewObject(env, hashMapClass, mapInit);
+    jobject value = (*env)->NewObject(env, floatCls, floatConstructor, p_stats.f_demux_bitrate);
+    jstring name = (*env)->NewStringUTF(env, "demuxBitrate");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, floatCls, floatConstructor, p_stats.f_input_bitrate);
+    name = (*env)->NewStringUTF(env, "inputBitrate");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, floatCls, floatConstructor, p_stats.f_send_bitrate);
+    name = (*env)->NewStringUTF(env, "sendBitrate");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_decoded_audio);
+    name = (*env)->NewStringUTF(env, "decodedAudio");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_decoded_video);
+    name = (*env)->NewStringUTF(env, "decodedVideo");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_demux_corrupted);
+    name = (*env)->NewStringUTF(env, "demuxCorrupted");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_demux_discontinuity);
+    name = (*env)->NewStringUTF(env, "demuxDiscontinuity");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_demux_read_bytes);
+    name = (*env)->NewStringUTF(env, "demuxReadBytes");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_displayed_pictures);
+    name = (*env)->NewStringUTF(env, "displayedPictures");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_lost_abuffers);
+    name = (*env)->NewStringUTF(env, "lostAbuffers");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_lost_pictures);
+    name = (*env)->NewStringUTF(env, "lostPictures");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_played_abuffers);
+    name = (*env)->NewStringUTF(env, "playedAbuffers");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_read_bytes);
+    name = (*env)->NewStringUTF(env, "readBytes");
+    (*env)->CallObjectMethod(env, statistics, mapPut, value, name);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_sent_bytes);
+    name = (*env)->NewStringUTF(env, "sentBytes");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_sent_packets);
+    name = (*env)->NewStringUTF(env, "sentPackets");
+    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
+
+    // Clean up local references
+    (*env)->DeleteLocalRef(env, mapClass);
+    (*env)->DeleteLocalRef(env, hashMapClass);
+    (*env)->DeleteLocalRef(env, integerCls);
+    (*env)->DeleteLocalRef(env, floatCls);
+
+    return statistics;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getAudioTrack(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_audio_get_track(mp);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_setAudioTrack(JNIEnv *env, jobject thiz, jint index)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_audio_set_track(mp, index);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getVideoTracksCount(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jint) libvlc_video_get_track_count(mp);
+    return -1;
+}
+
+jobject Java_org_videolan_libvlc_LibVLC_getSpuTrackDescription(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (!mp)
+        return NULL;
+
+    int i_nbTracks = libvlc_video_get_spu_count(mp);
+    jclass mapClass = (*env)->FindClass(env, "java/util/Map");
+    jclass hashMapClass = (*env)->FindClass(env, "java/util/HashMap");
+    jmethodID mapPut = (*env)->GetMethodID(env, mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+    /*
+     * "What are you building? Lay your hand on it. Where is it?"
+     * We need a concrete map to start
+     */
+    jmethodID mapInit = (*env)->GetMethodID(env, hashMapClass, "<init>", "()V");
+    jclass integerCls = (*env)->FindClass(env, "java/lang/Integer");
+    jmethodID integerConstructor = (*env)->GetMethodID(env, integerCls, "<init>", "(I)V");
+
+    jobject spuTrackMap = (*env)->NewObject(env, hashMapClass, mapInit);
+
+    libvlc_track_description_t *first = libvlc_video_get_spu_description(mp);
+    libvlc_track_description_t *desc = first;
+    unsigned i;
+    for (i = 0; i < i_nbTracks; ++i)
+    {
+        // store audio track ID and name in a map as <ID, Track Name>
+        jobject track_id = (*env)->NewObject(env, integerCls, integerConstructor, desc->i_id);
+        jstring name = (*env)->NewStringUTF(env, desc->psz_name);
+        (*env)->CallObjectMethod(env, spuTrackMap, mapPut, track_id, name);
+        desc = desc->p_next;
+    }
+    libvlc_track_description_list_release(first);
+
+    // Clean up local references
+    (*env)->DeleteLocalRef(env, mapClass);
+    (*env)->DeleteLocalRef(env, hashMapClass);
+    (*env)->DeleteLocalRef(env, integerCls);
+
+    return spuTrackMap;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getSpuTracksCount(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jint) libvlc_video_get_spu_count(mp);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getSpuTrack(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_video_get_spu(mp);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_setSpuTrack(JNIEnv *env, jobject thiz, jint index)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_video_set_spu(mp, index);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_addSubtitleTrack(JNIEnv *env, jobject thiz, jstring path)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp) {
+        jboolean isCopy;
+        const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
+        jint res = libvlc_video_set_subtitle_file(mp, psz_path);
+        (*env)->ReleaseStringUTFChars(env, path, psz_path);
+        return res;
+    } else {
+        return -1;
+    }
+}
diff --git a/libVLC/jni/libvlcjni-util.c b/libVLC/jni/libvlcjni-util.c
new file mode 100644
index 0000000..205d59d
--- /dev/null
+++ b/libVLC/jni/libvlcjni-util.c
@@ -0,0 +1,330 @@
+/*****************************************************************************
+ * libvlcjni-util.c
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <dirent.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_url.h>
+
+#include <jni.h>
+
+#define LOG_TAG "VLC/JNI/Util"
+#include "log.h"
+
+static jobject debugBufferInstance = NULL;
+
+// FIXME: use atomics
+static bool buffer_logging;
+
+#define THREAD_NAME "libvlcjni-util"
+extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
+extern void jni_detach_thread();
+extern int jni_get_env(JNIEnv **env);
+
+jint getInt(JNIEnv *env, jobject thiz, const char* field) {
+    jclass clazz = (*env)->GetObjectClass(env, thiz);
+    jfieldID fieldMP = (*env)->GetFieldID(env, clazz,
+                                          field, "I");
+    return (*env)->GetIntField(env, thiz, fieldMP);
+}
+void setInt(JNIEnv *env, jobject item, const char* field, jint value) {
+    jclass cls;
+    jfieldID fieldId;
+
+    /* Get a reference to item's class */
+    cls = (*env)->GetObjectClass(env, item);
+
+    /* Look for the instance field s in cls */
+    fieldId = (*env)->GetFieldID(env, cls, field, "I");
+    if (fieldId == NULL)
+        return;
+
+    (*env)->SetIntField(env, item, fieldId, value);
+}
+
+jlong getLong(JNIEnv *env, jobject thiz, const char* field) {
+    jclass clazz = (*env)->GetObjectClass(env, thiz);
+    jfieldID fieldMP = (*env)->GetFieldID(env, clazz,
+                                          field, "J");
+    return (*env)->GetLongField(env, thiz, fieldMP);
+}
+void setLong(JNIEnv *env, jobject item, const char* field, jlong value) {
+    jclass cls;
+    jfieldID fieldId;
+
+    /* Get a reference to item's class */
+    cls = (*env)->GetObjectClass(env, item);
+
+    /* Look for the instance field s in cls */
+    fieldId = (*env)->GetFieldID(env, cls, field, "J");
+    if (fieldId == NULL)
+        return;
+
+    (*env)->SetLongField(env, item, fieldId, value);
+}
+
+void setFloat(JNIEnv *env, jobject item, const char* field, jfloat value) {
+    jclass cls;
+    jfieldID fieldId;
+
+    /* Get a reference to item's class */
+    cls = (*env)->GetObjectClass(env, item);
+
+    /* Look for the instance field s in cls */
+    fieldId = (*env)->GetFieldID(env, cls, field, "F");
+    if (fieldId == NULL)
+        return;
+
+    (*env)->SetFloatField(env, item, fieldId, value);
+}
+void setString(JNIEnv *env, jobject item, const char* field, const char* text) {
+    jclass cls;
+    jfieldID fieldId;
+    jstring jstr;
+
+    /* Get a reference to item's class */
+    cls = (*env)->GetObjectClass(env, item);
+
+    /* Look for the instance field s in cls */
+    fieldId = (*env)->GetFieldID(env, cls, field, "Ljava/lang/String;");
+    if (fieldId == NULL)
+        return;
+
+    /* Create a new string and overwrite the instance field */
+    jstr = (*env)->NewStringUTF(env, text);
+    if (jstr == NULL)
+        return;
+    (*env)->SetObjectField(env, item, fieldId, jstr);
+}
+
+void arrayListGetIDs(JNIEnv *env, jclass* p_class, jmethodID* p_add, jmethodID* p_remove) {
+    *p_class = (*env)->FindClass(env, "java/util/ArrayList");
+    if(p_add)
+        *p_add = (*env)->GetMethodID(env, *p_class, "add", "(Ljava/lang/Object;)Z");
+    if(p_remove)
+        *p_remove = (*env)->GetMethodID(env, *p_class, "remove", "(I)Ljava/lang/Object;");
+}
+
+void arrayListStringAdd(JNIEnv *env, jclass class, jmethodID methodID, jobject arrayList, const char* str) {
+    jstring jstr = (*env)->NewStringUTF(env, str);
+    (*env)->CallBooleanMethod(env, arrayList, methodID, jstr);
+    (*env)->DeleteLocalRef(env, jstr);
+}
+
+jobject getEventHandlerReference(JNIEnv *env, jobject thiz, jobject eventHandler)
+{
+    jclass cls = (*env)->GetObjectClass(env, eventHandler);
+    if (!cls) {
+        LOGE("setEventHandler: failed to get class reference");
+        return NULL;
+    }
+
+    jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");
+    if (!methodID) {
+        LOGE("setEventHandler: failed to get the callback method");
+        return NULL;
+    }
+
+    return (*env)->NewGlobalRef(env, eventHandler);
+}
+
+static void debug_buffer_log(void *data, int level, const char *fmt, va_list ap)
+{
+    bool isAttached = false;
+    JNIEnv *env = NULL;
+
+    if (jni_get_env(&env) < 0) {
+        if (jni_attach_thread(&env, THREAD_NAME) < 0)
+            return;
+        isAttached = true;
+    }
+
+    /* Prepare message string */
+    char* psz_fmt_newline = malloc(strlen(fmt) + 2);
+    if(!psz_fmt_newline)
+        return;
+    strcpy(psz_fmt_newline, fmt);
+    strcat(psz_fmt_newline, "\n");
+    char* psz_msg = NULL;
+    int res = vasprintf(&psz_msg, psz_fmt_newline, ap);
+    free(psz_fmt_newline);
+    if(res < 0)
+        return;
+
+    jobject buffer = debugBufferInstance;
+    jclass buffer_class = (*env)->FindClass(env, "java/lang/StringBuffer");
+    jmethodID bufferAppendID = (*env)->GetMethodID(env, buffer_class, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
+
+    jstring message = (*env)->NewStringUTF(env, psz_msg);
+    (*env)->CallObjectMethod(env, buffer, bufferAppendID, message);
+    (*env)->DeleteLocalRef(env, message);
+    free(psz_msg);
+
+    if (isAttached)
+        jni_detach_thread();
+}
+
+void debug_log(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_list ap)
+{
+    bool *verbose = data;
+
+    static const uint8_t priority[5] = {
+        [LIBVLC_DEBUG]   = ANDROID_LOG_DEBUG,
+        [1 /* ??? */]    = ANDROID_LOG_DEBUG,
+        [LIBVLC_NOTICE]  = ANDROID_LOG_INFO,
+        [LIBVLC_WARNING] = ANDROID_LOG_WARN,
+        [LIBVLC_ERROR]   = ANDROID_LOG_ERROR,
+    };
+
+    int prio = ANDROID_LOG_DEBUG;
+    if (level >= LIBVLC_DEBUG && level <= LIBVLC_ERROR)
+        prio = priority[level];
+
+    /* Quit if we are not doing anything */
+    if(!buffer_logging && (!(*verbose) && prio < ANDROID_LOG_ERROR))
+        return;
+
+    /* Add emitting module & type */
+    char* fmt2 = NULL;
+    if(asprintf(&fmt2, "%s %s: %s", ctx->psz_module, ctx->psz_object_type, fmt) < 0)
+        return;
+
+    if (buffer_logging) {
+        va_list aq;
+        va_copy(aq, ap);
+        debug_buffer_log(data, level, fmt2, aq);
+        va_end(aq);
+    }
+
+    __android_log_vprint(prio, "VLC", fmt2, ap);
+    free(fmt2);
+}
+
+void Java_org_videolan_libvlc_LibVLC_startDebugBuffer(JNIEnv *env, jobject thiz)
+{
+    jclass libVLC_class = (*env)->FindClass(env, "org/videolan/libvlc/LibVLC");
+    jmethodID getInstance = (*env)->GetStaticMethodID(env, libVLC_class, "getInstance", "()Lorg/videolan/libvlc/LibVLC;");
+    jobject libvlcj = (*env)->CallStaticObjectMethod(env, libVLC_class, getInstance);
+
+    jfieldID bufferID = (*env)->GetFieldID(env, libVLC_class, "mDebugLogBuffer", "Ljava/lang/StringBuffer;");
+    jobject buffer = (*env)->GetObjectField(env, libvlcj, bufferID);
+
+    debugBufferInstance = (*env)->NewGlobalRef(env, buffer);
+    (*env)->DeleteLocalRef(env, buffer);
+
+    jfieldID buffer_flag = (*env)->GetFieldID(env, libVLC_class, "mIsBufferingLog", "Z");
+    (*env)->SetBooleanField(env, libvlcj, buffer_flag, JNI_TRUE);
+
+    (*env)->DeleteLocalRef(env, libVLC_class);
+    (*env)->DeleteLocalRef(env, libvlcj);
+    buffer_logging = true;
+}
+
+void Java_org_videolan_libvlc_LibVLC_stopDebugBuffer(JNIEnv *env, jobject thiz)
+{
+    buffer_logging = false;
+    jclass libVLC_class = (*env)->FindClass(env, "org/videolan/libvlc/LibVLC");
+    jmethodID getInstance = (*env)->GetStaticMethodID(env, libVLC_class, "getInstance", "()Lorg/videolan/libvlc/LibVLC;");
+    jobject libvlcj = (*env)->CallStaticObjectMethod(env, libVLC_class, getInstance);
+
+    (*env)->DeleteGlobalRef(env, debugBufferInstance);
+
+    jfieldID buffer_flag = (*env)->GetFieldID(env, libVLC_class, "mIsBufferingLog", "Z");
+    (*env)->SetBooleanField(env, libvlcj, buffer_flag, JNI_FALSE);
+
+    (*env)->DeleteLocalRef(env, libVLC_class);
+    (*env)->DeleteLocalRef(env, libvlcj);
+}
+
+jstring Java_org_videolan_libvlc_LibVLC_nativeToURI(JNIEnv *env, jobject thiz, jstring path)
+{
+    jboolean isCopy;
+    /* Get C string */
+    const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
+    /* Convert the path to URI */
+    char* psz_location;
+    if(unlikely( strstr( psz_path, "://" ) ))
+        psz_location = strdup(psz_path);
+    else
+        psz_location = vlc_path2uri(psz_path, "file");
+    /* Box into jstring */
+    jstring t = (*env)->NewStringUTF(env, psz_location);
+    /* Clean up */
+    (*env)->ReleaseStringUTFChars(env, path, psz_path);
+    free(psz_location);
+    return t;
+}
+
+void Java_org_videolan_libvlc_LibVLC_nativeReadDirectory(JNIEnv *env, jobject thiz, jstring path, jobject arrayList)
+{
+    jboolean isCopy;
+    /* Get C string */
+    const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
+
+    DIR* p_dir = opendir(psz_path);
+    (*env)->ReleaseStringUTFChars(env, path, psz_path);
+    if(!p_dir)
+        return;
+
+    jclass arrayClass = (*env)->FindClass(env, "java/util/ArrayList");
+    jmethodID methodID = (*env)->GetMethodID(env, arrayClass, "add", "(Ljava/lang/Object;)Z");
+
+    struct dirent* p_dirent;
+    jstring str;
+    while(1) {
+        errno = 0;
+        p_dirent = readdir(p_dir);
+        if(p_dirent == NULL) {
+            if(errno > 0) /* error reading this entry */
+                continue;
+            else if(errno == 0) /* end of stream */
+                break;
+        }
+        str = (*env)->NewStringUTF(env, p_dirent->d_name);
+        (*env)->CallBooleanMethod(env, arrayList, methodID, str);
+        (*env)->DeleteLocalRef(env, str);
+    }
+    closedir(p_dir);
+}
+
+jboolean Java_org_videolan_libvlc_LibVLC_nativeIsPathDirectory(JNIEnv *env, jobject thiz, jstring path)
+{
+    jboolean isCopy;
+    /* Get C string */
+    const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
+
+    jboolean isDirectory;
+    struct stat buf;
+    if(stat(psz_path, &buf) != 0)
+        /* couldn't stat */
+        isDirectory = JNI_FALSE;
+    else {
+        if(S_ISDIR(buf.st_mode))
+            isDirectory = JNI_TRUE;
+        else
+            isDirectory = JNI_FALSE;
+    }
+
+    (*env)->ReleaseStringUTFChars(env, path, psz_path);
+    return isDirectory;
+}
diff --git a/libVLC/jni/libvlcjni.c b/libVLC/jni/libvlcjni.c
new file mode 100644
index 0000000..1ab151c
--- /dev/null
+++ b/libVLC/jni/libvlcjni.c
@@ -0,0 +1,632 @@
+/*****************************************************************************
+ * libvlcjni.c
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <dirent.h>
+#include <errno.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_url.h>
+
+#include <jni.h>
+
+#include <android/api-level.h>
+
+#include "libvlcjni.h"
+#include "aout.h"
+#include "vout.h"
+#include "utils.h"
+#include "native_crash_handler.h"
+
+#define VOUT_ANDROID_SURFACE 0
+#define VOUT_OPENGLES2       1
+
+#define LOG_TAG "VLC/JNI/main"
+#include "log.h"
+
+#ifdef HAVE_IOMX_DR
+#define NO_IOMX_DR "--no-omxil-dr"
+#else
+#define NO_IOMX_DR ""
+#endif
+
+#define VLC_JNI_VERSION JNI_VERSION_1_2
+
+#define THREAD_NAME "libvlcjni"
+int jni_attach_thread(JNIEnv **env, const char *thread_name);
+void jni_detach_thread();
+int jni_get_env(JNIEnv **env);
+
+static void add_media_options(libvlc_media_t *p_md, JNIEnv *env, jobjectArray mediaOptions)
+{
+    int stringCount = (*env)->GetArrayLength(env, mediaOptions);
+    for(int i = 0; i < stringCount; i++)
+    {
+        jstring option = (jstring)(*env)->GetObjectArrayElement(env, mediaOptions, i);
+        const char* p_st = (*env)->GetStringUTFChars(env, option, 0);
+        libvlc_media_add_option(p_md, p_st); // option
+        (*env)->ReleaseStringUTFChars(env, option, p_st);
+    }
+}
+
+libvlc_media_t *new_media(jlong instance, JNIEnv *env, jobject thiz, jstring fileLocation, bool noOmx, bool noVideo)
+{
+    libvlc_instance_t *libvlc = (libvlc_instance_t*)(intptr_t)instance;
+    jboolean isCopy;
+    const char *psz_location = (*env)->GetStringUTFChars(env, fileLocation, &isCopy);
+    libvlc_media_t *p_md = libvlc_media_new_location(libvlc, psz_location);
+    (*env)->ReleaseStringUTFChars(env, fileLocation, psz_location);
+    if (!p_md)
+        return NULL;
+
+    jclass cls = (*env)->GetObjectClass(env, thiz);
+    jmethodID methodId = (*env)->GetMethodID(env, cls, "getMediaOptions", "(ZZ)[Ljava/lang/String;");
+    if (methodId != NULL)
+    {
+        jobjectArray mediaOptions = (*env)->CallObjectMethod(env, thiz, methodId, noOmx, noVideo);
+        if (mediaOptions != NULL)
+        {
+            add_media_options(p_md, env, mediaOptions);
+            (*env)->DeleteLocalRef(env, mediaOptions);
+        }
+    }
+    return p_md;
+}
+
+libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz)
+{
+    return (libvlc_media_player_t*)(intptr_t)getLong(env, thiz, "mInternalMediaPlayerInstance");
+}
+
+static void releaseMediaPlayer(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz);
+    if (p_mp)
+    {
+        libvlc_media_player_stop(p_mp);
+        libvlc_media_player_release(p_mp);
+        setLong(env, thiz, "mInternalMediaPlayerInstance", 0);
+    }
+}
+
+/* Pointer to the Java virtual machine
+ * Note: It's okay to use a static variable for the VM pointer since there
+ * can only be one instance of this shared library in a single VM
+ */
+static JavaVM *myVm;
+
+static jobject eventHandlerInstance = NULL;
+
+static void vlc_event_callback(const libvlc_event_t *ev, void *data)
+{
+    JNIEnv *env;
+
+    bool isAttached = false;
+
+    if (eventHandlerInstance == NULL)
+        return;
+
+    if (jni_get_env(&env) < 0) {
+        if (jni_attach_thread(&env, THREAD_NAME) < 0)
+            return;
+        isAttached = true;
+    }
+
+    /* Creating the bundle in C allows us to subscribe to more events
+     * and get better flexibility for each event. For example, we can
+     * have totally different types of data for each event, instead of,
+     * for example, only an integer and/or string.
+     */
+    jclass clsBundle = (*env)->FindClass(env, "android/os/Bundle");
+    jmethodID clsCtor = (*env)->GetMethodID(env, clsBundle, "<init>", "()V" );
+    jobject bundle = (*env)->NewObject(env, clsBundle, clsCtor);
+
+    jmethodID putInt = (*env)->GetMethodID(env, clsBundle, "putInt", "(Ljava/lang/String;I)V" );
+    jmethodID putLong = (*env)->GetMethodID(env, clsBundle, "putLong", "(Ljava/lang/String;J)V" );
+    jmethodID putFloat = (*env)->GetMethodID(env, clsBundle, "putFloat", "(Ljava/lang/String;F)V" );
+    jmethodID putString = (*env)->GetMethodID(env, clsBundle, "putString", "(Ljava/lang/String;Ljava/lang/String;)V" );
+
+    if (ev->type == libvlc_MediaPlayerPositionChanged) {
+        jstring sData = (*env)->NewStringUTF(env, "data");
+        (*env)->CallVoidMethod(env, bundle, putFloat, sData, ev->u.media_player_position_changed.new_position);
+        (*env)->DeleteLocalRef(env, sData);
+    } else if (ev->type == libvlc_MediaPlayerTimeChanged) {
+        jstring sData = (*env)->NewStringUTF(env, "data");
+        (*env)->CallVoidMethod(env, bundle, putLong, sData, ev->u.media_player_time_changed.new_time);
+        (*env)->DeleteLocalRef(env, sData);
+    } else if(ev->type == libvlc_MediaPlayerVout) {
+        /* For determining the vout/ES track change */
+        jstring sData = (*env)->NewStringUTF(env, "data");
+        (*env)->CallVoidMethod(env, bundle, putInt, sData, ev->u.media_player_vout.new_count);
+        (*env)->DeleteLocalRef(env, sData);
+    } else if(ev->type == libvlc_MediaListItemAdded ||
+              ev->type == libvlc_MediaListItemDeleted ) {
+        jstring item_uri = (*env)->NewStringUTF(env, "item_uri");
+        jstring item_index = (*env)->NewStringUTF(env, "item_index");
+        char* mrl = libvlc_media_get_mrl(
+            ev->type == libvlc_MediaListItemAdded ?
+            ev->u.media_list_item_added.item :
+            ev->u.media_list_item_deleted.item
+            );
+        jstring item_uri_value = (*env)->NewStringUTF(env, mrl);
+        jint item_index_value;
+        if(ev->type == libvlc_MediaListItemAdded)
+            item_index_value = ev->u.media_list_item_added.index;
+        else
+            item_index_value = ev->u.media_list_item_deleted.index;
+
+        (*env)->CallVoidMethod(env, bundle, putString, item_uri, item_uri_value);
+        (*env)->CallVoidMethod(env, bundle, putInt, item_index, item_index_value);
+
+        (*env)->DeleteLocalRef(env, item_uri);
+        (*env)->DeleteLocalRef(env, item_uri_value);
+        (*env)->DeleteLocalRef(env, item_index);
+        free(mrl);
+    }
+
+    /* Get the object class */
+    jclass cls = (*env)->GetObjectClass(env, eventHandlerInstance);
+    if (!cls) {
+        LOGE("EventHandler: failed to get class reference");
+        goto end;
+    }
+
+    /* Find the callback ID */
+    jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");
+    if (methodID) {
+        (*env)->CallVoidMethod(env, eventHandlerInstance, methodID, ev->type, bundle);
+    } else {
+        LOGE("EventHandler: failed to get the callback method");
+    }
+
+end:
+    (*env)->DeleteLocalRef(env, bundle);
+    if (isAttached)
+        jni_detach_thread();
+}
+
+jint JNI_OnLoad(JavaVM *vm, void *reserved)
+{
+    // Keep a reference on the Java VM.
+    myVm = vm;
+
+    pthread_mutex_init(&vout_android_lock, NULL);
+    pthread_cond_init(&vout_android_surf_attached, NULL);
+
+    LOGD("JNI interface loaded.");
+    return VLC_JNI_VERSION;
+}
+
+void JNI_OnUnload(JavaVM* vm, void* reserved) {
+    pthread_mutex_destroy(&vout_android_lock);
+    pthread_cond_destroy(&vout_android_surf_attached);
+}
+
+int jni_attach_thread(JNIEnv **env, const char *thread_name)
+{
+    JavaVMAttachArgs args;
+    jint result;
+
+    args.version = VLC_JNI_VERSION;
+    args.name = thread_name;
+    args.group = NULL;
+
+    result = (*myVm)->AttachCurrentThread(myVm, env, &args);
+    return result == JNI_OK ? 0 : -1;
+}
+
+void jni_detach_thread()
+{
+    (*myVm)->DetachCurrentThread(myVm);
+}
+
+int jni_get_env(JNIEnv **env)
+{
+    return (*myVm)->GetEnv(myVm, (void **)env, VLC_JNI_VERSION) == JNI_OK ? 0 : -1;
+}
+
+// FIXME: use atomics
+static bool verbosity;
+
+void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
+{
+    //only use OpenSLES if java side says we can
+    jclass cls = (*env)->GetObjectClass(env, thiz);
+    jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
+    bool use_opensles = (*env)->CallIntMethod(env, thiz, methodId) == AOUT_OPENSLES;
+
+    methodId = (*env)->GetMethodID(env, cls, "getVout", "()I");
+    bool use_opengles2 = (*env)->CallIntMethod(env, thiz, methodId) == VOUT_OPENGLES2;
+
+    methodId = (*env)->GetMethodID(env, cls, "timeStretchingEnabled", "()Z");
+    bool enable_time_stretch = (*env)->CallBooleanMethod(env, thiz, methodId);
+
+    methodId = (*env)->GetMethodID(env, cls, "frameSkipEnabled", "()Z");
+    bool enable_frame_skip = (*env)->CallBooleanMethod(env, thiz, methodId);
+
+    methodId = (*env)->GetMethodID(env, cls, "getDeblocking", "()I");
+    int deblocking = (*env)->CallIntMethod(env, thiz, methodId);
+    char deblockstr[2];
+    snprintf(deblockstr, sizeof(deblockstr), "%d", deblocking);
+    LOGD("Using deblocking level %d", deblocking);
+
+    methodId = (*env)->GetMethodID(env, cls, "getNetworkCaching", "()I");
+    int networkCaching = (*env)->CallIntMethod(env, thiz, methodId);
+    char networkCachingstr[25];
+    if(networkCaching > 0) {
+        snprintf(networkCachingstr, sizeof(networkCachingstr), "--network-caching=%d", networkCaching);
+        LOGD("Using network caching of %d ms", networkCaching);
+    }
+
+    methodId = (*env)->GetMethodID(env, cls, "getHttpReconnect", "()Z");
+    bool enable_http_reconnect = (*env)->CallBooleanMethod(env, thiz, methodId);
+
+    methodId = (*env)->GetMethodID(env, cls, "getChroma", "()Ljava/lang/String;");
+    jstring chroma = (*env)->CallObjectMethod(env, thiz, methodId);
+    const char *chromastr = (*env)->GetStringUTFChars(env, chroma, 0);
+    LOGD("Chroma set to \"%s\"", chromastr);
+
+    methodId = (*env)->GetMethodID(env, cls, "getSubtitlesEncoding", "()Ljava/lang/String;");
+    jstring subsencoding = (*env)->CallObjectMethod(env, thiz, methodId);
+    const char *subsencodingstr = (*env)->GetStringUTFChars(env, subsencoding, 0);
+    LOGD("Subtitle encoding set to \"%s\"", subsencodingstr);
+
+    methodId = (*env)->GetMethodID(env, cls, "isVerboseMode", "()Z");
+    verbosity = (*env)->CallBooleanMethod(env, thiz, methodId);
+
+    methodId = (*env)->GetMethodID(env, cls, "isDirectRendering", "()Z");
+    bool direct_rendering = (*env)->CallBooleanMethod(env, thiz, methodId);
+    /* With the MediaCodec opaque mode we cannot use the OpenGL ES vout. */
+    if (direct_rendering)
+        use_opengles2 = false;
+
+    methodId = (*env)->GetMethodID(env, cls, "getCachePath", "()Ljava/lang/String;");
+    jstring cachePath = (*env)->CallObjectMethod(env, thiz, methodId);
+    if (cachePath) {
+        const char *cache_path = (*env)->GetStringUTFChars(env, cachePath, 0);
+        setenv("DVDCSS_CACHE", cache_path, 1);
+        (*env)->ReleaseStringUTFChars(env, cachePath, cache_path);
+    }
+
+    /* Don't add any invalid options, otherwise it causes LibVLC to crash */
+    const char *argv[] = {
+        /* CPU intensive plugin, setting for slow devices */
+        enable_time_stretch ? "--audio-time-stretch" : "--no-audio-time-stretch",
+
+        /* avcodec speed settings for slow devices */
+        //"--avcodec-fast", // non-spec-compliant speedup tricks
+        "--avcodec-skiploopfilter", deblockstr,
+        "--avcodec-skip-frame", enable_frame_skip ? "2" : "0",
+        "--avcodec-skip-idct", enable_frame_skip ? "2" : "0",
+
+        /* Remove me when UTF-8 is enforced by law */
+        "--subsdec-encoding", subsencodingstr,
+
+        /* Enable statistics */
+        "--stats",
+
+        /* XXX: why can't the default be fine ? #7792 */
+        (networkCaching > 0) ? networkCachingstr : "",
+
+        /* Android audio API is a mess */
+        use_opensles ? "--aout=opensles" : "--aout=android_audiotrack",
+
+        /* Android video API is a mess */
+        use_opengles2 ? "--vout=gles2" : "--vout=androidsurface",
+        "--androidsurface-chroma", chromastr != NULL && chromastr[0] != 0 ? chromastr : "RV32",
+        /* XXX: we can't recover from direct rendering failure */
+        direct_rendering ? "" : "--no-mediacodec-dr",
+        direct_rendering ? "" : NO_IOMX_DR,
+
+        /* Reconnect on lost HTTP streams, e.g. network change */
+        enable_http_reconnect ? "--http-reconnect" : "",
+    };
+    libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
+
+    setLong(env, thiz, "mLibVlcInstance", (jlong)(intptr_t) instance);
+
+    (*env)->ReleaseStringUTFChars(env, chroma, chromastr);
+    (*env)->ReleaseStringUTFChars(env, subsencoding, subsencodingstr);
+
+    if (!instance)
+    {
+        jclass exc = (*env)->FindClass(env, "org/videolan/libvlc/LibVlcException");
+        (*env)->ThrowNew(env, exc, "Unable to instantiate LibVLC");
+    }
+
+    LOGI("LibVLC initialized: %p", instance);
+
+    libvlc_log_set(instance, debug_log, &verbosity);
+
+    init_native_crash_handler(env, thiz);
+}
+
+void Java_org_videolan_libvlc_LibVLC_nativeDestroy(JNIEnv *env, jobject thiz)
+{
+    destroy_native_crash_handler(env);
+
+    releaseMediaPlayer(env, thiz);
+    jlong libVlcInstance = getLong(env, thiz, "mLibVlcInstance");
+    if (!libVlcInstance)
+        return; // Already destroyed
+
+    libvlc_instance_t *instance = (libvlc_instance_t*)(intptr_t) libVlcInstance;
+    libvlc_log_unset(instance);
+    libvlc_release(instance);
+
+    setLong(env, thiz, "mLibVlcInstance", 0);
+}
+
+void Java_org_videolan_libvlc_LibVLC_detachEventHandler(JNIEnv *env, jobject thiz)
+{
+    if (eventHandlerInstance != NULL) {
+        (*env)->DeleteGlobalRef(env, eventHandlerInstance);
+        eventHandlerInstance = NULL;
+    }
+}
+
+void Java_org_videolan_libvlc_LibVLC_setEventHandler(JNIEnv *env, jobject thiz, jobject eventHandler)
+{
+    if (eventHandlerInstance != NULL) {
+        (*env)->DeleteGlobalRef(env, eventHandlerInstance);
+        eventHandlerInstance = NULL;
+    }
+
+    eventHandlerInstance = getEventHandlerReference(env, thiz, eventHandler);
+}
+
+void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz, jlong instance,
+                                             jstring mrl, jobjectArray mediaOptions)
+{
+    /* Release previous media player, if any */
+    releaseMediaPlayer(env, thiz);
+
+    /* Create a media player playing environment */
+    libvlc_media_player_t *mp = libvlc_media_player_new((libvlc_instance_t*)(intptr_t)instance);
+    libvlc_media_player_set_video_title_display(mp, libvlc_position_disable, 0);
+    jobject myJavaLibVLC = (*env)->NewGlobalRef(env, thiz);
+
+    //if AOUT_AUDIOTRACK_JAVA, we use amem
+    jclass cls = (*env)->GetObjectClass(env, thiz);
+    jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
+    if ( (*env)->CallIntMethod(env, thiz, methodId) == AOUT_AUDIOTRACK_JAVA )
+    {
+        libvlc_audio_set_callbacks(mp, aout_play, aout_pause, NULL, NULL, NULL,
+                                   (void*) myJavaLibVLC);
+        libvlc_audio_set_format_callbacks(mp, aout_open, aout_close);
+    }
+
+    /* Connect the event manager */
+    libvlc_event_manager_t *ev = libvlc_media_player_event_manager(mp);
+    static const libvlc_event_type_t mp_events[] = {
+        libvlc_MediaPlayerPlaying,
+        libvlc_MediaPlayerPaused,
+        libvlc_MediaPlayerEndReached,
+        libvlc_MediaPlayerStopped,
+        libvlc_MediaPlayerVout,
+        libvlc_MediaPlayerPositionChanged,
+        libvlc_MediaPlayerTimeChanged,
+        libvlc_MediaPlayerEncounteredError
+    };
+    for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++)
+        libvlc_event_attach(ev, mp_events[i], vlc_event_callback, myVm);
+
+    /* Keep a pointer to this media player */
+    setLong(env, thiz, "mInternalMediaPlayerInstance", (jlong)(intptr_t)mp);
+
+    cls = (*env)->GetObjectClass(env, thiz);
+    jmethodID methodID = (*env)->GetMethodID(env, cls, "applyEqualizer", "()V");
+    (*env)->CallVoidMethod(env, thiz, methodID);
+
+    const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, 0);
+
+    libvlc_media_t* p_md = libvlc_media_new_location((libvlc_instance_t*)(intptr_t)instance, p_mrl);
+    /* media options */
+    if (mediaOptions != NULL)
+        add_media_options(p_md, env, mediaOptions);
+
+    (*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
+
+    /* Connect the media event manager. */
+    libvlc_event_manager_t *ev_media = libvlc_media_event_manager(p_md);
+    static const libvlc_event_type_t mp_media_events[] = {
+        libvlc_MediaParsedChanged
+    };
+    for(int i = 0; i < (sizeof(mp_media_events) / sizeof(*mp_media_events)); i++)
+        libvlc_event_attach(ev_media, mp_media_events[i], vlc_event_callback, myVm);
+
+    libvlc_media_player_set_media(mp, p_md);
+    libvlc_media_player_play(mp);
+}
+
+jfloat Java_org_videolan_libvlc_LibVLC_getRate(JNIEnv *env, jobject thiz) {
+    libvlc_media_player_t* mp = getMediaPlayer(env, thiz);
+    if(mp)
+        return libvlc_media_player_get_rate(mp);
+    else
+        return 1.00;
+}
+
+void Java_org_videolan_libvlc_LibVLC_setRate(JNIEnv *env, jobject thiz, jfloat rate) {
+    libvlc_media_player_t* mp = getMediaPlayer(env, thiz);
+    if(mp)
+        libvlc_media_player_set_rate(mp, rate);
+}
+
+jboolean Java_org_videolan_libvlc_LibVLC_isPlaying(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return !!libvlc_media_player_is_playing(mp);
+    else
+        return 0;
+}
+
+jboolean Java_org_videolan_libvlc_LibVLC_isSeekable(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return !!libvlc_media_player_is_seekable(mp);
+    return 0;
+}
+
+void Java_org_videolan_libvlc_LibVLC_play(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        libvlc_media_player_play(mp);
+}
+
+void Java_org_videolan_libvlc_LibVLC_pause(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        libvlc_media_player_pause(mp);
+}
+
+void Java_org_videolan_libvlc_LibVLC_stop(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        libvlc_media_player_stop(mp);
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getPlayerState(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jint) libvlc_media_player_get_state(mp);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getVolume(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jint) libvlc_audio_get_volume(mp);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_setVolume(JNIEnv *env, jobject thiz, jint volume)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        //Returns 0 if the volume was set, -1 if it was out of range or error
+        return (jint) libvlc_audio_set_volume(mp, (int) volume);
+    return -1;
+}
+
+jlong Java_org_videolan_libvlc_LibVLC_getTime(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_media_player_get_time(mp);
+    return -1;
+}
+
+void Java_org_videolan_libvlc_LibVLC_setTime(JNIEnv *env, jobject thiz, jlong time)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        libvlc_media_player_set_time(mp, time);
+}
+
+jfloat Java_org_videolan_libvlc_LibVLC_getPosition(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jfloat) libvlc_media_player_get_position(mp);
+    return -1;
+}
+
+void Java_org_videolan_libvlc_LibVLC_setPosition(JNIEnv *env, jobject thiz, jfloat pos)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        libvlc_media_player_set_position(mp, pos);
+}
+
+jlong Java_org_videolan_libvlc_LibVLC_getLength(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jlong) libvlc_media_player_get_length(mp);
+    return -1;
+}
+
+jstring Java_org_videolan_libvlc_LibVLC_version(JNIEnv* env, jobject thiz)
+{
+    return (*env)->NewStringUTF(env, libvlc_get_version());
+}
+
+jstring Java_org_videolan_libvlc_LibVLC_compiler(JNIEnv* env, jobject thiz)
+{
+    return (*env)->NewStringUTF(env, libvlc_get_compiler());
+}
+
+jstring Java_org_videolan_libvlc_LibVLC_changeset(JNIEnv* env, jobject thiz)
+{
+    return (*env)->NewStringUTF(env, libvlc_get_changeset());
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getTitle(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_media_player_get_title(mp);
+    return -1;
+}
+
+void Java_org_videolan_libvlc_LibVLC_setTitle(JNIEnv *env, jobject thiz, jint title)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        libvlc_media_player_set_title(mp, title);
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getChapterCountForTitle(JNIEnv *env, jobject thiz, jint title)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_media_player_get_chapter_count_for_title(mp, title);
+    return -1;
+}
+
+jint Java_org_videolan_libvlc_LibVLC_getTitleCount(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return libvlc_media_player_get_title_count(mp);
+    return -1;
+}
+
+void Java_org_videolan_libvlc_LibVLC_playerNavigate(JNIEnv *env, jobject thiz, jint navigate)
+{
+    unsigned nav = navigate;
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        libvlc_media_player_navigate(mp, (unsigned) nav);
+}
+
diff --git a/libVLC/jni/log.h b/libVLC/jni/log.h
new file mode 100644
index 0000000..b595b34
--- /dev/null
+++ b/libVLC/jni/log.h
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * log.h
+ *****************************************************************************
+ * Copyright © 2011-2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef LIBVLCJNI_LOG_H
+#define LIBVLCJNI_LOG_H
+
+#include <android/log.h>
+
+/* C files should define LOG_TAG before including this header */
+#ifndef LOG_TAG
+# error You must define LOG_TAG
+#endif
+
+#ifndef NDEBUG
+# define LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
+# define LOGV(...)  __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
+#else
+# define LOGD(...)  (void)0
+# define LOGV(...)  (void)0
+#endif
+#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
+#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+#define  LOGW(...)  __android_log_print(ANDROID_LOG_WARNING,LOG_TAG,__VA_ARGS__)
+
+#endif // LIBVLCJNI_LOG_H
diff --git a/libVLC/jni/native_crash_handler.c b/libVLC/jni/native_crash_handler.c
new file mode 100644
index 0000000..2cb1590
--- /dev/null
+++ b/libVLC/jni/native_crash_handler.c
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * native_crash_handler.c
+ *****************************************************************************
+ * Copyright © 2010-2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <signal.h>
+
+#include "native_crash_handler.h"
+
+static struct sigaction old_actions[NSIG];
+static jobject j_libVLC;
+
+#define THREAD_NAME "native_crash_handler"
+extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
+extern void jni_detach_thread();
+
+// Monitored signals.
+static const int monitored_signals[] = {
+    SIGILL,
+    SIGABRT,
+    SIGBUS,
+    SIGFPE,
+    SIGSEGV,
+#ifndef _MIPS_ARCH
+    SIGSTKFLT,
+#else
+    SIGEMT,
+#endif
+    SIGPIPE
+};
+
+
+/**
+ * Callback called when a monitored signal is triggered.
+ */
+void sigaction_callback(int signal, siginfo_t *info, void *reserved)
+{
+    // Call the Java LibVLC method that handle the crash.
+    JNIEnv *env;
+    jni_attach_thread(&env, THREAD_NAME);
+
+    jclass cls = (*env)->GetObjectClass(env, j_libVLC);
+    jmethodID methodId = (*env)->GetMethodID(env, cls, "onNativeCrash", "()V");
+    (*env)->CallVoidMethod(env, j_libVLC, methodId);
+
+    (*env)->DeleteLocalRef(env, cls);
+    jni_detach_thread();
+
+    // Call the old signal handler.
+    old_actions[signal].sa_handler(signal);
+}
+
+
+void init_native_crash_handler(JNIEnv *env, jobject j_libVLC_local)
+{
+    j_libVLC = (*env)->NewGlobalRef(env, j_libVLC_local);
+    struct sigaction handler;
+    memset(&handler, 0, sizeof(struct sigaction));
+
+    handler.sa_sigaction = sigaction_callback;
+    handler.sa_flags = SA_RESETHAND;
+
+    // Install the signal handlers and save their old actions.
+    for (unsigned i = 0; i < sizeof(monitored_signals) / sizeof(int); ++i)
+    {
+        const int s = monitored_signals[i];
+        sigaction(s, &handler, &old_actions[s]);
+    }
+}
+
+
+void destroy_native_crash_handler(JNIEnv *env)
+{
+    // Uninstall the signal handlers and restore their old actions.
+    for (unsigned i = 0; i < sizeof(monitored_signals) / sizeof(int); ++i)
+    {
+        const int s = monitored_signals[i];
+        sigaction(s, &old_actions[s], NULL);
+    }
+
+    (*env)->DeleteGlobalRef(env, j_libVLC);
+}
diff --git a/libVLC/jni/native_crash_handler.h b/libVLC/jni/native_crash_handler.h
new file mode 100644
index 0000000..a57e61e
--- /dev/null
+++ b/libVLC/jni/native_crash_handler.h
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * native_crash_handler.h
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef LIBVLCJNI_NATIVE_CRASH_HANDLER_H
+#define LIBVLCJNI_NATIVE_CRASH_HANDLER_H
+
+#include <jni.h>
+
+void init_native_crash_handler(JNIEnv *env, jobject j_libVLC_local);
+void destroy_native_crash_handler(JNIEnv *env);
+
+#endif // LIBVLCJNI_NATIVE_CRASH_HANDLER_H
diff --git a/libVLC/jni/pipe2.c b/libVLC/jni/pipe2.c
new file mode 100644
index 0000000..218eb50
--- /dev/null
+++ b/libVLC/jni/pipe2.c
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * misc.c
+ *****************************************************************************
+ * Copyright © 2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <sys/linux-syscalls.h>
+
+//#include <sys/syscall.h>
+int syscall(int number, ...);
+
+/* Needed for android < 2.3 */
+int pipe2(int fds[2], int flags)
+{
+    return syscall(__NR_pipe2, fds, flags);
+}
diff --git a/libVLC/jni/pthread-condattr.c b/libVLC/jni/pthread-condattr.c
new file mode 100644
index 0000000..1a4d657
--- /dev/null
+++ b/libVLC/jni/pthread-condattr.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <pthread.h>
+#include <errno.h>
+
+int pthread_condattr_init(pthread_condattr_t *attr)
+{
+    if (attr == NULL)
+        return EINVAL;
+
+    *attr = PTHREAD_PROCESS_PRIVATE;
+    return 0;
+}
+
+int pthread_condattr_destroy(pthread_condattr_t *attr)
+{
+    if (attr == NULL)
+        return EINVAL;
+
+    *attr = 0xdeada11d;
+    return 0;
+}
+
+int pthread_condattr_getpshared(pthread_condattr_t *attr, int *pshared)
+{
+    if (attr == NULL || pshared == NULL)
+        return EINVAL;
+
+    *pshared = *attr;
+    return 0;
+}
+
+int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
+{
+    if (attr == NULL)
+        return EINVAL;
+
+    if (pshared != PTHREAD_PROCESS_SHARED &&
+        pshared != PTHREAD_PROCESS_PRIVATE)
+        return EINVAL;
+
+    *attr = pshared;
+    return 0;
+}
diff --git a/libVLC/jni/pthread-once.c b/libVLC/jni/pthread-once.c
new file mode 100644
index 0000000..9c2cffb
--- /dev/null
+++ b/libVLC/jni/pthread-once.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <errno.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#if defined(__arm__)
+/* The file only exists for ARM, for now */
+#include <machine/cpu-features.h>
+#endif
+
+/* Adapted from bionic_atomic_inline.h */
+static inline void ANDROID_MEMBAR_FULL(void) {
+#if defined(__arm__) && __ARM_ARCH__ >= 7
+    __asm__ __volatile__ ("dmb" ::: "memory");
+#elif defined(__arm__) && __ARM_ARCH__ == 6
+    /*
+     * See "Accessing the Data Memory Barrier operation" :
+     * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211i/I1014942.html
+     *
+     * From: https://casper.berkeley.edu/svn/trunk/roach/sw/linux/include/asm-arm/system.h
+     */
+    __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" :: "r" (0) : "memory");
+#elif (defined(__i386__) || defined(__x86_64__)) && defined(__SSE2__)
+    __asm__ __volatile__ ("mfence" ::: "memory");
+#else
+    /*
+     * Implementation not defined for this platform.  Hopefully we're building
+     * in uniprocessor mode.
+     *
+     * For example: MIPS, PowerPC, ARMv5, etc
+     */
+    __asm__ __volatile__ ("" ::: "memory");
+#endif
+}
+
+/* NOTE: this implementation doesn't support a init function that throws a C++ exception
+ *       or calls fork()
+ */
+int pthread_once( pthread_once_t*  once_control,  void (*init_routine)(void) )
+{
+    if( once_control == NULL || init_routine == NULL )
+        return EINVAL;
+    static pthread_mutex_t   once_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
+    volatile pthread_once_t* ocptr = once_control;
+
+    pthread_once_t tmp = *ocptr;
+    ANDROID_MEMBAR_FULL();
+    if (tmp == PTHREAD_ONCE_INIT) {
+        pthread_mutex_lock( &once_lock );
+        if (*ocptr == PTHREAD_ONCE_INIT) {
+            (*init_routine)();
+            ANDROID_MEMBAR_FULL();
+            *ocptr = ~PTHREAD_ONCE_INIT;
+        }
+        pthread_mutex_unlock( &once_lock );
+    }
+    return 0;
+}
diff --git a/libVLC/jni/pthread-rwlocks.c b/libVLC/jni/pthread-rwlocks.c
new file mode 100644
index 0000000..0ce0da7
--- /dev/null
+++ b/libVLC/jni/pthread-rwlocks.c
@@ -0,0 +1,349 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <pthread.h>
+
+/* Technical note:
+ *
+ * Possible states of a read/write lock:
+ *
+ *  - no readers and no writer (unlocked)
+ *  - one or more readers sharing the lock at the same time (read-locked)
+ *  - one writer holding the lock (write-lock)
+ *
+ * Additionally:
+ *  - trying to get the write-lock while there are any readers blocks
+ *  - trying to get the read-lock while there is a writer blocks
+ *  - a single thread can acquire the lock multiple times in the same mode
+ *
+ *  - Posix states that behaviour is undefined it a thread tries to acquire
+ *    the lock in two distinct modes (e.g. write after read, or read after write).
+ *
+ *  - This implementation tries to avoid writer starvation by making the readers
+ *    block as soon as there is a waiting writer on the lock. However, it cannot
+ *    completely eliminate it: each time the lock is unlocked, all waiting threads
+ *    are woken and battle for it, which one gets it depends on the kernel scheduler
+ *    and is semi-random.
+ *
+ */
+
+#define  __likely(cond)    __builtin_expect(!!(cond), 1)
+#define  __unlikely(cond)  __builtin_expect(!!(cond), 0)
+
+#define  RWLOCKATTR_DEFAULT     0
+#define  RWLOCKATTR_SHARED_MASK 0x0010
+
+static int __get_thread_id(void)
+{
+#ifdef __LP64__
+#error "Don't build pthread fallbacks for 64-bit; use the proper functions"
+#else
+    return pthread_self();
+#endif
+}
+
+int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
+{
+    if (!attr)
+        return EINVAL;
+
+    *attr = PTHREAD_PROCESS_PRIVATE;
+    return 0;
+}
+
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
+{
+    if (!attr)
+        return EINVAL;
+
+    *attr = -1;
+    return 0;
+}
+
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int  pshared)
+{
+    if (!attr)
+        return EINVAL;
+
+    switch (pshared) {
+    case PTHREAD_PROCESS_PRIVATE:
+    case PTHREAD_PROCESS_SHARED:
+        *attr = pshared;
+        return 0;
+    default:
+        return EINVAL;
+    }
+}
+
+int pthread_rwlockattr_getpshared(pthread_rwlockattr_t *attr, int *pshared)
+{
+    if (!attr || !pshared)
+        return EINVAL;
+
+    *pshared = *attr;
+    return 0;
+}
+
+int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
+{
+    pthread_mutexattr_t*  lock_attr = NULL;
+    pthread_condattr_t*   cond_attr = NULL;
+    pthread_mutexattr_t   lock_attr0;
+    pthread_condattr_t    cond_attr0;
+    int                   ret;
+
+    if (rwlock == NULL)
+        return EINVAL;
+
+    if (attr && *attr == PTHREAD_PROCESS_SHARED) {
+        lock_attr = &lock_attr0;
+        pthread_mutexattr_init(lock_attr);
+        pthread_mutexattr_setpshared(lock_attr, PTHREAD_PROCESS_SHARED);
+
+        cond_attr = &cond_attr0;
+        pthread_condattr_init(cond_attr);
+        pthread_condattr_setpshared(cond_attr, PTHREAD_PROCESS_SHARED);
+    }
+
+    ret = pthread_mutex_init(&rwlock->lock, lock_attr);
+    if (ret != 0)
+        return ret;
+
+    ret = pthread_cond_init(&rwlock->cond, cond_attr);
+    if (ret != 0) {
+        pthread_mutex_destroy(&rwlock->lock);
+        return ret;
+    }
+
+    rwlock->numLocks = 0;
+    rwlock->pendingReaders = 0;
+    rwlock->pendingWriters = 0;
+    rwlock->writerThreadId = 0;
+
+    return 0;
+}
+
+int pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
+{
+    int  ret;
+
+    if (rwlock == NULL)
+        return EINVAL;
+
+    if (rwlock->numLocks > 0)
+        return EBUSY;
+
+    pthread_cond_destroy(&rwlock->cond);
+    pthread_mutex_destroy(&rwlock->lock);
+    return 0;
+}
+
+/* Returns TRUE iff we can acquire a read lock. */
+static __inline__ int read_precondition(pthread_rwlock_t *rwlock, int  thread_id)
+{
+    /* We can't have the lock if any writer is waiting for it (writer bias).
+     * This tries to avoid starvation when there are multiple readers racing.
+     */
+    if (rwlock->pendingWriters > 0)
+        return 0;
+
+    /* We can have the lock if there is no writer, or if we write-own it */
+    /* The second test avoids a self-dead lock in case of buggy code. */
+    if (rwlock->writerThreadId == 0 || rwlock->writerThreadId == thread_id)
+        return 1;
+
+    /* Otherwise, we can't have it */
+    return 0;
+}
+
+/* returns TRUE iff we can acquire a write lock. */
+static __inline__ int write_precondition(pthread_rwlock_t *rwlock, int  thread_id)
+{
+    /* We can get the lock if nobody has it */
+    if (rwlock->numLocks == 0)
+        return 1;
+
+    /* Or if we already own it */
+    if (rwlock->writerThreadId == thread_id)
+        return 1;
+
+    /* Otherwise, not */
+    return 0;
+}
+
+/* This function is used to waken any waiting thread contending
+ * for the lock. One of them should be able to grab it after
+ * that.
+ */
+static void _pthread_rwlock_pulse(pthread_rwlock_t *rwlock)
+{
+    if (rwlock->pendingReaders > 0 || rwlock->pendingWriters > 0)
+        pthread_cond_broadcast(&rwlock->cond);
+}
+
+
+int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
+{
+    return pthread_rwlock_timedrdlock(rwlock, NULL);
+}
+
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
+{
+    int ret = 0;
+
+    if (rwlock == NULL)
+        return EINVAL;
+
+    pthread_mutex_lock(&rwlock->lock);
+    if (__unlikely(!read_precondition(rwlock, __get_thread_id())))
+        ret = EBUSY;
+    else
+        rwlock->numLocks ++;
+    pthread_mutex_unlock(&rwlock->lock);
+
+    return ret;
+}
+
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout)
+{
+    int thread_id, ret = 0;
+
+    if (rwlock == NULL)
+        return EINVAL;
+
+    pthread_mutex_lock(&rwlock->lock);
+    thread_id = __get_thread_id();
+    if (__unlikely(!read_precondition(rwlock, thread_id))) {
+        rwlock->pendingReaders += 1;
+        do {
+            ret = pthread_cond_timedwait(&rwlock->cond, &rwlock->lock, abs_timeout);
+        } while (ret == 0 && !read_precondition(rwlock, thread_id));
+        rwlock->pendingReaders -= 1;
+        if (ret != 0)
+            goto EXIT;
+    }
+    rwlock->numLocks ++;
+EXIT:
+    pthread_mutex_unlock(&rwlock->lock);
+    return ret;
+}
+
+
+int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
+{
+    return pthread_rwlock_timedwrlock(rwlock, NULL);
+}
+
+int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
+{
+    int thread_id, ret = 0;
+
+    if (rwlock == NULL)
+        return EINVAL;
+
+    pthread_mutex_lock(&rwlock->lock);
+    thread_id = __get_thread_id();
+    if (__unlikely(!write_precondition(rwlock, thread_id))) {
+        ret = EBUSY;
+    } else {
+        rwlock->numLocks ++;
+        rwlock->writerThreadId = thread_id;
+    }
+    pthread_mutex_unlock(&rwlock->lock);
+    return ret;
+}
+
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout)
+{
+    int thread_id, ret = 0;
+
+    if (rwlock == NULL)
+        return EINVAL;
+
+    pthread_mutex_lock(&rwlock->lock);
+    thread_id = __get_thread_id();
+    if (__unlikely(!write_precondition(rwlock, thread_id))) {
+        /* If we can't read yet, wait until the rwlock is unlocked
+         * and try again. Increment pendingReaders to get the
+         * cond broadcast when that happens.
+         */
+        rwlock->pendingWriters += 1;
+        do {
+            ret = pthread_cond_timedwait(&rwlock->cond, &rwlock->lock, abs_timeout);
+        } while (ret == 0 && !write_precondition(rwlock, thread_id));
+        rwlock->pendingWriters -= 1;
+        if (ret != 0)
+            goto EXIT;
+    }
+    rwlock->numLocks ++;
+    rwlock->writerThreadId = thread_id;
+EXIT:
+    pthread_mutex_unlock(&rwlock->lock);
+    return ret;
+}
+
+
+int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
+{
+    int  ret = 0;
+
+    if (rwlock == NULL)
+        return EINVAL;
+
+    pthread_mutex_lock(&rwlock->lock);
+
+    /* The lock must be held */
+    if (rwlock->numLocks == 0) {
+        ret = EPERM;
+        goto EXIT;
+    }
+
+    /* If it has only readers, writerThreadId is 0 */
+    if (rwlock->writerThreadId == 0) {
+        if (--rwlock->numLocks == 0)
+            _pthread_rwlock_pulse(rwlock);
+    }
+    /* Otherwise, it has only a single writer, which
+     * must be ourselves.
+     */
+    else {
+        if (rwlock->writerThreadId != __get_thread_id()) {
+            ret = EPERM;
+            goto EXIT;
+        }
+        if (--rwlock->numLocks == 0) {
+            rwlock->writerThreadId = 0;
+            _pthread_rwlock_pulse(rwlock);
+        }
+    }
+EXIT:
+    pthread_mutex_unlock(&rwlock->lock);
+    return ret;
+}
diff --git a/libVLC/jni/sem.c b/libVLC/jni/sem.c
new file mode 100644
index 0000000..244ccab
--- /dev/null
+++ b/libVLC/jni/sem.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <semaphore.h>
+#include <errno.h>
+#include <stddef.h>
+
+#define SEMCOUNT_VALUE_SHIFT      1
+/* convert a sem->count bit pattern into the corresponding signed value */
+#define SEMCOUNT_TO_VALUE(sval)  ((int)(sval) >> SEMCOUNT_VALUE_SHIFT)
+
+int sem_destroy(sem_t *sem)
+{
+    int count;
+
+    if (sem == NULL) {
+        errno = EINVAL;
+        return -1;
+    }
+    count = SEMCOUNT_TO_VALUE(sem->count);
+    if (count < 0) {
+        errno = EBUSY;
+        return -1;
+    }
+    sem->count = 0;
+    return 0;
+}
diff --git a/libVLC/jni/thumbnailer.c b/libVLC/jni/thumbnailer.c
new file mode 100644
index 0000000..2a95d21
--- /dev/null
+++ b/libVLC/jni/thumbnailer.c
@@ -0,0 +1,318 @@
+/*****************************************************************************
+ * thumbnailer.c
+ *****************************************************************************
+ * Copyright © 2011-2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <assert.h>
+#include <jni.h>
+#include <vlc/vlc.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <time.h>
+#include <errno.h>
+#include <unistd.h>
+
+#define LOG_TAG "VLC/JNI/thumbnailer"
+#include "log.h"
+
+#include "utils.h"
+
+#define THUMBNAIL_POSITION 0.5
+#define PIXEL_SIZE 4 /* RGBA */
+#define THUMBNAIL_MIN_WIDTH 32
+#define THUMBNAIL_MAX_WIDTH 4096
+#define THUMBNAIL_MIN_HEIGHT 32
+#define THUMBNAIL_MAX_HEIGHT 2304
+
+
+/*
+   Frame is:   thumbnail + black borders
+   frameData = frameWidth * frameHeight (values given by Java UI)
+
+   ┌————————————————————————————————————————————————————┐
+   │                                                    │
+   │                 Black Borders                      │
+   │                                                    │
+   ├————————————————————————————————————————————————————┤
+   │                                                    │
+   │                 Thumbnail Data                     │
+   │                                                    │
+   │             thumbHeight x thumbWidth               │
+   │             thumbPitch = thumbWidth * 4            │
+   │                                                    │
+   ├————————————————————————————————————————————————————┤
+   │                                                    │
+   │                                                    │
+   │                                                    │
+   └————————————————————————————————————————————————————┘
+*/
+
+enum {
+    THUMB_SEEKING,
+    THUMB_SEEKED,
+    THUMB_DROP_FIRST_FRAME,
+    THUMB_DONE,
+};
+
+typedef struct
+{
+    int state;
+
+    char *thumbData;
+    char *frameData;
+
+    unsigned blackBorders;
+    unsigned frameWidth;
+    unsigned thumbHeight;
+    unsigned thumbPitch;
+
+    pthread_mutex_t doneMutex;
+    pthread_cond_t doneCondVar;
+} thumbnailer_sys_t;
+
+
+/**
+ * Thumbnailer vout lock
+ **/
+static void *thumbnailer_lock(void *opaque, void **pixels)
+{
+    thumbnailer_sys_t *sys = opaque;
+    *pixels = sys->thumbData;
+    return NULL;
+}
+
+
+/**
+ * Thumbnailer vout unlock
+ **/
+static void thumbnailer_unlock(void *opaque, void *picture, void *const *pixels)
+{
+    thumbnailer_sys_t *sys = opaque;
+
+    /* If we have already received a thumbnail, or we are still seeking,
+     * we skip this frame. */
+    pthread_mutex_lock(&sys->doneMutex);
+    int state = sys->state;
+    if (state == THUMB_SEEKED)
+        sys->state = THUMB_DROP_FIRST_FRAME;
+    pthread_mutex_unlock(&sys->doneMutex);
+    if (state != THUMB_DROP_FIRST_FRAME)
+        return;
+
+    /* we have received our first thumbnail and we can exit. */
+    const char *dataSrc = sys->thumbData;
+    char *dataDest = sys->frameData + sys->blackBorders * PIXEL_SIZE;
+
+    /* Copy the thumbnail. */
+    for (unsigned i = 0; i < sys->thumbHeight; ++i)
+    {
+        memcpy(dataDest, dataSrc, sys->thumbPitch);
+        dataDest += sys->frameWidth * PIXEL_SIZE;
+        dataSrc += sys->thumbPitch;
+    }
+
+    /* Signal that the thumbnail was created. */
+    pthread_mutex_lock(&sys->doneMutex);
+    sys->state = THUMB_DONE;
+    pthread_cond_signal(&sys->doneCondVar);
+    pthread_mutex_unlock(&sys->doneMutex);
+}
+
+
+/**
+ * Thumbnailer main function.
+ * return null if the thumbail generation failed.
+ **/
+jbyteArray Java_org_videolan_libvlc_LibVLC_getThumbnail(JNIEnv *env, jobject thiz,
+                                                        jlong instance, jstring filePath,
+                                                        const jint frameWidth, const jint frameHeight)
+{
+    libvlc_instance_t *libvlc = (libvlc_instance_t *)(intptr_t)instance;
+    jbyteArray byteArray = NULL;
+
+    /* Create the thumbnailer data structure */
+    thumbnailer_sys_t *sys = calloc(1, sizeof(thumbnailer_sys_t));
+    if (sys == NULL)
+    {
+        LOGE("Could not create the thumbnailer data structure!");
+        goto enomem;
+    }
+
+    /* Initialize the barrier. */
+    pthread_mutex_init(&sys->doneMutex, NULL);
+    pthread_cond_init(&sys->doneCondVar, NULL);
+
+    /* Create a media player playing environment */
+    libvlc_media_player_t *mp = libvlc_media_player_new(libvlc);
+    libvlc_media_player_set_video_title_display(mp, libvlc_position_disable, 0);
+
+    libvlc_media_t *m = new_media(instance, env, thiz, filePath, true, false);
+    if (m == NULL)
+    {
+        LOGE("Could not create the media to play!");
+        goto end;
+    }
+
+    /* Fast and no options */
+    libvlc_media_add_option( m, ":no-audio" );
+    libvlc_media_add_option( m, ":no-spu" );
+    libvlc_media_add_option( m, ":no-osd" );
+
+    libvlc_media_player_set_media(mp, m);
+
+    /* Get the size of the video with the tracks information of the media. */
+    libvlc_media_track_t **tracks;
+    libvlc_media_parse(m);
+    int nbTracks = libvlc_media_tracks_get(m, &tracks);
+    libvlc_media_release(m);
+
+    /* Parse the results */
+    unsigned videoWidth = 0, videoHeight = 0;
+    bool hasVideoTrack = false;
+    for (unsigned i = 0; i < nbTracks; ++i)
+        if (tracks[i]->i_type == libvlc_track_video)
+        {
+            videoWidth = tracks[i]->video->i_width;
+            videoHeight = tracks[i]->video->i_height;
+            hasVideoTrack = true;
+            break;
+        }
+
+    libvlc_media_tracks_release(tracks, nbTracks);
+
+    /* Abort if we have not found a video track. */
+    if (!hasVideoTrack)
+    {
+        LOGE("Could not find any video track in this file.\n");
+        goto end;
+    }
+
+    LOGD("Video dimensions: %ix%i.\n", videoWidth, videoHeight );
+
+    /* VLC could not tell us the size */
+    if( videoWidth == 0 || videoHeight == 0 )
+    {
+        LOGE("Could not find the video dimensions.\n");
+        goto end;
+    }
+
+    if( videoWidth < THUMBNAIL_MIN_WIDTH || videoHeight < THUMBNAIL_MIN_HEIGHT
+        || videoWidth > THUMBNAIL_MAX_WIDTH || videoHeight > THUMBNAIL_MAX_HEIGHT )
+    {
+        LOGE("Wrong video dimensions.\n");
+        goto end;
+    }
+
+    /* Compute the size parameters of the frame to generate. */
+    unsigned thumbWidth  = frameWidth;
+    unsigned thumbHeight = frameHeight;
+    const float inputAR = (float)videoWidth / videoHeight;
+    const float screenAR = (float)frameWidth / frameHeight;
+
+    /* Most of the cases, video is wider than tall */
+    if (screenAR < inputAR)
+    {
+        thumbHeight = (float)frameWidth / inputAR + 1;
+        sys->blackBorders = ( (frameHeight - thumbHeight) / 2 ) * frameWidth;
+    }
+    else
+    {
+        LOGD("Weird aspect Ratio.\n");
+        thumbWidth = (float)frameHeight * inputAR;
+        sys->blackBorders = (frameWidth - thumbWidth) / 2;
+    }
+
+    sys->thumbPitch  = thumbWidth * PIXEL_SIZE;
+    sys->thumbHeight = thumbHeight;
+    sys->frameWidth  = frameWidth;
+
+    /* Allocate the memory to store the frames. */
+    size_t thumbSize = sys->thumbPitch * (sys->thumbHeight+1);
+    sys->thumbData = malloc(thumbSize);
+    if (sys->thumbData == NULL)
+    {
+        LOGE("Could not allocate the memory to store the frame!");
+        goto end;
+    }
+
+    /* Allocate the memory to store the thumbnail. */
+    unsigned frameSize = frameWidth * frameHeight * PIXEL_SIZE;
+    sys->frameData = calloc(frameSize, 1);
+    if (sys->frameData == NULL)
+    {
+        LOGE("Could not allocate the memory to store the thumbnail!");
+        goto end;
+    }
+
+    /* Set the video format and the callbacks. */
+    libvlc_video_set_format(mp, "RGBA", thumbWidth, thumbHeight, sys->thumbPitch);
+    libvlc_video_set_callbacks(mp, thumbnailer_lock, thumbnailer_unlock,
+                               NULL, (void*)sys);
+    sys->state = THUMB_SEEKING;
+
+    /* Play the media. */
+    libvlc_media_player_play(mp);
+    libvlc_media_player_set_position(mp, THUMBNAIL_POSITION);
+
+    const int wait_time = 50000;
+    const int max_attempts = 100;
+    for (int i = 0; i < max_attempts; ++i) {
+        if (libvlc_media_player_is_playing(mp) && libvlc_media_player_get_position(mp) >= THUMBNAIL_POSITION)
+            break;
+        usleep(wait_time);
+    }
+
+    /* Wait for the thumbnail to be generated. */
+    pthread_mutex_lock(&sys->doneMutex);
+    sys->state = THUMB_SEEKED;
+    struct timespec deadline;
+    clock_gettime(CLOCK_REALTIME, &deadline);
+    deadline.tv_sec += 10; /* amount of seconds before we abort thumbnailer */
+    do {
+        int ret = pthread_cond_timedwait(&sys->doneCondVar, &sys->doneMutex, &deadline);
+        if (ret == ETIMEDOUT)
+            break;
+    } while (sys->state != THUMB_DONE);
+    pthread_mutex_unlock(&sys->doneMutex);
+
+    /* Stop and release the media player. */
+    libvlc_media_player_stop(mp);
+    libvlc_media_player_release(mp);
+
+    if (sys->state == THUMB_DONE) {
+        /* Create the Java byte array to return the create thumbnail. */
+        byteArray = (*env)->NewByteArray(env, frameSize);
+        if (byteArray == NULL)
+        {
+            LOGE("Could not allocate the Java byte array to store the frame!");
+            goto end;
+        }
+
+        (*env)->SetByteArrayRegion(env, byteArray, 0, frameSize,
+                (jbyte *)sys->frameData);
+    }
+
+end:
+    pthread_mutex_destroy(&sys->doneMutex);
+    pthread_cond_destroy(&sys->doneCondVar);
+    free(sys->frameData);
+    free(sys->thumbData);
+    free(sys);
+enomem:
+    return byteArray;
+}
diff --git a/libVLC/jni/utils.h b/libVLC/jni/utils.h
new file mode 100644
index 0000000..f8502d9
--- /dev/null
+++ b/libVLC/jni/utils.h
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * utils.h
+ *****************************************************************************
+ * Copyright © 2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef LIBVLCJNI_UTILS_H
+#define LIBVLCJNI_UTILS_H
+
+libvlc_media_t *new_media(jlong instance, JNIEnv *env, jobject thiz, jstring fileLocation, bool noOmx, bool noVideo);
+
+libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz);
+
+jint getInt(JNIEnv *env, jobject thiz, const char* field);
+
+void setInt(JNIEnv *env, jobject item, const char* field, jint value);
+
+jlong getLong(JNIEnv *env, jobject thiz, const char* field);
+
+void setLong(JNIEnv *env, jobject item, const char* field, jlong value);
+
+void setFloat(JNIEnv *env, jobject item, const char* field, jfloat value);
+
+void setString(JNIEnv *env, jobject item, const char* field, const char* text);
+
+void arrayListGetIDs(JNIEnv *env, jclass* p_class, jmethodID* p_add, jmethodID* p_remove);
+
+void arrayListStringAdd(JNIEnv *env, jclass class, jmethodID methodID, jobject arrayList, const char* str);
+
+jobject getEventHandlerReference(JNIEnv *env, jobject thiz, jobject eventHandler);
+
+void debug_log(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_list ap);
+
+#endif // LIBVLCJNI_UTILS_H
diff --git a/libVLC/jni/vout.c b/libVLC/jni/vout.c
new file mode 100644
index 0000000..e178bcb
--- /dev/null
+++ b/libVLC/jni/vout.c
@@ -0,0 +1,191 @@
+/*****************************************************************************
+ * vout.c
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <vlc/vlc.h>
+#include <vlc_common.h>
+
+#include <jni.h>
+
+#define THREAD_NAME "jni_vout"
+extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
+extern void jni_detach_thread();
+
+pthread_mutex_t vout_android_lock;
+pthread_cond_t vout_android_surf_attached;
+static void *vout_android_surf = NULL;
+static void *vout_android_gui = NULL;
+static jobject vout_android_java_surf = NULL;
+static jobject vout_android_subtitles_surf = NULL;
+static bool vout_video_player_activity_created = false;
+
+void *jni_LockAndGetSubtitlesSurface() {
+    pthread_mutex_lock(&vout_android_lock);
+    while (vout_android_subtitles_surf == NULL)
+        pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
+    return vout_android_subtitles_surf;
+}
+
+void *jni_LockAndGetAndroidSurface() {
+    pthread_mutex_lock(&vout_android_lock);
+    while (vout_android_surf == NULL)
+        pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
+    return vout_android_surf;
+}
+
+jobject jni_LockAndGetAndroidJavaSurface() {
+    pthread_mutex_lock(&vout_android_lock);
+    while (vout_android_java_surf == NULL)
+        pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
+    return vout_android_java_surf;
+}
+
+void jni_UnlockAndroidSurface() {
+    pthread_mutex_unlock(&vout_android_lock);
+}
+
+void jni_EventHardwareAccelerationError()
+{
+    if (vout_android_gui == NULL)
+        return;
+
+    JNIEnv *env;
+    jni_attach_thread(&env, THREAD_NAME);
+
+    jclass cls = (*env)->GetObjectClass(env, vout_android_gui);
+    jmethodID methodId = (*env)->GetMethodID(env, cls, "eventHardwareAccelerationError", "()V");
+    (*env)->CallVoidMethod(env, vout_android_gui, methodId);
+
+    (*env)->DeleteLocalRef(env, cls);
+    jni_detach_thread();
+}
+
+void jni_SetAndroidSurfaceSizeEnv(JNIEnv *p_env, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)
+{
+    if (vout_android_gui == NULL)
+        return;
+
+    jclass cls = (*p_env)->GetObjectClass (p_env, vout_android_gui);
+    jmethodID methodId = (*p_env)->GetMethodID (p_env, cls, "setSurfaceSize", "(IIIIII)V");
+
+    (*p_env)->CallVoidMethod (p_env, vout_android_gui, methodId, width, height, visible_width, visible_height, sar_num, sar_den);
+
+    (*p_env)->DeleteLocalRef(p_env, cls);
+}
+
+void jni_SetAndroidSurfaceSize(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)
+{
+    JNIEnv *p_env;
+
+    jni_attach_thread(&p_env, THREAD_NAME);
+    jni_SetAndroidSurfaceSizeEnv(p_env, width, height, visible_width, visible_height, sar_num, sar_den);
+
+    jni_detach_thread();
+}
+
+bool jni_IsVideoPlayerActivityCreated() {
+    pthread_mutex_lock(&vout_android_lock);
+    bool result = vout_video_player_activity_created;
+    pthread_mutex_unlock(&vout_android_lock);
+    return result;
+}
+
+void Java_org_videolan_libvlc_LibVLC_eventVideoPlayerActivityCreated(JNIEnv *env, jobject thiz, jboolean created) {
+    pthread_mutex_lock(&vout_android_lock);
+    vout_video_player_activity_created = created;
+    pthread_mutex_unlock(&vout_android_lock);
+}
+
+void Java_org_videolan_libvlc_LibVLC_attachSurface(JNIEnv *env, jobject thiz, jobject surf, jobject gui) {
+    pthread_mutex_lock(&vout_android_lock);
+    jclass clz;
+    jfieldID fid;
+
+    clz = (*env)->FindClass(env, "org/videolan/libvlc/LibVlcUtil");
+    jmethodID methodId = (*env)->GetStaticMethodID(env, clz, "isGingerbreadOrLater", "()Z");
+    jboolean gingerbreadOrLater = (*env)->CallStaticBooleanMethod(env, clz, methodId);
+    // Android 2.2 and under don't have ANativeWindow_fromSurface
+    if(unlikely(!gingerbreadOrLater)) {
+        clz = (*env)->GetObjectClass(env, surf);
+        fid = (*env)->GetFieldID(env, clz, "mSurface", "I");
+        if (fid == NULL) {
+            jthrowable exp = (*env)->ExceptionOccurred(env);
+            if (exp) {
+                (*env)->DeleteLocalRef(env, exp);
+                (*env)->ExceptionClear(env);
+            }
+            fid = (*env)->GetFieldID(env, clz, "mNativeSurface", "I");
+        }
+        vout_android_surf = (void*)(*env)->GetIntField(env, surf, fid);
+        (*env)->DeleteLocalRef(env, clz);
+    }
+    vout_android_gui = (*env)->NewGlobalRef(env, gui);
+    vout_android_java_surf = (*env)->NewGlobalRef(env, surf);
+    pthread_cond_signal(&vout_android_surf_attached);
+    pthread_mutex_unlock(&vout_android_lock);
+}
+
+void Java_org_videolan_libvlc_LibVLC_detachSurface(JNIEnv *env, jobject thiz) {
+    pthread_mutex_lock(&vout_android_lock);
+    vout_android_surf = NULL;
+    if (vout_android_gui != NULL)
+        (*env)->DeleteGlobalRef(env, vout_android_gui);
+    if (vout_android_java_surf != NULL)
+        (*env)->DeleteGlobalRef(env, vout_android_java_surf);
+    vout_android_gui = NULL;
+    vout_android_java_surf = NULL;
+    pthread_mutex_unlock(&vout_android_lock);
+}
+
+void Java_org_videolan_libvlc_LibVLC_attachSubtitlesSurface(JNIEnv *env, jobject thiz, jobject surf) {
+    pthread_mutex_lock(&vout_android_lock);
+    vout_android_subtitles_surf = (*env)->NewGlobalRef(env, surf);
+    pthread_cond_signal(&vout_android_surf_attached);
+    pthread_mutex_unlock(&vout_android_lock);
+}
+
+void Java_org_videolan_libvlc_LibVLC_detachSubtitlesSurface(JNIEnv *env, jobject thiz) {
+    pthread_mutex_lock(&vout_android_lock);
+    (*env)->DeleteGlobalRef(env, vout_android_subtitles_surf);
+    vout_android_subtitles_surf = NULL;
+    pthread_mutex_unlock(&vout_android_lock);
+}
+
+static int mouse_x = -1;
+static int mouse_y = -1;
+static int mouse_button = -1;
+static int mouse_action = -1;
+
+void Java_org_videolan_libvlc_LibVLC_sendMouseEvent(JNIEnv* env, jobject thiz, jint action, jint button, jint x, jint y)
+{
+    mouse_x = x;
+    mouse_y = y;
+    mouse_button = button;
+    mouse_action = action;
+}
+
+void jni_getMouseCoordinates(int *action, int *button, int *x, int *y)
+{
+    *x = mouse_x;
+    *y = mouse_y;
+    *button = mouse_button;
+    *action = mouse_action;
+
+    mouse_button = mouse_action = mouse_x = mouse_y = -1;
+}
diff --git a/libVLC/jni/vout.h b/libVLC/jni/vout.h
new file mode 100644
index 0000000..c3d4fd7
--- /dev/null
+++ b/libVLC/jni/vout.h
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * vout.h
+ *****************************************************************************
+ * Copyright © 2011-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef LIBVLCJNI_VOUT_H
+#define LIBVLCJNI_VOUT_H
+
+/* vout lock initialized in vout.c */
+pthread_mutex_t vout_android_lock;
+pthread_cond_t vout_android_surf_attached;
+
+#endif // LIBVLCJNI_VOUT_H
diff --git a/libVLC/jni/wchar/wcpcpy.c b/libVLC/jni/wchar/wcpcpy.c
new file mode 100644
index 0000000..df63d72
--- /dev/null
+++ b/libVLC/jni/wchar/wcpcpy.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ *	David E. O'Brien
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)strcpy.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcpcpy(wchar_t * __restrict to, const wchar_t * __restrict from)
+{
+
+	for (; (*to = *from); ++from, ++to);
+	return(to);
+}
diff --git a/libVLC/jni/wchar/wcpncpy.c b/libVLC/jni/wchar/wcpncpy.c
new file mode 100644
index 0000000..87b361c
--- /dev/null
+++ b/libVLC/jni/wchar/wcpncpy.c
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcpncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n)
+{
+
+	for (; n--; dst++, src++) {
+		if (!(*dst = *src)) {
+			wchar_t *ret = dst;
+			while (n--)
+				*++dst = L'\0';
+			return (ret);
+		}
+	}
+	return (dst);
+}
diff --git a/libVLC/jni/wchar/wcscasecmp.c b/libVLC/jni/wchar/wcscasecmp.c
new file mode 100644
index 0000000..0143543
--- /dev/null
+++ b/libVLC/jni/wchar/wcscasecmp.c
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+#include <wctype.h>
+
+int
+wcscasecmp(const wchar_t *s1, const wchar_t *s2)
+{
+	wchar_t c1, c2;
+
+	for (; *s1; s1++, s2++) {
+		c1 = towlower(*s1);
+		c2 = towlower(*s2);
+		if (c1 != c2)
+			return ((int)c1 - c2);
+	}
+	return (-*s2);
+}
diff --git a/libVLC/jni/wchar/wcscat.c b/libVLC/jni/wchar/wcscat.c
new file mode 100644
index 0000000..7ae4e80
--- /dev/null
+++ b/libVLC/jni/wchar/wcscat.c
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wcscat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcscat(wchar_t * __restrict s1, const wchar_t * __restrict s2)
+{
+	wchar_t *cp;
+
+	cp = s1;
+	while (*cp != L'\0')
+		cp++;
+	while ((*cp++ = *s2++) != L'\0')
+		;
+
+	return (s1);
+}
diff --git a/libVLC/jni/wchar/wcschr.c b/libVLC/jni/wchar/wcschr.c
new file mode 100644
index 0000000..1df1fe6
--- /dev/null
+++ b/libVLC/jni/wchar/wcschr.c
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcschr(const wchar_t *s, wchar_t c)
+{
+
+	while (*s != c && *s != L'\0')
+		s++;
+	if (*s == c)
+		return ((wchar_t *)s);
+	return (NULL);
+}
diff --git a/libVLC/jni/wchar/wcscmp.c b/libVLC/jni/wchar/wcscmp.c
new file mode 100644
index 0000000..2d48914
--- /dev/null
+++ b/libVLC/jni/wchar/wcscmp.c
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)strcmp.c	8.1 (Berkeley) 6/4/93";
+#if 0
+__RCSID("$NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+/*
+ * Compare strings.
+ */
+int
+wcscmp(const wchar_t *s1, const wchar_t *s2)
+{
+
+	while (*s1 == *s2++)
+		if (*s1++ == '\0')
+			return (0);
+	/* XXX assumes wchar_t = int */
+	return (*(const unsigned int *)s1 - *(const unsigned int *)--s2);
+}
diff --git a/libVLC/jni/wchar/wcscoll.c b/libVLC/jni/wchar/wcscoll.c
new file mode 100644
index 0000000..6e843b7
--- /dev/null
+++ b/libVLC/jni/wchar/wcscoll.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <wchar.h>
+/*
+ * Compare strings using the current locale.  Since Bionic really does not
+ * support locales, we assume we always use the C locale and call wcscmp.
+ *
+ * This function is provided to make libstdc++-v3 usable.
+ */
+int
+wcscoll(const wchar_t *ws1, const wchar_t *ws2)
+{
+    return wcscmp(ws1, ws2);
+}
diff --git a/libVLC/jni/wchar/wcscpy.c b/libVLC/jni/wchar/wcscpy.c
new file mode 100644
index 0000000..0c6e1f2
--- /dev/null
+++ b/libVLC/jni/wchar/wcscpy.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wcscpy.c,v 1.2 2000/12/21 04:51:09 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcscpy(wchar_t * __restrict s1, const wchar_t * __restrict s2)
+{
+	wchar_t *cp;
+
+	cp = s1;
+	while ((*cp++ = *s2++) != L'\0')
+		;
+
+	return (s1);
+}
diff --git a/libVLC/jni/wchar/wcscspn.c b/libVLC/jni/wchar/wcscspn.c
new file mode 100644
index 0000000..7729dc8
--- /dev/null
+++ b/libVLC/jni/wchar/wcscspn.c
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wcscspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+size_t
+wcscspn(const wchar_t *s, const wchar_t *set)
+{
+	const wchar_t *p;
+	const wchar_t *q;
+
+	p = s;
+	while (*p) {
+		q = set;
+		while (*q) {
+			if (*p == *q)
+				goto done;
+			q++;
+		}
+		p++;
+	}
+
+done:
+	return (p - s);
+}
diff --git a/libVLC/jni/wchar/wcsdup.c b/libVLC/jni/wchar/wcsdup.c
new file mode 100644
index 0000000..1e5db92
--- /dev/null
+++ b/libVLC/jni/wchar/wcsdup.c
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2005 Tim J. Robbins.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+#include <wchar.h>
+
+wchar_t *
+wcsdup(const wchar_t *s)
+{
+	wchar_t *copy;
+	size_t len;
+
+	len = wcslen(s) + 1;
+	if ((copy = malloc(len * sizeof(wchar_t))) == NULL)
+		return (NULL);
+	return (wmemcpy(copy, s, len));
+}
diff --git a/libVLC/jni/wchar/wcslcat.c b/libVLC/jni/wchar/wcslcat.c
new file mode 100644
index 0000000..f5f1e1e
--- /dev/null
+++ b/libVLC/jni/wchar/wcslcat.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *	from OpenBSD: strlcat.c,v 1.3 2000/11/24 11:10:02 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <wchar.h>
+
+/*
+ * Appends src to string dst of size siz (unlike wcsncat, siz is the
+ * full size of dst, not space left).  At most siz-1 characters
+ * will be copied.  Always NUL terminates (unless siz == 0).
+ * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
+ * truncation occurred.
+ */
+size_t
+wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
+{
+	wchar_t *d = dst;
+	const wchar_t *s = src;
+	size_t n = siz;
+	size_t dlen;
+
+	/* Find the end of dst and adjust bytes left but don't go past end */
+	while (*d != '\0' && n-- != 0)
+		d++;
+	dlen = d - dst;
+	n = siz - dlen;
+
+	if (n == 0)
+		return(dlen + wcslen(s));
+	while (*s != '\0') {
+		if (n != 1) {
+			*d++ = *s;
+			n--;
+		}
+		s++;
+	}
+	*d = '\0';
+
+	return(dlen + (s - src));	/* count does not include NUL */
+}
diff --git a/libVLC/jni/wchar/wcslcpy.c b/libVLC/jni/wchar/wcslcpy.c
new file mode 100644
index 0000000..b104a06
--- /dev/null
+++ b/libVLC/jni/wchar/wcslcpy.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *	from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcslcpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <wchar.h>
+
+/*
+ * Copy src to string dst of size siz.  At most siz-1 characters
+ * will be copied.  Always NUL terminates (unless siz == 0).
+ * Returns wcslen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
+{
+	wchar_t *d = dst;
+	const wchar_t *s = src;
+	size_t n = siz;
+
+	/* Copy as many bytes as will fit */
+	if (n != 0 && --n != 0) {
+		do {
+			if ((*d++ = *s++) == 0)
+				break;
+		} while (--n != 0);
+	}
+
+	/* Not enough room in dst, add NUL and traverse rest of src */
+	if (n == 0) {
+		if (siz != 0)
+			*d = '\0';		/* NUL-terminate dst */
+		while (*s++)
+			;
+	}
+
+	return(s - src - 1);	/* count does not include NUL */
+}
diff --git a/libVLC/jni/wchar/wcslen.c b/libVLC/jni/wchar/wcslen.c
new file mode 100644
index 0000000..ca3004e
--- /dev/null
+++ b/libVLC/jni/wchar/wcslen.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+size_t
+wcslen(const wchar_t *s)
+{
+	const wchar_t *p;
+
+	p = s;
+	while (*p)
+		p++;
+
+	return p - s;
+}
diff --git a/libVLC/jni/wchar/wcsncasecmp.c b/libVLC/jni/wchar/wcsncasecmp.c
new file mode 100644
index 0000000..a42d98c
--- /dev/null
+++ b/libVLC/jni/wchar/wcsncasecmp.c
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+#include <wctype.h>
+
+int
+wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+	wchar_t c1, c2;
+
+	if (n == 0)
+		return (0);
+	for (; *s1; s1++, s2++) {
+		c1 = towlower(*s1);
+		c2 = towlower(*s2);
+		if (c1 != c2)
+			return ((int)c1 - c2);
+		if (--n == 0)
+			return (0);
+	}
+	return (-*s2);
+}
diff --git a/libVLC/jni/wchar/wcsncat.c b/libVLC/jni/wchar/wcsncat.c
new file mode 100644
index 0000000..44f1ff9
--- /dev/null
+++ b/libVLC/jni/wchar/wcsncat.c
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wcsncat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcsncat(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)
+{
+	wchar_t *p;
+	wchar_t *q;
+	const wchar_t *r;
+
+	p = s1;
+	while (*p)
+		p++;
+	q = p;
+	r = s2;
+	while (*r && n) {
+		*q++ = *r++;
+		n--;
+	}
+	*q = '\0';
+	return s1;
+}
diff --git a/libVLC/jni/wchar/wcsncmp.c b/libVLC/jni/wchar/wcsncmp.c
new file mode 100644
index 0000000..86d7a51
--- /dev/null
+++ b/libVLC/jni/wchar/wcsncmp.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)strncmp.c	8.1 (Berkeley) 6/4/93";
+__RCSID("$NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+int
+wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+
+	if (n == 0)
+		return (0);
+	do {
+		if (*s1 != *s2++) {
+			/* XXX assumes wchar_t = int */
+			return (*(const unsigned int *)s1 -
+			    *(const unsigned int *)--s2);
+		}
+		if (*s1++ == 0)
+			break;
+	} while (--n != 0);
+	return (0);
+}
diff --git a/libVLC/jni/wchar/wcsncpy.c b/libVLC/jni/wchar/wcsncpy.c
new file mode 100644
index 0000000..00d986b
--- /dev/null
+++ b/libVLC/jni/wchar/wcsncpy.c
@@ -0,0 +1,64 @@
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)strncpy.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+/*
+ * Copy src to dst, truncating or null-padding to always copy n bytes.
+ * Return dst.
+ */
+wchar_t *
+wcsncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n)
+{
+	if (n != 0) {
+		wchar_t *d = dst;
+		const wchar_t *s = src;
+
+		do {
+			if ((*d++ = *s++) == L'\0') {
+				/* NUL pad the remaining n-1 bytes */
+				while (--n != 0)
+					*d++ = L'\0';
+				break;
+			}
+		} while (--n != 0);
+	}
+	return (dst);
+}
diff --git a/libVLC/jni/wchar/wcsnlen.c b/libVLC/jni/wchar/wcsnlen.c
new file mode 100644
index 0000000..f03cf76
--- /dev/null
+++ b/libVLC/jni/wchar/wcsnlen.c
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+size_t
+wcsnlen(const wchar_t *s, size_t maxlen)
+{
+	size_t len;
+
+	for (len = 0; len < maxlen; len++, s++) {
+		if (!*s)
+			break;
+	}
+	return (len);
+}
diff --git a/libVLC/jni/wchar/wcspbrk.c b/libVLC/jni/wchar/wcspbrk.c
new file mode 100644
index 0000000..2ff71ba
--- /dev/null
+++ b/libVLC/jni/wchar/wcspbrk.c
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wcspbrk.c,v 1.2 2000/12/21 05:07:25 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcspbrk.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcspbrk(const wchar_t *s, const wchar_t *set)
+{
+	const wchar_t *p;
+	const wchar_t *q;
+
+	p = s;
+	while (*p) {
+		q = set;
+		while (*q) {
+			if (*p == *q) {
+				/* LINTED interface specification */
+				return (wchar_t *)p;
+			}
+			q++;
+		}
+		p++;
+	}
+	return NULL;
+}
diff --git a/libVLC/jni/wchar/wcsrchr.c b/libVLC/jni/wchar/wcsrchr.c
new file mode 100644
index 0000000..37c81ec
--- /dev/null
+++ b/libVLC/jni/wchar/wcsrchr.c
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 2002 Tim J. Robbins
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcsrchr(const wchar_t *s, wchar_t c)
+{
+	const wchar_t *last;
+
+	last = NULL;
+	for (;;) {
+		if (*s == c)
+			last = s;
+		if (*s == L'\0')
+			break;
+		s++;
+	}
+
+	return ((wchar_t *)last);
+}
diff --git a/libVLC/jni/wchar/wcsspn.c b/libVLC/jni/wchar/wcsspn.c
new file mode 100644
index 0000000..6569206
--- /dev/null
+++ b/libVLC/jni/wchar/wcsspn.c
@@ -0,0 +1,60 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wcsspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wcsspn.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+size_t
+wcsspn(const wchar_t *s, const wchar_t *set)
+{
+	const wchar_t *p;
+	const wchar_t *q;
+
+	p = s;
+	while (*p) {
+		q = set;
+		while (*q) {
+			if (*p == *q)
+				break;
+			q++;
+		}
+		if (!*q)
+			goto done;
+		p++;
+	}
+
+done:
+	return (p - s);
+}
diff --git a/libVLC/jni/wchar/wcsstr.c b/libVLC/jni/wchar/wcsstr.c
new file mode 100644
index 0000000..a9dc27b
--- /dev/null
+++ b/libVLC/jni/wchar/wcsstr.c
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)strstr.c	8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+/*
+ * Find the first occurrence of find in s.
+ */
+wchar_t *
+wcsstr(const wchar_t * __restrict s, const wchar_t * __restrict find)
+{
+	wchar_t c, sc;
+	size_t len;
+
+	if ((c = *find++) != L'\0') {
+		len = wcslen(find);
+		do {
+			do {
+				if ((sc = *s++) == L'\0')
+					return (NULL);
+			} while (sc != c);
+		} while (wcsncmp(s, find, len) != 0);
+		s--;
+	}
+	return ((wchar_t *)s);
+}
diff --git a/libVLC/jni/wchar/wcstok.c b/libVLC/jni/wchar/wcstok.c
new file mode 100644
index 0000000..5a77117
--- /dev/null
+++ b/libVLC/jni/wchar/wcstok.c
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 1998 Softweyr LLC.  All rights reserved.
+ *
+ * strtok_r, from Berkeley strtok
+ * Oct 13, 1998 by Wes Peters <wes at softweyr.com>
+ *
+ * Copyright (c) 1988, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notices, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notices, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL SOFTWEYR LLC, THE
+ * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t *
+wcstok(wchar_t * __restrict s, const wchar_t * __restrict delim,
+    wchar_t ** __restrict last)
+{
+	const wchar_t *spanp;
+	wchar_t *tok;
+	wchar_t c, sc;
+
+	if (s == NULL && (s = *last) == NULL)
+		return (NULL);
+
+	/*
+	 * Skip (span) leading delimiters (s += wcsspn(s, delim), sort of).
+	 */
+cont:
+	c = *s++;
+	for (spanp = delim; (sc = *spanp++) != L'\0';) {
+		if (c == sc)
+			goto cont;
+	}
+
+	if (c == L'\0') {	/* no non-delimiter characters */
+		*last = NULL;
+		return (NULL);
+	}
+	tok = s - 1;
+
+	/*
+	 * Scan token (scan for delimiters: s += wcscspn(s, delim), sort of).
+	 * Note that delim must have one NUL; we stop if we see that, too.
+	 */
+	for (;;) {
+		c = *s++;
+		spanp = delim;
+		do {
+			if ((sc = *spanp++) == c) {
+				if (c == L'\0')
+					s = NULL;
+				else
+					s[-1] = L'\0';
+				*last = s;
+				return (tok);
+			}
+		} while (sc != L'\0');
+	}
+	/* NOTREACHED */
+}
diff --git a/libVLC/jni/wchar/wcswidth.c b/libVLC/jni/wchar/wcswidth.c
new file mode 100644
index 0000000..b142074
--- /dev/null
+++ b/libVLC/jni/wchar/wcswidth.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+int
+wcswidth(const wchar_t *pwcs, size_t n)
+{
+	wchar_t wc;
+	int len, l;
+
+	len = 0;
+	while (n-- > 0 && (wc = *pwcs++) != L'\0') {
+		if ((l = wcwidth(wc)) < 0)
+			return (-1);
+		len += l;
+	}
+	return (len);
+}
+
diff --git a/libVLC/jni/wchar/wcsxfrm.c b/libVLC/jni/wchar/wcsxfrm.c
new file mode 100644
index 0000000..042ea56
--- /dev/null
+++ b/libVLC/jni/wchar/wcsxfrm.c
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants <alex at elvisti.kiev.ua>
+ *		at Electronni Visti IA, Kiev, Ukraine.
+ *			All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <wchar.h>
+
+/*
+ * Placeholder wcsxfrm() implementation. See wcscoll.c for a description of
+ * the logic used.
+ */
+size_t
+wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
+{
+    int prim, sec, l;
+    size_t slen;
+    char *mbsrc, *s, *ss;
+
+    if (*src == L'\0') {
+        if (len != 0)
+            *dest = L'\0';
+        return (0);
+    }
+
+    slen = wcslen(src);
+    if (len > 0) {
+        if (slen < len)
+            wcscpy(dest, src);
+        else {
+            wcsncpy(dest, src, len - 1);
+            dest[len - 1] = L'\0';
+        }
+    }
+    return (slen);
+}
diff --git a/libVLC/jni/wchar/wmemchr.c b/libVLC/jni/wchar/wmemchr.c
new file mode 100644
index 0000000..cab89c9
--- /dev/null
+++ b/libVLC/jni/wchar/wmemchr.c
@@ -0,0 +1,52 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wmemchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t	*
+wmemchr(const wchar_t *s, wchar_t c, size_t n)
+{
+	size_t i;
+
+	for (i = 0; i < n; i++) {
+		if (*s == c) {
+			/* LINTED const castaway */
+			return (wchar_t *)s;
+		}
+		s++;
+	}
+	return NULL;
+}
diff --git a/libVLC/jni/wchar/wmemcmp.c b/libVLC/jni/wchar/wmemcmp.c
new file mode 100644
index 0000000..fdb1f98
--- /dev/null
+++ b/libVLC/jni/wchar/wmemcmp.c
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wmemcmp.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wmemcmp.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+int
+wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+	size_t i;
+
+	for (i = 0; i < n; i++) {
+		if (*s1 != *s2) {
+			/* wchar might be unsigned */
+			return *s1 > *s2 ? 1 : -1; 
+		}
+		s1++;
+		s2++;
+	}
+	return 0;
+}
diff --git a/libVLC/jni/wchar/wmemcpy.c b/libVLC/jni/wchar/wmemcpy.c
new file mode 100644
index 0000000..c10770c
--- /dev/null
+++ b/libVLC/jni/wchar/wmemcpy.c
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <string.h>
+#include <wchar.h>
+
+wchar_t *
+wmemcpy(wchar_t * __restrict d, const wchar_t * __restrict s, size_t n)
+{
+	return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t));
+}
diff --git a/libVLC/jni/wchar/wmemmove.c b/libVLC/jni/wchar/wmemmove.c
new file mode 100644
index 0000000..05cfd10
--- /dev/null
+++ b/libVLC/jni/wchar/wmemmove.c
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wmemmove.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <string.h>
+#include <wchar.h>
+
+wchar_t *
+wmemmove(wchar_t *d, const wchar_t *s, size_t n)
+{
+	return (wchar_t *)memmove(d, s, n * sizeof(wchar_t));
+}
diff --git a/libVLC/jni/wchar/wmemset.c b/libVLC/jni/wchar/wmemset.c
new file mode 100644
index 0000000..0e96356
--- /dev/null
+++ b/libVLC/jni/wchar/wmemset.c
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	citrus Id: wmemset.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <sys/cdefs.h>
+#if 0
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: wmemset.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
+#endif /* LIBC_SCCS and not lint */
+#endif
+__FBSDID("$FreeBSD$");
+
+#include <wchar.h>
+
+wchar_t	*
+wmemset(wchar_t *s, wchar_t c, size_t n)
+{
+	size_t i;
+	wchar_t *p;
+
+	p = (wchar_t *)s;
+	for (i = 0; i < n; i++) {
+		*p = c;
+		p++;
+	}
+	return s;
+}
diff --git a/libVLC/project.properties b/libVLC/project.properties
new file mode 100644
index 0000000..60b343d
--- /dev/null
+++ b/libVLC/project.properties
@@ -0,0 +1,17 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+android.library=true
+# Indicates whether an apk should be generated for each density.
+split.density=false
+# Project target.
+target=android-21
diff --git a/libVLC/src/org/videolan/libvlc/AudioOutput.java b/libVLC/src/org/videolan/libvlc/AudioOutput.java
new file mode 100644
index 0000000..06955ac
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/AudioOutput.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Aout.java
+ *****************************************************************************
+ * Copyright © 2011-2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+import android.media.AudioFormat;
+import android.media.AudioManager;
+import android.media.AudioTrack;
+import android.util.Log;
+
+public class AudioOutput {
+    /**
+     * Java side of the audio output module for Android.
+     * Uses an AudioTrack to play decoded audio buffers.
+     *
+     * TODO Use MODE_STATIC instead of MODE_STREAM with a MemoryFile (ashmem)
+     */
+
+    public AudioOutput() {
+    }
+
+    private AudioTrack mAudioTrack;
+    private static final String TAG = "LibVLC/aout";
+
+    public void init(int sampleRateInHz, int channels, int samples) {
+        Log.d(TAG, sampleRateInHz + ", " + channels + ", " + samples + "=>" + channels * samples);
+        int minBufferSize = AudioTrack.getMinBufferSize(sampleRateInHz,
+                                                        AudioFormat.CHANNEL_OUT_STEREO,
+                                                        AudioFormat.ENCODING_PCM_16BIT);
+        mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
+                                     sampleRateInHz,
+                                     AudioFormat.CHANNEL_OUT_STEREO,
+                                     AudioFormat.ENCODING_PCM_16BIT,
+                                     Math.max(minBufferSize, channels * samples * 2),
+                                     AudioTrack.MODE_STREAM);
+    }
+
+    public void release() {
+        if (mAudioTrack != null) {
+            mAudioTrack.release();
+        }
+        mAudioTrack = null;
+    }
+
+    public void playBuffer(byte[] audioData, int bufferSize) {
+        if (mAudioTrack.getState() == AudioTrack.STATE_UNINITIALIZED)
+            return;
+        if (mAudioTrack.write(audioData, 0, bufferSize) != bufferSize) {
+            Log.w(TAG, "Could not write all the samples to the audio device");
+        }
+        mAudioTrack.play();
+    }
+
+    public void pause() {
+        mAudioTrack.pause();
+    }
+}
diff --git a/libVLC/src/org/videolan/libvlc/EventHandler.java b/libVLC/src/org/videolan/libvlc/EventHandler.java
new file mode 100644
index 0000000..16a0791
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/EventHandler.java
@@ -0,0 +1,131 @@
+/*****************************************************************************
+ * EventHandler.java
+ *****************************************************************************
+ * Copyright © 2011-2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+import java.util.ArrayList;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+
+public class EventHandler {
+
+    /*
+     * Be sure to subscribe to events you need in the JNI too.
+     */
+
+    //public static final int MediaMetaChanged                = 0;
+    //public static final int MediaSubItemAdded               = 1;
+    //public static final int MediaDurationChanged            = 2;
+    public static final int MediaParsedChanged                = 3;
+    //public static final int MediaFreed                      = 4;
+    //public static final int MediaStateChanged               = 5;
+
+    //public static final int MediaPlayerMediaChanged         = 0x100;
+    //public static final int MediaPlayerNothingSpecial       = 0x101;
+    //public static final int MediaPlayerOpening              = 0x102;
+    //public static final int MediaPlayerBuffering            = 0x103;
+    public static final int MediaPlayerPlaying                = 0x104;
+    public static final int MediaPlayerPaused                 = 0x105;
+    public static final int MediaPlayerStopped                = 0x106;
+    //public static final int MediaPlayerForward              = 0x107;
+    //public static final int MediaPlayerBackward             = 0x108;
+    public static final int MediaPlayerEndReached             = 0x109;
+    public static final int MediaPlayerEncounteredError       = 0x10a;
+    public static final int MediaPlayerTimeChanged            = 0x10b;
+    public static final int MediaPlayerPositionChanged        = 0x10c;
+    //public static final int MediaPlayerSeekableChanged      = 0x10d;
+    //public static final int MediaPlayerPausableChanged      = 0x10e;
+    //public static final int MediaPlayerTitleChanged         = 0x10f;
+    //public static final int MediaPlayerSnapshotTaken        = 0x110;
+    //public static final int MediaPlayerLengthChanged        = 0x111;
+    public static final int MediaPlayerVout                   = 0x112;
+
+    //public static final int MediaListItemAdded              = 0x200;
+    //public static final int MediaListWillAddItem            = 0x201;
+    //public static final int MediaListItemDeleted            = 0x202;
+    //public static final int MediaListWillDeleteItem         = 0x203;
+
+    //public static final int MediaListViewItemAdded          = 0x300;
+    //public static final int MediaListViewWillAddItem        = 0x301;
+    //public static final int MediaListViewItemDeleted        = 0x302;
+    //public static final int MediaListViewWillDeleteItem     = 0x303;
+
+    //public static final int MediaListPlayerPlayed           = 0x400;
+    //public static final int MediaListPlayerNextItemSet      = 0x401;
+    //public static final int MediaListPlayerStopped          = 0x402;
+
+    //public static final int MediaDiscovererStarted          = 0x500;
+    //public static final int MediaDiscovererEnded            = 0x501;
+
+    //public static final int VlmMediaAdded                   = 0x600;
+    //public static final int VlmMediaRemoved                 = 0x601;
+    //public static final int VlmMediaChanged                 = 0x602;
+    //public static final int VlmMediaInstanceStarted         = 0x603;
+    //public static final int VlmMediaInstanceStopped         = 0x604;
+    //public static final int VlmMediaInstanceStatusInit      = 0x605;
+    //public static final int VlmMediaInstanceStatusOpening   = 0x606;
+    //public static final int VlmMediaInstanceStatusPlaying   = 0x607;
+    //public static final int VlmMediaInstanceStatusPause     = 0x608;
+    //public static final int VlmMediaInstanceStatusEnd       = 0x609;
+    //public static final int VlmMediaInstanceStatusError     = 0x60a;
+
+    public static final int CustomMediaListExpanding          = 0x2000;
+    public static final int CustomMediaListExpandingEnd       = 0x2001;
+    public static final int CustomMediaListItemAdded          = 0x2002;
+    public static final int CustomMediaListItemDeleted        = 0x2003;
+    public static final int CustomMediaListItemMoved          = 0x2004;
+
+    public static final int HardwareAccelerationError         = 0x3000;
+
+    private ArrayList<Handler> mEventHandler;
+    private static EventHandler mInstance;
+
+    EventHandler() {
+        mEventHandler = new ArrayList<Handler>();
+    }
+
+    public static EventHandler getInstance() {
+        if (mInstance == null) {
+            mInstance = new EventHandler();
+        }
+        return mInstance;
+    }
+
+    public void addHandler(Handler handler) {
+        if (!mEventHandler.contains(handler))
+            mEventHandler.add(handler);
+    }
+
+    public void removeHandler(Handler handler) {
+        mEventHandler.remove(handler);
+    }
+
+    /** This method is called by a native thread **/
+    public void callback(int event, Bundle b) {
+        b.putInt("event", event);
+        for (int i = 0; i < mEventHandler.size(); i++) {
+            Message msg = Message.obtain();
+            msg.setData(b);
+            mEventHandler.get(i).sendMessage(msg);
+        }
+    }
+}
diff --git a/libVLC/src/org/videolan/libvlc/HWDecoderUtil.java b/libVLC/src/org/videolan/libvlc/HWDecoderUtil.java
new file mode 100644
index 0000000..8e0e903
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/HWDecoderUtil.java
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * HWDecUtil.java
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+/**
+ * Utility class that return the preferred hardware decoder from a list of known devices.
+ */
+public class HWDecoderUtil {
+
+    public enum Decoder {
+        UNKNOWN, NONE, OMX, MEDIACODEC, ALL
+    }
+
+    private static class DecoderBySOC {
+        public final String key;
+        public final Decoder dec;
+        public final String[] list;
+        public DecoderBySOC(String key, Decoder dec, String[] list) {
+            this.key = key;
+            this.dec = dec;
+            this.list = list;
+        }
+    }
+
+    private static final DecoderBySOC[] sDecoderBySOCList = new DecoderBySOC[] {
+        /*
+         *  Put first devices you want to blacklist
+         *  because theses devices can match the next rules.
+         */
+        new DecoderBySOC ("ro.product.brand", Decoder.NONE, new  String[] {
+                "SEMC",             // Xperia S
+        }),
+        new DecoderBySOC ("ro.board.platform", Decoder.NONE, new  String[] {
+                "msm7627",          // QCOM S1
+        }),
+        /*
+         * Devices working on OMX
+         */
+        new DecoderBySOC ("ro.board.platform", Decoder.OMX, new  String[] {
+                "omap3",            // Omap 3
+                "rockchip", "rk29", // Rockchip RK29
+                "msm7630",          // QCOM S2
+                "s5pc",             // Exynos 3
+                "montblanc",        // Montblanc
+                "exdroid",          // Allwinner A31
+        }),
+        new DecoderBySOC ("ro.hardware", Decoder.OMX, new  String[] {
+                "sun6i",            // Allwinner A31
+        }),
+        /*
+         * Devices working on Mediacodec and OMX
+         */
+        new DecoderBySOC ("ro.board.platform", Decoder.ALL, new  String[] {
+                "omap4",            // Omap 4
+                "tegra",            // Tegra 2 & 3
+                "tegra3",           // Tegra 3
+                "msm8660",          // QCOM S3
+                "exynos4",          // Exynos 4 (Samsung Galaxy S2/S3)
+                "exynos5",          // Exynos 5 (Samsung Galaxy S4)
+                "rk30", "rk31",     // Rockchip RK3*
+                "mv88de3100",       // Marvell ARMADA 1500
+        }),
+        new DecoderBySOC ("ro.hardware", Decoder.ALL, new  String[] {
+                "mt65", "mt83",     // MTK
+        }),
+    };
+
+    private static final HashMap<String, String> sSystemPropertyMap = new HashMap<String, String>();
+
+    /**
+     * @return the hardware decoder known to work for the running device
+     * (Always return Dec.ALL after Android 4.3)
+     */
+    public static Decoder getDecoderFromDevice() {
+        if (LibVlcUtil.isJellyBeanMR2OrLater())
+            return Decoder.ALL;
+        for (DecoderBySOC decBySOC : sDecoderBySOCList) {
+            String prop = sSystemPropertyMap.get(decBySOC.key);
+            if (prop == null) {
+                prop = getSystemProperty(decBySOC.key, "none");
+                sSystemPropertyMap.put(decBySOC.key, prop);
+            }
+            if (prop != null) {
+                for (String decProp: decBySOC.list)
+                    if (prop.contains(decProp))
+                        return decBySOC.dec;
+            }
+        }
+        return Decoder.UNKNOWN;
+    }
+
+    private static String getSystemProperty(String key, String def) {
+        try {
+            final ClassLoader cl = ClassLoader.getSystemClassLoader();
+            final Class<?> SystemProperties = cl.loadClass("android.os.SystemProperties");
+            final Class<?>[] paramTypes = new Class[] { String.class, String.class };
+            final Method get = SystemProperties.getMethod("get", paramTypes);
+            final Object[] params = new Object[] { key, def };
+            return (String) get.invoke(SystemProperties, params);
+        } catch (Exception e){
+            return def;
+        }
+    }
+}
diff --git a/libVLC/src/org/videolan/libvlc/IVideoPlayer.java b/libVLC/src/org/videolan/libvlc/IVideoPlayer.java
new file mode 100644
index 0000000..6d7f53d
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/IVideoPlayer.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * IVideoPlayer.java
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+public interface IVideoPlayer {
+    /**
+     * This method is called by native vout to request a surface resize when frame size doesn't match surface size.
+     * @param width Frame width
+     * @param height Frame height
+     * @param visible_width Visible frame width
+     * @param visible_height Visible frame height
+     * @param sar_num Surface aspect ratio numerator
+     * @param sar_den Surface aspect ratio denominator
+     */
+    void setSurfaceSize(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den);
+
+    /**
+     * Called in case of hardware acceleration error
+     */
+    public void eventHardwareAccelerationError();
+}
diff --git a/libVLC/src/org/videolan/libvlc/LibVLC.java b/libVLC/src/org/videolan/libvlc/LibVLC.java
new file mode 100644
index 0000000..790855a
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/LibVLC.java
@@ -0,0 +1,859 @@
+/*****************************************************************************
+ * LibVLC.java
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Map;
+
+import android.content.Context;
+import android.os.Build;
+import android.util.Log;
+import android.view.Surface;
+
+public class LibVLC {
+    private static final String TAG = "VLC/LibVLC";
+    public static final int AOUT_AUDIOTRACK_JAVA = 0;
+    public static final int AOUT_AUDIOTRACK = 1;
+    public static final int AOUT_OPENSLES = 2;
+
+    public static final int VOUT_ANDROID_SURFACE = 0;
+    public static final int VOUT_OPEGLES2 = 1;
+
+    public static final int HW_ACCELERATION_AUTOMATIC = -1;
+    public static final int HW_ACCELERATION_DISABLED = 0;
+    public static final int HW_ACCELERATION_DECODING = 1;
+    public static final int HW_ACCELERATION_FULL = 2;
+
+    public static final int DEV_HW_DECODER_AUTOMATIC = -1;
+    public static final int DEV_HW_DECODER_OMX = 0;
+    public static final int DEV_HW_DECODER_OMX_DR = 1;
+    public static final int DEV_HW_DECODER_MEDIACODEC = 2;
+    public static final int DEV_HW_DECODER_MEDIACODEC_DR = 3;
+
+    public static final int INPUT_NAV_ACTIVATE = 0;
+    public static final int INPUT_NAV_UP = 1;
+    public static final int INPUT_NAV_DOWN = 2;
+    public static final int INPUT_NAV_LEFT = 3;
+    public static final int INPUT_NAV_RIGHT = 4;
+
+    private static final String DEFAULT_CODEC_LIST = "mediacodec,iomx,all";
+
+    private static LibVLC sInstance;
+
+    /** libVLC instance C pointer */
+    private long mLibVlcInstance = 0; // Read-only, reserved for JNI
+    /** libvlc_media_player pointer and index */
+    private int mInternalMediaPlayerIndex = 0; // Read-only, reserved for JNI
+    private long mInternalMediaPlayerInstance = 0; // Read-only, reserved for JNI
+
+    private MediaList mMediaList; // Pointer to media list being followed
+    private MediaList mPrimaryList; // Primary/default media list; see getPrimaryMediaList()
+
+    /** Buffer for VLC messages */
+    private StringBuffer mDebugLogBuffer;
+    private boolean mIsBufferingLog = false;
+
+    private AudioOutput mAout;
+
+    /** Keep screen bright */
+    //private WakeLock mWakeLock;
+
+    /** Settings */
+    private int hardwareAcceleration = HW_ACCELERATION_AUTOMATIC;
+    private int devHardwareDecoder = DEV_HW_DECODER_AUTOMATIC;
+    private String codecList = DEFAULT_CODEC_LIST;
+    private String devCodecList = null;
+    private String subtitlesEncoding = "";
+    private int aout = LibVlcUtil.isGingerbreadOrLater() ? AOUT_OPENSLES : AOUT_AUDIOTRACK_JAVA;
+    private int vout = VOUT_ANDROID_SURFACE;
+    private boolean timeStretching = false;
+    private int deblocking = -1;
+    private String chroma = "";
+    private boolean verboseMode = true;
+    private float[] equalizer = null;
+    private boolean frameSkip = false;
+    private int networkCaching = 0;
+    private boolean httpReconnect = false;
+
+    /** Path of application-specific cache */
+    private String mCachePath = "";
+
+    /** Native crash handler */
+    private OnNativeCrashListener mOnNativeCrashListener;
+
+    /** Check in libVLC already initialized otherwise crash */
+    private boolean mIsInitialized = false;
+    public native void attachSurface(Surface surface, IVideoPlayer player);
+
+    public native void detachSurface();
+
+    public native void attachSubtitlesSurface(Surface surface);
+    public native void detachSubtitlesSurface();
+
+    public native void eventVideoPlayerActivityCreated(boolean created);
+
+    /* Load library before object instantiation */
+    static {
+        try {
+            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
+                System.loadLibrary("iomx-gingerbread");
+            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2)
+                System.loadLibrary("iomx-hc");
+            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1)
+                System.loadLibrary("iomx-ics");
+            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2)
+                System.loadLibrary("iomx-jbmr2");
+            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT)
+                System.loadLibrary("iomx-kk");
+        } catch (Throwable t) {
+            // No need to warn if it isn't found, when we intentionally don't build these except for debug
+            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
+                Log.w(TAG, "Unable to load the iomx library: " + t);
+        }
+        try {
+            System.loadLibrary("vlcjni");
+        } catch (UnsatisfiedLinkError ule) {
+            Log.e(TAG, "Can't load vlcjni library: " + ule);
+            /// FIXME Alert user
+            System.exit(1);
+        } catch (SecurityException se) {
+            Log.e(TAG, "Encountered a security issue when loading vlcjni library: " + se);
+            /// FIXME Alert user
+            System.exit(1);
+        }
+    }
+
+    /**
+     * Singleton constructor of libVLC Without surface and vout to create the
+     * thumbnail and get information e.g. on the MediaLibraryActivity
+     *
+     * @return libVLC instance
+     * @throws LibVlcException
+     */
+    public static LibVLC getInstance() throws LibVlcException {
+        synchronized (LibVLC.class) {
+            if (sInstance == null) {
+                /* First call */
+                sInstance = new LibVLC();
+            }
+        }
+
+        return sInstance;
+    }
+
+    /**
+     * Return an existing instance of libVLC Call it when it is NOT important
+     * that this fails
+     *
+     * @return libVLC instance OR null
+     */
+    public static LibVLC getExistingInstance() {
+        synchronized (LibVLC.class) {
+            return sInstance;
+        }
+    }
+
+    /**
+     * Constructor
+     * It is private because this class is a singleton.
+     */
+    private LibVLC() {
+        mAout = new AudioOutput();
+    }
+
+    /**
+     * Destructor:
+     * It is bad practice to rely on them, so please don't forget to call
+     * destroy() before exiting.
+     */
+    @Override
+    protected void finalize() {
+        if (mLibVlcInstance != 0) {
+            Log.d(TAG, "LibVLC is was destroyed yet before finalize()");
+            destroy();
+        }
+    }
+
+    /**
+     * Get the media list that LibVLC is following right now.
+     *
+     * @return The media list object being followed
+     */
+    public MediaList getMediaList() {
+        return mMediaList;
+    }
+
+    /**
+     * Set the media list for LibVLC to follow.
+     *
+     * @param mediaList The media list object to follow
+     */
+    public void setMediaList(MediaList mediaList) {
+        mMediaList = mediaList;
+    }
+
+    /**
+     * Sets LibVLC to follow the default media list (see below)
+     */
+    public void setMediaList() {
+        mMediaList = mPrimaryList;
+    }
+
+    /**
+     * Gets the primary media list, or the "currently playing" list.
+     * Not to be confused with the media list pointer from above, which
+     * refers the the MediaList object that libVLC is currently following.
+     * This list is just one out of many lists that it can be pointed towards.
+     *
+     * This list will be used for lists of songs that are not user-defined.
+     * For example: selecting a song from the Songs list, or from the list
+     * displayed after selecting an album.
+     *
+     * It is loaded as the default list.
+     *
+     * @return The primary media list
+     */
+    public MediaList getPrimaryMediaList() {
+        return mPrimaryList;
+    }
+
+    /**
+     * Give to LibVLC the surface to draw the video.
+     * @param f the surface to draw
+     */
+    public native void setSurface(Surface f);
+
+    public static synchronized void restart(Context context) {
+        if (sInstance != null) {
+            try {
+                sInstance.destroy();
+                sInstance.init(context);
+            } catch (LibVlcException lve) {
+                Log.e(TAG, "Unable to reinit libvlc: " + lve);
+            }
+        }
+    }
+
+    /**
+     * those get/is* are called from native code to get settings values.
+     */
+
+    public int getHardwareAcceleration() {
+        return this.hardwareAcceleration;
+    }
+
+    public void setHardwareAcceleration(int hardwareAcceleration) {
+
+        if (hardwareAcceleration == HW_ACCELERATION_DISABLED) {
+            Log.d(TAG, "HWDec disabled: by user");
+            this.hardwareAcceleration = HW_ACCELERATION_DISABLED;
+            this.codecList = "all";
+        } else {
+            // Automatic or forced
+            HWDecoderUtil.Decoder decoder = HWDecoderUtil.getDecoderFromDevice();
+
+            if (decoder == HWDecoderUtil.Decoder.NONE) {
+                // NONE
+                this.hardwareAcceleration = HW_ACCELERATION_DISABLED;
+                this.codecList = "all";
+                Log.d(TAG, "HWDec disabled: device not working with mediacodec,iomx");
+            } else if (decoder == HWDecoderUtil.Decoder.UNKNOWN) {
+                // UNKNOWN
+                if (hardwareAcceleration < 0) {
+                    this.hardwareAcceleration = HW_ACCELERATION_DISABLED;
+                    this.codecList = "all";
+                    Log.d(TAG, "HWDec disabled: automatic and (unknown device or android version < 4.3)");
+                } else {
+                    this.hardwareAcceleration = hardwareAcceleration;
+                    this.codecList = DEFAULT_CODEC_LIST;
+                    Log.d(TAG, "HWDec enabled: forced by user and unknown device");
+                }
+            } else {
+                // OMX, MEDIACODEC or ALL
+                this.hardwareAcceleration = hardwareAcceleration < 0 ?
+                        HW_ACCELERATION_FULL : hardwareAcceleration;
+                if (decoder == HWDecoderUtil.Decoder.ALL)
+                    this.codecList = DEFAULT_CODEC_LIST;
+                else {
+                    final StringBuilder sb = new StringBuilder();
+                    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC)
+                        sb.append("mediacodec,");
+                    else if (decoder == HWDecoderUtil.Decoder.OMX)
+                        sb.append("iomx,");
+                    sb.append("all");
+                    this.codecList = sb.toString();
+                }
+                Log.d(TAG, "HWDec enabled: device working with: " + this.codecList);
+            }
+        }
+    }
+
+    public int getDevHardwareDecoder() {
+        return this.devHardwareDecoder;
+    }
+
+    public void setDevHardwareDecoder(int devHardwareDecoder) {
+        if (devHardwareDecoder != DEV_HW_DECODER_AUTOMATIC) {
+            this.devHardwareDecoder = devHardwareDecoder;
+            if (this.devHardwareDecoder == DEV_HW_DECODER_OMX ||
+                    this.devHardwareDecoder == DEV_HW_DECODER_OMX_DR)
+                this.devCodecList = "iomx";
+            else
+                this.devCodecList = "mediacodec";
+
+            Log.d(TAG, "HWDec forced: " + this.devCodecList +
+                (isDirectRendering() ? "-dr" : ""));
+            this.devCodecList += ",none";
+        } else {
+            this.devHardwareDecoder = DEV_HW_DECODER_AUTOMATIC;
+            this.devCodecList = null;
+        }
+    }
+
+    public boolean isDirectRendering() {
+        if (devHardwareDecoder != DEV_HW_DECODER_AUTOMATIC) {
+            return (this.devHardwareDecoder == DEV_HW_DECODER_OMX_DR ||
+                    this.devHardwareDecoder == DEV_HW_DECODER_MEDIACODEC_DR);
+        } else {
+            return this.hardwareAcceleration == HW_ACCELERATION_FULL;
+        }
+    }
+
+    public String[] getMediaOptions(boolean noHardwareAcceleration, boolean noVideo) {
+        if (this.devHardwareDecoder != DEV_HW_DECODER_AUTOMATIC)
+            noHardwareAcceleration = noVideo = false;
+        else if (!noHardwareAcceleration)
+            noHardwareAcceleration = getHardwareAcceleration() == HW_ACCELERATION_DISABLED;
+
+        ArrayList<String> options = new ArrayList<String>();
+
+        if (!noHardwareAcceleration) {
+            /*
+             * Set higher caching values if using iomx decoding, since some omx
+             * decoders have a very high latency, and if the preroll data isn't
+             * enough to make the decoder output a frame, the playback timing gets
+             * started too soon, and every decoded frame appears to be too late.
+             * On Nexus One, the decoder latency seems to be 25 input packets
+             * for 320x170 H.264, a few packets less on higher resolutions.
+             * On Nexus S, the decoder latency seems to be about 7 packets.
+             */
+            options.add(":file-caching=1500");
+            options.add(":network-caching=1500");
+            options.add(":codec="+ (this.devCodecList != null ? this.devCodecList : this.codecList));
+        }
+        if (noVideo)
+            options.add(":no-video");
+
+        return options.toArray(new String[options.size()]);
+    }
+
+    public String getSubtitlesEncoding() {
+        return subtitlesEncoding;
+    }
+
+    public void setSubtitlesEncoding(String subtitlesEncoding) {
+        this.subtitlesEncoding = subtitlesEncoding;
+    }
+
+    public int getAout() {
+        return aout;
+    }
+
+    public void setAout(int aout) {
+        if (aout < 0)
+            this.aout = LibVlcUtil.isICSOrLater() ? AOUT_OPENSLES : AOUT_AUDIOTRACK_JAVA;
+        else
+            this.aout = aout;
+    }
+
+    public int getVout() {
+        return vout;
+    }
+
+    public void setVout(int vout) {
+        if (vout < 0)
+            this.vout = VOUT_ANDROID_SURFACE;
+        else
+            this.vout = vout;
+    }
+
+    public boolean timeStretchingEnabled() {
+        return timeStretching;
+    }
+
+    public void setTimeStretching(boolean timeStretching) {
+        this.timeStretching = timeStretching;
+    }
+
+    public int getDeblocking() {
+        int ret = deblocking;
+        if(deblocking < 0) {
+            /**
+             * Set some reasonable deblocking defaults:
+             *
+             * Skip all (4) for armv6 and MIPS by default
+             * Skip non-ref (1) for all armv7 more than 1.2 Ghz and more than 2 cores
+             * Skip non-key (3) for all devices that don't meet anything above
+             */
+            LibVlcUtil.MachineSpecs m = LibVlcUtil.getMachineSpecs();
+            if (m == null)
+                return ret;
+            if( (m.hasArmV6 && !(m.hasArmV7)) || m.hasMips )
+                ret = 4;
+            else if(m.frequency >= 1200 && m.processors > 2)
+                ret = 1;
+            else if(m.bogoMIPS >= 1200 && m.processors > 2) {
+                ret = 1;
+                Log.d(TAG, "Used bogoMIPS due to lack of frequency info");
+            } else
+                ret = 3;
+        } else if(deblocking > 4) { // sanity check
+            ret = 3;
+        }
+        return ret;
+    }
+
+    public void setDeblocking(int deblocking) {
+        this.deblocking = deblocking;
+    }
+
+    public String getChroma() {
+        return chroma;
+    }
+
+    public void setChroma(String chroma) {
+        this.chroma = chroma.equals("YV12") && !LibVlcUtil.isGingerbreadOrLater() ? "" : chroma;
+    }
+
+    public boolean isVerboseMode() {
+        return verboseMode;
+    }
+
+    public void setVerboseMode(boolean verboseMode) {
+        this.verboseMode = verboseMode;
+    }
+
+    public float[] getEqualizer()
+    {
+        return equalizer;
+    }
+
+    public void setEqualizer(float[] equalizer)
+    {
+        this.equalizer = equalizer;
+        applyEqualizer();
+    }
+
+    private void applyEqualizer()
+    {
+        setNativeEqualizer(mInternalMediaPlayerInstance, this.equalizer);
+    }
+    private native int setNativeEqualizer(long mediaPlayer, float[] bands);
+
+    public boolean frameSkipEnabled() {
+        return frameSkip;
+    }
+
+    public void setFrameSkip(boolean frameskip) {
+        this.frameSkip = frameskip;
+    }
+
+    public int getNetworkCaching() {
+        return this.networkCaching;
+    }
+
+    public void setNetworkCaching(int networkcaching) {
+        this.networkCaching = networkcaching;
+    }
+
+    public boolean getHttpReconnect() {
+        return httpReconnect;
+    }
+
+    public void setHttpReconnect(boolean httpReconnect) {
+        this.httpReconnect = httpReconnect;
+    }
+
+    /**
+     * Initialize the libVLC class.
+     *
+     * This function must be called before using any libVLC functions.
+     *
+     * @throws LibVlcException
+     */
+    public void init(Context context) throws LibVlcException {
+        Log.v(TAG, "Initializing LibVLC");
+        mDebugLogBuffer = new StringBuffer();
+        if (!mIsInitialized) {
+            if(!LibVlcUtil.hasCompatibleCPU(context)) {
+                Log.e(TAG, LibVlcUtil.getErrorMsg());
+                throw new LibVlcException();
+            }
+
+            File cacheDir = context.getCacheDir();
+            mCachePath = (cacheDir != null) ? cacheDir.getAbsolutePath() : null;
+            nativeInit();
+            mMediaList = mPrimaryList = new MediaList(this);
+            setEventHandler(EventHandler.getInstance());
+            mIsInitialized = true;
+        }
+    }
+
+    /**
+     * Destroy this libVLC instance
+     * @note You must call it before exiting
+     */
+    public void destroy() {
+        Log.v(TAG, "Destroying LibVLC instance");
+        nativeDestroy();
+        detachEventHandler();
+        mIsInitialized = false;
+    }
+
+    /**
+     * Open the Java audio output.
+     * This function is called by the native code
+     */
+    public void initAout(int sampleRateInHz, int channels, int samples) {
+        Log.d(TAG, "Opening the java audio output");
+        mAout.init(sampleRateInHz, channels, samples);
+    }
+
+    /**
+     * Play an audio buffer taken from the native code
+     * This function is called by the native code
+     */
+    public void playAudio(byte[] audioData, int bufferSize) {
+        mAout.playBuffer(audioData, bufferSize);
+    }
+
+    /**
+     * Pause the Java audio output
+     * This function is called by the native code
+     */
+    public void pauseAout() {
+        Log.d(TAG, "Pausing the java audio output");
+        mAout.pause();
+    }
+
+    /**
+     * Close the Java audio output
+     * This function is called by the native code
+     */
+    public void closeAout() {
+        Log.d(TAG, "Closing the java audio output");
+        mAout.release();
+    }
+
+    /**
+     * Play a media from the media list (playlist)
+     *
+     * @param position The index of the media
+     */
+    public void playIndex(int position) {
+        String mrl = mMediaList.getMRL(position);
+        if (mrl == null)
+            return;
+        String[] options = mMediaList.getMediaOptions(position);
+        mInternalMediaPlayerIndex = position;
+        playMRL(mLibVlcInstance, mrl, options);
+    }
+
+    /**
+     * Play an MRL directly.
+     *
+     * @param mrl MRL of the media to play.
+     */
+    public void playMRL(String mrl) {
+        // index=-1 will return options from libvlc instance without relying on MediaList
+        String[] options = mMediaList.getMediaOptions(-1);
+        mInternalMediaPlayerIndex = 0;
+        playMRL(mLibVlcInstance, mrl, options);
+    }
+
+    public TrackInfo[] readTracksInfo(String mrl) {
+        return readTracksInfo(mLibVlcInstance, mrl);
+    }
+
+    /**
+     * Get a media thumbnail.
+     */
+    public byte[] getThumbnail(String mrl, int i_width, int i_height) {
+        return getThumbnail(mLibVlcInstance, mrl, i_width, i_height);
+    }
+
+    /**
+     * Return true if there is a video track in the file
+     */
+    public boolean hasVideoTrack(String mrl) throws java.io.IOException {
+        return hasVideoTrack(mLibVlcInstance, mrl);
+    }
+
+    /**
+     * Sets the speed of playback (1 being normal speed, 2 being twice as fast)
+     *
+     * @param rate
+     */
+    public native void setRate(float rate);
+
+    /**
+     * Get the current playback speed
+     */
+    public native float getRate();
+
+    /**
+     * Initialize the libvlc C library
+     * @return a pointer to the libvlc instance
+     */
+    private native void nativeInit() throws LibVlcException;
+
+    /**
+     * Close the libvlc C library
+     * @note mLibVlcInstance should be 0 after a call to destroy()
+     */
+    private native void nativeDestroy();
+
+    /**
+     * Start buffering to the mDebugLogBuffer.
+     */
+    public native void startDebugBuffer();
+    public native void stopDebugBuffer();
+    public String getBufferContent() {
+        return mDebugLogBuffer.toString();
+    }
+
+    public void clearBuffer() {
+        mDebugLogBuffer.setLength(0);
+    }
+
+    public boolean isDebugBuffering() {
+        return mIsBufferingLog;
+    }
+
+    /**
+     * Play an mrl
+     */
+    private native void playMRL(long instance, String mrl, String[] mediaOptions);
+
+    /**
+     * Returns true if any media is playing
+     */
+    public native boolean isPlaying();
+
+    /**
+     * Returns true if any media is seekable
+     */
+    public native boolean isSeekable();
+
+    /**
+     * Plays any loaded media
+     */
+    public native void play();
+
+    /**
+     * Pauses any playing media
+     */
+    public native void pause();
+
+    /**
+     * Stops any playing media
+     */
+    public native void stop();
+
+    /**
+     * Get player state.
+     */
+    public native int getPlayerState();
+
+    /**
+     * Gets volume as integer
+     */
+    public native int getVolume();
+
+    /**
+     * Sets volume as integer
+     * @param volume: Volume level passed as integer
+     */
+    public native int setVolume(int volume);
+
+    /**
+     * Gets the current movie time (in ms).
+     * @return the movie time (in ms), or -1 if there is no media.
+     */
+    public native long getTime();
+
+    /**
+     * Sets the movie time (in ms), if any media is being played.
+     * @param time: Time in ms.
+     * @return the movie time (in ms), or -1 if there is no media.
+     */
+    public native long setTime(long time);
+
+    /**
+     * Gets the movie position.
+     * @return the movie position, or -1 for any error.
+     */
+    public native float getPosition();
+
+    /**
+     * Sets the movie position.
+     * @param pos: movie position.
+     */
+    public native void setPosition(float pos);
+
+    /**
+     * Gets current movie's length in ms.
+     * @return the movie length (in ms), or -1 if there is no media.
+     */
+    public native long getLength();
+
+    /**
+     * Get the libVLC version
+     * @return the libVLC version string
+     */
+    public native String version();
+
+    /**
+     * Get the libVLC compiler
+     * @return the libVLC compiler string
+     */
+    public native String compiler();
+
+    /**
+     * Get the libVLC changeset
+     * @return the libVLC changeset string
+     */
+    public native String changeset();
+
+    /**
+     * Get a media thumbnail.
+     * @return a bytearray with the RGBA thumbnail data inside.
+     */
+    private native byte[] getThumbnail(long instance, String mrl, int i_width, int i_height);
+
+    /**
+     * Return true if there is a video track in the file
+     */
+    private native boolean hasVideoTrack(long instance, String mrl);
+
+    private native TrackInfo[] readTracksInfo(long instance, String mrl);
+
+    public native TrackInfo[] readTracksInfoInternal();
+
+    public native int getAudioTracksCount();
+
+    public native Map<Integer,String> getAudioTrackDescription();
+
+    public native Map<String, Object> getStats();
+
+    public native int getAudioTrack();
+
+    public native int setAudioTrack(int index);
+
+    public native int getVideoTracksCount();
+
+    public native int addSubtitleTrack(String path);
+
+    public native Map<Integer,String> getSpuTrackDescription();
+
+    public native int getSpuTrack();
+
+    public native int setSpuTrack(int index);
+
+    public native int getSpuTracksCount();
+
+    public static native String nativeToURI(String path);
+    
+    public native static void sendMouseEvent( int action, int button, int x, int y);
+
+    /**
+     * Quickly converts path to URIs, which are mandatory in libVLC.
+     *
+     * @param path
+     *            The path to be converted.
+     * @return A URI representation of path
+     */
+    public static String PathToURI(String path) {
+        if(path == null) {
+            throw new NullPointerException("Cannot convert null path!");
+        }
+        return LibVLC.nativeToURI(path);
+    }
+
+    public static native void nativeReadDirectory(String path, ArrayList<String> res);
+
+    public native static boolean nativeIsPathDirectory(String path);
+
+     /**
+      * Expand and continue playing the current media.
+      *
+      * @return the index of the media was expanded, and -1 if no media was expanded
+      */
+    public int expandAndPlay() {
+        int r = mMediaList.expandMedia(mInternalMediaPlayerIndex);
+        if(r == 0)
+            this.playIndex(mInternalMediaPlayerIndex);
+        return r;
+    }
+
+    /**
+     * Expand the current media.
+     * @return the index of the media was expanded, and -1 if no media was expanded
+     */
+    public int expand() {
+        return mMediaList.expandMedia(mInternalMediaPlayerIndex);
+    }
+
+    private native void setEventHandler(EventHandler eventHandler);
+
+    private native void detachEventHandler();
+
+    public native float[] getBands();
+
+    public native String[] getPresets();
+
+    public native float[] getPreset(int index);
+
+    public static interface OnNativeCrashListener {
+        public void onNativeCrash();
+    }
+
+    public void setOnNativeCrashListener(OnNativeCrashListener l) {
+        mOnNativeCrashListener = l;
+    }
+
+    private void onNativeCrash() {
+        if (mOnNativeCrashListener != null)
+            mOnNativeCrashListener.onNativeCrash();
+    }
+
+    public String getCachePath() {
+        return mCachePath;
+    }
+
+    public native int getTitle();
+    public native void setTitle(int title);
+    public native int getChapterCountForTitle(int title);
+    public native int getTitleCount();
+    public native void playerNavigate(int navigate);
+
+}
diff --git a/libVLC/src/org/videolan/libvlc/LibVlcException.java b/libVLC/src/org/videolan/libvlc/LibVlcException.java
new file mode 100644
index 0000000..f676f13
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/LibVlcException.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * LibVlcException.java
+ *****************************************************************************
+ * Copyright © 2011-2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/**
+ * LibVlcException: exceptions thrown by the native LibVLC interface
+ */
+package org.videolan.libvlc;
+
+/**
+ * @author jpeg
+ *
+ */
+public class LibVlcException extends Exception {
+    private static final long serialVersionUID = -1909522348226924189L;
+
+    /**
+     * Create an empty error
+     */
+    public LibVlcException() {
+        super();
+    }
+
+    /**
+     * @param detailMessage
+     */
+    public LibVlcException(String detailMessage) {
+        super(detailMessage);
+    }
+
+    /**
+     * @param throwable
+     */
+    public LibVlcException(Throwable throwable) {
+        super(throwable);
+    }
+
+    /**
+     * @param detailMessage
+     * @param throwable
+     */
+    public LibVlcException(String detailMessage, Throwable throwable) {
+        super(detailMessage, throwable);
+    }
+
+}
diff --git a/libVLC/src/org/videolan/libvlc/LibVlcUtil.java b/libVLC/src/org/videolan/libvlc/LibVlcUtil.java
new file mode 100644
index 0000000..0ddf780
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/LibVlcUtil.java
@@ -0,0 +1,539 @@
+/*****************************************************************************
+ * LibVlcUtil.java
+ *****************************************************************************
+ * Copyright © 2011-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Locale;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.net.Uri;
+import android.os.Build;
+import android.util.Log;
+
+public class LibVlcUtil {
+    public final static String TAG = "VLC/LibVLC/Util";
+
+    public static boolean isFroyoOrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO;
+    }
+
+    public static boolean isGingerbreadOrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD;
+    }
+
+    public static boolean isHoneycombOrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
+    }
+
+    public static boolean isICSOrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
+    }
+
+    public static boolean isJellyBeanOrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN;
+    }
+
+    public static boolean isJellyBeanMR1OrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
+    }
+
+    public static boolean isJellyBeanMR2OrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
+    }
+
+    public static boolean isKitKatOrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT;
+    }
+
+    public static boolean isLolliPopOrLater()
+    {
+        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP;
+    }
+
+    private static String errorMsg = null;
+    private static boolean isCompatible = false;
+    public static String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public static File URItoFile(String URI) {
+        if(URI == null) return null;
+        return new File(Uri.decode(URI).replace("file://",""));
+    }
+
+    public static String URItoFileName(String URI) {
+        if(URI == null) return null;
+        return URItoFile(URI).getName();
+    }
+
+    public static boolean hasCompatibleCPU(Context context)
+    {
+        // If already checked return cached result
+        if(errorMsg != null || isCompatible) return isCompatible;
+
+        final File lib = searchLibrary(context);
+        if (lib == null)
+            return true;
+
+        ElfData elf = readLib(lib);
+        if(elf == null) {
+            Log.e(TAG, "WARNING: Unable to read libvlcjni.so; cannot check device ABI!");
+            Log.e(TAG, "WARNING: Cannot guarantee correct ABI for this build (may crash)!");
+            return true;
+        }
+
+        String CPU_ABI = android.os.Build.CPU_ABI;
+        String CPU_ABI2 = "none";
+        if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { // CPU_ABI2 since 2.2
+            try {
+                CPU_ABI2 = (String)android.os.Build.class.getDeclaredField("CPU_ABI2").get(null);
+            } catch (Exception e) { }
+        }
+
+        final boolean elfHasX86 = elf.e_machine == EM_386 || elf.e_machine == EM_X86_64;
+        final boolean elfHasArm = elf.e_machine == EM_ARM || elf.e_machine == EM_AARCH64;
+        final boolean elfHasMips = elf.e_machine == EM_MIPS;
+        final boolean elfIs64bits = elf.is64bits;
+
+        Log.i(TAG, "machine = " + (elfHasArm ? "arm" : elfHasX86 ? "x86" : "mips") + ", " +
+                                  (elfIs64bits ? "64bits" : "32bits"));
+        Log.i(TAG, "arch = " + elf.att_arch);
+        Log.i(TAG, "fpu = " + elf.att_fpu);
+        boolean hasNeon = false, hasFpu = false, hasArmV6 = false,
+                hasArmV7 = false, hasMips = false, hasX86 = false, is64bits = false;
+        float bogoMIPS = -1;
+        int processors = 0;
+
+        if(CPU_ABI.equals("x86") ||
+           CPU_ABI2.equals("x86")) {
+            hasX86 = true;
+        } else if(CPU_ABI.equals("x86_64") ||
+                  CPU_ABI2.equals("x86_64")) {
+            hasX86 = true;
+            is64bits = true;
+        } else if(CPU_ABI.equals("armeabi-v7a") ||
+                  CPU_ABI2.equals("armeabi-v7a")) {
+            hasArmV7 = true;
+            hasArmV6 = true; /* Armv7 is backwards compatible to < v6 */
+        } else if(CPU_ABI.equals("armeabi") ||
+                  CPU_ABI2.equals("armeabi")) {
+            hasArmV6 = true;
+        } else if(CPU_ABI.equals("arm64-v8a") ||
+                CPU_ABI2.equals("arm64-v8a")) {
+            hasNeon = true;
+            hasArmV6 = true;
+            hasArmV7 = true;
+            is64bits = true;
+        }
+
+        try {
+            FileReader fileReader = new FileReader("/proc/cpuinfo");
+            BufferedReader br = new BufferedReader(fileReader);
+            String line;
+            while((line = br.readLine()) != null) {
+                if(!hasArmV7 && line.contains("AArch64")) {
+                    hasArmV7 = true;
+                    hasArmV6 = true; /* Armv8 is backwards compatible to < v7 */
+                }
+                if(!hasArmV7 && line.contains("ARMv7")) {
+                    hasArmV7 = true;
+                    hasArmV6 = true; /* Armv7 is backwards compatible to < v6 */
+                }
+                if(!hasArmV7 && !hasArmV6 && line.contains("ARMv6"))
+                    hasArmV6 = true;
+                // "clflush size" is a x86-specific cpuinfo tag.
+                // (see kernel sources arch/x86/kernel/cpu/proc.c)
+                if(line.contains("clflush size"))
+                    hasX86 = true;
+                if(line.contains("GenuineIntel"))
+                    hasX86 = true;
+                // "microsecond timers" is specific to MIPS.
+                // see arch/mips/kernel/proc.c
+                if(line.contains("microsecond timers"))
+                    hasMips = true;
+                if(!hasNeon && (line.contains("neon") || line.contains("asimd")))
+                    hasNeon = true;
+                if(!hasFpu && (line.contains("vfp") || (line.contains("Features") && line.contains("fp"))))
+                    hasFpu = true;
+                if(line.startsWith("processor"))
+                    processors++;
+                if(bogoMIPS < 0 && line.toLowerCase(Locale.ENGLISH).contains("bogomips")) {
+                    String[] bogo_parts = line.split(":");
+                    try {
+                        bogoMIPS = Float.parseFloat(bogo_parts[1].trim());
+                    } catch(NumberFormatException e) {
+                        bogoMIPS = -1; // invalid bogomips
+                    }
+                }
+            }
+            fileReader.close();
+        } catch(IOException ex){
+            ex.printStackTrace();
+            errorMsg = "IOException whilst reading cpuinfo flags";
+            isCompatible = false;
+            return false;
+        }
+        if(processors == 0)
+            processors = 1; // possibly borked cpuinfo?
+
+        // Enforce proper architecture to prevent problems
+        if(elfHasX86 && !hasX86) {
+            errorMsg = "x86 build on non-x86 device";
+            isCompatible = false;
+            return false;
+        } else if(elfHasArm && hasX86) {
+            errorMsg = "ARM build on x86 device";
+            isCompatible = false;
+            return false;
+        }
+
+        if(elfHasMips && !hasMips) {
+            errorMsg = "MIPS build on non-MIPS device";
+            isCompatible = false;
+            return false;
+        } else if(elfHasArm && hasMips) {
+            errorMsg = "ARM build on MIPS device";
+            isCompatible = false;
+            return false;
+        }
+
+        if(elf.e_machine == EM_ARM && elf.att_arch.startsWith("v7") && !hasArmV7) {
+            errorMsg = "ARMv7 build on non-ARMv7 device";
+            isCompatible = false;
+            return false;
+        }
+        if(elf.e_machine == EM_ARM) {
+            if(elf.att_arch.startsWith("v6") && !hasArmV6) {
+                errorMsg = "ARMv6 build on non-ARMv6 device";
+                isCompatible = false;
+                return false;
+            } else if(elf.att_fpu && !hasFpu) {
+                errorMsg = "FPU-enabled build on non-FPU device";
+                isCompatible = false;
+                return false;
+            }
+        }
+        if (elfIs64bits && !is64bits) {
+            errorMsg = "64bits build on 32bits device";
+            isCompatible = false;
+        }
+
+        float frequency = -1;
+        try {
+            FileReader fileReader = new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
+            BufferedReader br = new BufferedReader(fileReader);
+            String line = "";
+            try {
+                line = br.readLine();
+                frequency = Float.parseFloat(line) / 1000.f; /* Convert to MHz */
+            } catch(NumberFormatException e) {
+                Log.w(TAG, "Could not parse maximum CPU frequency!");
+                Log.w(TAG, "Failed to parse: " + line);
+            }
+            fileReader.close();
+        } catch(IOException ex) {
+            Log.w(TAG, "Could not find maximum CPU frequency!");
+        }
+
+        errorMsg = null;
+        isCompatible = true;
+        // Store into MachineSpecs
+        machineSpecs = new MachineSpecs();
+        machineSpecs.hasArmV6 = hasArmV6;
+        machineSpecs.hasArmV7 = hasArmV7;
+        machineSpecs.hasFpu = hasFpu;
+        machineSpecs.hasMips = hasMips;
+        machineSpecs.hasNeon = hasNeon;
+        machineSpecs.hasX86 = hasX86;
+        machineSpecs.is64bits = is64bits;
+        machineSpecs.bogoMIPS = bogoMIPS;
+        machineSpecs.processors = processors;
+        machineSpecs.frequency = frequency;
+        return true;
+    }
+
+    public static MachineSpecs getMachineSpecs() {
+        return machineSpecs;
+    }
+    private static MachineSpecs machineSpecs = null;
+    public static class MachineSpecs {
+        public boolean hasNeon;
+        public boolean hasFpu;
+        public boolean hasArmV6;
+        public boolean hasArmV7;
+        public boolean hasMips;
+        public boolean hasX86;
+        public boolean is64bits;
+        public float bogoMIPS;
+        public int processors;
+        public float frequency; /* in MHz */
+    }
+
+    private static final int EM_386 = 3;
+    private static final int EM_MIPS = 8;
+    private static final int EM_ARM = 40;
+    private static final int EM_X86_64 = 62;
+    private static final int EM_AARCH64 = 183;
+    private static final int ELF_HEADER_SIZE = 52;
+    private static final int SECTION_HEADER_SIZE = 40;
+    private static final int SHT_ARM_ATTRIBUTES = 0x70000003;
+    private static class ElfData {
+        ByteOrder order;
+        boolean is64bits;
+        int e_machine;
+        int e_shoff;
+        int e_shnum;
+        int sh_offset;
+        int sh_size;
+        String att_arch;
+        boolean att_fpu;
+    }
+
+    private static File searchLibrary(Context context) {
+        // Search for library path
+        String [] libraryPaths = null;
+        final ApplicationInfo applicationInfo = context.getApplicationInfo();
+
+        if ((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+            final String property = System.getProperty("java.library.path");
+            libraryPaths = property.split(":");
+        } else {
+            libraryPaths = new String[1];
+            if (isGingerbreadOrLater())
+                libraryPaths[0] = applicationInfo.nativeLibraryDir;
+            else
+                libraryPaths[0] = applicationInfo.dataDir + "/lib";
+        }
+        if (libraryPaths == null) {
+            Log.e(TAG, "can't find library path");
+            return null;
+        }
+
+        // Search for libvlcjni.so
+        File lib = null;
+        for (String libraryPath : libraryPaths) {
+            lib = new File(libraryPath, "libvlcjni.so");
+            if (lib.exists() && lib.canRead())
+                return lib;;
+        }
+        Log.e(TAG, "WARNING: Can't find shared library");
+        return null;
+    }
+
+    /** '*' prefix means it's unsupported */
+    private static String[] CPU_archs = {"*Pre-v4", "*v4", "*v4T",
+                                         "v5T", "v5TE", "v5TEJ",
+                                         "v6", "v6KZ", "v6T2", "v6K", "v7",
+                                         "*v6-M", "*v6S-M", "*v7E-M", "*v8"};
+
+    private static ElfData readLib(File file) {
+        RandomAccessFile in = null;
+        try {
+            in = new RandomAccessFile(file, "r");
+
+            ElfData elf = new ElfData();
+            if (!readHeader(in, elf))
+                return null;
+
+            switch (elf.e_machine) {
+                case EM_386:
+                case EM_MIPS:
+                case EM_X86_64:
+                case EM_AARCH64:
+                    return elf;
+                case EM_ARM:
+                    in.close();
+                    in = new RandomAccessFile(file, "r");
+                    if (!readSection(in, elf))
+                        return null;
+                    in.close();
+                    in = new RandomAccessFile(file, "r");
+                    if (!readArmAttributes(in, elf))
+                        return null;
+                    break;
+                default:
+                    return null;
+            }
+            return elf;
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (in != null)
+                    in.close();
+            } catch (IOException e) {
+            }
+        }
+        return null;
+    }
+
+    private static boolean readHeader(RandomAccessFile in, ElfData elf) throws IOException {
+        // http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html
+        byte[] bytes = new byte[ELF_HEADER_SIZE];
+        in.readFully(bytes);
+        if (bytes[0] != 127 ||
+                bytes[1] != 'E' ||
+                bytes[2] != 'L' ||
+                bytes[3] != 'F' ||
+                (bytes[4] != 1 && bytes[4] != 2)) {
+            Log.e(TAG, "ELF header invalid");
+            return false;
+        }
+
+        elf.is64bits = bytes[4] == 2;
+        elf.order = bytes[5] == 1
+                ? ByteOrder.LITTLE_ENDIAN // ELFDATA2LSB
+                : ByteOrder.BIG_ENDIAN;   // ELFDATA2MSB
+
+        // wrap bytes in a ByteBuffer to force endianess
+        ByteBuffer buffer = ByteBuffer.wrap(bytes);
+        buffer.order(elf.order);
+
+        elf.e_machine = buffer.getShort(18);    /* Architecture */
+        elf.e_shoff = buffer.getInt(32);        /* Section header table file offset */
+        elf.e_shnum = buffer.getShort(48);      /* Section header table entry count */
+        return true;
+    }
+
+    private static boolean readSection(RandomAccessFile in, ElfData elf) throws IOException {
+        byte[] bytes = new byte[SECTION_HEADER_SIZE];
+        in.seek(elf.e_shoff);
+
+        for (int i = 0; i < elf.e_shnum; ++i) {
+            in.readFully(bytes);
+
+            // wrap bytes in a ByteBuffer to force endianess
+            ByteBuffer buffer = ByteBuffer.wrap(bytes);
+            buffer.order(elf.order);
+
+            int sh_type = buffer.getInt(4); /* Section type */
+            if (sh_type != SHT_ARM_ATTRIBUTES)
+                continue;
+
+            elf.sh_offset = buffer.getInt(16);  /* Section file offset */
+            elf.sh_size = buffer.getInt(20);    /* Section size in bytes */
+            return true;
+        }
+
+        return false;
+    }
+
+    private static boolean readArmAttributes(RandomAccessFile in, ElfData elf) throws IOException {
+        byte[] bytes = new byte[elf.sh_size];
+        in.seek(elf.sh_offset);
+        in.readFully(bytes);
+
+        // wrap bytes in a ByteBuffer to force endianess
+        ByteBuffer buffer = ByteBuffer.wrap(bytes);
+        buffer.order(elf.order);
+
+        //http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf
+        //http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045d/IHI0045D_ABI_addenda.pdf
+        if (buffer.get() != 'A') // format-version
+            return false;
+
+        // sub-sections loop
+        while (buffer.remaining() > 0) {
+            int start_section = buffer.position();
+            int length = buffer.getInt();
+            String vendor = getString(buffer);
+            if (vendor.equals("aeabi")) {
+                // tags loop
+                while (buffer.position() < start_section + length) {
+                    int start = buffer.position();
+                    int tag = buffer.get();
+                    int size = buffer.getInt();
+                    // skip if not Tag_File, we don't care about others
+                    if (tag != 1) {
+                        buffer.position(start + size);
+                        continue;
+                    }
+
+                    // attributes loop
+                    while (buffer.position() < start + size) {
+                        tag = getUleb128(buffer);
+                        if (tag == 6) { // CPU_arch
+                            int arch = getUleb128(buffer);
+                            elf.att_arch = CPU_archs[arch];
+                        }
+                        else if (tag == 27) { // ABI_HardFP_use
+                            getUleb128(buffer);
+                            elf.att_fpu = true;
+                        }
+                        else {
+                            // string for 4=CPU_raw_name / 5=CPU_name / 32=compatibility
+                            // string for >32 && odd tags
+                            // uleb128 for other
+                            tag %= 128;
+                            if (tag == 4 || tag == 5 || tag == 32 || (tag > 32 && (tag & 1) != 0))
+                                getString(buffer);
+                            else
+                                getUleb128(buffer);
+                        }
+                    }
+                }
+                break;
+            }
+        }
+        return true;
+    }
+
+    private static String getString(ByteBuffer buffer) {
+        StringBuilder sb = new StringBuilder(buffer.limit());
+        while (buffer.remaining() > 0) {
+            char c = (char) buffer.get();
+            if (c == 0)
+                break;
+            sb.append(c);
+        }
+        return sb.toString();
+    }
+
+    private static int getUleb128(ByteBuffer buffer) {
+        int ret = 0;
+        int c;
+        do {
+            ret <<= 7;
+            c = buffer.get();
+            ret |= c & 0x7f;
+        } while((c & 0x80) > 0);
+
+        return ret;
+    }
+}
diff --git a/libVLC/src/org/videolan/libvlc/Media.java b/libVLC/src/org/videolan/libvlc/Media.java
new file mode 100644
index 0000000..29b9d94
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/Media.java
@@ -0,0 +1,433 @@
+/*****************************************************************************
+ * Media.java
+ *****************************************************************************
+ * Copyright © 2011-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Locale;
+
+import android.graphics.Bitmap;
+import android.util.Log;
+
+public class Media implements Comparable<Media> {
+    public final static String TAG = "VLC/LibVLC/Media";
+
+    public final static HashSet<String> VIDEO_EXTENSIONS;
+    public final static HashSet<String> AUDIO_EXTENSIONS;
+    public final static String EXTENSIONS_REGEX;
+    public final static HashSet<String> FOLDER_BLACKLIST;
+
+    static {
+        String[] video_extensions = {
+                ".3g2", ".3gp", ".3gp2", ".3gpp", ".amv", ".asf", ".avi", ".divx", ".drc", ".dv",
+                ".f4v", ".flv", ".gvi", ".gxf", ".ismv", ".iso", ".m1v", ".m2v", ".m2t", ".m2ts",
+                ".m4v", ".mkv", ".mov", ".mp2", ".mp2v", ".mp4", ".mp4v", ".mpe", ".mpeg",
+                ".mpeg1", ".mpeg2", ".mpeg4", ".mpg", ".mpv2", ".mts", ".mtv", ".mxf", ".mxg",
+                ".nsv", ".nut", ".nuv", ".ogm", ".ogv", ".ogx", ".ps", ".rec", ".rm", ".rmvb",
+                ".tod", ".ts", ".tts", ".vob", ".vro", ".webm", ".wm", ".wmv", ".wtv", ".xesc" };
+
+        String[] audio_extensions = {
+                ".3ga", ".a52", ".aac", ".ac3", ".adt", ".adts", ".aif", ".aifc", ".aiff", ".amr",
+                ".aob", ".ape", ".awb", ".caf", ".dts", ".flac", ".it", ".m4a", ".m4b", ".m4p",
+                ".mid", ".mka", ".mlp", ".mod", ".mpa", ".mp1", ".mp2", ".mp3", ".mpc", ".mpga",
+                ".oga", ".ogg", ".oma", ".opus", ".ra", ".ram", ".rmi", ".s3m", ".spx", ".tta",
+                ".voc", ".vqf", ".w64", ".wav", ".wma", ".wv", ".xa", ".xm" };
+
+        String[] folder_blacklist = {
+                "/alarms",
+                "/notifications",
+                "/ringtones",
+                "/media/alarms",
+                "/media/notifications",
+                "/media/ringtones",
+                "/media/audio/alarms",
+                "/media/audio/notifications",
+                "/media/audio/ringtones",
+                "/Android/data/" };
+
+        VIDEO_EXTENSIONS = new HashSet<String>();
+        for (String item : video_extensions)
+            VIDEO_EXTENSIONS.add(item);
+        AUDIO_EXTENSIONS = new HashSet<String>();
+        for (String item : audio_extensions)
+            AUDIO_EXTENSIONS.add(item);
+
+        StringBuilder sb = new StringBuilder(115);
+        sb.append(".+(\\.)((?i)(");
+        sb.append(video_extensions[0].substring(1));
+        for(int i = 1; i < video_extensions.length; i++) {
+            sb.append('|');
+            sb.append(video_extensions[i].substring(1));
+        }
+        for(int i = 0; i < audio_extensions.length; i++) {
+            sb.append('|');
+            sb.append(audio_extensions[i].substring(1));
+        }
+        sb.append("))");
+        EXTENSIONS_REGEX = sb.toString();
+        FOLDER_BLACKLIST = new HashSet<String>();
+        for (String item : folder_blacklist)
+            FOLDER_BLACKLIST.add(android.os.Environment.getExternalStorageDirectory().getPath() + item);
+    }
+
+    public final static int TYPE_ALL = -1;
+    public final static int TYPE_VIDEO = 0;
+    public final static int TYPE_AUDIO = 1;
+    public final static int TYPE_GROUP = 2;
+
+    /** Metadata from libvlc_media */
+    protected String mTitle;
+    private String mArtist;
+    private String mGenre;
+    private String mCopyright;
+    private String mAlbum;
+    private String mTrackNumber;
+    private String mDescription;
+    private String mRating;
+    private String mDate;
+    private String mSettings;
+    private String mNowPlaying;
+    private String mPublisher;
+    private String mEncodedBy;
+    private String mTrackID;
+    private String mArtworkURL;
+
+    private final String mLocation;
+    private String mFilename;
+    private long mTime = 0;
+    private int mAudioTrack = -1;
+    private int mSpuTrack = -2;
+    private long mLength = 0;
+    private int mType;
+    private int mWidth = 0;
+    private int mHeight = 0;
+    private Bitmap mPicture;
+    private boolean mIsPictureParsed;
+
+    /**
+     * Create a new Media
+     * @param libVLC A pointer to the libVLC instance. Should not be NULL
+     * @param URI The URI of the media.
+     */
+    public Media(LibVLC libVLC, String URI) {
+        if(libVLC == null)
+            throw new NullPointerException("libVLC was null");
+
+        mLocation = URI;
+
+        mType = TYPE_ALL;
+        TrackInfo[] tracks = libVLC.readTracksInfo(mLocation);
+
+        extractTrackInfo(tracks);
+    }
+
+    private void extractTrackInfo(TrackInfo[] tracks) {
+        if (tracks == null)
+            return;
+
+        for (TrackInfo track : tracks) {
+            if (track.Type == TrackInfo.TYPE_VIDEO) {
+                mType = TYPE_VIDEO;
+                mWidth = track.Width;
+                mHeight = track.Height;
+            } else if (mType == TYPE_ALL && track.Type == TrackInfo.TYPE_AUDIO){
+                mType = TYPE_AUDIO;
+            } else if (track.Type == TrackInfo.TYPE_META) {
+                mLength = track.Length;
+                mTitle = track.Title;
+                mArtist = getValueWrapper(track.Artist, UnknownStringType.Artist);
+                mAlbum = getValueWrapper(track.Album, UnknownStringType.Album);
+                mGenre = getValueWrapper(track.Genre, UnknownStringType.Genre);
+                mArtworkURL = track.ArtworkURL;
+                Log.d(TAG, "Title " + mTitle);
+                Log.d(TAG, "Artist " + mArtist);
+                Log.d(TAG, "Genre " + mGenre);
+                Log.d(TAG, "Album " + mAlbum);
+            }
+        }
+
+        /* No useful ES found */
+        if (mType == TYPE_ALL) {
+            int dotIndex = mLocation.lastIndexOf(".");
+            if (dotIndex != -1) {
+                String fileExt = mLocation.substring(dotIndex).toLowerCase(Locale.ENGLISH);
+                if( Media.VIDEO_EXTENSIONS.contains(fileExt) ) {
+                    mType = TYPE_VIDEO;
+                } else if (Media.AUDIO_EXTENSIONS.contains(fileExt)) {
+                    mType = TYPE_AUDIO;
+                }
+            }
+        }
+    }
+
+    public Media(String location, long time, long length, int type,
+            Bitmap picture, String title, String artist, String genre, String album,
+            int width, int height, String artworkURL, int audio, int spu) {
+        mLocation = location;
+        mFilename = null;
+        mTime = time;
+        mAudioTrack = audio;
+        mSpuTrack = spu;
+        mLength = length;
+        mType = type;
+        mPicture = picture;
+        mWidth = width;
+        mHeight = height;
+
+        mTitle = title;
+        mArtist = getValueWrapper(artist, UnknownStringType.Artist);
+        mGenre = getValueWrapper(genre, UnknownStringType.Genre);
+        mAlbum = getValueWrapper(album, UnknownStringType.Album);
+        mArtworkURL = artworkURL;
+    }
+
+    private enum UnknownStringType { Artist , Genre, Album };
+    /**
+     * Uses introspection to read VLC l10n databases, so that we can sever the
+     * hard-coded dependency gracefully for 3rd party libvlc apps while still
+     * maintaining good l10n in VLC for Android.
+     *
+     * @see org.videolan.vlc.util.Util#getValue(String, int)
+     *
+     * @param string The default string
+     * @param type Alias for R.string.xxx
+     * @return The default string if not empty or string from introspection
+     */
+    private static String getValueWrapper(String string, UnknownStringType type) {
+        if(string != null && string.length() > 0) return string;
+
+        try {
+            Class<?> stringClass = Class.forName("org.videolan.vlc.R$string");
+            Class<?> utilClass = Class.forName("org.videolan.vlc.Util");
+
+            Integer value;
+            switch(type) {
+            case Album:
+                value = (Integer)stringClass.getField("unknown_album").get(null);
+                break;
+            case Genre:
+                value = (Integer)stringClass.getField("unknown_genre").get(null);
+                break;
+            case Artist:
+            default:
+                value = (Integer)stringClass.getField("unknown_artist").get(null);
+                break;
+            }
+
+            Method getValueMethod = utilClass.getDeclaredMethod("getValue", String.class, Integer.TYPE);
+            // Util.getValue(string, R.string.xxx);
+            return (String) getValueMethod.invoke(null, string, value);
+        } catch (ClassNotFoundException e) {
+        } catch (IllegalArgumentException e) {
+        } catch (IllegalAccessException e) {
+        } catch (NoSuchFieldException e) {
+        } catch (NoSuchMethodException e) {
+        } catch (InvocationTargetException e) {
+        }
+
+        // VLC for Android translations not available (custom app perhaps)
+        // Use hardcoded English phrases.
+        switch(type) {
+        case Album:
+            return "Unknown Album";
+        case Genre:
+            return "Unknown Genre";
+        case Artist:
+        default:
+            return "Unknown Artist";
+        }
+    }
+
+    /**
+     * Compare the filenames to sort items
+     */
+    @Override
+    public int compareTo(Media another) {
+        return mTitle.toUpperCase(Locale.getDefault()).compareTo(
+                another.getTitle().toUpperCase(Locale.getDefault()));
+    }
+
+    public String getLocation() {
+        return mLocation;
+    }
+
+    public void updateMeta() {
+
+    }
+
+    public String getFileName() {
+        if (mFilename == null) {
+            mFilename = LibVlcUtil.URItoFileName(mLocation);
+        }
+        return mFilename;
+    }
+
+    public long getTime() {
+        return mTime;
+    }
+
+    public void setTime(long time) {
+        mTime = time;
+    }
+
+    public int getAudioTrack() {
+        return mAudioTrack;
+    }
+
+    public void setAudioTrack(int track) {
+        mAudioTrack = track;
+    }
+
+    public int getSpuTrack() {
+        return mSpuTrack;
+    }
+
+    public void setSpuTrack(int track) {
+        mSpuTrack = track;
+    }
+
+    public long getLength() {
+        return mLength;
+    }
+
+    public int getType() {
+        return mType;
+    }
+
+    public int getWidth() {
+        return mWidth;
+    }
+
+    public int getHeight() {
+        return mHeight;
+    }
+
+    /**
+     * Returns the raw picture object. Likely to be NULL in VLC for Android
+     * due to lazy-loading.
+     *
+     * Use {@link org.videolan.vlc.util.Bitmap#getPictureFromCache(Media)} instead.
+     *
+     * @return The raw picture or NULL
+     */
+    public Bitmap getPicture() {
+        return mPicture;
+    }
+
+    /**
+     * Sets the raw picture object.
+     *
+     * In VLC for Android, use {@link org.videolan.vlc.MediaDatabase#setPicture(Media, Bitmap)} instead.
+     *
+     * @param p
+     */
+    public void setPicture(Bitmap p) {
+        mPicture = p;
+    }
+
+    public boolean isPictureParsed() {
+        return mIsPictureParsed;
+    }
+
+    public void setPictureParsed(boolean isParsed) {
+        mIsPictureParsed = isParsed;
+    }
+
+    public String getTitle() {
+        if (mTitle != null && mType != TYPE_VIDEO)
+            return mTitle;
+        else {
+            String fileName = getFileName();
+            if (fileName == null)
+                return "";
+            int end = fileName.lastIndexOf(".");
+            if (end <= 0)
+                return fileName;
+            return fileName.substring(0, end);
+        }
+    }
+
+    public String getSubtitle() {
+        return mType != TYPE_VIDEO ? mArtist + " - " + mAlbum : "";
+    }
+
+    public String getArtist() {
+        return mArtist;
+    }
+
+    public String getGenre() {
+        if(getValueWrapper(null, UnknownStringType.Genre).equals(mGenre))
+            return mGenre;
+        else if( mGenre.length() > 1)/* Make genres case insensitive via normalisation */
+            return Character.toUpperCase(mGenre.charAt(0)) + mGenre.substring(1).toLowerCase(Locale.getDefault());
+        else
+            return mGenre;
+    }
+
+    public String getCopyright() {
+        return mCopyright;
+    }
+
+    public String getAlbum() {
+        return mAlbum;
+    }
+
+    public String getTrackNumber() {
+        return mTrackNumber;
+    }
+
+    public String getDescription() {
+        return mDescription;
+    }
+
+    public String getRating() {
+        return mRating;
+    }
+
+    public String getDate() {
+        return mDate;
+    }
+
+    public String getSettings() {
+        return mSettings;
+    }
+
+    public String getNowPlaying() {
+        return mNowPlaying;
+    }
+
+    public String getPublisher() {
+        return mPublisher;
+    }
+
+    public String getEncodedBy() {
+        return mEncodedBy;
+    }
+
+    public String getTrackID() {
+        return mTrackID;
+    }
+
+    public String getArtworkURL() {
+        return mArtworkURL;
+    }
+}
diff --git a/libVLC/src/org/videolan/libvlc/MediaList.java b/libVLC/src/org/videolan/libvlc/MediaList.java
new file mode 100644
index 0000000..666568e
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/MediaList.java
@@ -0,0 +1,236 @@
+/*****************************************************************************
+ * MediaList.java
+ *****************************************************************************
+ * Copyright © 2013 VLC authors and VideoLAN
+ * Copyright © 2013 Edward Wang
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+package org.videolan.libvlc;
+
+import java.util.ArrayList;
+
+import android.os.Bundle;
+
+/**
+ * Java/JNI wrapper for the libvlc_media_list_t structure.
+ */
+public class MediaList {
+    private static final String TAG = "VLC/LibVLC/MediaList";
+
+    /* Since the libvlc_media_t is not created until the media plays, we have
+     * to cache them here. */
+    private static class MediaHolder {
+        Media m;
+        boolean noVideo; // default false
+        boolean noHardwareAcceleration; // default false
+
+        public MediaHolder(Media media) {
+            m = media; noVideo = false; noHardwareAcceleration = false;
+        }
+        public MediaHolder(Media m_, boolean noVideo_, boolean noHardwareAcceleration_) {
+            m = m_; noVideo = noVideo_; noHardwareAcceleration = noHardwareAcceleration_;
+        }
+    }
+
+    /* TODO: add locking */
+    private ArrayList<MediaHolder> mInternalList;
+    private LibVLC mLibVLC; // Used to create new objects that require a libvlc instance
+    private EventHandler mEventHandler;
+
+    public MediaList(LibVLC libVLC) {
+        mEventHandler = new EventHandler(); // used in init() below to fire events at the correct targets
+        mInternalList = new ArrayList<MediaHolder>();
+        mLibVLC = libVLC;
+    }
+
+    /**
+     * Adds a media URI to the media list.
+     *
+     * @param mrl
+     *            The MRL to add. Must be a location and not a path.
+     *            {@link LibVLC#PathToURI(String)} can be used to convert a path
+     *            to a MRL.
+     */
+    public void add(String mrl) {
+        add(new Media(mLibVLC, mrl));
+    }
+    public void add(Media media) {
+        add(media, false, false);
+    }
+    public void add(Media media, boolean noVideo) {
+        add(media, noVideo, false);
+    }
+    public void add(Media media, boolean noVideo, boolean noHardwareAcceleration) {
+        mInternalList.add(new MediaHolder(media, noVideo, noHardwareAcceleration));
+        signal_list_event(EventHandler.CustomMediaListItemAdded, mInternalList.size() - 1, media.getLocation());
+    }
+
+    /**
+     * Clear the media list. (remove all media)
+     */
+    public void clear() {
+        // Signal to observers of media being deleted.
+        for(int i = 0; i < mInternalList.size(); i++) {
+            signal_list_event(EventHandler.CustomMediaListItemDeleted, i, mInternalList.get(i).m.getLocation());
+        }
+        mInternalList.clear();
+    }
+
+    private boolean isValid(int position) {
+        return position >= 0 && position < mInternalList.size();
+    }
+
+    /**
+     * This function checks the currently playing media for subitems at the given
+     * position, and if any exist, it will expand them at the same position
+     * and replace the current media.
+     *
+     * @param position The position to expand
+     * @return -1 if no subitems were found, 0 if subitems were expanded
+     */
+    public int expandMedia(int position) {
+        ArrayList<String> children = new ArrayList<String>();
+        int ret = expandMedia(mLibVLC, position, children);
+        if(ret == 0) {
+            mEventHandler.callback(EventHandler.CustomMediaListExpanding, new Bundle());
+            this.remove(position);
+            for(String mrl : children) {
+                this.insert(position, mrl);
+            }
+            mEventHandler.callback(EventHandler.CustomMediaListExpandingEnd, new Bundle());
+        }
+        return ret;
+    }
+    private native int expandMedia(LibVLC libvlc_instance, int position, ArrayList<String> children);
+
+    public void loadPlaylist(String mrl) {
+        ArrayList<String> items = new ArrayList<String>();
+        loadPlaylist(mLibVLC, mrl, items);
+        this.clear();
+        for(String item : items) {
+            this.add(item);
+        }
+    }
+    private native void loadPlaylist(LibVLC libvlc_instance, String mrl, ArrayList<String> items);
+
+    public void insert(int position, String mrl) {
+        insert(position, new Media(mLibVLC, mrl));
+    }
+    public void insert(int position, Media media) {
+        mInternalList.add(position, new MediaHolder(media));
+        signal_list_event(EventHandler.CustomMediaListItemAdded, position, media.getLocation());
+    }
+
+    /**
+     * Move a media from one position to another
+     *
+     * @param startPosition start position
+     * @param endPosition end position
+     * @throws IndexOutOfBoundsException
+     */
+    public void move(int startPosition, int endPosition) {
+        if (!(isValid(startPosition)
+              && endPosition >= 0 && endPosition <= mInternalList.size()))
+            throw new IndexOutOfBoundsException("Indexes out of range");
+
+        MediaHolder toMove = mInternalList.get(startPosition);
+        mInternalList.remove(startPosition);
+        if (startPosition >= endPosition)
+            mInternalList.add(endPosition, toMove);
+        else
+            mInternalList.add(endPosition - 1, toMove);
+        Bundle b = new Bundle();
+        b.putInt("index_before", startPosition);
+        b.putInt("index_after", endPosition);
+        mEventHandler.callback(EventHandler.CustomMediaListItemMoved, b);
+    }
+
+    public void remove(int position) {
+        if (!isValid(position))
+            return;
+        String uri = mInternalList.get(position).m.getLocation();
+        mInternalList.remove(position);
+        signal_list_event(EventHandler.CustomMediaListItemDeleted, position, uri);
+    }
+
+    public void remove(String location) {
+        for (int i = 0; i < mInternalList.size(); ++i) {
+            String uri = mInternalList.get(i).m.getLocation();
+            if (uri.equals(location)) {
+                mInternalList.remove(i);
+                signal_list_event(EventHandler.CustomMediaListItemDeleted, i, uri);
+                i--;
+            }
+        }
+    }
+
+    public int size() {
+        return mInternalList.size();
+    }
+
+    public Media getMedia(int position) {
+        if (!isValid(position))
+            return null;
+        return mInternalList.get(position).m;
+    }
+
+    /**
+     * @param position The index of the media in the list
+     * @return null if not found
+     */
+    public String getMRL(int position) {
+        if (!isValid(position))
+            return null;
+        return mInternalList.get(position).m.getLocation();
+    }
+
+    public String[] getMediaOptions(int position) {
+        boolean noHardwareAcceleration = false;
+        boolean noVideo = false;
+        if (isValid(position))
+        {
+            noHardwareAcceleration = mInternalList.get(position).noHardwareAcceleration;
+            noVideo = mInternalList.get(position).noVideo;
+        }
+
+        return mLibVLC.getMediaOptions(noHardwareAcceleration, noVideo);
+    }
+
+    public EventHandler getEventHandler() {
+        return mEventHandler;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("LibVLC Media List: {");
+        for(int i = 0; i < size(); i++) {
+            sb.append(((Integer)i).toString());
+            sb.append(": ");
+            sb.append(getMRL(i));
+            sb.append(", ");
+        }
+        sb.append("}");
+        return sb.toString();
+    }
+
+    private void signal_list_event(int event, int position, String uri) {
+        Bundle b = new Bundle();
+        b.putString("item_uri", uri);
+        b.putInt("item_index", position);
+        mEventHandler.callback(event, b);
+    }
+}
diff --git a/libVLC/src/org/videolan/libvlc/TrackInfo.java b/libVLC/src/org/videolan/libvlc/TrackInfo.java
new file mode 100644
index 0000000..b55dc55
--- /dev/null
+++ b/libVLC/src/org/videolan/libvlc/TrackInfo.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * TrackInfo.java
+ *****************************************************************************
+ * Copyright © 2010-2013 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc;
+
+public class TrackInfo {
+
+    public static final int TYPE_UNKNOWN = -1;
+    public static final int TYPE_AUDIO = 0;
+    public static final int TYPE_VIDEO = 1;
+    public static final int TYPE_TEXT = 2;
+    public static final int TYPE_META = 3;
+
+    public int Type;
+    public int Id;
+    public String Codec;
+    public String Language;
+    public int Bitrate;
+
+    /* Video */
+    public int Height;
+    public int Width;
+    public float Framerate;
+
+    /* Audio */
+    public int Channels;
+    public int Samplerate;
+
+    /* MetaData */
+    public long Length;
+    public String Title;
+    public String Artist;
+    public String Album;
+    public String Genre;
+    public String ArtworkURL;
+}
diff --git a/settings.gradle b/settings.gradle
index 276effd..54809d6 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,3 @@
 include ':java-libs/WheelView'
+include ':libVLC'
 include ':vlc-android'
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 2d8f88f..18fe4b2 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -40,8 +40,6 @@ android {
     buildToolsVersion "21.0.2"
 
     sourceSets.main {
-        jni.srcDirs = [] //this prevents gradle to build native code with ndk, we have our own MakeFile for it.
-        jniLibs.srcDir 'libs' //that's were generated .so files are put.
         manifest.srcFile 'AndroidManifest.xml'
         java.srcDirs = ['src']
         resources.srcDirs = ['src']
@@ -76,6 +74,7 @@ android {
 
 dependencies {
     compile project(':java-libs/WheelView')
+    compile project(':libVLC')
     compile 'com.android.support:appcompat-v7:21.0.0'
     compile 'com.android.support:cardview-v7:21.0.0'
 }
\ No newline at end of file
diff --git a/vlc-android/jni/Android.mk b/vlc-android/jni/Android.mk
deleted file mode 100644
index 0ce845e..0000000
--- a/vlc-android/jni/Android.mk
+++ /dev/null
@@ -1,151 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE    := libvlcjni
-
-LOCAL_SRC_FILES := libvlcjni.c libvlcjni-util.c libvlcjni-track.c libvlcjni-medialist.c aout.c vout.c libvlcjni-equalizer.c native_crash_handler.c
-LOCAL_SRC_FILES += thumbnailer.c
-ifneq ($(ANDROID_API),android-21)
-# compat functions not needed after android-21
-LOCAL_SRC_FILES += pthread-condattr.c pthread-rwlocks.c pthread-once.c eventfd.c sem.c pipe2.c
-endif
-LOCAL_SRC_FILES += wchar/wcpcpy.c
-LOCAL_SRC_FILES += wchar/wcpncpy.c
-LOCAL_SRC_FILES += wchar/wcscasecmp.c
-LOCAL_SRC_FILES += wchar/wcscat.c
-LOCAL_SRC_FILES += wchar/wcschr.c
-LOCAL_SRC_FILES += wchar/wcscmp.c
-LOCAL_SRC_FILES += wchar/wcscoll.c
-LOCAL_SRC_FILES += wchar/wcscpy.c
-LOCAL_SRC_FILES += wchar/wcscspn.c
-LOCAL_SRC_FILES += wchar/wcsdup.c
-LOCAL_SRC_FILES += wchar/wcslcat.c
-LOCAL_SRC_FILES += wchar/wcslcpy.c
-LOCAL_SRC_FILES += wchar/wcslen.c
-LOCAL_SRC_FILES += wchar/wcsncasecmp.c
-LOCAL_SRC_FILES += wchar/wcsncat.c
-LOCAL_SRC_FILES += wchar/wcsncmp.c
-LOCAL_SRC_FILES += wchar/wcsncpy.c
-LOCAL_SRC_FILES += wchar/wcsnlen.c
-LOCAL_SRC_FILES += wchar/wcspbrk.c
-LOCAL_SRC_FILES += wchar/wcsrchr.c
-LOCAL_SRC_FILES += wchar/wcsspn.c
-LOCAL_SRC_FILES += wchar/wcsstr.c
-LOCAL_SRC_FILES += wchar/wcstok.c
-LOCAL_SRC_FILES += wchar/wcswidth.c
-LOCAL_SRC_FILES += wchar/wcsxfrm.c
-LOCAL_SRC_FILES += wchar/wmemchr.c
-LOCAL_SRC_FILES += wchar/wmemcmp.c
-LOCAL_SRC_FILES += wchar/wmemcpy.c
-LOCAL_SRC_FILES += wchar/wmemmove.c
-LOCAL_SRC_FILES += wchar/wmemset.c
-
-
-LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include
-
-ARCH=$(ANDROID_ABI)
-
-CPP_STATIC=$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++$(CXXSTL)/libs/$(ARCH)/libgnustl_static.a
-
-LOCAL_CFLAGS := -std=gnu99
-ifeq ($(ARCH), armeabi)
-	LOCAL_CFLAGS += -DHAVE_ARMEABI
-	# Needed by ARMv6 Thumb1 (the System Control coprocessor/CP15 is mandatory on ARMv6)
-	# On newer ARM architectures we can use Thumb2
-	LOCAL_ARM_MODE := arm
-endif
-ifeq ($(ARCH), armeabi-v7a)
-	LOCAL_CFLAGS += -DHAVE_ARMEABI_V7A
-endif
-ifneq (,$(wildcard $(LOCAL_PATH)/../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c))
-	LOCAL_CFLAGS += -DHAVE_IOMX_DR
-endif
-LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
-	$(VLC_MODULES) \
-	$(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
-	$(VLC_BUILD_DIR)/src/.libs/libvlccore.a \
-	$(VLC_BUILD_DIR)/compat/.libs/libcompat.a \
-	-ldl -lz -lm -llog \
-	-ldvbpsi -lebml -lmatroska -ltag \
-	-logg -lFLAC -ltheora -lvorbis \
-	-lmpeg2 -la52 \
-	-lavformat -lavcodec -lswscale -lavutil -lpostproc -lgsm -lopenjpeg \
-	-lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \
-	-lspeex -lspeexdsp \
-	-lxml2 -lpng -lgnutls -lgcrypt -lgpg-error \
-	-lnettle -lhogweed -lgmp \
-	-lfreetype -liconv -lass -lfribidi -lopus \
-	-lEGL -lGLESv2 -ljpeg \
-	-ldvdnav -ldvdread -ldvdcss \
-	-lmad \
-	$(CPP_STATIC)
-
-include $(BUILD_SHARED_LIBRARY)
-
-# libiomx-* build
-
-LIBIOMX_SRC_FILES_COMMON := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
-LIBIOMX_INCLUDES_COMMON := $(VLC_SRC_DIR)/modules/codec/omxil
-LIBIOMX_LDLIBS_COMMON := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder -llog -lcutils -lui
-LIBIOMX_CFLAGS_COMMON := -Wno-psabi
-# Once we always build this with a version of vlc that contains nativewindowpriv.c,
-# we can remove this condition
-ifneq (,$(wildcard $(LOCAL_PATH)/../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c))
-LIBIOMX_SRC_FILES_COMMON += ../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c
-endif
-
-# no hwbuffer for gingerbread
-LIBIOMX_INCLUDES_gingerbread := $(LIBIOMX_INCLUDES_COMMON) \
-	$(ANDROID_SYS_HEADERS_GINGERBREAD)/frameworks/base/include \
-	$(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include \
-	$(ANDROID_SYS_HEADERS_GINGERBREAD)/hardware/libhardware/include
-LIBIOMX_LDLIBS_gingerbread := $(LIBIOMX_LDLIBS_COMMON)
-LIBIOMX_CFLAGS_gingerbread := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=10
-
-LIBIOMX_INCLUDES_hc := $(LIBIOMX_INCLUDES_COMMON) \
-	$(ANDROID_SYS_HEADERS_HC)/frameworks/base/include \
-	$(ANDROID_SYS_HEADERS_HC)/frameworks/base/native/include \
-	$(ANDROID_SYS_HEADERS_HC)/system/core/include \
-	$(ANDROID_SYS_HEADERS_HC)/hardware/libhardware/include
-LIBIOMX_LDLIBS_hc := $(LIBIOMX_LDLIBS_COMMON)
-LIBIOMX_CFLAGS_hc := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=13
-
-LIBIOMX_INCLUDES_ics := $(LIBIOMX_INCLUDES_COMMON) \
-	$(ANDROID_SYS_HEADERS_ICS)/frameworks/base/include \
-	$(ANDROID_SYS_HEADERS_ICS)/frameworks/base/native/include \
-	$(ANDROID_SYS_HEADERS_ICS)/system/core/include \
-	$(ANDROID_SYS_HEADERS_ICS)/hardware/libhardware/include
-LIBIOMX_LDLIBS_ics := $(LIBIOMX_LDLIBS_COMMON) $(LIBIOMX_LDLIBS_HWBUFFER)
-LIBIOMX_CFLAGS_ics := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=14
-
-LIBIOMX_SRC_FILES_jbmr2 := $(LIBIOMX_SRC_FILES_COMMON) $(LIBIOMX_SRC_FILES_HWBUFFER)
-LIBIOMX_INCLUDES_jbmr2 := $(LIBIOMX_INCLUDES_COMMON) \
-	$(ANDROID_SYS_HEADERS_JBMR2)/frameworks/native/include \
-	$(ANDROID_SYS_HEADERS_JBMR2)/frameworks/av/include \
-	$(ANDROID_SYS_HEADERS_JBMR2)/system/core/include \
-	$(ANDROID_SYS_HEADERS_JBMR2)/hardware/libhardware/include
-LIBIOMX_LDLIBS_jbmr2 := $(LIBIOMX_LDLIBS_COMMON) $(LIBIOMX_LDLIBS_HWBUFFER)
-LIBIOMX_CFLAGS_jbmr2 := $(LIBIOMX_CFLAGS_COMMON) $(LIBIOMX_CFLAGS_HWBUFFER) -DANDROID_API=18
-
-LIBIOMX_SRC_FILES_kk := $(LIBIOMX_SRC_FILES_COMMON) $(LIBIOMX_SRC_FILES_HWBUFFER)
-LIBIOMX_INCLUDES_kk := $(LIBIOMX_INCLUDES_COMMON) \
-	$(ANDROID_SYS_HEADERS_KK)/frameworks/native/include \
-	$(ANDROID_SYS_HEADERS_KK)/frameworks/av/include \
-	$(ANDROID_SYS_HEADERS_KK)/system/core/include \
-	$(ANDROID_SYS_HEADERS_KK)/hardware/libhardware/include
-LIBIOMX_LDLIBS_kk := $(LIBIOMX_LDLIBS_COMMON) $(LIBIOMX_LDLIBS_HWBUFFER)
-LIBIOMX_CFLAGS_kk := $(LIBIOMX_CFLAGS_COMMON) $(LIBIOMX_CFLAGS_HWBUFFER) -DANDROID_API=19
-
-define build_iomx
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(1)
-LOCAL_SRC_FILES  := $(LIBIOMX_SRC_FILES_COMMON)
-LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
-LOCAL_LDLIBS     := $(LIBIOMX_LDLIBS_$(2))
-LOCAL_CFLAGS     := $(LIBIOMX_CFLAGS_$(2))
-include $(BUILD_SHARED_LIBRARY)
-endef
-
-# call build_iomx for each libiomx-* in LIBVLC_LIBS
-$(foreach IOMX_MODULE,$(filter libiomx-%,$(LIBVLC_LIBS)), \
-	$(eval $(call build_iomx,$(IOMX_MODULE),$(subst libiomx-,,$(IOMX_MODULE)))))
diff --git a/vlc-android/jni/Application.mk b/vlc-android/jni/Application.mk
deleted file mode 100644
index 9e30f15..0000000
--- a/vlc-android/jni/Application.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-APP_PLATFORM := $(ANDROID_API)
-APP_ABI := $(ANDROID_ABI)
-NDK_TOOLCHAIN_VERSION=$(GCCVER)
diff --git a/vlc-android/jni/aout.c b/vlc-android/jni/aout.c
deleted file mode 100644
index af13111..0000000
--- a/vlc-android/jni/aout.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*****************************************************************************
- * aout.c
- *****************************************************************************
- * Copyright © 2011-2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include <stdint.h>
-
-#include <jni.h>
-
-#include <vlc/vlc.h>
-
-#include "aout.h"
-
-#define LOG_TAG "VLC/JNI/aout"
-#include "log.h"
-
-// An audio frame will contain FRAME_SIZE samples
-#define FRAME_SIZE (4096*2)
-
-typedef struct
-{
-    jobject j_libVlc;   /// Pointer to the LibVLC Java object
-    jmethodID play;     /// Java method to play audio buffers
-    jbyteArray buffer;  /// Raw audio data to be played
-} aout_sys_t;
-
-#define THREAD_NAME "jni_aout"
-extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
-extern void jni_detach_thread();
-
-int aout_open(void **opaque, char *format, unsigned *rate, unsigned *nb_channels)
-{
-    LOGI ("Opening the JNI audio output");
-
-    aout_sys_t *p_sys = calloc (1, sizeof (*p_sys));
-    if (!p_sys)
-        goto enomem;
-
-    p_sys->j_libVlc = *opaque;       // Keep a reference to our Java object
-    *opaque         = (void*) p_sys; // The callback will need aout_sys_t
-
-    LOGI ("Parameters: %u channels, FOURCC '%4.4s',  sample rate: %uHz",
-          *nb_channels, format, *rate);
-
-    JNIEnv *p_env;
-    if (jni_attach_thread (&p_env, THREAD_NAME) != 0)
-    {
-        LOGE("Could not attach the display thread to the JVM !");
-        goto eattach;
-    }
-
-    // Call the init function.
-    jclass cls = (*p_env)->GetObjectClass (p_env, p_sys->j_libVlc);
-    jmethodID methodIdInitAout = (*p_env)->GetMethodID (p_env, cls,
-                                                        "initAout", "(III)V");
-    if (!methodIdInitAout)
-    {
-        LOGE ("Method initAout() could not be found!");
-        goto error;
-    }
-
-    LOGV ("Number of channels forced to 2, number of samples to %d", FRAME_SIZE);
-    *nb_channels = 2;
-
-    int aout_rate = *rate;
-    while (1) {
-        (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, methodIdInitAout,
-                                  aout_rate, *nb_channels, FRAME_SIZE);
-        if ((*p_env)->ExceptionCheck (p_env) == 0) {
-            *rate = aout_rate;
-            break;
-        }
-
-        if (aout_rate <= 0) {
-            LOGE ("initAout failed, invalid sample rate %dHz", aout_rate);
-        } else if (aout_rate != 44100) {
-            if (aout_rate < 4000) {
-                do {
-                    aout_rate *= 2;
-                } while (aout_rate < 4000);
-            } else if (aout_rate > 48000) {
-                do {
-                    aout_rate /= 2;
-                } while (aout_rate > 48000);
-            } else {
-                aout_rate = 44100;
-            }
-
-            LOGE ("initAout failed, try next sample rate %dHz", aout_rate);
-            (*p_env)->ExceptionClear (p_env);
-            continue;
-        }
-
-        LOGE ("Unable to create audio player!");
-#ifndef NDEBUG
-        (*p_env)->ExceptionDescribe (p_env);
-#endif
-        (*p_env)->ExceptionClear (p_env);
-        goto error;
-    }
-
-    /* Create a new byte array to store the audio data. */
-    jbyteArray buffer = (*p_env)->NewByteArray (p_env,
-                                                   *nb_channels *
-                                                   FRAME_SIZE *
-                                                   sizeof (uint16_t) /* =2 */);
-    if (buffer == NULL)
-    {
-        LOGE ("Could not allocate the Java byte array to store the audio data!");
-        goto error;
-    }
-
-    /* Use a global reference to not reallocate memory each time we run
-       the play function. */
-    p_sys->buffer = (*p_env)->NewGlobalRef (p_env, buffer);
-    /* The local reference is no longer useful. */
-    (*p_env)->DeleteLocalRef (p_env, buffer);
-    if (p_sys->buffer == NULL)
-    {
-        LOGE ("Could not create the global reference!");
-        goto error;
-    }
-
-    // Get the play methodId
-    p_sys->play = (*p_env)->GetMethodID (p_env, cls, "playAudio", "([BI)V");
-    assert (p_sys->play != NULL);
-    jni_detach_thread ();
-    return 0;
-
-error:
-    jni_detach_thread ();
-eattach:
-    *opaque = NULL;
-    free (p_sys);
-enomem:
-    return -1;
-}
-
-/**
- * Play an audio frame
- **/
-void aout_play(void *opaque, const void *samples, unsigned count, int64_t pts)
-{
-    aout_sys_t *p_sys = opaque;
-    JNIEnv *p_env;
-
-    /* How ugly: we constantly attach/detach this thread to/from the JVM
-     * because it will be killed before aout_close is called.
-     * aout_close will actually be called in an different thread!
-     */
-    jni_attach_thread (&p_env, THREAD_NAME);
-
-    (*p_env)->SetByteArrayRegion (p_env, p_sys->buffer, 0,
-                                  2 /*nb_channels*/ * count * sizeof (uint16_t),
-                                  (jbyte*) samples);
-    if ((*p_env)->ExceptionCheck (p_env))
-    {
-        // This can happen if for some reason the size of the input buffer
-        // is larger than the size of the output buffer
-        LOGE ("An exception occurred while calling SetByteArrayRegion");
-        (*p_env)->ExceptionDescribe (p_env);
-        (*p_env)->ExceptionClear (p_env);
-        return;
-    }
-
-    (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, p_sys->play,
-                              p_sys->buffer,
-                              2 /*nb_channels*/ * count * sizeof (uint16_t),
-                              FRAME_SIZE);
-    // FIXME: check for errors
-
-    jni_detach_thread ();
-}
-
-void aout_pause(void *opaque, int64_t pts)
-{
-    LOGI ("Pausing audio output");
-    aout_sys_t *p_sys = opaque;
-    assert(p_sys);
-
-    JNIEnv *p_env;
-    jni_attach_thread (&p_env, THREAD_NAME);
-
-    // Call the pause function.
-    jclass cls = (*p_env)->GetObjectClass (p_env, p_sys->j_libVlc);
-    jmethodID methodIdPauseAout = (*p_env)->GetMethodID (p_env, cls, "pauseAout", "()V");
-    if (!methodIdPauseAout)
-        LOGE ("Method pauseAout() could not be found!");
-    (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, methodIdPauseAout);
-    if ((*p_env)->ExceptionCheck (p_env))
-    {
-        LOGE ("Unable to pause audio player!");
-#ifndef NDEBUG
-        (*p_env)->ExceptionDescribe (p_env);
-#endif
-        (*p_env)->ExceptionClear (p_env);
-    }
-
-    jni_detach_thread ();
-}
-
-void aout_close(void *opaque)
-{
-    LOGI ("Closing audio output");
-    aout_sys_t *p_sys = opaque;
-    assert(p_sys);
-    assert(p_sys->buffer);
-
-    JNIEnv *p_env;
-    jni_attach_thread (&p_env, THREAD_NAME);
-
-    // Call the close function.
-    jclass cls = (*p_env)->GetObjectClass (p_env, p_sys->j_libVlc);
-    jmethodID methodIdCloseAout = (*p_env)->GetMethodID (p_env, cls, "closeAout", "()V");
-    if (!methodIdCloseAout)
-        LOGE ("Method closeAout() could not be found!");
-    (*p_env)->CallVoidMethod (p_env, p_sys->j_libVlc, methodIdCloseAout);
-    if ((*p_env)->ExceptionCheck (p_env))
-    {
-        LOGE ("Unable to close audio player!");
-#ifndef NDEBUG
-        (*p_env)->ExceptionDescribe (p_env);
-#endif
-        (*p_env)->ExceptionClear (p_env);
-    }
-
-    (*p_env)->DeleteGlobalRef (p_env, p_sys->buffer);
-    jni_detach_thread ();
-    free (p_sys);
-}
-
-int aout_get_native_sample_rate(void)
-{
-    JNIEnv *p_env;
-    jni_attach_thread (&p_env, THREAD_NAME);
-    jclass cls = (*p_env)->FindClass (p_env, "android/media/AudioTrack");
-    jmethodID method = (*p_env)->GetStaticMethodID (p_env, cls, "getNativeOutputSampleRate", "(I)I");
-    int sample_rate = (*p_env)->CallStaticIntMethod (p_env, cls, method, 3); // AudioManager.STREAM_MUSIC
-    jni_detach_thread ();
-    return sample_rate;
-}
diff --git a/vlc-android/jni/aout.h b/vlc-android/jni/aout.h
deleted file mode 100644
index 3fa3833..0000000
--- a/vlc-android/jni/aout.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * aout.h
- *****************************************************************************
- * Copyright © 2011-2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLCJNI_AOUT_H
-#define LIBVLCJNI_AOUT_H
-
-#include <stdint.h>
-
-#define AOUT_AUDIOTRACK_JAVA 0
-#define AOUT_AUDIOTRACK      1
-#define AOUT_OPENSLES        2
-
-int aout_open(void **opaque, char *format, unsigned *rate, unsigned *nb_channels);
-void aout_play(void *opaque, const void *samples, unsigned count, int64_t pts);
-void aout_pause(void *opaque, int64_t pts);
-void aout_close(void *opaque);
-
-#endif // LIBVLCJNI_AOUT_H
diff --git a/vlc-android/jni/egl-android-info.txt b/vlc-android/jni/egl-android-info.txt
deleted file mode 100644
index 9aaa1bc..0000000
--- a/vlc-android/jni/egl-android-info.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Some information to reuse in the future if needed the egl-android vout.
-
-// Linking options.
--lGLES_v1_CM -lEGL -landroid
-
-
-#include <android/native_window_jni.h>
-
-// Native android window to display the video.
-ANativeWindow *p_nativeWindow;
-
-void Java_vlc_android_LibVLC_setSurface(JNIEnv *env, jobject thiz, jobject surface)
-{
-    p_nativeWindow = ANativeWindow_fromSurface(env, surface);
-}
-
-
-char psz_pWin[255];
-snprintf(psz_pWin, 255, "%i", p_nativeWindow);
-
-const char *argv[] = { ....,
-                      "--vout", "egl_android",
-                      "--egl-android-window", psz_pWin};
diff --git a/vlc-android/jni/eventfd.c b/vlc-android/jni/eventfd.c
deleted file mode 100644
index 37b0e7a..0000000
--- a/vlc-android/jni/eventfd.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * eventfd.c
- *****************************************************************************
- * Copyright © 2012 Rafaël Carré
- * Copyright © 2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <sys/linux-syscalls.h>
-
-//#include <sys/syscall.h>
-int syscall(int number, ...);
-
-int eventfd(unsigned int initval, int flags)
-{
-    return syscall(__NR_eventfd2, initval, flags);
-}
diff --git a/vlc-android/jni/libvlcjni-equalizer.c b/vlc-android/jni/libvlcjni-equalizer.c
deleted file mode 100644
index 2dad0e4..0000000
--- a/vlc-android/jni/libvlcjni-equalizer.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*****************************************************************************
- * libvlcjni-equalizer.c
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <vlc/vlc.h>
-#include <vlc_common.h>
-
-#include <jni.h>
-
-#include "utils.h"
-
-#define LOG_TAG "VLC/JNI/Equalizer"
-#include "log.h"
-
-/**
- * return band list as float[]
- */
-jfloatArray Java_org_videolan_libvlc_LibVLC_getBands(JNIEnv *env, jobject thiz)
-{
-    unsigned count = libvlc_audio_equalizer_get_band_count();
-    jfloatArray bands = (*env)->NewFloatArray(env, count);
-
-    for (unsigned i = 0; i < count; ++i)
-    {
-        jfloat band = libvlc_audio_equalizer_get_band_frequency(i);
-        (*env)->SetFloatArrayRegion(env, bands, i, 1, &band);
-    }
-    return bands;
-}
-
-/**
- * return preset list as String[]
- */
-jobjectArray Java_org_videolan_libvlc_LibVLC_getPresets(JNIEnv *env, jobject thiz)
-{
-    unsigned count = libvlc_audio_equalizer_get_preset_count();
-    jclass stringClass = (*env)->FindClass(env, "java/lang/String");
-    jobjectArray presets = (*env)->NewObjectArray(env, count, stringClass, NULL);
-
-    for (unsigned i = 0; i < count; ++i)
-    {
-        const char *name = libvlc_audio_equalizer_get_preset_name(i);
-        jstring jname = (*env)->NewStringUTF(env, name);
-        (*env)->SetObjectArrayElement(env, presets, i, jname);
-    }
-    return presets;
-}
-
-/**
- * return preset n° <index> as float[] (first element is preamp, then bands)
- */
-jfloatArray Java_org_videolan_libvlc_LibVLC_getPreset(JNIEnv *env, jobject thiz, jint index)
-{
-    unsigned count = libvlc_audio_equalizer_get_band_count();
-    jfloatArray array = (*env)->NewFloatArray(env, count + 1);
-    libvlc_equalizer_t *p_equalizer = libvlc_audio_equalizer_new_from_preset(index);
-    if (p_equalizer != NULL)
-    {
-        jfloat preamp = libvlc_audio_equalizer_get_preamp(p_equalizer);
-        (*env)->SetFloatArrayRegion(env, array, 0, 1, &preamp);
-
-        for (unsigned i = 0; i < count; ++i)
-        {
-            jfloat band = libvlc_audio_equalizer_get_amp_at_index(p_equalizer, i);
-            (*env)->SetFloatArrayRegion(env, array, i + 1, 1, &band);
-        }
-        libvlc_audio_equalizer_release(p_equalizer);
-    }
-    return array;
-}
-
-/**
- * apply equalizer settings (param bands is float[] (first element is preamp, then bands))
- */
-//"--audio-filter=equalizer", "--equalizer-bands=-3.5 -4.5 -1 0 0 5 8 8 8 8",
-jint Java_org_videolan_libvlc_LibVLC_setNativeEqualizer(JNIEnv *env, jobject thiz, jlong media_player, jfloatArray bands)
-{
-    jint res = -1;
-    libvlc_media_player_t *mp = (libvlc_media_player_t*)(intptr_t)media_player;
-    if (!mp)
-        return res;
-
-    if (bands == NULL)
-        return libvlc_media_player_set_equalizer(mp, NULL);
-
-    jfloat *cbands = (*env)->GetFloatArrayElements(env, bands, NULL);
-    if (cbands == NULL)
-        return res;
-
-    jsize input_count = (*env)->GetArrayLength(env, bands);
-    unsigned band_count = libvlc_audio_equalizer_get_band_count();
-    if (input_count == band_count+1) // first item is preamp
-    {
-        libvlc_equalizer_t *p_equalizer = libvlc_audio_equalizer_new();
-        libvlc_audio_equalizer_set_preamp(p_equalizer, cbands[0]);
-        for (unsigned i = 0; i < band_count; ++i)
-        {
-            libvlc_audio_equalizer_set_amp_at_index(p_equalizer, cbands[i+1], i);
-        }
-        res = libvlc_media_player_set_equalizer(mp, p_equalizer);
-        libvlc_audio_equalizer_release(p_equalizer);
-    }
-    return res;
-}
diff --git a/vlc-android/jni/libvlcjni-medialist.c b/vlc-android/jni/libvlcjni-medialist.c
deleted file mode 100644
index 257fadc..0000000
--- a/vlc-android/jni/libvlcjni-medialist.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*****************************************************************************
- * libvlcjni-medialist.c
- *****************************************************************************
- * Copyright © 2013 VLC authors and VideoLAN
- * Copyright © 2013 Edward Wang
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-#include <jni.h>
-#include <vlc/vlc.h>
-#include <vlc/libvlc_media_list.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-#include "utils.h"
-#define LOG_TAG "VLC/JNI/MediaList"
-#include "log.h"
-
-struct stopped_monitor {
-    pthread_mutex_t doneMutex;
-    pthread_cond_t doneCondVar;
-    bool stopped;
-};
-
-static void stopped_callback(const libvlc_event_t *ev, void *data)
-{
-    struct stopped_monitor* monitor = data;
-    pthread_mutex_lock(&monitor->doneMutex);
-    monitor->stopped = true;
-    pthread_cond_signal(&monitor->doneCondVar);
-    pthread_mutex_unlock(&monitor->doneMutex);
-}
-
-static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, jobject arrayList, libvlc_media_t* p_md) {
-    if(!p_md) {
-        return -1;
-    }
-    libvlc_media_list_t* p_subitems = libvlc_media_subitems(p_md);
-    libvlc_media_release(p_md);
-    if(p_subitems) {
-        // Expand any subitems if needed
-        int subitem_count = libvlc_media_list_count(p_subitems);
-        if(subitem_count > 0) {
-            LOGD("Found %d subitems, expanding", subitem_count);
-            jclass arrayListClass; jmethodID methodAdd;
-            arrayListGetIDs(env, &arrayListClass, &methodAdd, NULL);
-
-            for(int i = subitem_count - 1; i >= 0; i--) {
-                libvlc_media_t* p_subitem = libvlc_media_list_item_at_index(p_subitems, i);
-                char* p_subitem_uri = libvlc_media_get_mrl(p_subitem);
-                arrayListStringAdd(env, arrayListClass, methodAdd, arrayList, p_subitem_uri);
-                free(p_subitem_uri);
-            }
-        }
-        libvlc_media_list_release(p_subitems);
-        if(subitem_count > 0) {
-            return 0;
-        } else {
-            return -1;
-        }
-    } else {
-        return -1;
-    }
-}
-
-jint Java_org_videolan_libvlc_MediaList_expandMedia(JNIEnv *env, jobject thiz, jobject libvlcJava, jint position, jobject children) {
-    return (jint)expand_media_internal(env,
-        (libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"),
-        children,
-        (libvlc_media_t*)libvlc_media_player_get_media((libvlc_media_player_t*)(intptr_t)getLong(env, libvlcJava, "mInternalMediaPlayerInstance"))
-        );
-}
-
-void Java_org_videolan_libvlc_MediaList_loadPlaylist(JNIEnv *env, jobject thiz, jobject libvlcJava, jstring mrl, jobject items) {
-    const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, NULL);
-
-    libvlc_media_t *p_md = libvlc_media_new_location((libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"), p_mrl);
-    libvlc_media_add_option(p_md, ":demux=playlist,none");
-    libvlc_media_add_option(p_md, ":run-time=1");
-
-    struct stopped_monitor* monitor = malloc(sizeof(struct stopped_monitor));
-    pthread_mutex_init(&monitor->doneMutex, NULL);
-    pthread_cond_init(&monitor->doneCondVar, NULL);
-    monitor->stopped = false;
-    pthread_mutex_lock(&monitor->doneMutex);
-
-    libvlc_media_player_t* p_mp = libvlc_media_player_new((libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"));
-    libvlc_media_player_set_video_title_display(p_mp, libvlc_position_disable, 0);
-    libvlc_event_manager_t* ev = libvlc_media_player_event_manager(p_mp);
-    libvlc_event_attach(ev, libvlc_MediaPlayerEndReached, stopped_callback, monitor);
-    libvlc_media_player_set_media(p_mp, p_md);
-    libvlc_media_player_play(p_mp);
-
-    struct timespec deadline;
-    clock_gettime(CLOCK_REALTIME, &deadline);
-    deadline.tv_sec += 2; /* If "VLC can't open the file", return */
-    int mp_alive = 1;
-    while(!(monitor->stopped) && mp_alive) {
-        pthread_cond_timedwait(&monitor->doneCondVar, &monitor->doneMutex, &deadline);
-        mp_alive = libvlc_media_player_will_play(p_mp);
-    }
-    pthread_mutex_unlock(&monitor->doneMutex);
-    pthread_mutex_destroy(&monitor->doneMutex);
-    pthread_cond_destroy(&monitor->doneCondVar);
-    free(monitor);
-
-    libvlc_media_player_release(p_mp);
-
-    expand_media_internal(env, (libvlc_instance_t*)(intptr_t)getLong(env, libvlcJava, "mLibVlcInstance"), items, p_md);
-
-    (*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
-}
diff --git a/vlc-android/jni/libvlcjni-track.c b/vlc-android/jni/libvlcjni-track.c
deleted file mode 100644
index eba0b5c..0000000
--- a/vlc-android/jni/libvlcjni-track.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/*****************************************************************************
- * libvlcjni-track.c
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <vlc/vlc.h>
-#include <vlc_common.h>
-#include <vlc_fourcc.h>
-
-#include <jni.h>
-
-#include "utils.h"
-
-#define LOG_TAG "VLC/JNI/track"
-#include "log.h"
-
-struct length_change_monitor {
-    pthread_mutex_t doneMutex;
-    pthread_cond_t doneCondVar;
-    bool length_changed;
-};
-
-static void length_changed_callback(const libvlc_event_t *ev, void *data)
-{
-    struct length_change_monitor *monitor = data;
-    pthread_mutex_lock(&monitor->doneMutex);
-    monitor->length_changed = true;
-    pthread_cond_signal(&monitor->doneCondVar);
-    pthread_mutex_unlock(&monitor->doneMutex);
-}
-
-jboolean Java_org_videolan_libvlc_LibVLC_hasVideoTrack(JNIEnv *env, jobject thiz,
-                                                       jlong i_instance, jstring fileLocation)
-{
-    /* Create a new item and assign it to the media player. */
-    libvlc_media_t *p_m = new_media(i_instance, env, thiz, fileLocation, false, false);
-    if (p_m == NULL)
-    {
-        LOGE("Could not create the media!");
-        return JNI_FALSE;
-    }
-
-    /* Get the tracks information of the media. */
-    libvlc_media_parse(p_m);
-
-    libvlc_media_player_t* p_mp = libvlc_media_player_new_from_media(p_m);
-    libvlc_media_player_set_video_title_display(p_mp, libvlc_position_disable, 0);
-
-    struct length_change_monitor* monitor;
-    monitor = malloc(sizeof(struct length_change_monitor));
-    if (!monitor) return 0;
-
-    /* Initialize pthread variables. */
-    pthread_mutex_init(&monitor->doneMutex, NULL);
-    pthread_cond_init(&monitor->doneCondVar, NULL);
-    monitor->length_changed = false;
-
-    libvlc_event_manager_t *ev = libvlc_media_player_event_manager(p_mp);
-    libvlc_event_attach(ev, libvlc_MediaPlayerLengthChanged, length_changed_callback, monitor);
-    libvlc_media_player_play( p_mp );
-
-    pthread_mutex_lock(&monitor->doneMutex);
-
-    struct timespec deadline;
-    clock_gettime(CLOCK_REALTIME, &deadline);
-    deadline.tv_sec += 2; /* If "VLC can't open the file", return */
-    int mp_alive = 1;
-    while( !monitor->length_changed && mp_alive ) {
-        pthread_cond_timedwait(&monitor->doneCondVar, &monitor->doneMutex, &deadline);
-        mp_alive = libvlc_media_player_will_play(p_mp);
-    }
-    pthread_mutex_unlock(&monitor->doneMutex);
-
-    int i_nbTracks;
-    if( mp_alive )
-        i_nbTracks = libvlc_video_get_track_count(p_mp);
-    else
-        i_nbTracks = -1;
-    LOGI("Number of video tracks: %d",i_nbTracks);
-
-    libvlc_event_detach(ev, libvlc_MediaPlayerLengthChanged, length_changed_callback, monitor);
-    libvlc_media_player_stop(p_mp);
-    libvlc_media_player_release(p_mp);
-    libvlc_media_release(p_m);
-
-    pthread_mutex_destroy(&monitor->doneMutex);
-    pthread_cond_destroy(&monitor->doneCondVar);
-    free(monitor);
-
-    if(i_nbTracks > 0)
-        return JNI_TRUE;
-    else if(i_nbTracks < 0)
-        (*env)->ThrowNew(env, (*env)->FindClass(env, "java/io/IOException"), "VLC can't open the file");
-    else
-        return JNI_FALSE;
-}
-
-jobjectArray read_track_info_internal(JNIEnv *env, jobject thiz, libvlc_media_t* p_m)
-{
-    /* get java class */
-    jclass cls = (*env)->FindClass( env, "org/videolan/libvlc/TrackInfo" );
-    if ( !cls )
-    {
-        LOGE("Failed to load class (org/videolan/libvlc/TrackInfo)" );
-        return NULL;
-    }
-
-    /* get java class contructor */
-    jmethodID clsCtor = (*env)->GetMethodID( env, cls, "<init>", "()V" );
-    if ( !clsCtor )
-    {
-        LOGE("Failed to find class constructor (org/videolan/libvlc/TrackInfo)" );
-        return NULL;
-    }
-
-    /* Get the tracks information of the media. */
-    libvlc_media_track_t **p_tracks;
-
-    int i_nbTracks = libvlc_media_tracks_get(p_m, &p_tracks);
-    jobjectArray array = (*env)->NewObjectArray(env, i_nbTracks + 1, cls, NULL);
-
-    unsigned i;
-    if (array != NULL)
-    {
-        for (i = 0; i <= i_nbTracks; ++i)
-        {
-            jobject item = (*env)->NewObject(env, cls, clsCtor);
-            if (item == NULL)
-                continue;
-            (*env)->SetObjectArrayElement(env, array, i, item);
-
-            // use last track for metadata
-            if (i == i_nbTracks)
-            {
-                setInt(env, item, "Type", 3 /* TYPE_META */);
-                setLong(env, item, "Length", libvlc_media_get_duration(p_m));
-                setString(env, item, "Title", libvlc_media_get_meta(p_m, libvlc_meta_Title));
-                setString(env, item, "Artist", libvlc_media_get_meta(p_m, libvlc_meta_Artist));
-                setString(env, item, "Album", libvlc_media_get_meta(p_m, libvlc_meta_Album));
-                setString(env, item, "Genre", libvlc_media_get_meta(p_m, libvlc_meta_Genre));
-                setString(env, item, "ArtworkURL", libvlc_media_get_meta(p_m, libvlc_meta_ArtworkURL));
-                continue;
-            }
-
-            setInt(env, item, "Id", p_tracks[i]->i_id);
-            setInt(env, item, "Type", p_tracks[i]->i_type);
-            setString(env, item, "Codec", (const char*)vlc_fourcc_GetDescription(0,p_tracks[i]->i_codec));
-            setString(env, item, "Language", p_tracks[i]->psz_language);
-            setInt(env, item, "Bitrate", p_tracks[i]->i_bitrate);
-
-            if (p_tracks[i]->i_type == libvlc_track_video)
-            {
-                setInt(env, item, "Height", p_tracks[i]->video->i_height);
-                setInt(env, item, "Width", p_tracks[i]->video->i_width);
-                setFloat(env, item, "Framerate", (float)p_tracks[i]->video->i_frame_rate_num / p_tracks[i]->video->i_frame_rate_den);
-            }
-            if (p_tracks[i]->i_type == libvlc_track_audio)
-            {
-                setInt(env, item, "Channels", p_tracks[i]->audio->i_channels);
-                setInt(env, item, "Samplerate", p_tracks[i]->audio->i_rate);
-            }
-        }
-    }
-
-    libvlc_media_tracks_release(p_tracks, i_nbTracks);
-    return array;
-}
-
-jobjectArray Java_org_videolan_libvlc_LibVLC_readTracksInfo(JNIEnv *env, jobject thiz,
-                                                            jlong instance, jstring mrl)
-{
-    /* Create a new item and assign it to the media player. */
-    libvlc_media_t *p_m = new_media(instance, env, thiz, mrl, false, false);
-    if (p_m == NULL)
-    {
-        LOGE("Could not create the media!");
-        return NULL;
-    }
-
-    libvlc_media_parse(p_m);
-    jobjectArray jar = read_track_info_internal(env, thiz, p_m);
-    libvlc_media_release(p_m);
-    return jar;
-}
-
-
-jobjectArray Java_org_videolan_libvlc_LibVLC_readTracksInfoInternal(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz);
-    if (p_mp == NULL) {
-        LOGE("No media player!");
-        return NULL;
-    }
-    libvlc_media_t *p_m = libvlc_media_player_get_media(p_mp);
-    if (p_m == NULL) {
-        LOGE("Could not load internal media!");
-        return NULL;
-    } else
-        return read_track_info_internal(env, thiz, p_m);
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getAudioTracksCount(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return (jint) libvlc_audio_get_track_count(mp);
-    return -1;
-}
-
-jobject Java_org_videolan_libvlc_LibVLC_getAudioTrackDescription(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (!mp)
-        return NULL;
-
-    int i_nbTracks = libvlc_audio_get_track_count(mp) - 1;
-    if (i_nbTracks < 0)
-        i_nbTracks = 0;
-    jclass mapClass = (*env)->FindClass(env, "java/util/Map");
-    jclass hashMapClass = (*env)->FindClass(env, "java/util/HashMap");
-    jmethodID mapPut = (*env)->GetMethodID(env, mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-    /*
-     * "What are you building? Lay your hand on it. Where is it?"
-     * We need a concrete map to start
-     */
-    jmethodID mapInit = (*env)->GetMethodID(env, hashMapClass, "<init>", "()V");
-    jclass integerCls = (*env)->FindClass(env, "java/lang/Integer");
-    jmethodID integerConstructor = (*env)->GetMethodID(env, integerCls, "<init>", "(I)V");
-
-    jobject audioTrackMap = (*env)->NewObject(env, hashMapClass, mapInit);
-
-    libvlc_track_description_t *first = libvlc_audio_get_track_description(mp);
-    libvlc_track_description_t *desc = first != NULL ? first->p_next : NULL;
-    unsigned i;
-    for (i = 0; i < i_nbTracks; ++i)
-    {
-        // store audio track ID and name in a map as <ID, Track Name>
-        jobject track_id = (*env)->NewObject(env, integerCls, integerConstructor, desc->i_id);
-        jstring name = (*env)->NewStringUTF(env, desc->psz_name);
-        (*env)->CallObjectMethod(env, audioTrackMap, mapPut, track_id, name);
-        desc = desc->p_next;
-    }
-    libvlc_track_description_list_release(first);
-
-    // Clean up local references
-    (*env)->DeleteLocalRef(env, mapClass);
-    (*env)->DeleteLocalRef(env, hashMapClass);
-    (*env)->DeleteLocalRef(env, integerCls);
-
-    return audioTrackMap;
-}
-
-jobject Java_org_videolan_libvlc_LibVLC_getStats(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (!mp)
-        return NULL;
-
-    libvlc_media_t *p_mp = libvlc_media_player_get_media(mp);
-    if (!p_mp)
-        return NULL;
-
-    libvlc_media_stats_t p_stats;
-    libvlc_media_get_stats(p_mp, &p_stats);
-
-    jclass mapClass = (*env)->FindClass(env, "java/util/Map");
-    jclass hashMapClass = (*env)->FindClass(env, "java/util/HashMap");
-    jmethodID mapPut = (*env)->GetMethodID(env, mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-    /* We need a concrete map to start */
-    jmethodID mapInit = (*env)->GetMethodID(env, hashMapClass, "<init>", "()V");
-    jclass integerCls = (*env)->FindClass(env, "java/lang/Integer");
-    jmethodID integerConstructor = (*env)->GetMethodID(env, integerCls, "<init>", "(I)V");
-    jclass floatCls = (*env)->FindClass(env, "java/lang/Float");
-    jmethodID floatConstructor = (*env)->GetMethodID(env, floatCls, "<init>", "(F)V");
-
-    jobject statistics = (*env)->NewObject(env, hashMapClass, mapInit);
-    jobject value = (*env)->NewObject(env, floatCls, floatConstructor, p_stats.f_demux_bitrate);
-    jstring name = (*env)->NewStringUTF(env, "demuxBitrate");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, floatCls, floatConstructor, p_stats.f_input_bitrate);
-    name = (*env)->NewStringUTF(env, "inputBitrate");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, floatCls, floatConstructor, p_stats.f_send_bitrate);
-    name = (*env)->NewStringUTF(env, "sendBitrate");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_decoded_audio);
-    name = (*env)->NewStringUTF(env, "decodedAudio");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_decoded_video);
-    name = (*env)->NewStringUTF(env, "decodedVideo");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_demux_corrupted);
-    name = (*env)->NewStringUTF(env, "demuxCorrupted");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_demux_discontinuity);
-    name = (*env)->NewStringUTF(env, "demuxDiscontinuity");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_demux_read_bytes);
-    name = (*env)->NewStringUTF(env, "demuxReadBytes");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_displayed_pictures);
-    name = (*env)->NewStringUTF(env, "displayedPictures");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_lost_abuffers);
-    name = (*env)->NewStringUTF(env, "lostAbuffers");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_lost_pictures);
-    name = (*env)->NewStringUTF(env, "lostPictures");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_played_abuffers);
-    name = (*env)->NewStringUTF(env, "playedAbuffers");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_read_bytes);
-    name = (*env)->NewStringUTF(env, "readBytes");
-    (*env)->CallObjectMethod(env, statistics, mapPut, value, name);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_sent_bytes);
-    name = (*env)->NewStringUTF(env, "sentBytes");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    value = (*env)->NewObject(env, integerCls, integerConstructor, p_stats.i_sent_packets);
-    name = (*env)->NewStringUTF(env, "sentPackets");
-    (*env)->CallObjectMethod(env, statistics, mapPut, name, value);
-
-    // Clean up local references
-    (*env)->DeleteLocalRef(env, mapClass);
-    (*env)->DeleteLocalRef(env, hashMapClass);
-    (*env)->DeleteLocalRef(env, integerCls);
-    (*env)->DeleteLocalRef(env, floatCls);
-
-    return statistics;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getAudioTrack(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_audio_get_track(mp);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_setAudioTrack(JNIEnv *env, jobject thiz, jint index)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_audio_set_track(mp, index);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getVideoTracksCount(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return (jint) libvlc_video_get_track_count(mp);
-    return -1;
-}
-
-jobject Java_org_videolan_libvlc_LibVLC_getSpuTrackDescription(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (!mp)
-        return NULL;
-
-    int i_nbTracks = libvlc_video_get_spu_count(mp);
-    jclass mapClass = (*env)->FindClass(env, "java/util/Map");
-    jclass hashMapClass = (*env)->FindClass(env, "java/util/HashMap");
-    jmethodID mapPut = (*env)->GetMethodID(env, mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-    /*
-     * "What are you building? Lay your hand on it. Where is it?"
-     * We need a concrete map to start
-     */
-    jmethodID mapInit = (*env)->GetMethodID(env, hashMapClass, "<init>", "()V");
-    jclass integerCls = (*env)->FindClass(env, "java/lang/Integer");
-    jmethodID integerConstructor = (*env)->GetMethodID(env, integerCls, "<init>", "(I)V");
-
-    jobject spuTrackMap = (*env)->NewObject(env, hashMapClass, mapInit);
-
-    libvlc_track_description_t *first = libvlc_video_get_spu_description(mp);
-    libvlc_track_description_t *desc = first;
-    unsigned i;
-    for (i = 0; i < i_nbTracks; ++i)
-    {
-        // store audio track ID and name in a map as <ID, Track Name>
-        jobject track_id = (*env)->NewObject(env, integerCls, integerConstructor, desc->i_id);
-        jstring name = (*env)->NewStringUTF(env, desc->psz_name);
-        (*env)->CallObjectMethod(env, spuTrackMap, mapPut, track_id, name);
-        desc = desc->p_next;
-    }
-    libvlc_track_description_list_release(first);
-
-    // Clean up local references
-    (*env)->DeleteLocalRef(env, mapClass);
-    (*env)->DeleteLocalRef(env, hashMapClass);
-    (*env)->DeleteLocalRef(env, integerCls);
-
-    return spuTrackMap;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getSpuTracksCount(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return (jint) libvlc_video_get_spu_count(mp);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getSpuTrack(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_video_get_spu(mp);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_setSpuTrack(JNIEnv *env, jobject thiz, jint index)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_video_set_spu(mp, index);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_addSubtitleTrack(JNIEnv *env, jobject thiz, jstring path)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp) {
-        jboolean isCopy;
-        const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
-        jint res = libvlc_video_set_subtitle_file(mp, psz_path);
-        (*env)->ReleaseStringUTFChars(env, path, psz_path);
-        return res;
-    } else {
-        return -1;
-    }
-}
diff --git a/vlc-android/jni/libvlcjni-util.c b/vlc-android/jni/libvlcjni-util.c
deleted file mode 100644
index 205d59d..0000000
--- a/vlc-android/jni/libvlcjni-util.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*****************************************************************************
- * libvlcjni-util.c
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <dirent.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-#include <vlc/vlc.h>
-#include <vlc_common.h>
-#include <vlc_url.h>
-
-#include <jni.h>
-
-#define LOG_TAG "VLC/JNI/Util"
-#include "log.h"
-
-static jobject debugBufferInstance = NULL;
-
-// FIXME: use atomics
-static bool buffer_logging;
-
-#define THREAD_NAME "libvlcjni-util"
-extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
-extern void jni_detach_thread();
-extern int jni_get_env(JNIEnv **env);
-
-jint getInt(JNIEnv *env, jobject thiz, const char* field) {
-    jclass clazz = (*env)->GetObjectClass(env, thiz);
-    jfieldID fieldMP = (*env)->GetFieldID(env, clazz,
-                                          field, "I");
-    return (*env)->GetIntField(env, thiz, fieldMP);
-}
-void setInt(JNIEnv *env, jobject item, const char* field, jint value) {
-    jclass cls;
-    jfieldID fieldId;
-
-    /* Get a reference to item's class */
-    cls = (*env)->GetObjectClass(env, item);
-
-    /* Look for the instance field s in cls */
-    fieldId = (*env)->GetFieldID(env, cls, field, "I");
-    if (fieldId == NULL)
-        return;
-
-    (*env)->SetIntField(env, item, fieldId, value);
-}
-
-jlong getLong(JNIEnv *env, jobject thiz, const char* field) {
-    jclass clazz = (*env)->GetObjectClass(env, thiz);
-    jfieldID fieldMP = (*env)->GetFieldID(env, clazz,
-                                          field, "J");
-    return (*env)->GetLongField(env, thiz, fieldMP);
-}
-void setLong(JNIEnv *env, jobject item, const char* field, jlong value) {
-    jclass cls;
-    jfieldID fieldId;
-
-    /* Get a reference to item's class */
-    cls = (*env)->GetObjectClass(env, item);
-
-    /* Look for the instance field s in cls */
-    fieldId = (*env)->GetFieldID(env, cls, field, "J");
-    if (fieldId == NULL)
-        return;
-
-    (*env)->SetLongField(env, item, fieldId, value);
-}
-
-void setFloat(JNIEnv *env, jobject item, const char* field, jfloat value) {
-    jclass cls;
-    jfieldID fieldId;
-
-    /* Get a reference to item's class */
-    cls = (*env)->GetObjectClass(env, item);
-
-    /* Look for the instance field s in cls */
-    fieldId = (*env)->GetFieldID(env, cls, field, "F");
-    if (fieldId == NULL)
-        return;
-
-    (*env)->SetFloatField(env, item, fieldId, value);
-}
-void setString(JNIEnv *env, jobject item, const char* field, const char* text) {
-    jclass cls;
-    jfieldID fieldId;
-    jstring jstr;
-
-    /* Get a reference to item's class */
-    cls = (*env)->GetObjectClass(env, item);
-
-    /* Look for the instance field s in cls */
-    fieldId = (*env)->GetFieldID(env, cls, field, "Ljava/lang/String;");
-    if (fieldId == NULL)
-        return;
-
-    /* Create a new string and overwrite the instance field */
-    jstr = (*env)->NewStringUTF(env, text);
-    if (jstr == NULL)
-        return;
-    (*env)->SetObjectField(env, item, fieldId, jstr);
-}
-
-void arrayListGetIDs(JNIEnv *env, jclass* p_class, jmethodID* p_add, jmethodID* p_remove) {
-    *p_class = (*env)->FindClass(env, "java/util/ArrayList");
-    if(p_add)
-        *p_add = (*env)->GetMethodID(env, *p_class, "add", "(Ljava/lang/Object;)Z");
-    if(p_remove)
-        *p_remove = (*env)->GetMethodID(env, *p_class, "remove", "(I)Ljava/lang/Object;");
-}
-
-void arrayListStringAdd(JNIEnv *env, jclass class, jmethodID methodID, jobject arrayList, const char* str) {
-    jstring jstr = (*env)->NewStringUTF(env, str);
-    (*env)->CallBooleanMethod(env, arrayList, methodID, jstr);
-    (*env)->DeleteLocalRef(env, jstr);
-}
-
-jobject getEventHandlerReference(JNIEnv *env, jobject thiz, jobject eventHandler)
-{
-    jclass cls = (*env)->GetObjectClass(env, eventHandler);
-    if (!cls) {
-        LOGE("setEventHandler: failed to get class reference");
-        return NULL;
-    }
-
-    jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");
-    if (!methodID) {
-        LOGE("setEventHandler: failed to get the callback method");
-        return NULL;
-    }
-
-    return (*env)->NewGlobalRef(env, eventHandler);
-}
-
-static void debug_buffer_log(void *data, int level, const char *fmt, va_list ap)
-{
-    bool isAttached = false;
-    JNIEnv *env = NULL;
-
-    if (jni_get_env(&env) < 0) {
-        if (jni_attach_thread(&env, THREAD_NAME) < 0)
-            return;
-        isAttached = true;
-    }
-
-    /* Prepare message string */
-    char* psz_fmt_newline = malloc(strlen(fmt) + 2);
-    if(!psz_fmt_newline)
-        return;
-    strcpy(psz_fmt_newline, fmt);
-    strcat(psz_fmt_newline, "\n");
-    char* psz_msg = NULL;
-    int res = vasprintf(&psz_msg, psz_fmt_newline, ap);
-    free(psz_fmt_newline);
-    if(res < 0)
-        return;
-
-    jobject buffer = debugBufferInstance;
-    jclass buffer_class = (*env)->FindClass(env, "java/lang/StringBuffer");
-    jmethodID bufferAppendID = (*env)->GetMethodID(env, buffer_class, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
-
-    jstring message = (*env)->NewStringUTF(env, psz_msg);
-    (*env)->CallObjectMethod(env, buffer, bufferAppendID, message);
-    (*env)->DeleteLocalRef(env, message);
-    free(psz_msg);
-
-    if (isAttached)
-        jni_detach_thread();
-}
-
-void debug_log(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_list ap)
-{
-    bool *verbose = data;
-
-    static const uint8_t priority[5] = {
-        [LIBVLC_DEBUG]   = ANDROID_LOG_DEBUG,
-        [1 /* ??? */]    = ANDROID_LOG_DEBUG,
-        [LIBVLC_NOTICE]  = ANDROID_LOG_INFO,
-        [LIBVLC_WARNING] = ANDROID_LOG_WARN,
-        [LIBVLC_ERROR]   = ANDROID_LOG_ERROR,
-    };
-
-    int prio = ANDROID_LOG_DEBUG;
-    if (level >= LIBVLC_DEBUG && level <= LIBVLC_ERROR)
-        prio = priority[level];
-
-    /* Quit if we are not doing anything */
-    if(!buffer_logging && (!(*verbose) && prio < ANDROID_LOG_ERROR))
-        return;
-
-    /* Add emitting module & type */
-    char* fmt2 = NULL;
-    if(asprintf(&fmt2, "%s %s: %s", ctx->psz_module, ctx->psz_object_type, fmt) < 0)
-        return;
-
-    if (buffer_logging) {
-        va_list aq;
-        va_copy(aq, ap);
-        debug_buffer_log(data, level, fmt2, aq);
-        va_end(aq);
-    }
-
-    __android_log_vprint(prio, "VLC", fmt2, ap);
-    free(fmt2);
-}
-
-void Java_org_videolan_libvlc_LibVLC_startDebugBuffer(JNIEnv *env, jobject thiz)
-{
-    jclass libVLC_class = (*env)->FindClass(env, "org/videolan/libvlc/LibVLC");
-    jmethodID getInstance = (*env)->GetStaticMethodID(env, libVLC_class, "getInstance", "()Lorg/videolan/libvlc/LibVLC;");
-    jobject libvlcj = (*env)->CallStaticObjectMethod(env, libVLC_class, getInstance);
-
-    jfieldID bufferID = (*env)->GetFieldID(env, libVLC_class, "mDebugLogBuffer", "Ljava/lang/StringBuffer;");
-    jobject buffer = (*env)->GetObjectField(env, libvlcj, bufferID);
-
-    debugBufferInstance = (*env)->NewGlobalRef(env, buffer);
-    (*env)->DeleteLocalRef(env, buffer);
-
-    jfieldID buffer_flag = (*env)->GetFieldID(env, libVLC_class, "mIsBufferingLog", "Z");
-    (*env)->SetBooleanField(env, libvlcj, buffer_flag, JNI_TRUE);
-
-    (*env)->DeleteLocalRef(env, libVLC_class);
-    (*env)->DeleteLocalRef(env, libvlcj);
-    buffer_logging = true;
-}
-
-void Java_org_videolan_libvlc_LibVLC_stopDebugBuffer(JNIEnv *env, jobject thiz)
-{
-    buffer_logging = false;
-    jclass libVLC_class = (*env)->FindClass(env, "org/videolan/libvlc/LibVLC");
-    jmethodID getInstance = (*env)->GetStaticMethodID(env, libVLC_class, "getInstance", "()Lorg/videolan/libvlc/LibVLC;");
-    jobject libvlcj = (*env)->CallStaticObjectMethod(env, libVLC_class, getInstance);
-
-    (*env)->DeleteGlobalRef(env, debugBufferInstance);
-
-    jfieldID buffer_flag = (*env)->GetFieldID(env, libVLC_class, "mIsBufferingLog", "Z");
-    (*env)->SetBooleanField(env, libvlcj, buffer_flag, JNI_FALSE);
-
-    (*env)->DeleteLocalRef(env, libVLC_class);
-    (*env)->DeleteLocalRef(env, libvlcj);
-}
-
-jstring Java_org_videolan_libvlc_LibVLC_nativeToURI(JNIEnv *env, jobject thiz, jstring path)
-{
-    jboolean isCopy;
-    /* Get C string */
-    const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
-    /* Convert the path to URI */
-    char* psz_location;
-    if(unlikely( strstr( psz_path, "://" ) ))
-        psz_location = strdup(psz_path);
-    else
-        psz_location = vlc_path2uri(psz_path, "file");
-    /* Box into jstring */
-    jstring t = (*env)->NewStringUTF(env, psz_location);
-    /* Clean up */
-    (*env)->ReleaseStringUTFChars(env, path, psz_path);
-    free(psz_location);
-    return t;
-}
-
-void Java_org_videolan_libvlc_LibVLC_nativeReadDirectory(JNIEnv *env, jobject thiz, jstring path, jobject arrayList)
-{
-    jboolean isCopy;
-    /* Get C string */
-    const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
-
-    DIR* p_dir = opendir(psz_path);
-    (*env)->ReleaseStringUTFChars(env, path, psz_path);
-    if(!p_dir)
-        return;
-
-    jclass arrayClass = (*env)->FindClass(env, "java/util/ArrayList");
-    jmethodID methodID = (*env)->GetMethodID(env, arrayClass, "add", "(Ljava/lang/Object;)Z");
-
-    struct dirent* p_dirent;
-    jstring str;
-    while(1) {
-        errno = 0;
-        p_dirent = readdir(p_dir);
-        if(p_dirent == NULL) {
-            if(errno > 0) /* error reading this entry */
-                continue;
-            else if(errno == 0) /* end of stream */
-                break;
-        }
-        str = (*env)->NewStringUTF(env, p_dirent->d_name);
-        (*env)->CallBooleanMethod(env, arrayList, methodID, str);
-        (*env)->DeleteLocalRef(env, str);
-    }
-    closedir(p_dir);
-}
-
-jboolean Java_org_videolan_libvlc_LibVLC_nativeIsPathDirectory(JNIEnv *env, jobject thiz, jstring path)
-{
-    jboolean isCopy;
-    /* Get C string */
-    const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
-
-    jboolean isDirectory;
-    struct stat buf;
-    if(stat(psz_path, &buf) != 0)
-        /* couldn't stat */
-        isDirectory = JNI_FALSE;
-    else {
-        if(S_ISDIR(buf.st_mode))
-            isDirectory = JNI_TRUE;
-        else
-            isDirectory = JNI_FALSE;
-    }
-
-    (*env)->ReleaseStringUTFChars(env, path, psz_path);
-    return isDirectory;
-}
diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
deleted file mode 100644
index 1ab151c..0000000
--- a/vlc-android/jni/libvlcjni.c
+++ /dev/null
@@ -1,632 +0,0 @@
-/*****************************************************************************
- * libvlcjni.c
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <dirent.h>
-#include <errno.h>
-#include <string.h>
-#include <pthread.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <vlc/vlc.h>
-#include <vlc_common.h>
-#include <vlc_url.h>
-
-#include <jni.h>
-
-#include <android/api-level.h>
-
-#include "libvlcjni.h"
-#include "aout.h"
-#include "vout.h"
-#include "utils.h"
-#include "native_crash_handler.h"
-
-#define VOUT_ANDROID_SURFACE 0
-#define VOUT_OPENGLES2       1
-
-#define LOG_TAG "VLC/JNI/main"
-#include "log.h"
-
-#ifdef HAVE_IOMX_DR
-#define NO_IOMX_DR "--no-omxil-dr"
-#else
-#define NO_IOMX_DR ""
-#endif
-
-#define VLC_JNI_VERSION JNI_VERSION_1_2
-
-#define THREAD_NAME "libvlcjni"
-int jni_attach_thread(JNIEnv **env, const char *thread_name);
-void jni_detach_thread();
-int jni_get_env(JNIEnv **env);
-
-static void add_media_options(libvlc_media_t *p_md, JNIEnv *env, jobjectArray mediaOptions)
-{
-    int stringCount = (*env)->GetArrayLength(env, mediaOptions);
-    for(int i = 0; i < stringCount; i++)
-    {
-        jstring option = (jstring)(*env)->GetObjectArrayElement(env, mediaOptions, i);
-        const char* p_st = (*env)->GetStringUTFChars(env, option, 0);
-        libvlc_media_add_option(p_md, p_st); // option
-        (*env)->ReleaseStringUTFChars(env, option, p_st);
-    }
-}
-
-libvlc_media_t *new_media(jlong instance, JNIEnv *env, jobject thiz, jstring fileLocation, bool noOmx, bool noVideo)
-{
-    libvlc_instance_t *libvlc = (libvlc_instance_t*)(intptr_t)instance;
-    jboolean isCopy;
-    const char *psz_location = (*env)->GetStringUTFChars(env, fileLocation, &isCopy);
-    libvlc_media_t *p_md = libvlc_media_new_location(libvlc, psz_location);
-    (*env)->ReleaseStringUTFChars(env, fileLocation, psz_location);
-    if (!p_md)
-        return NULL;
-
-    jclass cls = (*env)->GetObjectClass(env, thiz);
-    jmethodID methodId = (*env)->GetMethodID(env, cls, "getMediaOptions", "(ZZ)[Ljava/lang/String;");
-    if (methodId != NULL)
-    {
-        jobjectArray mediaOptions = (*env)->CallObjectMethod(env, thiz, methodId, noOmx, noVideo);
-        if (mediaOptions != NULL)
-        {
-            add_media_options(p_md, env, mediaOptions);
-            (*env)->DeleteLocalRef(env, mediaOptions);
-        }
-    }
-    return p_md;
-}
-
-libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz)
-{
-    return (libvlc_media_player_t*)(intptr_t)getLong(env, thiz, "mInternalMediaPlayerInstance");
-}
-
-static void releaseMediaPlayer(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz);
-    if (p_mp)
-    {
-        libvlc_media_player_stop(p_mp);
-        libvlc_media_player_release(p_mp);
-        setLong(env, thiz, "mInternalMediaPlayerInstance", 0);
-    }
-}
-
-/* Pointer to the Java virtual machine
- * Note: It's okay to use a static variable for the VM pointer since there
- * can only be one instance of this shared library in a single VM
- */
-static JavaVM *myVm;
-
-static jobject eventHandlerInstance = NULL;
-
-static void vlc_event_callback(const libvlc_event_t *ev, void *data)
-{
-    JNIEnv *env;
-
-    bool isAttached = false;
-
-    if (eventHandlerInstance == NULL)
-        return;
-
-    if (jni_get_env(&env) < 0) {
-        if (jni_attach_thread(&env, THREAD_NAME) < 0)
-            return;
-        isAttached = true;
-    }
-
-    /* Creating the bundle in C allows us to subscribe to more events
-     * and get better flexibility for each event. For example, we can
-     * have totally different types of data for each event, instead of,
-     * for example, only an integer and/or string.
-     */
-    jclass clsBundle = (*env)->FindClass(env, "android/os/Bundle");
-    jmethodID clsCtor = (*env)->GetMethodID(env, clsBundle, "<init>", "()V" );
-    jobject bundle = (*env)->NewObject(env, clsBundle, clsCtor);
-
-    jmethodID putInt = (*env)->GetMethodID(env, clsBundle, "putInt", "(Ljava/lang/String;I)V" );
-    jmethodID putLong = (*env)->GetMethodID(env, clsBundle, "putLong", "(Ljava/lang/String;J)V" );
-    jmethodID putFloat = (*env)->GetMethodID(env, clsBundle, "putFloat", "(Ljava/lang/String;F)V" );
-    jmethodID putString = (*env)->GetMethodID(env, clsBundle, "putString", "(Ljava/lang/String;Ljava/lang/String;)V" );
-
-    if (ev->type == libvlc_MediaPlayerPositionChanged) {
-        jstring sData = (*env)->NewStringUTF(env, "data");
-        (*env)->CallVoidMethod(env, bundle, putFloat, sData, ev->u.media_player_position_changed.new_position);
-        (*env)->DeleteLocalRef(env, sData);
-    } else if (ev->type == libvlc_MediaPlayerTimeChanged) {
-        jstring sData = (*env)->NewStringUTF(env, "data");
-        (*env)->CallVoidMethod(env, bundle, putLong, sData, ev->u.media_player_time_changed.new_time);
-        (*env)->DeleteLocalRef(env, sData);
-    } else if(ev->type == libvlc_MediaPlayerVout) {
-        /* For determining the vout/ES track change */
-        jstring sData = (*env)->NewStringUTF(env, "data");
-        (*env)->CallVoidMethod(env, bundle, putInt, sData, ev->u.media_player_vout.new_count);
-        (*env)->DeleteLocalRef(env, sData);
-    } else if(ev->type == libvlc_MediaListItemAdded ||
-              ev->type == libvlc_MediaListItemDeleted ) {
-        jstring item_uri = (*env)->NewStringUTF(env, "item_uri");
-        jstring item_index = (*env)->NewStringUTF(env, "item_index");
-        char* mrl = libvlc_media_get_mrl(
-            ev->type == libvlc_MediaListItemAdded ?
-            ev->u.media_list_item_added.item :
-            ev->u.media_list_item_deleted.item
-            );
-        jstring item_uri_value = (*env)->NewStringUTF(env, mrl);
-        jint item_index_value;
-        if(ev->type == libvlc_MediaListItemAdded)
-            item_index_value = ev->u.media_list_item_added.index;
-        else
-            item_index_value = ev->u.media_list_item_deleted.index;
-
-        (*env)->CallVoidMethod(env, bundle, putString, item_uri, item_uri_value);
-        (*env)->CallVoidMethod(env, bundle, putInt, item_index, item_index_value);
-
-        (*env)->DeleteLocalRef(env, item_uri);
-        (*env)->DeleteLocalRef(env, item_uri_value);
-        (*env)->DeleteLocalRef(env, item_index);
-        free(mrl);
-    }
-
-    /* Get the object class */
-    jclass cls = (*env)->GetObjectClass(env, eventHandlerInstance);
-    if (!cls) {
-        LOGE("EventHandler: failed to get class reference");
-        goto end;
-    }
-
-    /* Find the callback ID */
-    jmethodID methodID = (*env)->GetMethodID(env, cls, "callback", "(ILandroid/os/Bundle;)V");
-    if (methodID) {
-        (*env)->CallVoidMethod(env, eventHandlerInstance, methodID, ev->type, bundle);
-    } else {
-        LOGE("EventHandler: failed to get the callback method");
-    }
-
-end:
-    (*env)->DeleteLocalRef(env, bundle);
-    if (isAttached)
-        jni_detach_thread();
-}
-
-jint JNI_OnLoad(JavaVM *vm, void *reserved)
-{
-    // Keep a reference on the Java VM.
-    myVm = vm;
-
-    pthread_mutex_init(&vout_android_lock, NULL);
-    pthread_cond_init(&vout_android_surf_attached, NULL);
-
-    LOGD("JNI interface loaded.");
-    return VLC_JNI_VERSION;
-}
-
-void JNI_OnUnload(JavaVM* vm, void* reserved) {
-    pthread_mutex_destroy(&vout_android_lock);
-    pthread_cond_destroy(&vout_android_surf_attached);
-}
-
-int jni_attach_thread(JNIEnv **env, const char *thread_name)
-{
-    JavaVMAttachArgs args;
-    jint result;
-
-    args.version = VLC_JNI_VERSION;
-    args.name = thread_name;
-    args.group = NULL;
-
-    result = (*myVm)->AttachCurrentThread(myVm, env, &args);
-    return result == JNI_OK ? 0 : -1;
-}
-
-void jni_detach_thread()
-{
-    (*myVm)->DetachCurrentThread(myVm);
-}
-
-int jni_get_env(JNIEnv **env)
-{
-    return (*myVm)->GetEnv(myVm, (void **)env, VLC_JNI_VERSION) == JNI_OK ? 0 : -1;
-}
-
-// FIXME: use atomics
-static bool verbosity;
-
-void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
-{
-    //only use OpenSLES if java side says we can
-    jclass cls = (*env)->GetObjectClass(env, thiz);
-    jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
-    bool use_opensles = (*env)->CallIntMethod(env, thiz, methodId) == AOUT_OPENSLES;
-
-    methodId = (*env)->GetMethodID(env, cls, "getVout", "()I");
-    bool use_opengles2 = (*env)->CallIntMethod(env, thiz, methodId) == VOUT_OPENGLES2;
-
-    methodId = (*env)->GetMethodID(env, cls, "timeStretchingEnabled", "()Z");
-    bool enable_time_stretch = (*env)->CallBooleanMethod(env, thiz, methodId);
-
-    methodId = (*env)->GetMethodID(env, cls, "frameSkipEnabled", "()Z");
-    bool enable_frame_skip = (*env)->CallBooleanMethod(env, thiz, methodId);
-
-    methodId = (*env)->GetMethodID(env, cls, "getDeblocking", "()I");
-    int deblocking = (*env)->CallIntMethod(env, thiz, methodId);
-    char deblockstr[2];
-    snprintf(deblockstr, sizeof(deblockstr), "%d", deblocking);
-    LOGD("Using deblocking level %d", deblocking);
-
-    methodId = (*env)->GetMethodID(env, cls, "getNetworkCaching", "()I");
-    int networkCaching = (*env)->CallIntMethod(env, thiz, methodId);
-    char networkCachingstr[25];
-    if(networkCaching > 0) {
-        snprintf(networkCachingstr, sizeof(networkCachingstr), "--network-caching=%d", networkCaching);
-        LOGD("Using network caching of %d ms", networkCaching);
-    }
-
-    methodId = (*env)->GetMethodID(env, cls, "getHttpReconnect", "()Z");
-    bool enable_http_reconnect = (*env)->CallBooleanMethod(env, thiz, methodId);
-
-    methodId = (*env)->GetMethodID(env, cls, "getChroma", "()Ljava/lang/String;");
-    jstring chroma = (*env)->CallObjectMethod(env, thiz, methodId);
-    const char *chromastr = (*env)->GetStringUTFChars(env, chroma, 0);
-    LOGD("Chroma set to \"%s\"", chromastr);
-
-    methodId = (*env)->GetMethodID(env, cls, "getSubtitlesEncoding", "()Ljava/lang/String;");
-    jstring subsencoding = (*env)->CallObjectMethod(env, thiz, methodId);
-    const char *subsencodingstr = (*env)->GetStringUTFChars(env, subsencoding, 0);
-    LOGD("Subtitle encoding set to \"%s\"", subsencodingstr);
-
-    methodId = (*env)->GetMethodID(env, cls, "isVerboseMode", "()Z");
-    verbosity = (*env)->CallBooleanMethod(env, thiz, methodId);
-
-    methodId = (*env)->GetMethodID(env, cls, "isDirectRendering", "()Z");
-    bool direct_rendering = (*env)->CallBooleanMethod(env, thiz, methodId);
-    /* With the MediaCodec opaque mode we cannot use the OpenGL ES vout. */
-    if (direct_rendering)
-        use_opengles2 = false;
-
-    methodId = (*env)->GetMethodID(env, cls, "getCachePath", "()Ljava/lang/String;");
-    jstring cachePath = (*env)->CallObjectMethod(env, thiz, methodId);
-    if (cachePath) {
-        const char *cache_path = (*env)->GetStringUTFChars(env, cachePath, 0);
-        setenv("DVDCSS_CACHE", cache_path, 1);
-        (*env)->ReleaseStringUTFChars(env, cachePath, cache_path);
-    }
-
-    /* Don't add any invalid options, otherwise it causes LibVLC to crash */
-    const char *argv[] = {
-        /* CPU intensive plugin, setting for slow devices */
-        enable_time_stretch ? "--audio-time-stretch" : "--no-audio-time-stretch",
-
-        /* avcodec speed settings for slow devices */
-        //"--avcodec-fast", // non-spec-compliant speedup tricks
-        "--avcodec-skiploopfilter", deblockstr,
-        "--avcodec-skip-frame", enable_frame_skip ? "2" : "0",
-        "--avcodec-skip-idct", enable_frame_skip ? "2" : "0",
-
-        /* Remove me when UTF-8 is enforced by law */
-        "--subsdec-encoding", subsencodingstr,
-
-        /* Enable statistics */
-        "--stats",
-
-        /* XXX: why can't the default be fine ? #7792 */
-        (networkCaching > 0) ? networkCachingstr : "",
-
-        /* Android audio API is a mess */
-        use_opensles ? "--aout=opensles" : "--aout=android_audiotrack",
-
-        /* Android video API is a mess */
-        use_opengles2 ? "--vout=gles2" : "--vout=androidsurface",
-        "--androidsurface-chroma", chromastr != NULL && chromastr[0] != 0 ? chromastr : "RV32",
-        /* XXX: we can't recover from direct rendering failure */
-        direct_rendering ? "" : "--no-mediacodec-dr",
-        direct_rendering ? "" : NO_IOMX_DR,
-
-        /* Reconnect on lost HTTP streams, e.g. network change */
-        enable_http_reconnect ? "--http-reconnect" : "",
-    };
-    libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
-
-    setLong(env, thiz, "mLibVlcInstance", (jlong)(intptr_t) instance);
-
-    (*env)->ReleaseStringUTFChars(env, chroma, chromastr);
-    (*env)->ReleaseStringUTFChars(env, subsencoding, subsencodingstr);
-
-    if (!instance)
-    {
-        jclass exc = (*env)->FindClass(env, "org/videolan/libvlc/LibVlcException");
-        (*env)->ThrowNew(env, exc, "Unable to instantiate LibVLC");
-    }
-
-    LOGI("LibVLC initialized: %p", instance);
-
-    libvlc_log_set(instance, debug_log, &verbosity);
-
-    init_native_crash_handler(env, thiz);
-}
-
-void Java_org_videolan_libvlc_LibVLC_nativeDestroy(JNIEnv *env, jobject thiz)
-{
-    destroy_native_crash_handler(env);
-
-    releaseMediaPlayer(env, thiz);
-    jlong libVlcInstance = getLong(env, thiz, "mLibVlcInstance");
-    if (!libVlcInstance)
-        return; // Already destroyed
-
-    libvlc_instance_t *instance = (libvlc_instance_t*)(intptr_t) libVlcInstance;
-    libvlc_log_unset(instance);
-    libvlc_release(instance);
-
-    setLong(env, thiz, "mLibVlcInstance", 0);
-}
-
-void Java_org_videolan_libvlc_LibVLC_detachEventHandler(JNIEnv *env, jobject thiz)
-{
-    if (eventHandlerInstance != NULL) {
-        (*env)->DeleteGlobalRef(env, eventHandlerInstance);
-        eventHandlerInstance = NULL;
-    }
-}
-
-void Java_org_videolan_libvlc_LibVLC_setEventHandler(JNIEnv *env, jobject thiz, jobject eventHandler)
-{
-    if (eventHandlerInstance != NULL) {
-        (*env)->DeleteGlobalRef(env, eventHandlerInstance);
-        eventHandlerInstance = NULL;
-    }
-
-    eventHandlerInstance = getEventHandlerReference(env, thiz, eventHandler);
-}
-
-void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz, jlong instance,
-                                             jstring mrl, jobjectArray mediaOptions)
-{
-    /* Release previous media player, if any */
-    releaseMediaPlayer(env, thiz);
-
-    /* Create a media player playing environment */
-    libvlc_media_player_t *mp = libvlc_media_player_new((libvlc_instance_t*)(intptr_t)instance);
-    libvlc_media_player_set_video_title_display(mp, libvlc_position_disable, 0);
-    jobject myJavaLibVLC = (*env)->NewGlobalRef(env, thiz);
-
-    //if AOUT_AUDIOTRACK_JAVA, we use amem
-    jclass cls = (*env)->GetObjectClass(env, thiz);
-    jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
-    if ( (*env)->CallIntMethod(env, thiz, methodId) == AOUT_AUDIOTRACK_JAVA )
-    {
-        libvlc_audio_set_callbacks(mp, aout_play, aout_pause, NULL, NULL, NULL,
-                                   (void*) myJavaLibVLC);
-        libvlc_audio_set_format_callbacks(mp, aout_open, aout_close);
-    }
-
-    /* Connect the event manager */
-    libvlc_event_manager_t *ev = libvlc_media_player_event_manager(mp);
-    static const libvlc_event_type_t mp_events[] = {
-        libvlc_MediaPlayerPlaying,
-        libvlc_MediaPlayerPaused,
-        libvlc_MediaPlayerEndReached,
-        libvlc_MediaPlayerStopped,
-        libvlc_MediaPlayerVout,
-        libvlc_MediaPlayerPositionChanged,
-        libvlc_MediaPlayerTimeChanged,
-        libvlc_MediaPlayerEncounteredError
-    };
-    for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++)
-        libvlc_event_attach(ev, mp_events[i], vlc_event_callback, myVm);
-
-    /* Keep a pointer to this media player */
-    setLong(env, thiz, "mInternalMediaPlayerInstance", (jlong)(intptr_t)mp);
-
-    cls = (*env)->GetObjectClass(env, thiz);
-    jmethodID methodID = (*env)->GetMethodID(env, cls, "applyEqualizer", "()V");
-    (*env)->CallVoidMethod(env, thiz, methodID);
-
-    const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, 0);
-
-    libvlc_media_t* p_md = libvlc_media_new_location((libvlc_instance_t*)(intptr_t)instance, p_mrl);
-    /* media options */
-    if (mediaOptions != NULL)
-        add_media_options(p_md, env, mediaOptions);
-
-    (*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
-
-    /* Connect the media event manager. */
-    libvlc_event_manager_t *ev_media = libvlc_media_event_manager(p_md);
-    static const libvlc_event_type_t mp_media_events[] = {
-        libvlc_MediaParsedChanged
-    };
-    for(int i = 0; i < (sizeof(mp_media_events) / sizeof(*mp_media_events)); i++)
-        libvlc_event_attach(ev_media, mp_media_events[i], vlc_event_callback, myVm);
-
-    libvlc_media_player_set_media(mp, p_md);
-    libvlc_media_player_play(mp);
-}
-
-jfloat Java_org_videolan_libvlc_LibVLC_getRate(JNIEnv *env, jobject thiz) {
-    libvlc_media_player_t* mp = getMediaPlayer(env, thiz);
-    if(mp)
-        return libvlc_media_player_get_rate(mp);
-    else
-        return 1.00;
-}
-
-void Java_org_videolan_libvlc_LibVLC_setRate(JNIEnv *env, jobject thiz, jfloat rate) {
-    libvlc_media_player_t* mp = getMediaPlayer(env, thiz);
-    if(mp)
-        libvlc_media_player_set_rate(mp, rate);
-}
-
-jboolean Java_org_videolan_libvlc_LibVLC_isPlaying(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return !!libvlc_media_player_is_playing(mp);
-    else
-        return 0;
-}
-
-jboolean Java_org_videolan_libvlc_LibVLC_isSeekable(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return !!libvlc_media_player_is_seekable(mp);
-    return 0;
-}
-
-void Java_org_videolan_libvlc_LibVLC_play(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        libvlc_media_player_play(mp);
-}
-
-void Java_org_videolan_libvlc_LibVLC_pause(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        libvlc_media_player_pause(mp);
-}
-
-void Java_org_videolan_libvlc_LibVLC_stop(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        libvlc_media_player_stop(mp);
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getPlayerState(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return (jint) libvlc_media_player_get_state(mp);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getVolume(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return (jint) libvlc_audio_get_volume(mp);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_setVolume(JNIEnv *env, jobject thiz, jint volume)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        //Returns 0 if the volume was set, -1 if it was out of range or error
-        return (jint) libvlc_audio_set_volume(mp, (int) volume);
-    return -1;
-}
-
-jlong Java_org_videolan_libvlc_LibVLC_getTime(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_media_player_get_time(mp);
-    return -1;
-}
-
-void Java_org_videolan_libvlc_LibVLC_setTime(JNIEnv *env, jobject thiz, jlong time)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        libvlc_media_player_set_time(mp, time);
-}
-
-jfloat Java_org_videolan_libvlc_LibVLC_getPosition(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return (jfloat) libvlc_media_player_get_position(mp);
-    return -1;
-}
-
-void Java_org_videolan_libvlc_LibVLC_setPosition(JNIEnv *env, jobject thiz, jfloat pos)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        libvlc_media_player_set_position(mp, pos);
-}
-
-jlong Java_org_videolan_libvlc_LibVLC_getLength(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return (jlong) libvlc_media_player_get_length(mp);
-    return -1;
-}
-
-jstring Java_org_videolan_libvlc_LibVLC_version(JNIEnv* env, jobject thiz)
-{
-    return (*env)->NewStringUTF(env, libvlc_get_version());
-}
-
-jstring Java_org_videolan_libvlc_LibVLC_compiler(JNIEnv* env, jobject thiz)
-{
-    return (*env)->NewStringUTF(env, libvlc_get_compiler());
-}
-
-jstring Java_org_videolan_libvlc_LibVLC_changeset(JNIEnv* env, jobject thiz)
-{
-    return (*env)->NewStringUTF(env, libvlc_get_changeset());
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getTitle(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_media_player_get_title(mp);
-    return -1;
-}
-
-void Java_org_videolan_libvlc_LibVLC_setTitle(JNIEnv *env, jobject thiz, jint title)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        libvlc_media_player_set_title(mp, title);
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getChapterCountForTitle(JNIEnv *env, jobject thiz, jint title)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_media_player_get_chapter_count_for_title(mp, title);
-    return -1;
-}
-
-jint Java_org_videolan_libvlc_LibVLC_getTitleCount(JNIEnv *env, jobject thiz)
-{
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        return libvlc_media_player_get_title_count(mp);
-    return -1;
-}
-
-void Java_org_videolan_libvlc_LibVLC_playerNavigate(JNIEnv *env, jobject thiz, jint navigate)
-{
-    unsigned nav = navigate;
-    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
-    if (mp)
-        libvlc_media_player_navigate(mp, (unsigned) nav);
-}
-
diff --git a/vlc-android/jni/log.h b/vlc-android/jni/log.h
deleted file mode 100644
index b595b34..0000000
--- a/vlc-android/jni/log.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************
- * log.h
- *****************************************************************************
- * Copyright © 2011-2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLCJNI_LOG_H
-#define LIBVLCJNI_LOG_H
-
-#include <android/log.h>
-
-/* C files should define LOG_TAG before including this header */
-#ifndef LOG_TAG
-# error You must define LOG_TAG
-#endif
-
-#ifndef NDEBUG
-# define LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
-# define LOGV(...)  __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
-#else
-# define LOGD(...)  (void)0
-# define LOGV(...)  (void)0
-#endif
-#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
-#define  LOGW(...)  __android_log_print(ANDROID_LOG_WARNING,LOG_TAG,__VA_ARGS__)
-
-#endif // LIBVLCJNI_LOG_H
diff --git a/vlc-android/jni/native_crash_handler.c b/vlc-android/jni/native_crash_handler.c
deleted file mode 100644
index 2cb1590..0000000
--- a/vlc-android/jni/native_crash_handler.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*****************************************************************************
- * native_crash_handler.c
- *****************************************************************************
- * Copyright © 2010-2014 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <signal.h>
-
-#include "native_crash_handler.h"
-
-static struct sigaction old_actions[NSIG];
-static jobject j_libVLC;
-
-#define THREAD_NAME "native_crash_handler"
-extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
-extern void jni_detach_thread();
-
-// Monitored signals.
-static const int monitored_signals[] = {
-    SIGILL,
-    SIGABRT,
-    SIGBUS,
-    SIGFPE,
-    SIGSEGV,
-#ifndef _MIPS_ARCH
-    SIGSTKFLT,
-#else
-    SIGEMT,
-#endif
-    SIGPIPE
-};
-
-
-/**
- * Callback called when a monitored signal is triggered.
- */
-void sigaction_callback(int signal, siginfo_t *info, void *reserved)
-{
-    // Call the Java LibVLC method that handle the crash.
-    JNIEnv *env;
-    jni_attach_thread(&env, THREAD_NAME);
-
-    jclass cls = (*env)->GetObjectClass(env, j_libVLC);
-    jmethodID methodId = (*env)->GetMethodID(env, cls, "onNativeCrash", "()V");
-    (*env)->CallVoidMethod(env, j_libVLC, methodId);
-
-    (*env)->DeleteLocalRef(env, cls);
-    jni_detach_thread();
-
-    // Call the old signal handler.
-    old_actions[signal].sa_handler(signal);
-}
-
-
-void init_native_crash_handler(JNIEnv *env, jobject j_libVLC_local)
-{
-    j_libVLC = (*env)->NewGlobalRef(env, j_libVLC_local);
-    struct sigaction handler;
-    memset(&handler, 0, sizeof(struct sigaction));
-
-    handler.sa_sigaction = sigaction_callback;
-    handler.sa_flags = SA_RESETHAND;
-
-    // Install the signal handlers and save their old actions.
-    for (unsigned i = 0; i < sizeof(monitored_signals) / sizeof(int); ++i)
-    {
-        const int s = monitored_signals[i];
-        sigaction(s, &handler, &old_actions[s]);
-    }
-}
-
-
-void destroy_native_crash_handler(JNIEnv *env)
-{
-    // Uninstall the signal handlers and restore their old actions.
-    for (unsigned i = 0; i < sizeof(monitored_signals) / sizeof(int); ++i)
-    {
-        const int s = monitored_signals[i];
-        sigaction(s, &old_actions[s], NULL);
-    }
-
-    (*env)->DeleteGlobalRef(env, j_libVLC);
-}
diff --git a/vlc-android/jni/native_crash_handler.h b/vlc-android/jni/native_crash_handler.h
deleted file mode 100644
index a57e61e..0000000
--- a/vlc-android/jni/native_crash_handler.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*****************************************************************************
- * native_crash_handler.h
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLCJNI_NATIVE_CRASH_HANDLER_H
-#define LIBVLCJNI_NATIVE_CRASH_HANDLER_H
-
-#include <jni.h>
-
-void init_native_crash_handler(JNIEnv *env, jobject j_libVLC_local);
-void destroy_native_crash_handler(JNIEnv *env);
-
-#endif // LIBVLCJNI_NATIVE_CRASH_HANDLER_H
diff --git a/vlc-android/jni/pipe2.c b/vlc-android/jni/pipe2.c
deleted file mode 100644
index 218eb50..0000000
--- a/vlc-android/jni/pipe2.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * misc.c
- *****************************************************************************
- * Copyright © 2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <sys/linux-syscalls.h>
-
-//#include <sys/syscall.h>
-int syscall(int number, ...);
-
-/* Needed for android < 2.3 */
-int pipe2(int fds[2], int flags)
-{
-    return syscall(__NR_pipe2, fds, flags);
-}
diff --git a/vlc-android/jni/pthread-condattr.c b/vlc-android/jni/pthread-condattr.c
deleted file mode 100644
index 1a4d657..0000000
--- a/vlc-android/jni/pthread-condattr.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <errno.h>
-
-int pthread_condattr_init(pthread_condattr_t *attr)
-{
-    if (attr == NULL)
-        return EINVAL;
-
-    *attr = PTHREAD_PROCESS_PRIVATE;
-    return 0;
-}
-
-int pthread_condattr_destroy(pthread_condattr_t *attr)
-{
-    if (attr == NULL)
-        return EINVAL;
-
-    *attr = 0xdeada11d;
-    return 0;
-}
-
-int pthread_condattr_getpshared(pthread_condattr_t *attr, int *pshared)
-{
-    if (attr == NULL || pshared == NULL)
-        return EINVAL;
-
-    *pshared = *attr;
-    return 0;
-}
-
-int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
-{
-    if (attr == NULL)
-        return EINVAL;
-
-    if (pshared != PTHREAD_PROCESS_SHARED &&
-        pshared != PTHREAD_PROCESS_PRIVATE)
-        return EINVAL;
-
-    *attr = pshared;
-    return 0;
-}
diff --git a/vlc-android/jni/pthread-once.c b/vlc-android/jni/pthread-once.c
deleted file mode 100644
index 9c2cffb..0000000
--- a/vlc-android/jni/pthread-once.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <errno.h>
-#include <pthread.h>
-#include <unistd.h>
-
-#if defined(__arm__)
-/* The file only exists for ARM, for now */
-#include <machine/cpu-features.h>
-#endif
-
-/* Adapted from bionic_atomic_inline.h */
-static inline void ANDROID_MEMBAR_FULL(void) {
-#if defined(__arm__) && __ARM_ARCH__ >= 7
-    __asm__ __volatile__ ("dmb" ::: "memory");
-#elif defined(__arm__) && __ARM_ARCH__ == 6
-    /*
-     * See "Accessing the Data Memory Barrier operation" :
-     * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211i/I1014942.html
-     *
-     * From: https://casper.berkeley.edu/svn/trunk/roach/sw/linux/include/asm-arm/system.h
-     */
-    __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" :: "r" (0) : "memory");
-#elif (defined(__i386__) || defined(__x86_64__)) && defined(__SSE2__)
-    __asm__ __volatile__ ("mfence" ::: "memory");
-#else
-    /*
-     * Implementation not defined for this platform.  Hopefully we're building
-     * in uniprocessor mode.
-     *
-     * For example: MIPS, PowerPC, ARMv5, etc
-     */
-    __asm__ __volatile__ ("" ::: "memory");
-#endif
-}
-
-/* NOTE: this implementation doesn't support a init function that throws a C++ exception
- *       or calls fork()
- */
-int pthread_once( pthread_once_t*  once_control,  void (*init_routine)(void) )
-{
-    if( once_control == NULL || init_routine == NULL )
-        return EINVAL;
-    static pthread_mutex_t   once_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
-    volatile pthread_once_t* ocptr = once_control;
-
-    pthread_once_t tmp = *ocptr;
-    ANDROID_MEMBAR_FULL();
-    if (tmp == PTHREAD_ONCE_INIT) {
-        pthread_mutex_lock( &once_lock );
-        if (*ocptr == PTHREAD_ONCE_INIT) {
-            (*init_routine)();
-            ANDROID_MEMBAR_FULL();
-            *ocptr = ~PTHREAD_ONCE_INIT;
-        }
-        pthread_mutex_unlock( &once_lock );
-    }
-    return 0;
-}
diff --git a/vlc-android/jni/pthread-rwlocks.c b/vlc-android/jni/pthread-rwlocks.c
deleted file mode 100644
index 0ce0da7..0000000
--- a/vlc-android/jni/pthread-rwlocks.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <pthread.h>
-
-/* Technical note:
- *
- * Possible states of a read/write lock:
- *
- *  - no readers and no writer (unlocked)
- *  - one or more readers sharing the lock at the same time (read-locked)
- *  - one writer holding the lock (write-lock)
- *
- * Additionally:
- *  - trying to get the write-lock while there are any readers blocks
- *  - trying to get the read-lock while there is a writer blocks
- *  - a single thread can acquire the lock multiple times in the same mode
- *
- *  - Posix states that behaviour is undefined it a thread tries to acquire
- *    the lock in two distinct modes (e.g. write after read, or read after write).
- *
- *  - This implementation tries to avoid writer starvation by making the readers
- *    block as soon as there is a waiting writer on the lock. However, it cannot
- *    completely eliminate it: each time the lock is unlocked, all waiting threads
- *    are woken and battle for it, which one gets it depends on the kernel scheduler
- *    and is semi-random.
- *
- */
-
-#define  __likely(cond)    __builtin_expect(!!(cond), 1)
-#define  __unlikely(cond)  __builtin_expect(!!(cond), 0)
-
-#define  RWLOCKATTR_DEFAULT     0
-#define  RWLOCKATTR_SHARED_MASK 0x0010
-
-static int __get_thread_id(void)
-{
-#ifdef __LP64__
-#error "Don't build pthread fallbacks for 64-bit; use the proper functions"
-#else
-    return pthread_self();
-#endif
-}
-
-int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
-{
-    if (!attr)
-        return EINVAL;
-
-    *attr = PTHREAD_PROCESS_PRIVATE;
-    return 0;
-}
-
-int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
-{
-    if (!attr)
-        return EINVAL;
-
-    *attr = -1;
-    return 0;
-}
-
-int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int  pshared)
-{
-    if (!attr)
-        return EINVAL;
-
-    switch (pshared) {
-    case PTHREAD_PROCESS_PRIVATE:
-    case PTHREAD_PROCESS_SHARED:
-        *attr = pshared;
-        return 0;
-    default:
-        return EINVAL;
-    }
-}
-
-int pthread_rwlockattr_getpshared(pthread_rwlockattr_t *attr, int *pshared)
-{
-    if (!attr || !pshared)
-        return EINVAL;
-
-    *pshared = *attr;
-    return 0;
-}
-
-int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
-{
-    pthread_mutexattr_t*  lock_attr = NULL;
-    pthread_condattr_t*   cond_attr = NULL;
-    pthread_mutexattr_t   lock_attr0;
-    pthread_condattr_t    cond_attr0;
-    int                   ret;
-
-    if (rwlock == NULL)
-        return EINVAL;
-
-    if (attr && *attr == PTHREAD_PROCESS_SHARED) {
-        lock_attr = &lock_attr0;
-        pthread_mutexattr_init(lock_attr);
-        pthread_mutexattr_setpshared(lock_attr, PTHREAD_PROCESS_SHARED);
-
-        cond_attr = &cond_attr0;
-        pthread_condattr_init(cond_attr);
-        pthread_condattr_setpshared(cond_attr, PTHREAD_PROCESS_SHARED);
-    }
-
-    ret = pthread_mutex_init(&rwlock->lock, lock_attr);
-    if (ret != 0)
-        return ret;
-
-    ret = pthread_cond_init(&rwlock->cond, cond_attr);
-    if (ret != 0) {
-        pthread_mutex_destroy(&rwlock->lock);
-        return ret;
-    }
-
-    rwlock->numLocks = 0;
-    rwlock->pendingReaders = 0;
-    rwlock->pendingWriters = 0;
-    rwlock->writerThreadId = 0;
-
-    return 0;
-}
-
-int pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
-{
-    int  ret;
-
-    if (rwlock == NULL)
-        return EINVAL;
-
-    if (rwlock->numLocks > 0)
-        return EBUSY;
-
-    pthread_cond_destroy(&rwlock->cond);
-    pthread_mutex_destroy(&rwlock->lock);
-    return 0;
-}
-
-/* Returns TRUE iff we can acquire a read lock. */
-static __inline__ int read_precondition(pthread_rwlock_t *rwlock, int  thread_id)
-{
-    /* We can't have the lock if any writer is waiting for it (writer bias).
-     * This tries to avoid starvation when there are multiple readers racing.
-     */
-    if (rwlock->pendingWriters > 0)
-        return 0;
-
-    /* We can have the lock if there is no writer, or if we write-own it */
-    /* The second test avoids a self-dead lock in case of buggy code. */
-    if (rwlock->writerThreadId == 0 || rwlock->writerThreadId == thread_id)
-        return 1;
-
-    /* Otherwise, we can't have it */
-    return 0;
-}
-
-/* returns TRUE iff we can acquire a write lock. */
-static __inline__ int write_precondition(pthread_rwlock_t *rwlock, int  thread_id)
-{
-    /* We can get the lock if nobody has it */
-    if (rwlock->numLocks == 0)
-        return 1;
-
-    /* Or if we already own it */
-    if (rwlock->writerThreadId == thread_id)
-        return 1;
-
-    /* Otherwise, not */
-    return 0;
-}
-
-/* This function is used to waken any waiting thread contending
- * for the lock. One of them should be able to grab it after
- * that.
- */
-static void _pthread_rwlock_pulse(pthread_rwlock_t *rwlock)
-{
-    if (rwlock->pendingReaders > 0 || rwlock->pendingWriters > 0)
-        pthread_cond_broadcast(&rwlock->cond);
-}
-
-
-int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
-{
-    return pthread_rwlock_timedrdlock(rwlock, NULL);
-}
-
-int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
-{
-    int ret = 0;
-
-    if (rwlock == NULL)
-        return EINVAL;
-
-    pthread_mutex_lock(&rwlock->lock);
-    if (__unlikely(!read_precondition(rwlock, __get_thread_id())))
-        ret = EBUSY;
-    else
-        rwlock->numLocks ++;
-    pthread_mutex_unlock(&rwlock->lock);
-
-    return ret;
-}
-
-int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout)
-{
-    int thread_id, ret = 0;
-
-    if (rwlock == NULL)
-        return EINVAL;
-
-    pthread_mutex_lock(&rwlock->lock);
-    thread_id = __get_thread_id();
-    if (__unlikely(!read_precondition(rwlock, thread_id))) {
-        rwlock->pendingReaders += 1;
-        do {
-            ret = pthread_cond_timedwait(&rwlock->cond, &rwlock->lock, abs_timeout);
-        } while (ret == 0 && !read_precondition(rwlock, thread_id));
-        rwlock->pendingReaders -= 1;
-        if (ret != 0)
-            goto EXIT;
-    }
-    rwlock->numLocks ++;
-EXIT:
-    pthread_mutex_unlock(&rwlock->lock);
-    return ret;
-}
-
-
-int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
-{
-    return pthread_rwlock_timedwrlock(rwlock, NULL);
-}
-
-int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
-{
-    int thread_id, ret = 0;
-
-    if (rwlock == NULL)
-        return EINVAL;
-
-    pthread_mutex_lock(&rwlock->lock);
-    thread_id = __get_thread_id();
-    if (__unlikely(!write_precondition(rwlock, thread_id))) {
-        ret = EBUSY;
-    } else {
-        rwlock->numLocks ++;
-        rwlock->writerThreadId = thread_id;
-    }
-    pthread_mutex_unlock(&rwlock->lock);
-    return ret;
-}
-
-int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout)
-{
-    int thread_id, ret = 0;
-
-    if (rwlock == NULL)
-        return EINVAL;
-
-    pthread_mutex_lock(&rwlock->lock);
-    thread_id = __get_thread_id();
-    if (__unlikely(!write_precondition(rwlock, thread_id))) {
-        /* If we can't read yet, wait until the rwlock is unlocked
-         * and try again. Increment pendingReaders to get the
-         * cond broadcast when that happens.
-         */
-        rwlock->pendingWriters += 1;
-        do {
-            ret = pthread_cond_timedwait(&rwlock->cond, &rwlock->lock, abs_timeout);
-        } while (ret == 0 && !write_precondition(rwlock, thread_id));
-        rwlock->pendingWriters -= 1;
-        if (ret != 0)
-            goto EXIT;
-    }
-    rwlock->numLocks ++;
-    rwlock->writerThreadId = thread_id;
-EXIT:
-    pthread_mutex_unlock(&rwlock->lock);
-    return ret;
-}
-
-
-int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
-{
-    int  ret = 0;
-
-    if (rwlock == NULL)
-        return EINVAL;
-
-    pthread_mutex_lock(&rwlock->lock);
-
-    /* The lock must be held */
-    if (rwlock->numLocks == 0) {
-        ret = EPERM;
-        goto EXIT;
-    }
-
-    /* If it has only readers, writerThreadId is 0 */
-    if (rwlock->writerThreadId == 0) {
-        if (--rwlock->numLocks == 0)
-            _pthread_rwlock_pulse(rwlock);
-    }
-    /* Otherwise, it has only a single writer, which
-     * must be ourselves.
-     */
-    else {
-        if (rwlock->writerThreadId != __get_thread_id()) {
-            ret = EPERM;
-            goto EXIT;
-        }
-        if (--rwlock->numLocks == 0) {
-            rwlock->writerThreadId = 0;
-            _pthread_rwlock_pulse(rwlock);
-        }
-    }
-EXIT:
-    pthread_mutex_unlock(&rwlock->lock);
-    return ret;
-}
diff --git a/vlc-android/jni/sem.c b/vlc-android/jni/sem.c
deleted file mode 100644
index 244ccab..0000000
--- a/vlc-android/jni/sem.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <semaphore.h>
-#include <errno.h>
-#include <stddef.h>
-
-#define SEMCOUNT_VALUE_SHIFT      1
-/* convert a sem->count bit pattern into the corresponding signed value */
-#define SEMCOUNT_TO_VALUE(sval)  ((int)(sval) >> SEMCOUNT_VALUE_SHIFT)
-
-int sem_destroy(sem_t *sem)
-{
-    int count;
-
-    if (sem == NULL) {
-        errno = EINVAL;
-        return -1;
-    }
-    count = SEMCOUNT_TO_VALUE(sem->count);
-    if (count < 0) {
-        errno = EBUSY;
-        return -1;
-    }
-    sem->count = 0;
-    return 0;
-}
diff --git a/vlc-android/jni/thumbnailer.c b/vlc-android/jni/thumbnailer.c
deleted file mode 100644
index 2a95d21..0000000
--- a/vlc-android/jni/thumbnailer.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*****************************************************************************
- * thumbnailer.c
- *****************************************************************************
- * Copyright © 2011-2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <assert.h>
-#include <jni.h>
-#include <vlc/vlc.h>
-#include <pthread.h>
-#include <stdbool.h>
-#include <time.h>
-#include <errno.h>
-#include <unistd.h>
-
-#define LOG_TAG "VLC/JNI/thumbnailer"
-#include "log.h"
-
-#include "utils.h"
-
-#define THUMBNAIL_POSITION 0.5
-#define PIXEL_SIZE 4 /* RGBA */
-#define THUMBNAIL_MIN_WIDTH 32
-#define THUMBNAIL_MAX_WIDTH 4096
-#define THUMBNAIL_MIN_HEIGHT 32
-#define THUMBNAIL_MAX_HEIGHT 2304
-
-
-/*
-   Frame is:   thumbnail + black borders
-   frameData = frameWidth * frameHeight (values given by Java UI)
-
-   ┌————————————————————————————————————————————————————┐
-   │                                                    │
-   │                 Black Borders                      │
-   │                                                    │
-   ├————————————————————————————————————————————————————┤
-   │                                                    │
-   │                 Thumbnail Data                     │
-   │                                                    │
-   │             thumbHeight x thumbWidth               │
-   │             thumbPitch = thumbWidth * 4            │
-   │                                                    │
-   ├————————————————————————————————————————————————————┤
-   │                                                    │
-   │                                                    │
-   │                                                    │
-   └————————————————————————————————————————————————————┘
-*/
-
-enum {
-    THUMB_SEEKING,
-    THUMB_SEEKED,
-    THUMB_DROP_FIRST_FRAME,
-    THUMB_DONE,
-};
-
-typedef struct
-{
-    int state;
-
-    char *thumbData;
-    char *frameData;
-
-    unsigned blackBorders;
-    unsigned frameWidth;
-    unsigned thumbHeight;
-    unsigned thumbPitch;
-
-    pthread_mutex_t doneMutex;
-    pthread_cond_t doneCondVar;
-} thumbnailer_sys_t;
-
-
-/**
- * Thumbnailer vout lock
- **/
-static void *thumbnailer_lock(void *opaque, void **pixels)
-{
-    thumbnailer_sys_t *sys = opaque;
-    *pixels = sys->thumbData;
-    return NULL;
-}
-
-
-/**
- * Thumbnailer vout unlock
- **/
-static void thumbnailer_unlock(void *opaque, void *picture, void *const *pixels)
-{
-    thumbnailer_sys_t *sys = opaque;
-
-    /* If we have already received a thumbnail, or we are still seeking,
-     * we skip this frame. */
-    pthread_mutex_lock(&sys->doneMutex);
-    int state = sys->state;
-    if (state == THUMB_SEEKED)
-        sys->state = THUMB_DROP_FIRST_FRAME;
-    pthread_mutex_unlock(&sys->doneMutex);
-    if (state != THUMB_DROP_FIRST_FRAME)
-        return;
-
-    /* we have received our first thumbnail and we can exit. */
-    const char *dataSrc = sys->thumbData;
-    char *dataDest = sys->frameData + sys->blackBorders * PIXEL_SIZE;
-
-    /* Copy the thumbnail. */
-    for (unsigned i = 0; i < sys->thumbHeight; ++i)
-    {
-        memcpy(dataDest, dataSrc, sys->thumbPitch);
-        dataDest += sys->frameWidth * PIXEL_SIZE;
-        dataSrc += sys->thumbPitch;
-    }
-
-    /* Signal that the thumbnail was created. */
-    pthread_mutex_lock(&sys->doneMutex);
-    sys->state = THUMB_DONE;
-    pthread_cond_signal(&sys->doneCondVar);
-    pthread_mutex_unlock(&sys->doneMutex);
-}
-
-
-/**
- * Thumbnailer main function.
- * return null if the thumbail generation failed.
- **/
-jbyteArray Java_org_videolan_libvlc_LibVLC_getThumbnail(JNIEnv *env, jobject thiz,
-                                                        jlong instance, jstring filePath,
-                                                        const jint frameWidth, const jint frameHeight)
-{
-    libvlc_instance_t *libvlc = (libvlc_instance_t *)(intptr_t)instance;
-    jbyteArray byteArray = NULL;
-
-    /* Create the thumbnailer data structure */
-    thumbnailer_sys_t *sys = calloc(1, sizeof(thumbnailer_sys_t));
-    if (sys == NULL)
-    {
-        LOGE("Could not create the thumbnailer data structure!");
-        goto enomem;
-    }
-
-    /* Initialize the barrier. */
-    pthread_mutex_init(&sys->doneMutex, NULL);
-    pthread_cond_init(&sys->doneCondVar, NULL);
-
-    /* Create a media player playing environment */
-    libvlc_media_player_t *mp = libvlc_media_player_new(libvlc);
-    libvlc_media_player_set_video_title_display(mp, libvlc_position_disable, 0);
-
-    libvlc_media_t *m = new_media(instance, env, thiz, filePath, true, false);
-    if (m == NULL)
-    {
-        LOGE("Could not create the media to play!");
-        goto end;
-    }
-
-    /* Fast and no options */
-    libvlc_media_add_option( m, ":no-audio" );
-    libvlc_media_add_option( m, ":no-spu" );
-    libvlc_media_add_option( m, ":no-osd" );
-
-    libvlc_media_player_set_media(mp, m);
-
-    /* Get the size of the video with the tracks information of the media. */
-    libvlc_media_track_t **tracks;
-    libvlc_media_parse(m);
-    int nbTracks = libvlc_media_tracks_get(m, &tracks);
-    libvlc_media_release(m);
-
-    /* Parse the results */
-    unsigned videoWidth = 0, videoHeight = 0;
-    bool hasVideoTrack = false;
-    for (unsigned i = 0; i < nbTracks; ++i)
-        if (tracks[i]->i_type == libvlc_track_video)
-        {
-            videoWidth = tracks[i]->video->i_width;
-            videoHeight = tracks[i]->video->i_height;
-            hasVideoTrack = true;
-            break;
-        }
-
-    libvlc_media_tracks_release(tracks, nbTracks);
-
-    /* Abort if we have not found a video track. */
-    if (!hasVideoTrack)
-    {
-        LOGE("Could not find any video track in this file.\n");
-        goto end;
-    }
-
-    LOGD("Video dimensions: %ix%i.\n", videoWidth, videoHeight );
-
-    /* VLC could not tell us the size */
-    if( videoWidth == 0 || videoHeight == 0 )
-    {
-        LOGE("Could not find the video dimensions.\n");
-        goto end;
-    }
-
-    if( videoWidth < THUMBNAIL_MIN_WIDTH || videoHeight < THUMBNAIL_MIN_HEIGHT
-        || videoWidth > THUMBNAIL_MAX_WIDTH || videoHeight > THUMBNAIL_MAX_HEIGHT )
-    {
-        LOGE("Wrong video dimensions.\n");
-        goto end;
-    }
-
-    /* Compute the size parameters of the frame to generate. */
-    unsigned thumbWidth  = frameWidth;
-    unsigned thumbHeight = frameHeight;
-    const float inputAR = (float)videoWidth / videoHeight;
-    const float screenAR = (float)frameWidth / frameHeight;
-
-    /* Most of the cases, video is wider than tall */
-    if (screenAR < inputAR)
-    {
-        thumbHeight = (float)frameWidth / inputAR + 1;
-        sys->blackBorders = ( (frameHeight - thumbHeight) / 2 ) * frameWidth;
-    }
-    else
-    {
-        LOGD("Weird aspect Ratio.\n");
-        thumbWidth = (float)frameHeight * inputAR;
-        sys->blackBorders = (frameWidth - thumbWidth) / 2;
-    }
-
-    sys->thumbPitch  = thumbWidth * PIXEL_SIZE;
-    sys->thumbHeight = thumbHeight;
-    sys->frameWidth  = frameWidth;
-
-    /* Allocate the memory to store the frames. */
-    size_t thumbSize = sys->thumbPitch * (sys->thumbHeight+1);
-    sys->thumbData = malloc(thumbSize);
-    if (sys->thumbData == NULL)
-    {
-        LOGE("Could not allocate the memory to store the frame!");
-        goto end;
-    }
-
-    /* Allocate the memory to store the thumbnail. */
-    unsigned frameSize = frameWidth * frameHeight * PIXEL_SIZE;
-    sys->frameData = calloc(frameSize, 1);
-    if (sys->frameData == NULL)
-    {
-        LOGE("Could not allocate the memory to store the thumbnail!");
-        goto end;
-    }
-
-    /* Set the video format and the callbacks. */
-    libvlc_video_set_format(mp, "RGBA", thumbWidth, thumbHeight, sys->thumbPitch);
-    libvlc_video_set_callbacks(mp, thumbnailer_lock, thumbnailer_unlock,
-                               NULL, (void*)sys);
-    sys->state = THUMB_SEEKING;
-
-    /* Play the media. */
-    libvlc_media_player_play(mp);
-    libvlc_media_player_set_position(mp, THUMBNAIL_POSITION);
-
-    const int wait_time = 50000;
-    const int max_attempts = 100;
-    for (int i = 0; i < max_attempts; ++i) {
-        if (libvlc_media_player_is_playing(mp) && libvlc_media_player_get_position(mp) >= THUMBNAIL_POSITION)
-            break;
-        usleep(wait_time);
-    }
-
-    /* Wait for the thumbnail to be generated. */
-    pthread_mutex_lock(&sys->doneMutex);
-    sys->state = THUMB_SEEKED;
-    struct timespec deadline;
-    clock_gettime(CLOCK_REALTIME, &deadline);
-    deadline.tv_sec += 10; /* amount of seconds before we abort thumbnailer */
-    do {
-        int ret = pthread_cond_timedwait(&sys->doneCondVar, &sys->doneMutex, &deadline);
-        if (ret == ETIMEDOUT)
-            break;
-    } while (sys->state != THUMB_DONE);
-    pthread_mutex_unlock(&sys->doneMutex);
-
-    /* Stop and release the media player. */
-    libvlc_media_player_stop(mp);
-    libvlc_media_player_release(mp);
-
-    if (sys->state == THUMB_DONE) {
-        /* Create the Java byte array to return the create thumbnail. */
-        byteArray = (*env)->NewByteArray(env, frameSize);
-        if (byteArray == NULL)
-        {
-            LOGE("Could not allocate the Java byte array to store the frame!");
-            goto end;
-        }
-
-        (*env)->SetByteArrayRegion(env, byteArray, 0, frameSize,
-                (jbyte *)sys->frameData);
-    }
-
-end:
-    pthread_mutex_destroy(&sys->doneMutex);
-    pthread_cond_destroy(&sys->doneCondVar);
-    free(sys->frameData);
-    free(sys->thumbData);
-    free(sys);
-enomem:
-    return byteArray;
-}
diff --git a/vlc-android/jni/utils.h b/vlc-android/jni/utils.h
deleted file mode 100644
index f8502d9..0000000
--- a/vlc-android/jni/utils.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*****************************************************************************
- * utils.h
- *****************************************************************************
- * Copyright © 2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLCJNI_UTILS_H
-#define LIBVLCJNI_UTILS_H
-
-libvlc_media_t *new_media(jlong instance, JNIEnv *env, jobject thiz, jstring fileLocation, bool noOmx, bool noVideo);
-
-libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz);
-
-jint getInt(JNIEnv *env, jobject thiz, const char* field);
-
-void setInt(JNIEnv *env, jobject item, const char* field, jint value);
-
-jlong getLong(JNIEnv *env, jobject thiz, const char* field);
-
-void setLong(JNIEnv *env, jobject item, const char* field, jlong value);
-
-void setFloat(JNIEnv *env, jobject item, const char* field, jfloat value);
-
-void setString(JNIEnv *env, jobject item, const char* field, const char* text);
-
-void arrayListGetIDs(JNIEnv *env, jclass* p_class, jmethodID* p_add, jmethodID* p_remove);
-
-void arrayListStringAdd(JNIEnv *env, jclass class, jmethodID methodID, jobject arrayList, const char* str);
-
-jobject getEventHandlerReference(JNIEnv *env, jobject thiz, jobject eventHandler);
-
-void debug_log(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_list ap);
-
-#endif // LIBVLCJNI_UTILS_H
diff --git a/vlc-android/jni/vout.c b/vlc-android/jni/vout.c
deleted file mode 100644
index e178bcb..0000000
--- a/vlc-android/jni/vout.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*****************************************************************************
- * vout.c
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <vlc/vlc.h>
-#include <vlc_common.h>
-
-#include <jni.h>
-
-#define THREAD_NAME "jni_vout"
-extern int jni_attach_thread(JNIEnv **env, const char *thread_name);
-extern void jni_detach_thread();
-
-pthread_mutex_t vout_android_lock;
-pthread_cond_t vout_android_surf_attached;
-static void *vout_android_surf = NULL;
-static void *vout_android_gui = NULL;
-static jobject vout_android_java_surf = NULL;
-static jobject vout_android_subtitles_surf = NULL;
-static bool vout_video_player_activity_created = false;
-
-void *jni_LockAndGetSubtitlesSurface() {
-    pthread_mutex_lock(&vout_android_lock);
-    while (vout_android_subtitles_surf == NULL)
-        pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
-    return vout_android_subtitles_surf;
-}
-
-void *jni_LockAndGetAndroidSurface() {
-    pthread_mutex_lock(&vout_android_lock);
-    while (vout_android_surf == NULL)
-        pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
-    return vout_android_surf;
-}
-
-jobject jni_LockAndGetAndroidJavaSurface() {
-    pthread_mutex_lock(&vout_android_lock);
-    while (vout_android_java_surf == NULL)
-        pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
-    return vout_android_java_surf;
-}
-
-void jni_UnlockAndroidSurface() {
-    pthread_mutex_unlock(&vout_android_lock);
-}
-
-void jni_EventHardwareAccelerationError()
-{
-    if (vout_android_gui == NULL)
-        return;
-
-    JNIEnv *env;
-    jni_attach_thread(&env, THREAD_NAME);
-
-    jclass cls = (*env)->GetObjectClass(env, vout_android_gui);
-    jmethodID methodId = (*env)->GetMethodID(env, cls, "eventHardwareAccelerationError", "()V");
-    (*env)->CallVoidMethod(env, vout_android_gui, methodId);
-
-    (*env)->DeleteLocalRef(env, cls);
-    jni_detach_thread();
-}
-
-void jni_SetAndroidSurfaceSizeEnv(JNIEnv *p_env, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)
-{
-    if (vout_android_gui == NULL)
-        return;
-
-    jclass cls = (*p_env)->GetObjectClass (p_env, vout_android_gui);
-    jmethodID methodId = (*p_env)->GetMethodID (p_env, cls, "setSurfaceSize", "(IIIIII)V");
-
-    (*p_env)->CallVoidMethod (p_env, vout_android_gui, methodId, width, height, visible_width, visible_height, sar_num, sar_den);
-
-    (*p_env)->DeleteLocalRef(p_env, cls);
-}
-
-void jni_SetAndroidSurfaceSize(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den)
-{
-    JNIEnv *p_env;
-
-    jni_attach_thread(&p_env, THREAD_NAME);
-    jni_SetAndroidSurfaceSizeEnv(p_env, width, height, visible_width, visible_height, sar_num, sar_den);
-
-    jni_detach_thread();
-}
-
-bool jni_IsVideoPlayerActivityCreated() {
-    pthread_mutex_lock(&vout_android_lock);
-    bool result = vout_video_player_activity_created;
-    pthread_mutex_unlock(&vout_android_lock);
-    return result;
-}
-
-void Java_org_videolan_libvlc_LibVLC_eventVideoPlayerActivityCreated(JNIEnv *env, jobject thiz, jboolean created) {
-    pthread_mutex_lock(&vout_android_lock);
-    vout_video_player_activity_created = created;
-    pthread_mutex_unlock(&vout_android_lock);
-}
-
-void Java_org_videolan_libvlc_LibVLC_attachSurface(JNIEnv *env, jobject thiz, jobject surf, jobject gui) {
-    pthread_mutex_lock(&vout_android_lock);
-    jclass clz;
-    jfieldID fid;
-
-    clz = (*env)->FindClass(env, "org/videolan/libvlc/LibVlcUtil");
-    jmethodID methodId = (*env)->GetStaticMethodID(env, clz, "isGingerbreadOrLater", "()Z");
-    jboolean gingerbreadOrLater = (*env)->CallStaticBooleanMethod(env, clz, methodId);
-    // Android 2.2 and under don't have ANativeWindow_fromSurface
-    if(unlikely(!gingerbreadOrLater)) {
-        clz = (*env)->GetObjectClass(env, surf);
-        fid = (*env)->GetFieldID(env, clz, "mSurface", "I");
-        if (fid == NULL) {
-            jthrowable exp = (*env)->ExceptionOccurred(env);
-            if (exp) {
-                (*env)->DeleteLocalRef(env, exp);
-                (*env)->ExceptionClear(env);
-            }
-            fid = (*env)->GetFieldID(env, clz, "mNativeSurface", "I");
-        }
-        vout_android_surf = (void*)(*env)->GetIntField(env, surf, fid);
-        (*env)->DeleteLocalRef(env, clz);
-    }
-    vout_android_gui = (*env)->NewGlobalRef(env, gui);
-    vout_android_java_surf = (*env)->NewGlobalRef(env, surf);
-    pthread_cond_signal(&vout_android_surf_attached);
-    pthread_mutex_unlock(&vout_android_lock);
-}
-
-void Java_org_videolan_libvlc_LibVLC_detachSurface(JNIEnv *env, jobject thiz) {
-    pthread_mutex_lock(&vout_android_lock);
-    vout_android_surf = NULL;
-    if (vout_android_gui != NULL)
-        (*env)->DeleteGlobalRef(env, vout_android_gui);
-    if (vout_android_java_surf != NULL)
-        (*env)->DeleteGlobalRef(env, vout_android_java_surf);
-    vout_android_gui = NULL;
-    vout_android_java_surf = NULL;
-    pthread_mutex_unlock(&vout_android_lock);
-}
-
-void Java_org_videolan_libvlc_LibVLC_attachSubtitlesSurface(JNIEnv *env, jobject thiz, jobject surf) {
-    pthread_mutex_lock(&vout_android_lock);
-    vout_android_subtitles_surf = (*env)->NewGlobalRef(env, surf);
-    pthread_cond_signal(&vout_android_surf_attached);
-    pthread_mutex_unlock(&vout_android_lock);
-}
-
-void Java_org_videolan_libvlc_LibVLC_detachSubtitlesSurface(JNIEnv *env, jobject thiz) {
-    pthread_mutex_lock(&vout_android_lock);
-    (*env)->DeleteGlobalRef(env, vout_android_subtitles_surf);
-    vout_android_subtitles_surf = NULL;
-    pthread_mutex_unlock(&vout_android_lock);
-}
-
-static int mouse_x = -1;
-static int mouse_y = -1;
-static int mouse_button = -1;
-static int mouse_action = -1;
-
-void Java_org_videolan_libvlc_LibVLC_sendMouseEvent(JNIEnv* env, jobject thiz, jint action, jint button, jint x, jint y)
-{
-    mouse_x = x;
-    mouse_y = y;
-    mouse_button = button;
-    mouse_action = action;
-}
-
-void jni_getMouseCoordinates(int *action, int *button, int *x, int *y)
-{
-    *x = mouse_x;
-    *y = mouse_y;
-    *button = mouse_button;
-    *action = mouse_action;
-
-    mouse_button = mouse_action = mouse_x = mouse_y = -1;
-}
diff --git a/vlc-android/jni/vout.h b/vlc-android/jni/vout.h
deleted file mode 100644
index c3d4fd7..0000000
--- a/vlc-android/jni/vout.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*****************************************************************************
- * vout.h
- *****************************************************************************
- * Copyright © 2011-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef LIBVLCJNI_VOUT_H
-#define LIBVLCJNI_VOUT_H
-
-/* vout lock initialized in vout.c */
-pthread_mutex_t vout_android_lock;
-pthread_cond_t vout_android_surf_attached;
-
-#endif // LIBVLCJNI_VOUT_H
diff --git a/vlc-android/jni/wchar/wcpcpy.c b/vlc-android/jni/wchar/wcpcpy.c
deleted file mode 100644
index df63d72..0000000
--- a/vlc-android/jni/wchar/wcpcpy.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999
- *	David E. O'Brien
- * Copyright (c) 1988, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcpy.c	8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcpcpy(wchar_t * __restrict to, const wchar_t * __restrict from)
-{
-
-	for (; (*to = *from); ++from, ++to);
-	return(to);
-}
diff --git a/vlc-android/jni/wchar/wcpncpy.c b/vlc-android/jni/wchar/wcpncpy.c
deleted file mode 100644
index 87b361c..0000000
--- a/vlc-android/jni/wchar/wcpncpy.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcpncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n)
-{
-
-	for (; n--; dst++, src++) {
-		if (!(*dst = *src)) {
-			wchar_t *ret = dst;
-			while (n--)
-				*++dst = L'\0';
-			return (ret);
-		}
-	}
-	return (dst);
-}
diff --git a/vlc-android/jni/wchar/wcscasecmp.c b/vlc-android/jni/wchar/wcscasecmp.c
deleted file mode 100644
index 0143543..0000000
--- a/vlc-android/jni/wchar/wcscasecmp.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-#include <wctype.h>
-
-int
-wcscasecmp(const wchar_t *s1, const wchar_t *s2)
-{
-	wchar_t c1, c2;
-
-	for (; *s1; s1++, s2++) {
-		c1 = towlower(*s1);
-		c2 = towlower(*s2);
-		if (c1 != c2)
-			return ((int)c1 - c2);
-	}
-	return (-*s2);
-}
diff --git a/vlc-android/jni/wchar/wcscat.c b/vlc-android/jni/wchar/wcscat.c
deleted file mode 100644
index 7ae4e80..0000000
--- a/vlc-android/jni/wchar/wcscat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wcscat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcscat(wchar_t * __restrict s1, const wchar_t * __restrict s2)
-{
-	wchar_t *cp;
-
-	cp = s1;
-	while (*cp != L'\0')
-		cp++;
-	while ((*cp++ = *s2++) != L'\0')
-		;
-
-	return (s1);
-}
diff --git a/vlc-android/jni/wchar/wcschr.c b/vlc-android/jni/wchar/wcschr.c
deleted file mode 100644
index 1df1fe6..0000000
--- a/vlc-android/jni/wchar/wcschr.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcschr(const wchar_t *s, wchar_t c)
-{
-
-	while (*s != c && *s != L'\0')
-		s++;
-	if (*s == c)
-		return ((wchar_t *)s);
-	return (NULL);
-}
diff --git a/vlc-android/jni/wchar/wcscmp.c b/vlc-android/jni/wchar/wcscmp.c
deleted file mode 100644
index 2d48914..0000000
--- a/vlc-android/jni/wchar/wcscmp.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcmp.c	8.1 (Berkeley) 6/4/93";
-#if 0
-__RCSID("$NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-/*
- * Compare strings.
- */
-int
-wcscmp(const wchar_t *s1, const wchar_t *s2)
-{
-
-	while (*s1 == *s2++)
-		if (*s1++ == '\0')
-			return (0);
-	/* XXX assumes wchar_t = int */
-	return (*(const unsigned int *)s1 - *(const unsigned int *)--s2);
-}
diff --git a/vlc-android/jni/wchar/wcscoll.c b/vlc-android/jni/wchar/wcscoll.c
deleted file mode 100644
index 6e843b7..0000000
--- a/vlc-android/jni/wchar/wcscoll.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <wchar.h>
-/*
- * Compare strings using the current locale.  Since Bionic really does not
- * support locales, we assume we always use the C locale and call wcscmp.
- *
- * This function is provided to make libstdc++-v3 usable.
- */
-int
-wcscoll(const wchar_t *ws1, const wchar_t *ws2)
-{
-    return wcscmp(ws1, ws2);
-}
diff --git a/vlc-android/jni/wchar/wcscpy.c b/vlc-android/jni/wchar/wcscpy.c
deleted file mode 100644
index 0c6e1f2..0000000
--- a/vlc-android/jni/wchar/wcscpy.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wcscpy.c,v 1.2 2000/12/21 04:51:09 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcscpy(wchar_t * __restrict s1, const wchar_t * __restrict s2)
-{
-	wchar_t *cp;
-
-	cp = s1;
-	while ((*cp++ = *s2++) != L'\0')
-		;
-
-	return (s1);
-}
diff --git a/vlc-android/jni/wchar/wcscspn.c b/vlc-android/jni/wchar/wcscspn.c
deleted file mode 100644
index 7729dc8..0000000
--- a/vlc-android/jni/wchar/wcscspn.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wcscspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-size_t
-wcscspn(const wchar_t *s, const wchar_t *set)
-{
-	const wchar_t *p;
-	const wchar_t *q;
-
-	p = s;
-	while (*p) {
-		q = set;
-		while (*q) {
-			if (*p == *q)
-				goto done;
-			q++;
-		}
-		p++;
-	}
-
-done:
-	return (p - s);
-}
diff --git a/vlc-android/jni/wchar/wcsdup.c b/vlc-android/jni/wchar/wcsdup.c
deleted file mode 100644
index 1e5db92..0000000
--- a/vlc-android/jni/wchar/wcsdup.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * Copyright (c) 2005 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stdlib.h>
-#include <wchar.h>
-
-wchar_t *
-wcsdup(const wchar_t *s)
-{
-	wchar_t *copy;
-	size_t len;
-
-	len = wcslen(s) + 1;
-	if ((copy = malloc(len * sizeof(wchar_t))) == NULL)
-		return (NULL);
-	return (wmemcpy(copy, s, len));
-}
diff --git a/vlc-android/jni/wchar/wcslcat.c b/vlc-android/jni/wchar/wcslcat.c
deleted file mode 100644
index f5f1e1e..0000000
--- a/vlc-android/jni/wchar/wcslcat.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *	from OpenBSD: strlcat.c,v 1.3 2000/11/24 11:10:02 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <wchar.h>
-
-/*
- * Appends src to string dst of size siz (unlike wcsncat, siz is the
- * full size of dst, not space left).  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz == 0).
- * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
- * truncation occurred.
- */
-size_t
-wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
-{
-	wchar_t *d = dst;
-	const wchar_t *s = src;
-	size_t n = siz;
-	size_t dlen;
-
-	/* Find the end of dst and adjust bytes left but don't go past end */
-	while (*d != '\0' && n-- != 0)
-		d++;
-	dlen = d - dst;
-	n = siz - dlen;
-
-	if (n == 0)
-		return(dlen + wcslen(s));
-	while (*s != '\0') {
-		if (n != 1) {
-			*d++ = *s;
-			n--;
-		}
-		s++;
-	}
-	*d = '\0';
-
-	return(dlen + (s - src));	/* count does not include NUL */
-}
diff --git a/vlc-android/jni/wchar/wcslcpy.c b/vlc-android/jni/wchar/wcslcpy.c
deleted file mode 100644
index b104a06..0000000
--- a/vlc-android/jni/wchar/wcslcpy.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *	from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcslcpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <wchar.h>
-
-/*
- * Copy src to string dst of size siz.  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz == 0).
- * Returns wcslen(src); if retval >= siz, truncation occurred.
- */
-size_t
-wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
-{
-	wchar_t *d = dst;
-	const wchar_t *s = src;
-	size_t n = siz;
-
-	/* Copy as many bytes as will fit */
-	if (n != 0 && --n != 0) {
-		do {
-			if ((*d++ = *s++) == 0)
-				break;
-		} while (--n != 0);
-	}
-
-	/* Not enough room in dst, add NUL and traverse rest of src */
-	if (n == 0) {
-		if (siz != 0)
-			*d = '\0';		/* NUL-terminate dst */
-		while (*s++)
-			;
-	}
-
-	return(s - src - 1);	/* count does not include NUL */
-}
diff --git a/vlc-android/jni/wchar/wcslen.c b/vlc-android/jni/wchar/wcslen.c
deleted file mode 100644
index ca3004e..0000000
--- a/vlc-android/jni/wchar/wcslen.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-size_t
-wcslen(const wchar_t *s)
-{
-	const wchar_t *p;
-
-	p = s;
-	while (*p)
-		p++;
-
-	return p - s;
-}
diff --git a/vlc-android/jni/wchar/wcsncasecmp.c b/vlc-android/jni/wchar/wcsncasecmp.c
deleted file mode 100644
index a42d98c..0000000
--- a/vlc-android/jni/wchar/wcsncasecmp.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-#include <wctype.h>
-
-int
-wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
-{
-	wchar_t c1, c2;
-
-	if (n == 0)
-		return (0);
-	for (; *s1; s1++, s2++) {
-		c1 = towlower(*s1);
-		c2 = towlower(*s2);
-		if (c1 != c2)
-			return ((int)c1 - c2);
-		if (--n == 0)
-			return (0);
-	}
-	return (-*s2);
-}
diff --git a/vlc-android/jni/wchar/wcsncat.c b/vlc-android/jni/wchar/wcsncat.c
deleted file mode 100644
index 44f1ff9..0000000
--- a/vlc-android/jni/wchar/wcsncat.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wcsncat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcsncat(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)
-{
-	wchar_t *p;
-	wchar_t *q;
-	const wchar_t *r;
-
-	p = s1;
-	while (*p)
-		p++;
-	q = p;
-	r = s2;
-	while (*r && n) {
-		*q++ = *r++;
-		n--;
-	}
-	*q = '\0';
-	return s1;
-}
diff --git a/vlc-android/jni/wchar/wcsncmp.c b/vlc-android/jni/wchar/wcsncmp.c
deleted file mode 100644
index 86d7a51..0000000
--- a/vlc-android/jni/wchar/wcsncmp.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncmp.c	8.1 (Berkeley) 6/4/93";
-__RCSID("$NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-int
-wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
-{
-
-	if (n == 0)
-		return (0);
-	do {
-		if (*s1 != *s2++) {
-			/* XXX assumes wchar_t = int */
-			return (*(const unsigned int *)s1 -
-			    *(const unsigned int *)--s2);
-		}
-		if (*s1++ == 0)
-			break;
-	} while (--n != 0);
-	return (0);
-}
diff --git a/vlc-android/jni/wchar/wcsncpy.c b/vlc-android/jni/wchar/wcsncpy.c
deleted file mode 100644
index 00d986b..0000000
--- a/vlc-android/jni/wchar/wcsncpy.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncpy.c	8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-/*
- * Copy src to dst, truncating or null-padding to always copy n bytes.
- * Return dst.
- */
-wchar_t *
-wcsncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n)
-{
-	if (n != 0) {
-		wchar_t *d = dst;
-		const wchar_t *s = src;
-
-		do {
-			if ((*d++ = *s++) == L'\0') {
-				/* NUL pad the remaining n-1 bytes */
-				while (--n != 0)
-					*d++ = L'\0';
-				break;
-			}
-		} while (--n != 0);
-	}
-	return (dst);
-}
diff --git a/vlc-android/jni/wchar/wcsnlen.c b/vlc-android/jni/wchar/wcsnlen.c
deleted file mode 100644
index f03cf76..0000000
--- a/vlc-android/jni/wchar/wcsnlen.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das at FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-size_t
-wcsnlen(const wchar_t *s, size_t maxlen)
-{
-	size_t len;
-
-	for (len = 0; len < maxlen; len++, s++) {
-		if (!*s)
-			break;
-	}
-	return (len);
-}
diff --git a/vlc-android/jni/wchar/wcspbrk.c b/vlc-android/jni/wchar/wcspbrk.c
deleted file mode 100644
index 2ff71ba..0000000
--- a/vlc-android/jni/wchar/wcspbrk.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wcspbrk.c,v 1.2 2000/12/21 05:07:25 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcspbrk.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcspbrk(const wchar_t *s, const wchar_t *set)
-{
-	const wchar_t *p;
-	const wchar_t *q;
-
-	p = s;
-	while (*p) {
-		q = set;
-		while (*q) {
-			if (*p == *q) {
-				/* LINTED interface specification */
-				return (wchar_t *)p;
-			}
-			q++;
-		}
-		p++;
-	}
-	return NULL;
-}
diff --git a/vlc-android/jni/wchar/wcsrchr.c b/vlc-android/jni/wchar/wcsrchr.c
deleted file mode 100644
index 37c81ec..0000000
--- a/vlc-android/jni/wchar/wcsrchr.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcsrchr(const wchar_t *s, wchar_t c)
-{
-	const wchar_t *last;
-
-	last = NULL;
-	for (;;) {
-		if (*s == c)
-			last = s;
-		if (*s == L'\0')
-			break;
-		s++;
-	}
-
-	return ((wchar_t *)last);
-}
diff --git a/vlc-android/jni/wchar/wcsspn.c b/vlc-android/jni/wchar/wcsspn.c
deleted file mode 100644
index 6569206..0000000
--- a/vlc-android/jni/wchar/wcsspn.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wcsspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcsspn.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-size_t
-wcsspn(const wchar_t *s, const wchar_t *set)
-{
-	const wchar_t *p;
-	const wchar_t *q;
-
-	p = s;
-	while (*p) {
-		q = set;
-		while (*q) {
-			if (*p == *q)
-				break;
-			q++;
-		}
-		if (!*q)
-			goto done;
-		p++;
-	}
-
-done:
-	return (p - s);
-}
diff --git a/vlc-android/jni/wchar/wcsstr.c b/vlc-android/jni/wchar/wcsstr.c
deleted file mode 100644
index a9dc27b..0000000
--- a/vlc-android/jni/wchar/wcsstr.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strstr.c	8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-/*
- * Find the first occurrence of find in s.
- */
-wchar_t *
-wcsstr(const wchar_t * __restrict s, const wchar_t * __restrict find)
-{
-	wchar_t c, sc;
-	size_t len;
-
-	if ((c = *find++) != L'\0') {
-		len = wcslen(find);
-		do {
-			do {
-				if ((sc = *s++) == L'\0')
-					return (NULL);
-			} while (sc != c);
-		} while (wcsncmp(s, find, len) != 0);
-		s--;
-	}
-	return ((wchar_t *)s);
-}
diff --git a/vlc-android/jni/wchar/wcstok.c b/vlc-android/jni/wchar/wcstok.c
deleted file mode 100644
index 5a77117..0000000
--- a/vlc-android/jni/wchar/wcstok.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * Copyright (c) 1998 Softweyr LLC.  All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes at softweyr.com>
- *
- * Copyright (c) 1988, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notices, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notices, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL SOFTWEYR LLC, THE
- * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t *
-wcstok(wchar_t * __restrict s, const wchar_t * __restrict delim,
-    wchar_t ** __restrict last)
-{
-	const wchar_t *spanp;
-	wchar_t *tok;
-	wchar_t c, sc;
-
-	if (s == NULL && (s = *last) == NULL)
-		return (NULL);
-
-	/*
-	 * Skip (span) leading delimiters (s += wcsspn(s, delim), sort of).
-	 */
-cont:
-	c = *s++;
-	for (spanp = delim; (sc = *spanp++) != L'\0';) {
-		if (c == sc)
-			goto cont;
-	}
-
-	if (c == L'\0') {	/* no non-delimiter characters */
-		*last = NULL;
-		return (NULL);
-	}
-	tok = s - 1;
-
-	/*
-	 * Scan token (scan for delimiters: s += wcscspn(s, delim), sort of).
-	 * Note that delim must have one NUL; we stop if we see that, too.
-	 */
-	for (;;) {
-		c = *s++;
-		spanp = delim;
-		do {
-			if ((sc = *spanp++) == c) {
-				if (c == L'\0')
-					s = NULL;
-				else
-					s[-1] = L'\0';
-				*last = s;
-				return (tok);
-			}
-		} while (sc != L'\0');
-	}
-	/* NOTREACHED */
-}
diff --git a/vlc-android/jni/wchar/wcswidth.c b/vlc-android/jni/wchar/wcswidth.c
deleted file mode 100644
index b142074..0000000
--- a/vlc-android/jni/wchar/wcswidth.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-int
-wcswidth(const wchar_t *pwcs, size_t n)
-{
-	wchar_t wc;
-	int len, l;
-
-	len = 0;
-	while (n-- > 0 && (wc = *pwcs++) != L'\0') {
-		if ((l = wcwidth(wc)) < 0)
-			return (-1);
-		len += l;
-	}
-	return (len);
-}
-
diff --git a/vlc-android/jni/wchar/wcsxfrm.c b/vlc-android/jni/wchar/wcsxfrm.c
deleted file mode 100644
index 042ea56..0000000
--- a/vlc-android/jni/wchar/wcsxfrm.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 1995 Alex Tatmanjants <alex at elvisti.kiev.ua>
- *		at Electronni Visti IA, Kiev, Ukraine.
- *			All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <wchar.h>
-
-/*
- * Placeholder wcsxfrm() implementation. See wcscoll.c for a description of
- * the logic used.
- */
-size_t
-wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
-{
-    int prim, sec, l;
-    size_t slen;
-    char *mbsrc, *s, *ss;
-
-    if (*src == L'\0') {
-        if (len != 0)
-            *dest = L'\0';
-        return (0);
-    }
-
-    slen = wcslen(src);
-    if (len > 0) {
-        if (slen < len)
-            wcscpy(dest, src);
-        else {
-            wcsncpy(dest, src, len - 1);
-            dest[len - 1] = L'\0';
-        }
-    }
-    return (slen);
-}
diff --git a/vlc-android/jni/wchar/wmemchr.c b/vlc-android/jni/wchar/wmemchr.c
deleted file mode 100644
index cab89c9..0000000
--- a/vlc-android/jni/wchar/wmemchr.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wmemchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t	*
-wmemchr(const wchar_t *s, wchar_t c, size_t n)
-{
-	size_t i;
-
-	for (i = 0; i < n; i++) {
-		if (*s == c) {
-			/* LINTED const castaway */
-			return (wchar_t *)s;
-		}
-		s++;
-	}
-	return NULL;
-}
diff --git a/vlc-android/jni/wchar/wmemcmp.c b/vlc-android/jni/wchar/wmemcmp.c
deleted file mode 100644
index fdb1f98..0000000
--- a/vlc-android/jni/wchar/wmemcmp.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wmemcmp.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wmemcmp.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-int
-wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
-{
-	size_t i;
-
-	for (i = 0; i < n; i++) {
-		if (*s1 != *s2) {
-			/* wchar might be unsigned */
-			return *s1 > *s2 ? 1 : -1; 
-		}
-		s1++;
-		s2++;
-	}
-	return 0;
-}
diff --git a/vlc-android/jni/wchar/wmemcpy.c b/vlc-android/jni/wchar/wmemcpy.c
deleted file mode 100644
index c10770c..0000000
--- a/vlc-android/jni/wchar/wmemcpy.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <string.h>
-#include <wchar.h>
-
-wchar_t *
-wmemcpy(wchar_t * __restrict d, const wchar_t * __restrict s, size_t n)
-{
-	return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t));
-}
diff --git a/vlc-android/jni/wchar/wmemmove.c b/vlc-android/jni/wchar/wmemmove.c
deleted file mode 100644
index 05cfd10..0000000
--- a/vlc-android/jni/wchar/wmemmove.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wmemmove.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <string.h>
-#include <wchar.h>
-
-wchar_t *
-wmemmove(wchar_t *d, const wchar_t *s, size_t n)
-{
-	return (wchar_t *)memmove(d, s, n * sizeof(wchar_t));
-}
diff --git a/vlc-android/jni/wchar/wmemset.c b/vlc-android/jni/wchar/wmemset.c
deleted file mode 100644
index 0e96356..0000000
--- a/vlc-android/jni/wchar/wmemset.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	citrus Id: wmemset.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wmemset.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
-
-#include <wchar.h>
-
-wchar_t	*
-wmemset(wchar_t *s, wchar_t c, size_t n)
-{
-	size_t i;
-	wchar_t *p;
-
-	p = (wchar_t *)s;
-	for (i = 0; i < n; i++) {
-		*p = c;
-		p++;
-	}
-	return s;
-}
diff --git a/vlc-android/project.properties b/vlc-android/project.properties
index 02b1870..db9ba9a 100644
--- a/vlc-android/project.properties
+++ b/vlc-android/project.properties
@@ -7,8 +7,11 @@
 # "ant.properties", and override values to adapt the script to your
 # project structure.
 
+#split.density=true
+
 # Project target.
 target=android-21
 android.library.reference.1=../java-libs/appcompat
 android.library.reference.2=../java-libs/WheelView
 android.library.reference.3=../java-libs/cardview
+android.library.reference.4=../libVLC
diff --git a/vlc-android/src/org/videolan/libvlc/AudioOutput.java b/vlc-android/src/org/videolan/libvlc/AudioOutput.java
deleted file mode 100644
index 06955ac..0000000
--- a/vlc-android/src/org/videolan/libvlc/AudioOutput.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*****************************************************************************
- * Aout.java
- *****************************************************************************
- * Copyright © 2011-2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-import android.media.AudioFormat;
-import android.media.AudioManager;
-import android.media.AudioTrack;
-import android.util.Log;
-
-public class AudioOutput {
-    /**
-     * Java side of the audio output module for Android.
-     * Uses an AudioTrack to play decoded audio buffers.
-     *
-     * TODO Use MODE_STATIC instead of MODE_STREAM with a MemoryFile (ashmem)
-     */
-
-    public AudioOutput() {
-    }
-
-    private AudioTrack mAudioTrack;
-    private static final String TAG = "LibVLC/aout";
-
-    public void init(int sampleRateInHz, int channels, int samples) {
-        Log.d(TAG, sampleRateInHz + ", " + channels + ", " + samples + "=>" + channels * samples);
-        int minBufferSize = AudioTrack.getMinBufferSize(sampleRateInHz,
-                                                        AudioFormat.CHANNEL_OUT_STEREO,
-                                                        AudioFormat.ENCODING_PCM_16BIT);
-        mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
-                                     sampleRateInHz,
-                                     AudioFormat.CHANNEL_OUT_STEREO,
-                                     AudioFormat.ENCODING_PCM_16BIT,
-                                     Math.max(minBufferSize, channels * samples * 2),
-                                     AudioTrack.MODE_STREAM);
-    }
-
-    public void release() {
-        if (mAudioTrack != null) {
-            mAudioTrack.release();
-        }
-        mAudioTrack = null;
-    }
-
-    public void playBuffer(byte[] audioData, int bufferSize) {
-        if (mAudioTrack.getState() == AudioTrack.STATE_UNINITIALIZED)
-            return;
-        if (mAudioTrack.write(audioData, 0, bufferSize) != bufferSize) {
-            Log.w(TAG, "Could not write all the samples to the audio device");
-        }
-        mAudioTrack.play();
-    }
-
-    public void pause() {
-        mAudioTrack.pause();
-    }
-}
diff --git a/vlc-android/src/org/videolan/libvlc/EventHandler.java b/vlc-android/src/org/videolan/libvlc/EventHandler.java
deleted file mode 100644
index 16a0791..0000000
--- a/vlc-android/src/org/videolan/libvlc/EventHandler.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*****************************************************************************
- * EventHandler.java
- *****************************************************************************
- * Copyright © 2011-2014 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-import java.util.ArrayList;
-
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-
-public class EventHandler {
-
-    /*
-     * Be sure to subscribe to events you need in the JNI too.
-     */
-
-    //public static final int MediaMetaChanged                = 0;
-    //public static final int MediaSubItemAdded               = 1;
-    //public static final int MediaDurationChanged            = 2;
-    public static final int MediaParsedChanged                = 3;
-    //public static final int MediaFreed                      = 4;
-    //public static final int MediaStateChanged               = 5;
-
-    //public static final int MediaPlayerMediaChanged         = 0x100;
-    //public static final int MediaPlayerNothingSpecial       = 0x101;
-    //public static final int MediaPlayerOpening              = 0x102;
-    //public static final int MediaPlayerBuffering            = 0x103;
-    public static final int MediaPlayerPlaying                = 0x104;
-    public static final int MediaPlayerPaused                 = 0x105;
-    public static final int MediaPlayerStopped                = 0x106;
-    //public static final int MediaPlayerForward              = 0x107;
-    //public static final int MediaPlayerBackward             = 0x108;
-    public static final int MediaPlayerEndReached             = 0x109;
-    public static final int MediaPlayerEncounteredError       = 0x10a;
-    public static final int MediaPlayerTimeChanged            = 0x10b;
-    public static final int MediaPlayerPositionChanged        = 0x10c;
-    //public static final int MediaPlayerSeekableChanged      = 0x10d;
-    //public static final int MediaPlayerPausableChanged      = 0x10e;
-    //public static final int MediaPlayerTitleChanged         = 0x10f;
-    //public static final int MediaPlayerSnapshotTaken        = 0x110;
-    //public static final int MediaPlayerLengthChanged        = 0x111;
-    public static final int MediaPlayerVout                   = 0x112;
-
-    //public static final int MediaListItemAdded              = 0x200;
-    //public static final int MediaListWillAddItem            = 0x201;
-    //public static final int MediaListItemDeleted            = 0x202;
-    //public static final int MediaListWillDeleteItem         = 0x203;
-
-    //public static final int MediaListViewItemAdded          = 0x300;
-    //public static final int MediaListViewWillAddItem        = 0x301;
-    //public static final int MediaListViewItemDeleted        = 0x302;
-    //public static final int MediaListViewWillDeleteItem     = 0x303;
-
-    //public static final int MediaListPlayerPlayed           = 0x400;
-    //public static final int MediaListPlayerNextItemSet      = 0x401;
-    //public static final int MediaListPlayerStopped          = 0x402;
-
-    //public static final int MediaDiscovererStarted          = 0x500;
-    //public static final int MediaDiscovererEnded            = 0x501;
-
-    //public static final int VlmMediaAdded                   = 0x600;
-    //public static final int VlmMediaRemoved                 = 0x601;
-    //public static final int VlmMediaChanged                 = 0x602;
-    //public static final int VlmMediaInstanceStarted         = 0x603;
-    //public static final int VlmMediaInstanceStopped         = 0x604;
-    //public static final int VlmMediaInstanceStatusInit      = 0x605;
-    //public static final int VlmMediaInstanceStatusOpening   = 0x606;
-    //public static final int VlmMediaInstanceStatusPlaying   = 0x607;
-    //public static final int VlmMediaInstanceStatusPause     = 0x608;
-    //public static final int VlmMediaInstanceStatusEnd       = 0x609;
-    //public static final int VlmMediaInstanceStatusError     = 0x60a;
-
-    public static final int CustomMediaListExpanding          = 0x2000;
-    public static final int CustomMediaListExpandingEnd       = 0x2001;
-    public static final int CustomMediaListItemAdded          = 0x2002;
-    public static final int CustomMediaListItemDeleted        = 0x2003;
-    public static final int CustomMediaListItemMoved          = 0x2004;
-
-    public static final int HardwareAccelerationError         = 0x3000;
-
-    private ArrayList<Handler> mEventHandler;
-    private static EventHandler mInstance;
-
-    EventHandler() {
-        mEventHandler = new ArrayList<Handler>();
-    }
-
-    public static EventHandler getInstance() {
-        if (mInstance == null) {
-            mInstance = new EventHandler();
-        }
-        return mInstance;
-    }
-
-    public void addHandler(Handler handler) {
-        if (!mEventHandler.contains(handler))
-            mEventHandler.add(handler);
-    }
-
-    public void removeHandler(Handler handler) {
-        mEventHandler.remove(handler);
-    }
-
-    /** This method is called by a native thread **/
-    public void callback(int event, Bundle b) {
-        b.putInt("event", event);
-        for (int i = 0; i < mEventHandler.size(); i++) {
-            Message msg = Message.obtain();
-            msg.setData(b);
-            mEventHandler.get(i).sendMessage(msg);
-        }
-    }
-}
diff --git a/vlc-android/src/org/videolan/libvlc/HWDecoderUtil.java b/vlc-android/src/org/videolan/libvlc/HWDecoderUtil.java
deleted file mode 100644
index 8e0e903..0000000
--- a/vlc-android/src/org/videolan/libvlc/HWDecoderUtil.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*****************************************************************************
- * HWDecUtil.java
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-/**
- * Utility class that return the preferred hardware decoder from a list of known devices.
- */
-public class HWDecoderUtil {
-
-    public enum Decoder {
-        UNKNOWN, NONE, OMX, MEDIACODEC, ALL
-    }
-
-    private static class DecoderBySOC {
-        public final String key;
-        public final Decoder dec;
-        public final String[] list;
-        public DecoderBySOC(String key, Decoder dec, String[] list) {
-            this.key = key;
-            this.dec = dec;
-            this.list = list;
-        }
-    }
-
-    private static final DecoderBySOC[] sDecoderBySOCList = new DecoderBySOC[] {
-        /*
-         *  Put first devices you want to blacklist
-         *  because theses devices can match the next rules.
-         */
-        new DecoderBySOC ("ro.product.brand", Decoder.NONE, new  String[] {
-                "SEMC",             // Xperia S
-        }),
-        new DecoderBySOC ("ro.board.platform", Decoder.NONE, new  String[] {
-                "msm7627",          // QCOM S1
-        }),
-        /*
-         * Devices working on OMX
-         */
-        new DecoderBySOC ("ro.board.platform", Decoder.OMX, new  String[] {
-                "omap3",            // Omap 3
-                "rockchip", "rk29", // Rockchip RK29
-                "msm7630",          // QCOM S2
-                "s5pc",             // Exynos 3
-                "montblanc",        // Montblanc
-                "exdroid",          // Allwinner A31
-        }),
-        new DecoderBySOC ("ro.hardware", Decoder.OMX, new  String[] {
-                "sun6i",            // Allwinner A31
-        }),
-        /*
-         * Devices working on Mediacodec and OMX
-         */
-        new DecoderBySOC ("ro.board.platform", Decoder.ALL, new  String[] {
-                "omap4",            // Omap 4
-                "tegra",            // Tegra 2 & 3
-                "tegra3",           // Tegra 3
-                "msm8660",          // QCOM S3
-                "exynos4",          // Exynos 4 (Samsung Galaxy S2/S3)
-                "exynos5",          // Exynos 5 (Samsung Galaxy S4)
-                "rk30", "rk31",     // Rockchip RK3*
-                "mv88de3100",       // Marvell ARMADA 1500
-        }),
-        new DecoderBySOC ("ro.hardware", Decoder.ALL, new  String[] {
-                "mt65", "mt83",     // MTK
-        }),
-    };
-
-    private static final HashMap<String, String> sSystemPropertyMap = new HashMap<String, String>();
-
-    /**
-     * @return the hardware decoder known to work for the running device
-     * (Always return Dec.ALL after Android 4.3)
-     */
-    public static Decoder getDecoderFromDevice() {
-        if (LibVlcUtil.isJellyBeanMR2OrLater())
-            return Decoder.ALL;
-        for (DecoderBySOC decBySOC : sDecoderBySOCList) {
-            String prop = sSystemPropertyMap.get(decBySOC.key);
-            if (prop == null) {
-                prop = getSystemProperty(decBySOC.key, "none");
-                sSystemPropertyMap.put(decBySOC.key, prop);
-            }
-            if (prop != null) {
-                for (String decProp: decBySOC.list)
-                    if (prop.contains(decProp))
-                        return decBySOC.dec;
-            }
-        }
-        return Decoder.UNKNOWN;
-    }
-
-    private static String getSystemProperty(String key, String def) {
-        try {
-            final ClassLoader cl = ClassLoader.getSystemClassLoader();
-            final Class<?> SystemProperties = cl.loadClass("android.os.SystemProperties");
-            final Class<?>[] paramTypes = new Class[] { String.class, String.class };
-            final Method get = SystemProperties.getMethod("get", paramTypes);
-            final Object[] params = new Object[] { key, def };
-            return (String) get.invoke(SystemProperties, params);
-        } catch (Exception e){
-            return def;
-        }
-    }
-}
diff --git a/vlc-android/src/org/videolan/libvlc/IVideoPlayer.java b/vlc-android/src/org/videolan/libvlc/IVideoPlayer.java
deleted file mode 100644
index 6d7f53d..0000000
--- a/vlc-android/src/org/videolan/libvlc/IVideoPlayer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * IVideoPlayer.java
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-public interface IVideoPlayer {
-    /**
-     * This method is called by native vout to request a surface resize when frame size doesn't match surface size.
-     * @param width Frame width
-     * @param height Frame height
-     * @param visible_width Visible frame width
-     * @param visible_height Visible frame height
-     * @param sar_num Surface aspect ratio numerator
-     * @param sar_den Surface aspect ratio denominator
-     */
-    void setSurfaceSize(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den);
-
-    /**
-     * Called in case of hardware acceleration error
-     */
-    public void eventHardwareAccelerationError();
-}
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
deleted file mode 100644
index 790855a..0000000
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ /dev/null
@@ -1,859 +0,0 @@
-/*****************************************************************************
- * LibVLC.java
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Map;
-
-import android.content.Context;
-import android.os.Build;
-import android.util.Log;
-import android.view.Surface;
-
-public class LibVLC {
-    private static final String TAG = "VLC/LibVLC";
-    public static final int AOUT_AUDIOTRACK_JAVA = 0;
-    public static final int AOUT_AUDIOTRACK = 1;
-    public static final int AOUT_OPENSLES = 2;
-
-    public static final int VOUT_ANDROID_SURFACE = 0;
-    public static final int VOUT_OPEGLES2 = 1;
-
-    public static final int HW_ACCELERATION_AUTOMATIC = -1;
-    public static final int HW_ACCELERATION_DISABLED = 0;
-    public static final int HW_ACCELERATION_DECODING = 1;
-    public static final int HW_ACCELERATION_FULL = 2;
-
-    public static final int DEV_HW_DECODER_AUTOMATIC = -1;
-    public static final int DEV_HW_DECODER_OMX = 0;
-    public static final int DEV_HW_DECODER_OMX_DR = 1;
-    public static final int DEV_HW_DECODER_MEDIACODEC = 2;
-    public static final int DEV_HW_DECODER_MEDIACODEC_DR = 3;
-
-    public static final int INPUT_NAV_ACTIVATE = 0;
-    public static final int INPUT_NAV_UP = 1;
-    public static final int INPUT_NAV_DOWN = 2;
-    public static final int INPUT_NAV_LEFT = 3;
-    public static final int INPUT_NAV_RIGHT = 4;
-
-    private static final String DEFAULT_CODEC_LIST = "mediacodec,iomx,all";
-
-    private static LibVLC sInstance;
-
-    /** libVLC instance C pointer */
-    private long mLibVlcInstance = 0; // Read-only, reserved for JNI
-    /** libvlc_media_player pointer and index */
-    private int mInternalMediaPlayerIndex = 0; // Read-only, reserved for JNI
-    private long mInternalMediaPlayerInstance = 0; // Read-only, reserved for JNI
-
-    private MediaList mMediaList; // Pointer to media list being followed
-    private MediaList mPrimaryList; // Primary/default media list; see getPrimaryMediaList()
-
-    /** Buffer for VLC messages */
-    private StringBuffer mDebugLogBuffer;
-    private boolean mIsBufferingLog = false;
-
-    private AudioOutput mAout;
-
-    /** Keep screen bright */
-    //private WakeLock mWakeLock;
-
-    /** Settings */
-    private int hardwareAcceleration = HW_ACCELERATION_AUTOMATIC;
-    private int devHardwareDecoder = DEV_HW_DECODER_AUTOMATIC;
-    private String codecList = DEFAULT_CODEC_LIST;
-    private String devCodecList = null;
-    private String subtitlesEncoding = "";
-    private int aout = LibVlcUtil.isGingerbreadOrLater() ? AOUT_OPENSLES : AOUT_AUDIOTRACK_JAVA;
-    private int vout = VOUT_ANDROID_SURFACE;
-    private boolean timeStretching = false;
-    private int deblocking = -1;
-    private String chroma = "";
-    private boolean verboseMode = true;
-    private float[] equalizer = null;
-    private boolean frameSkip = false;
-    private int networkCaching = 0;
-    private boolean httpReconnect = false;
-
-    /** Path of application-specific cache */
-    private String mCachePath = "";
-
-    /** Native crash handler */
-    private OnNativeCrashListener mOnNativeCrashListener;
-
-    /** Check in libVLC already initialized otherwise crash */
-    private boolean mIsInitialized = false;
-    public native void attachSurface(Surface surface, IVideoPlayer player);
-
-    public native void detachSurface();
-
-    public native void attachSubtitlesSurface(Surface surface);
-    public native void detachSubtitlesSurface();
-
-    public native void eventVideoPlayerActivityCreated(boolean created);
-
-    /* Load library before object instantiation */
-    static {
-        try {
-            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
-                System.loadLibrary("iomx-gingerbread");
-            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2)
-                System.loadLibrary("iomx-hc");
-            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1)
-                System.loadLibrary("iomx-ics");
-            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2)
-                System.loadLibrary("iomx-jbmr2");
-            else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT)
-                System.loadLibrary("iomx-kk");
-        } catch (Throwable t) {
-            // No need to warn if it isn't found, when we intentionally don't build these except for debug
-            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
-                Log.w(TAG, "Unable to load the iomx library: " + t);
-        }
-        try {
-            System.loadLibrary("vlcjni");
-        } catch (UnsatisfiedLinkError ule) {
-            Log.e(TAG, "Can't load vlcjni library: " + ule);
-            /// FIXME Alert user
-            System.exit(1);
-        } catch (SecurityException se) {
-            Log.e(TAG, "Encountered a security issue when loading vlcjni library: " + se);
-            /// FIXME Alert user
-            System.exit(1);
-        }
-    }
-
-    /**
-     * Singleton constructor of libVLC Without surface and vout to create the
-     * thumbnail and get information e.g. on the MediaLibraryActivity
-     *
-     * @return libVLC instance
-     * @throws LibVlcException
-     */
-    public static LibVLC getInstance() throws LibVlcException {
-        synchronized (LibVLC.class) {
-            if (sInstance == null) {
-                /* First call */
-                sInstance = new LibVLC();
-            }
-        }
-
-        return sInstance;
-    }
-
-    /**
-     * Return an existing instance of libVLC Call it when it is NOT important
-     * that this fails
-     *
-     * @return libVLC instance OR null
-     */
-    public static LibVLC getExistingInstance() {
-        synchronized (LibVLC.class) {
-            return sInstance;
-        }
-    }
-
-    /**
-     * Constructor
-     * It is private because this class is a singleton.
-     */
-    private LibVLC() {
-        mAout = new AudioOutput();
-    }
-
-    /**
-     * Destructor:
-     * It is bad practice to rely on them, so please don't forget to call
-     * destroy() before exiting.
-     */
-    @Override
-    protected void finalize() {
-        if (mLibVlcInstance != 0) {
-            Log.d(TAG, "LibVLC is was destroyed yet before finalize()");
-            destroy();
-        }
-    }
-
-    /**
-     * Get the media list that LibVLC is following right now.
-     *
-     * @return The media list object being followed
-     */
-    public MediaList getMediaList() {
-        return mMediaList;
-    }
-
-    /**
-     * Set the media list for LibVLC to follow.
-     *
-     * @param mediaList The media list object to follow
-     */
-    public void setMediaList(MediaList mediaList) {
-        mMediaList = mediaList;
-    }
-
-    /**
-     * Sets LibVLC to follow the default media list (see below)
-     */
-    public void setMediaList() {
-        mMediaList = mPrimaryList;
-    }
-
-    /**
-     * Gets the primary media list, or the "currently playing" list.
-     * Not to be confused with the media list pointer from above, which
-     * refers the the MediaList object that libVLC is currently following.
-     * This list is just one out of many lists that it can be pointed towards.
-     *
-     * This list will be used for lists of songs that are not user-defined.
-     * For example: selecting a song from the Songs list, or from the list
-     * displayed after selecting an album.
-     *
-     * It is loaded as the default list.
-     *
-     * @return The primary media list
-     */
-    public MediaList getPrimaryMediaList() {
-        return mPrimaryList;
-    }
-
-    /**
-     * Give to LibVLC the surface to draw the video.
-     * @param f the surface to draw
-     */
-    public native void setSurface(Surface f);
-
-    public static synchronized void restart(Context context) {
-        if (sInstance != null) {
-            try {
-                sInstance.destroy();
-                sInstance.init(context);
-            } catch (LibVlcException lve) {
-                Log.e(TAG, "Unable to reinit libvlc: " + lve);
-            }
-        }
-    }
-
-    /**
-     * those get/is* are called from native code to get settings values.
-     */
-
-    public int getHardwareAcceleration() {
-        return this.hardwareAcceleration;
-    }
-
-    public void setHardwareAcceleration(int hardwareAcceleration) {
-
-        if (hardwareAcceleration == HW_ACCELERATION_DISABLED) {
-            Log.d(TAG, "HWDec disabled: by user");
-            this.hardwareAcceleration = HW_ACCELERATION_DISABLED;
-            this.codecList = "all";
-        } else {
-            // Automatic or forced
-            HWDecoderUtil.Decoder decoder = HWDecoderUtil.getDecoderFromDevice();
-
-            if (decoder == HWDecoderUtil.Decoder.NONE) {
-                // NONE
-                this.hardwareAcceleration = HW_ACCELERATION_DISABLED;
-                this.codecList = "all";
-                Log.d(TAG, "HWDec disabled: device not working with mediacodec,iomx");
-            } else if (decoder == HWDecoderUtil.Decoder.UNKNOWN) {
-                // UNKNOWN
-                if (hardwareAcceleration < 0) {
-                    this.hardwareAcceleration = HW_ACCELERATION_DISABLED;
-                    this.codecList = "all";
-                    Log.d(TAG, "HWDec disabled: automatic and (unknown device or android version < 4.3)");
-                } else {
-                    this.hardwareAcceleration = hardwareAcceleration;
-                    this.codecList = DEFAULT_CODEC_LIST;
-                    Log.d(TAG, "HWDec enabled: forced by user and unknown device");
-                }
-            } else {
-                // OMX, MEDIACODEC or ALL
-                this.hardwareAcceleration = hardwareAcceleration < 0 ?
-                        HW_ACCELERATION_FULL : hardwareAcceleration;
-                if (decoder == HWDecoderUtil.Decoder.ALL)
-                    this.codecList = DEFAULT_CODEC_LIST;
-                else {
-                    final StringBuilder sb = new StringBuilder();
-                    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC)
-                        sb.append("mediacodec,");
-                    else if (decoder == HWDecoderUtil.Decoder.OMX)
-                        sb.append("iomx,");
-                    sb.append("all");
-                    this.codecList = sb.toString();
-                }
-                Log.d(TAG, "HWDec enabled: device working with: " + this.codecList);
-            }
-        }
-    }
-
-    public int getDevHardwareDecoder() {
-        return this.devHardwareDecoder;
-    }
-
-    public void setDevHardwareDecoder(int devHardwareDecoder) {
-        if (devHardwareDecoder != DEV_HW_DECODER_AUTOMATIC) {
-            this.devHardwareDecoder = devHardwareDecoder;
-            if (this.devHardwareDecoder == DEV_HW_DECODER_OMX ||
-                    this.devHardwareDecoder == DEV_HW_DECODER_OMX_DR)
-                this.devCodecList = "iomx";
-            else
-                this.devCodecList = "mediacodec";
-
-            Log.d(TAG, "HWDec forced: " + this.devCodecList +
-                (isDirectRendering() ? "-dr" : ""));
-            this.devCodecList += ",none";
-        } else {
-            this.devHardwareDecoder = DEV_HW_DECODER_AUTOMATIC;
-            this.devCodecList = null;
-        }
-    }
-
-    public boolean isDirectRendering() {
-        if (devHardwareDecoder != DEV_HW_DECODER_AUTOMATIC) {
-            return (this.devHardwareDecoder == DEV_HW_DECODER_OMX_DR ||
-                    this.devHardwareDecoder == DEV_HW_DECODER_MEDIACODEC_DR);
-        } else {
-            return this.hardwareAcceleration == HW_ACCELERATION_FULL;
-        }
-    }
-
-    public String[] getMediaOptions(boolean noHardwareAcceleration, boolean noVideo) {
-        if (this.devHardwareDecoder != DEV_HW_DECODER_AUTOMATIC)
-            noHardwareAcceleration = noVideo = false;
-        else if (!noHardwareAcceleration)
-            noHardwareAcceleration = getHardwareAcceleration() == HW_ACCELERATION_DISABLED;
-
-        ArrayList<String> options = new ArrayList<String>();
-
-        if (!noHardwareAcceleration) {
-            /*
-             * Set higher caching values if using iomx decoding, since some omx
-             * decoders have a very high latency, and if the preroll data isn't
-             * enough to make the decoder output a frame, the playback timing gets
-             * started too soon, and every decoded frame appears to be too late.
-             * On Nexus One, the decoder latency seems to be 25 input packets
-             * for 320x170 H.264, a few packets less on higher resolutions.
-             * On Nexus S, the decoder latency seems to be about 7 packets.
-             */
-            options.add(":file-caching=1500");
-            options.add(":network-caching=1500");
-            options.add(":codec="+ (this.devCodecList != null ? this.devCodecList : this.codecList));
-        }
-        if (noVideo)
-            options.add(":no-video");
-
-        return options.toArray(new String[options.size()]);
-    }
-
-    public String getSubtitlesEncoding() {
-        return subtitlesEncoding;
-    }
-
-    public void setSubtitlesEncoding(String subtitlesEncoding) {
-        this.subtitlesEncoding = subtitlesEncoding;
-    }
-
-    public int getAout() {
-        return aout;
-    }
-
-    public void setAout(int aout) {
-        if (aout < 0)
-            this.aout = LibVlcUtil.isICSOrLater() ? AOUT_OPENSLES : AOUT_AUDIOTRACK_JAVA;
-        else
-            this.aout = aout;
-    }
-
-    public int getVout() {
-        return vout;
-    }
-
-    public void setVout(int vout) {
-        if (vout < 0)
-            this.vout = VOUT_ANDROID_SURFACE;
-        else
-            this.vout = vout;
-    }
-
-    public boolean timeStretchingEnabled() {
-        return timeStretching;
-    }
-
-    public void setTimeStretching(boolean timeStretching) {
-        this.timeStretching = timeStretching;
-    }
-
-    public int getDeblocking() {
-        int ret = deblocking;
-        if(deblocking < 0) {
-            /**
-             * Set some reasonable deblocking defaults:
-             *
-             * Skip all (4) for armv6 and MIPS by default
-             * Skip non-ref (1) for all armv7 more than 1.2 Ghz and more than 2 cores
-             * Skip non-key (3) for all devices that don't meet anything above
-             */
-            LibVlcUtil.MachineSpecs m = LibVlcUtil.getMachineSpecs();
-            if (m == null)
-                return ret;
-            if( (m.hasArmV6 && !(m.hasArmV7)) || m.hasMips )
-                ret = 4;
-            else if(m.frequency >= 1200 && m.processors > 2)
-                ret = 1;
-            else if(m.bogoMIPS >= 1200 && m.processors > 2) {
-                ret = 1;
-                Log.d(TAG, "Used bogoMIPS due to lack of frequency info");
-            } else
-                ret = 3;
-        } else if(deblocking > 4) { // sanity check
-            ret = 3;
-        }
-        return ret;
-    }
-
-    public void setDeblocking(int deblocking) {
-        this.deblocking = deblocking;
-    }
-
-    public String getChroma() {
-        return chroma;
-    }
-
-    public void setChroma(String chroma) {
-        this.chroma = chroma.equals("YV12") && !LibVlcUtil.isGingerbreadOrLater() ? "" : chroma;
-    }
-
-    public boolean isVerboseMode() {
-        return verboseMode;
-    }
-
-    public void setVerboseMode(boolean verboseMode) {
-        this.verboseMode = verboseMode;
-    }
-
-    public float[] getEqualizer()
-    {
-        return equalizer;
-    }
-
-    public void setEqualizer(float[] equalizer)
-    {
-        this.equalizer = equalizer;
-        applyEqualizer();
-    }
-
-    private void applyEqualizer()
-    {
-        setNativeEqualizer(mInternalMediaPlayerInstance, this.equalizer);
-    }
-    private native int setNativeEqualizer(long mediaPlayer, float[] bands);
-
-    public boolean frameSkipEnabled() {
-        return frameSkip;
-    }
-
-    public void setFrameSkip(boolean frameskip) {
-        this.frameSkip = frameskip;
-    }
-
-    public int getNetworkCaching() {
-        return this.networkCaching;
-    }
-
-    public void setNetworkCaching(int networkcaching) {
-        this.networkCaching = networkcaching;
-    }
-
-    public boolean getHttpReconnect() {
-        return httpReconnect;
-    }
-
-    public void setHttpReconnect(boolean httpReconnect) {
-        this.httpReconnect = httpReconnect;
-    }
-
-    /**
-     * Initialize the libVLC class.
-     *
-     * This function must be called before using any libVLC functions.
-     *
-     * @throws LibVlcException
-     */
-    public void init(Context context) throws LibVlcException {
-        Log.v(TAG, "Initializing LibVLC");
-        mDebugLogBuffer = new StringBuffer();
-        if (!mIsInitialized) {
-            if(!LibVlcUtil.hasCompatibleCPU(context)) {
-                Log.e(TAG, LibVlcUtil.getErrorMsg());
-                throw new LibVlcException();
-            }
-
-            File cacheDir = context.getCacheDir();
-            mCachePath = (cacheDir != null) ? cacheDir.getAbsolutePath() : null;
-            nativeInit();
-            mMediaList = mPrimaryList = new MediaList(this);
-            setEventHandler(EventHandler.getInstance());
-            mIsInitialized = true;
-        }
-    }
-
-    /**
-     * Destroy this libVLC instance
-     * @note You must call it before exiting
-     */
-    public void destroy() {
-        Log.v(TAG, "Destroying LibVLC instance");
-        nativeDestroy();
-        detachEventHandler();
-        mIsInitialized = false;
-    }
-
-    /**
-     * Open the Java audio output.
-     * This function is called by the native code
-     */
-    public void initAout(int sampleRateInHz, int channels, int samples) {
-        Log.d(TAG, "Opening the java audio output");
-        mAout.init(sampleRateInHz, channels, samples);
-    }
-
-    /**
-     * Play an audio buffer taken from the native code
-     * This function is called by the native code
-     */
-    public void playAudio(byte[] audioData, int bufferSize) {
-        mAout.playBuffer(audioData, bufferSize);
-    }
-
-    /**
-     * Pause the Java audio output
-     * This function is called by the native code
-     */
-    public void pauseAout() {
-        Log.d(TAG, "Pausing the java audio output");
-        mAout.pause();
-    }
-
-    /**
-     * Close the Java audio output
-     * This function is called by the native code
-     */
-    public void closeAout() {
-        Log.d(TAG, "Closing the java audio output");
-        mAout.release();
-    }
-
-    /**
-     * Play a media from the media list (playlist)
-     *
-     * @param position The index of the media
-     */
-    public void playIndex(int position) {
-        String mrl = mMediaList.getMRL(position);
-        if (mrl == null)
-            return;
-        String[] options = mMediaList.getMediaOptions(position);
-        mInternalMediaPlayerIndex = position;
-        playMRL(mLibVlcInstance, mrl, options);
-    }
-
-    /**
-     * Play an MRL directly.
-     *
-     * @param mrl MRL of the media to play.
-     */
-    public void playMRL(String mrl) {
-        // index=-1 will return options from libvlc instance without relying on MediaList
-        String[] options = mMediaList.getMediaOptions(-1);
-        mInternalMediaPlayerIndex = 0;
-        playMRL(mLibVlcInstance, mrl, options);
-    }
-
-    public TrackInfo[] readTracksInfo(String mrl) {
-        return readTracksInfo(mLibVlcInstance, mrl);
-    }
-
-    /**
-     * Get a media thumbnail.
-     */
-    public byte[] getThumbnail(String mrl, int i_width, int i_height) {
-        return getThumbnail(mLibVlcInstance, mrl, i_width, i_height);
-    }
-
-    /**
-     * Return true if there is a video track in the file
-     */
-    public boolean hasVideoTrack(String mrl) throws java.io.IOException {
-        return hasVideoTrack(mLibVlcInstance, mrl);
-    }
-
-    /**
-     * Sets the speed of playback (1 being normal speed, 2 being twice as fast)
-     *
-     * @param rate
-     */
-    public native void setRate(float rate);
-
-    /**
-     * Get the current playback speed
-     */
-    public native float getRate();
-
-    /**
-     * Initialize the libvlc C library
-     * @return a pointer to the libvlc instance
-     */
-    private native void nativeInit() throws LibVlcException;
-
-    /**
-     * Close the libvlc C library
-     * @note mLibVlcInstance should be 0 after a call to destroy()
-     */
-    private native void nativeDestroy();
-
-    /**
-     * Start buffering to the mDebugLogBuffer.
-     */
-    public native void startDebugBuffer();
-    public native void stopDebugBuffer();
-    public String getBufferContent() {
-        return mDebugLogBuffer.toString();
-    }
-
-    public void clearBuffer() {
-        mDebugLogBuffer.setLength(0);
-    }
-
-    public boolean isDebugBuffering() {
-        return mIsBufferingLog;
-    }
-
-    /**
-     * Play an mrl
-     */
-    private native void playMRL(long instance, String mrl, String[] mediaOptions);
-
-    /**
-     * Returns true if any media is playing
-     */
-    public native boolean isPlaying();
-
-    /**
-     * Returns true if any media is seekable
-     */
-    public native boolean isSeekable();
-
-    /**
-     * Plays any loaded media
-     */
-    public native void play();
-
-    /**
-     * Pauses any playing media
-     */
-    public native void pause();
-
-    /**
-     * Stops any playing media
-     */
-    public native void stop();
-
-    /**
-     * Get player state.
-     */
-    public native int getPlayerState();
-
-    /**
-     * Gets volume as integer
-     */
-    public native int getVolume();
-
-    /**
-     * Sets volume as integer
-     * @param volume: Volume level passed as integer
-     */
-    public native int setVolume(int volume);
-
-    /**
-     * Gets the current movie time (in ms).
-     * @return the movie time (in ms), or -1 if there is no media.
-     */
-    public native long getTime();
-
-    /**
-     * Sets the movie time (in ms), if any media is being played.
-     * @param time: Time in ms.
-     * @return the movie time (in ms), or -1 if there is no media.
-     */
-    public native long setTime(long time);
-
-    /**
-     * Gets the movie position.
-     * @return the movie position, or -1 for any error.
-     */
-    public native float getPosition();
-
-    /**
-     * Sets the movie position.
-     * @param pos: movie position.
-     */
-    public native void setPosition(float pos);
-
-    /**
-     * Gets current movie's length in ms.
-     * @return the movie length (in ms), or -1 if there is no media.
-     */
-    public native long getLength();
-
-    /**
-     * Get the libVLC version
-     * @return the libVLC version string
-     */
-    public native String version();
-
-    /**
-     * Get the libVLC compiler
-     * @return the libVLC compiler string
-     */
-    public native String compiler();
-
-    /**
-     * Get the libVLC changeset
-     * @return the libVLC changeset string
-     */
-    public native String changeset();
-
-    /**
-     * Get a media thumbnail.
-     * @return a bytearray with the RGBA thumbnail data inside.
-     */
-    private native byte[] getThumbnail(long instance, String mrl, int i_width, int i_height);
-
-    /**
-     * Return true if there is a video track in the file
-     */
-    private native boolean hasVideoTrack(long instance, String mrl);
-
-    private native TrackInfo[] readTracksInfo(long instance, String mrl);
-
-    public native TrackInfo[] readTracksInfoInternal();
-
-    public native int getAudioTracksCount();
-
-    public native Map<Integer,String> getAudioTrackDescription();
-
-    public native Map<String, Object> getStats();
-
-    public native int getAudioTrack();
-
-    public native int setAudioTrack(int index);
-
-    public native int getVideoTracksCount();
-
-    public native int addSubtitleTrack(String path);
-
-    public native Map<Integer,String> getSpuTrackDescription();
-
-    public native int getSpuTrack();
-
-    public native int setSpuTrack(int index);
-
-    public native int getSpuTracksCount();
-
-    public static native String nativeToURI(String path);
-    
-    public native static void sendMouseEvent( int action, int button, int x, int y);
-
-    /**
-     * Quickly converts path to URIs, which are mandatory in libVLC.
-     *
-     * @param path
-     *            The path to be converted.
-     * @return A URI representation of path
-     */
-    public static String PathToURI(String path) {
-        if(path == null) {
-            throw new NullPointerException("Cannot convert null path!");
-        }
-        return LibVLC.nativeToURI(path);
-    }
-
-    public static native void nativeReadDirectory(String path, ArrayList<String> res);
-
-    public native static boolean nativeIsPathDirectory(String path);
-
-     /**
-      * Expand and continue playing the current media.
-      *
-      * @return the index of the media was expanded, and -1 if no media was expanded
-      */
-    public int expandAndPlay() {
-        int r = mMediaList.expandMedia(mInternalMediaPlayerIndex);
-        if(r == 0)
-            this.playIndex(mInternalMediaPlayerIndex);
-        return r;
-    }
-
-    /**
-     * Expand the current media.
-     * @return the index of the media was expanded, and -1 if no media was expanded
-     */
-    public int expand() {
-        return mMediaList.expandMedia(mInternalMediaPlayerIndex);
-    }
-
-    private native void setEventHandler(EventHandler eventHandler);
-
-    private native void detachEventHandler();
-
-    public native float[] getBands();
-
-    public native String[] getPresets();
-
-    public native float[] getPreset(int index);
-
-    public static interface OnNativeCrashListener {
-        public void onNativeCrash();
-    }
-
-    public void setOnNativeCrashListener(OnNativeCrashListener l) {
-        mOnNativeCrashListener = l;
-    }
-
-    private void onNativeCrash() {
-        if (mOnNativeCrashListener != null)
-            mOnNativeCrashListener.onNativeCrash();
-    }
-
-    public String getCachePath() {
-        return mCachePath;
-    }
-
-    public native int getTitle();
-    public native void setTitle(int title);
-    public native int getChapterCountForTitle(int title);
-    public native int getTitleCount();
-    public native void playerNavigate(int navigate);
-
-}
diff --git a/vlc-android/src/org/videolan/libvlc/LibVlcException.java b/vlc-android/src/org/videolan/libvlc/LibVlcException.java
deleted file mode 100644
index f676f13..0000000
--- a/vlc-android/src/org/videolan/libvlc/LibVlcException.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * LibVlcException.java
- *****************************************************************************
- * Copyright © 2011-2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/**
- * LibVlcException: exceptions thrown by the native LibVLC interface
- */
-package org.videolan.libvlc;
-
-/**
- * @author jpeg
- *
- */
-public class LibVlcException extends Exception {
-    private static final long serialVersionUID = -1909522348226924189L;
-
-    /**
-     * Create an empty error
-     */
-    public LibVlcException() {
-        super();
-    }
-
-    /**
-     * @param detailMessage
-     */
-    public LibVlcException(String detailMessage) {
-        super(detailMessage);
-    }
-
-    /**
-     * @param throwable
-     */
-    public LibVlcException(Throwable throwable) {
-        super(throwable);
-    }
-
-    /**
-     * @param detailMessage
-     * @param throwable
-     */
-    public LibVlcException(String detailMessage, Throwable throwable) {
-        super(detailMessage, throwable);
-    }
-
-}
diff --git a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
deleted file mode 100644
index 0ddf780..0000000
--- a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
+++ /dev/null
@@ -1,539 +0,0 @@
-/*****************************************************************************
- * LibVlcUtil.java
- *****************************************************************************
- * Copyright © 2011-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.Locale;
-
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.net.Uri;
-import android.os.Build;
-import android.util.Log;
-
-public class LibVlcUtil {
-    public final static String TAG = "VLC/LibVLC/Util";
-
-    public static boolean isFroyoOrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO;
-    }
-
-    public static boolean isGingerbreadOrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD;
-    }
-
-    public static boolean isHoneycombOrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
-    }
-
-    public static boolean isICSOrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
-    }
-
-    public static boolean isJellyBeanOrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN;
-    }
-
-    public static boolean isJellyBeanMR1OrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
-    }
-
-    public static boolean isJellyBeanMR2OrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
-    }
-
-    public static boolean isKitKatOrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT;
-    }
-
-    public static boolean isLolliPopOrLater()
-    {
-        return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP;
-    }
-
-    private static String errorMsg = null;
-    private static boolean isCompatible = false;
-    public static String getErrorMsg() {
-        return errorMsg;
-    }
-
-    public static File URItoFile(String URI) {
-        if(URI == null) return null;
-        return new File(Uri.decode(URI).replace("file://",""));
-    }
-
-    public static String URItoFileName(String URI) {
-        if(URI == null) return null;
-        return URItoFile(URI).getName();
-    }
-
-    public static boolean hasCompatibleCPU(Context context)
-    {
-        // If already checked return cached result
-        if(errorMsg != null || isCompatible) return isCompatible;
-
-        final File lib = searchLibrary(context);
-        if (lib == null)
-            return true;
-
-        ElfData elf = readLib(lib);
-        if(elf == null) {
-            Log.e(TAG, "WARNING: Unable to read libvlcjni.so; cannot check device ABI!");
-            Log.e(TAG, "WARNING: Cannot guarantee correct ABI for this build (may crash)!");
-            return true;
-        }
-
-        String CPU_ABI = android.os.Build.CPU_ABI;
-        String CPU_ABI2 = "none";
-        if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { // CPU_ABI2 since 2.2
-            try {
-                CPU_ABI2 = (String)android.os.Build.class.getDeclaredField("CPU_ABI2").get(null);
-            } catch (Exception e) { }
-        }
-
-        final boolean elfHasX86 = elf.e_machine == EM_386 || elf.e_machine == EM_X86_64;
-        final boolean elfHasArm = elf.e_machine == EM_ARM || elf.e_machine == EM_AARCH64;
-        final boolean elfHasMips = elf.e_machine == EM_MIPS;
-        final boolean elfIs64bits = elf.is64bits;
-
-        Log.i(TAG, "machine = " + (elfHasArm ? "arm" : elfHasX86 ? "x86" : "mips") + ", " +
-                                  (elfIs64bits ? "64bits" : "32bits"));
-        Log.i(TAG, "arch = " + elf.att_arch);
-        Log.i(TAG, "fpu = " + elf.att_fpu);
-        boolean hasNeon = false, hasFpu = false, hasArmV6 = false,
-                hasArmV7 = false, hasMips = false, hasX86 = false, is64bits = false;
-        float bogoMIPS = -1;
-        int processors = 0;
-
-        if(CPU_ABI.equals("x86") ||
-           CPU_ABI2.equals("x86")) {
-            hasX86 = true;
-        } else if(CPU_ABI.equals("x86_64") ||
-                  CPU_ABI2.equals("x86_64")) {
-            hasX86 = true;
-            is64bits = true;
-        } else if(CPU_ABI.equals("armeabi-v7a") ||
-                  CPU_ABI2.equals("armeabi-v7a")) {
-            hasArmV7 = true;
-            hasArmV6 = true; /* Armv7 is backwards compatible to < v6 */
-        } else if(CPU_ABI.equals("armeabi") ||
-                  CPU_ABI2.equals("armeabi")) {
-            hasArmV6 = true;
-        } else if(CPU_ABI.equals("arm64-v8a") ||
-                CPU_ABI2.equals("arm64-v8a")) {
-            hasNeon = true;
-            hasArmV6 = true;
-            hasArmV7 = true;
-            is64bits = true;
-        }
-
-        try {
-            FileReader fileReader = new FileReader("/proc/cpuinfo");
-            BufferedReader br = new BufferedReader(fileReader);
-            String line;
-            while((line = br.readLine()) != null) {
-                if(!hasArmV7 && line.contains("AArch64")) {
-                    hasArmV7 = true;
-                    hasArmV6 = true; /* Armv8 is backwards compatible to < v7 */
-                }
-                if(!hasArmV7 && line.contains("ARMv7")) {
-                    hasArmV7 = true;
-                    hasArmV6 = true; /* Armv7 is backwards compatible to < v6 */
-                }
-                if(!hasArmV7 && !hasArmV6 && line.contains("ARMv6"))
-                    hasArmV6 = true;
-                // "clflush size" is a x86-specific cpuinfo tag.
-                // (see kernel sources arch/x86/kernel/cpu/proc.c)
-                if(line.contains("clflush size"))
-                    hasX86 = true;
-                if(line.contains("GenuineIntel"))
-                    hasX86 = true;
-                // "microsecond timers" is specific to MIPS.
-                // see arch/mips/kernel/proc.c
-                if(line.contains("microsecond timers"))
-                    hasMips = true;
-                if(!hasNeon && (line.contains("neon") || line.contains("asimd")))
-                    hasNeon = true;
-                if(!hasFpu && (line.contains("vfp") || (line.contains("Features") && line.contains("fp"))))
-                    hasFpu = true;
-                if(line.startsWith("processor"))
-                    processors++;
-                if(bogoMIPS < 0 && line.toLowerCase(Locale.ENGLISH).contains("bogomips")) {
-                    String[] bogo_parts = line.split(":");
-                    try {
-                        bogoMIPS = Float.parseFloat(bogo_parts[1].trim());
-                    } catch(NumberFormatException e) {
-                        bogoMIPS = -1; // invalid bogomips
-                    }
-                }
-            }
-            fileReader.close();
-        } catch(IOException ex){
-            ex.printStackTrace();
-            errorMsg = "IOException whilst reading cpuinfo flags";
-            isCompatible = false;
-            return false;
-        }
-        if(processors == 0)
-            processors = 1; // possibly borked cpuinfo?
-
-        // Enforce proper architecture to prevent problems
-        if(elfHasX86 && !hasX86) {
-            errorMsg = "x86 build on non-x86 device";
-            isCompatible = false;
-            return false;
-        } else if(elfHasArm && hasX86) {
-            errorMsg = "ARM build on x86 device";
-            isCompatible = false;
-            return false;
-        }
-
-        if(elfHasMips && !hasMips) {
-            errorMsg = "MIPS build on non-MIPS device";
-            isCompatible = false;
-            return false;
-        } else if(elfHasArm && hasMips) {
-            errorMsg = "ARM build on MIPS device";
-            isCompatible = false;
-            return false;
-        }
-
-        if(elf.e_machine == EM_ARM && elf.att_arch.startsWith("v7") && !hasArmV7) {
-            errorMsg = "ARMv7 build on non-ARMv7 device";
-            isCompatible = false;
-            return false;
-        }
-        if(elf.e_machine == EM_ARM) {
-            if(elf.att_arch.startsWith("v6") && !hasArmV6) {
-                errorMsg = "ARMv6 build on non-ARMv6 device";
-                isCompatible = false;
-                return false;
-            } else if(elf.att_fpu && !hasFpu) {
-                errorMsg = "FPU-enabled build on non-FPU device";
-                isCompatible = false;
-                return false;
-            }
-        }
-        if (elfIs64bits && !is64bits) {
-            errorMsg = "64bits build on 32bits device";
-            isCompatible = false;
-        }
-
-        float frequency = -1;
-        try {
-            FileReader fileReader = new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
-            BufferedReader br = new BufferedReader(fileReader);
-            String line = "";
-            try {
-                line = br.readLine();
-                frequency = Float.parseFloat(line) / 1000.f; /* Convert to MHz */
-            } catch(NumberFormatException e) {
-                Log.w(TAG, "Could not parse maximum CPU frequency!");
-                Log.w(TAG, "Failed to parse: " + line);
-            }
-            fileReader.close();
-        } catch(IOException ex) {
-            Log.w(TAG, "Could not find maximum CPU frequency!");
-        }
-
-        errorMsg = null;
-        isCompatible = true;
-        // Store into MachineSpecs
-        machineSpecs = new MachineSpecs();
-        machineSpecs.hasArmV6 = hasArmV6;
-        machineSpecs.hasArmV7 = hasArmV7;
-        machineSpecs.hasFpu = hasFpu;
-        machineSpecs.hasMips = hasMips;
-        machineSpecs.hasNeon = hasNeon;
-        machineSpecs.hasX86 = hasX86;
-        machineSpecs.is64bits = is64bits;
-        machineSpecs.bogoMIPS = bogoMIPS;
-        machineSpecs.processors = processors;
-        machineSpecs.frequency = frequency;
-        return true;
-    }
-
-    public static MachineSpecs getMachineSpecs() {
-        return machineSpecs;
-    }
-    private static MachineSpecs machineSpecs = null;
-    public static class MachineSpecs {
-        public boolean hasNeon;
-        public boolean hasFpu;
-        public boolean hasArmV6;
-        public boolean hasArmV7;
-        public boolean hasMips;
-        public boolean hasX86;
-        public boolean is64bits;
-        public float bogoMIPS;
-        public int processors;
-        public float frequency; /* in MHz */
-    }
-
-    private static final int EM_386 = 3;
-    private static final int EM_MIPS = 8;
-    private static final int EM_ARM = 40;
-    private static final int EM_X86_64 = 62;
-    private static final int EM_AARCH64 = 183;
-    private static final int ELF_HEADER_SIZE = 52;
-    private static final int SECTION_HEADER_SIZE = 40;
-    private static final int SHT_ARM_ATTRIBUTES = 0x70000003;
-    private static class ElfData {
-        ByteOrder order;
-        boolean is64bits;
-        int e_machine;
-        int e_shoff;
-        int e_shnum;
-        int sh_offset;
-        int sh_size;
-        String att_arch;
-        boolean att_fpu;
-    }
-
-    private static File searchLibrary(Context context) {
-        // Search for library path
-        String [] libraryPaths = null;
-        final ApplicationInfo applicationInfo = context.getApplicationInfo();
-
-        if ((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
-            final String property = System.getProperty("java.library.path");
-            libraryPaths = property.split(":");
-        } else {
-            libraryPaths = new String[1];
-            if (isGingerbreadOrLater())
-                libraryPaths[0] = applicationInfo.nativeLibraryDir;
-            else
-                libraryPaths[0] = applicationInfo.dataDir + "/lib";
-        }
-        if (libraryPaths == null) {
-            Log.e(TAG, "can't find library path");
-            return null;
-        }
-
-        // Search for libvlcjni.so
-        File lib = null;
-        for (String libraryPath : libraryPaths) {
-            lib = new File(libraryPath, "libvlcjni.so");
-            if (lib.exists() && lib.canRead())
-                return lib;;
-        }
-        Log.e(TAG, "WARNING: Can't find shared library");
-        return null;
-    }
-
-    /** '*' prefix means it's unsupported */
-    private static String[] CPU_archs = {"*Pre-v4", "*v4", "*v4T",
-                                         "v5T", "v5TE", "v5TEJ",
-                                         "v6", "v6KZ", "v6T2", "v6K", "v7",
-                                         "*v6-M", "*v6S-M", "*v7E-M", "*v8"};
-
-    private static ElfData readLib(File file) {
-        RandomAccessFile in = null;
-        try {
-            in = new RandomAccessFile(file, "r");
-
-            ElfData elf = new ElfData();
-            if (!readHeader(in, elf))
-                return null;
-
-            switch (elf.e_machine) {
-                case EM_386:
-                case EM_MIPS:
-                case EM_X86_64:
-                case EM_AARCH64:
-                    return elf;
-                case EM_ARM:
-                    in.close();
-                    in = new RandomAccessFile(file, "r");
-                    if (!readSection(in, elf))
-                        return null;
-                    in.close();
-                    in = new RandomAccessFile(file, "r");
-                    if (!readArmAttributes(in, elf))
-                        return null;
-                    break;
-                default:
-                    return null;
-            }
-            return elf;
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (in != null)
-                    in.close();
-            } catch (IOException e) {
-            }
-        }
-        return null;
-    }
-
-    private static boolean readHeader(RandomAccessFile in, ElfData elf) throws IOException {
-        // http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html
-        byte[] bytes = new byte[ELF_HEADER_SIZE];
-        in.readFully(bytes);
-        if (bytes[0] != 127 ||
-                bytes[1] != 'E' ||
-                bytes[2] != 'L' ||
-                bytes[3] != 'F' ||
-                (bytes[4] != 1 && bytes[4] != 2)) {
-            Log.e(TAG, "ELF header invalid");
-            return false;
-        }
-
-        elf.is64bits = bytes[4] == 2;
-        elf.order = bytes[5] == 1
-                ? ByteOrder.LITTLE_ENDIAN // ELFDATA2LSB
-                : ByteOrder.BIG_ENDIAN;   // ELFDATA2MSB
-
-        // wrap bytes in a ByteBuffer to force endianess
-        ByteBuffer buffer = ByteBuffer.wrap(bytes);
-        buffer.order(elf.order);
-
-        elf.e_machine = buffer.getShort(18);    /* Architecture */
-        elf.e_shoff = buffer.getInt(32);        /* Section header table file offset */
-        elf.e_shnum = buffer.getShort(48);      /* Section header table entry count */
-        return true;
-    }
-
-    private static boolean readSection(RandomAccessFile in, ElfData elf) throws IOException {
-        byte[] bytes = new byte[SECTION_HEADER_SIZE];
-        in.seek(elf.e_shoff);
-
-        for (int i = 0; i < elf.e_shnum; ++i) {
-            in.readFully(bytes);
-
-            // wrap bytes in a ByteBuffer to force endianess
-            ByteBuffer buffer = ByteBuffer.wrap(bytes);
-            buffer.order(elf.order);
-
-            int sh_type = buffer.getInt(4); /* Section type */
-            if (sh_type != SHT_ARM_ATTRIBUTES)
-                continue;
-
-            elf.sh_offset = buffer.getInt(16);  /* Section file offset */
-            elf.sh_size = buffer.getInt(20);    /* Section size in bytes */
-            return true;
-        }
-
-        return false;
-    }
-
-    private static boolean readArmAttributes(RandomAccessFile in, ElfData elf) throws IOException {
-        byte[] bytes = new byte[elf.sh_size];
-        in.seek(elf.sh_offset);
-        in.readFully(bytes);
-
-        // wrap bytes in a ByteBuffer to force endianess
-        ByteBuffer buffer = ByteBuffer.wrap(bytes);
-        buffer.order(elf.order);
-
-        //http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf
-        //http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045d/IHI0045D_ABI_addenda.pdf
-        if (buffer.get() != 'A') // format-version
-            return false;
-
-        // sub-sections loop
-        while (buffer.remaining() > 0) {
-            int start_section = buffer.position();
-            int length = buffer.getInt();
-            String vendor = getString(buffer);
-            if (vendor.equals("aeabi")) {
-                // tags loop
-                while (buffer.position() < start_section + length) {
-                    int start = buffer.position();
-                    int tag = buffer.get();
-                    int size = buffer.getInt();
-                    // skip if not Tag_File, we don't care about others
-                    if (tag != 1) {
-                        buffer.position(start + size);
-                        continue;
-                    }
-
-                    // attributes loop
-                    while (buffer.position() < start + size) {
-                        tag = getUleb128(buffer);
-                        if (tag == 6) { // CPU_arch
-                            int arch = getUleb128(buffer);
-                            elf.att_arch = CPU_archs[arch];
-                        }
-                        else if (tag == 27) { // ABI_HardFP_use
-                            getUleb128(buffer);
-                            elf.att_fpu = true;
-                        }
-                        else {
-                            // string for 4=CPU_raw_name / 5=CPU_name / 32=compatibility
-                            // string for >32 && odd tags
-                            // uleb128 for other
-                            tag %= 128;
-                            if (tag == 4 || tag == 5 || tag == 32 || (tag > 32 && (tag & 1) != 0))
-                                getString(buffer);
-                            else
-                                getUleb128(buffer);
-                        }
-                    }
-                }
-                break;
-            }
-        }
-        return true;
-    }
-
-    private static String getString(ByteBuffer buffer) {
-        StringBuilder sb = new StringBuilder(buffer.limit());
-        while (buffer.remaining() > 0) {
-            char c = (char) buffer.get();
-            if (c == 0)
-                break;
-            sb.append(c);
-        }
-        return sb.toString();
-    }
-
-    private static int getUleb128(ByteBuffer buffer) {
-        int ret = 0;
-        int c;
-        do {
-            ret <<= 7;
-            c = buffer.get();
-            ret |= c & 0x7f;
-        } while((c & 0x80) > 0);
-
-        return ret;
-    }
-}
diff --git a/vlc-android/src/org/videolan/libvlc/Media.java b/vlc-android/src/org/videolan/libvlc/Media.java
deleted file mode 100644
index 29b9d94..0000000
--- a/vlc-android/src/org/videolan/libvlc/Media.java
+++ /dev/null
@@ -1,433 +0,0 @@
-/*****************************************************************************
- * Media.java
- *****************************************************************************
- * Copyright © 2011-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Locale;
-
-import android.graphics.Bitmap;
-import android.util.Log;
-
-public class Media implements Comparable<Media> {
-    public final static String TAG = "VLC/LibVLC/Media";
-
-    public final static HashSet<String> VIDEO_EXTENSIONS;
-    public final static HashSet<String> AUDIO_EXTENSIONS;
-    public final static String EXTENSIONS_REGEX;
-    public final static HashSet<String> FOLDER_BLACKLIST;
-
-    static {
-        String[] video_extensions = {
-                ".3g2", ".3gp", ".3gp2", ".3gpp", ".amv", ".asf", ".avi", ".divx", ".drc", ".dv",
-                ".f4v", ".flv", ".gvi", ".gxf", ".ismv", ".iso", ".m1v", ".m2v", ".m2t", ".m2ts",
-                ".m4v", ".mkv", ".mov", ".mp2", ".mp2v", ".mp4", ".mp4v", ".mpe", ".mpeg",
-                ".mpeg1", ".mpeg2", ".mpeg4", ".mpg", ".mpv2", ".mts", ".mtv", ".mxf", ".mxg",
-                ".nsv", ".nut", ".nuv", ".ogm", ".ogv", ".ogx", ".ps", ".rec", ".rm", ".rmvb",
-                ".tod", ".ts", ".tts", ".vob", ".vro", ".webm", ".wm", ".wmv", ".wtv", ".xesc" };
-
-        String[] audio_extensions = {
-                ".3ga", ".a52", ".aac", ".ac3", ".adt", ".adts", ".aif", ".aifc", ".aiff", ".amr",
-                ".aob", ".ape", ".awb", ".caf", ".dts", ".flac", ".it", ".m4a", ".m4b", ".m4p",
-                ".mid", ".mka", ".mlp", ".mod", ".mpa", ".mp1", ".mp2", ".mp3", ".mpc", ".mpga",
-                ".oga", ".ogg", ".oma", ".opus", ".ra", ".ram", ".rmi", ".s3m", ".spx", ".tta",
-                ".voc", ".vqf", ".w64", ".wav", ".wma", ".wv", ".xa", ".xm" };
-
-        String[] folder_blacklist = {
-                "/alarms",
-                "/notifications",
-                "/ringtones",
-                "/media/alarms",
-                "/media/notifications",
-                "/media/ringtones",
-                "/media/audio/alarms",
-                "/media/audio/notifications",
-                "/media/audio/ringtones",
-                "/Android/data/" };
-
-        VIDEO_EXTENSIONS = new HashSet<String>();
-        for (String item : video_extensions)
-            VIDEO_EXTENSIONS.add(item);
-        AUDIO_EXTENSIONS = new HashSet<String>();
-        for (String item : audio_extensions)
-            AUDIO_EXTENSIONS.add(item);
-
-        StringBuilder sb = new StringBuilder(115);
-        sb.append(".+(\\.)((?i)(");
-        sb.append(video_extensions[0].substring(1));
-        for(int i = 1; i < video_extensions.length; i++) {
-            sb.append('|');
-            sb.append(video_extensions[i].substring(1));
-        }
-        for(int i = 0; i < audio_extensions.length; i++) {
-            sb.append('|');
-            sb.append(audio_extensions[i].substring(1));
-        }
-        sb.append("))");
-        EXTENSIONS_REGEX = sb.toString();
-        FOLDER_BLACKLIST = new HashSet<String>();
-        for (String item : folder_blacklist)
-            FOLDER_BLACKLIST.add(android.os.Environment.getExternalStorageDirectory().getPath() + item);
-    }
-
-    public final static int TYPE_ALL = -1;
-    public final static int TYPE_VIDEO = 0;
-    public final static int TYPE_AUDIO = 1;
-    public final static int TYPE_GROUP = 2;
-
-    /** Metadata from libvlc_media */
-    protected String mTitle;
-    private String mArtist;
-    private String mGenre;
-    private String mCopyright;
-    private String mAlbum;
-    private String mTrackNumber;
-    private String mDescription;
-    private String mRating;
-    private String mDate;
-    private String mSettings;
-    private String mNowPlaying;
-    private String mPublisher;
-    private String mEncodedBy;
-    private String mTrackID;
-    private String mArtworkURL;
-
-    private final String mLocation;
-    private String mFilename;
-    private long mTime = 0;
-    private int mAudioTrack = -1;
-    private int mSpuTrack = -2;
-    private long mLength = 0;
-    private int mType;
-    private int mWidth = 0;
-    private int mHeight = 0;
-    private Bitmap mPicture;
-    private boolean mIsPictureParsed;
-
-    /**
-     * Create a new Media
-     * @param libVLC A pointer to the libVLC instance. Should not be NULL
-     * @param URI The URI of the media.
-     */
-    public Media(LibVLC libVLC, String URI) {
-        if(libVLC == null)
-            throw new NullPointerException("libVLC was null");
-
-        mLocation = URI;
-
-        mType = TYPE_ALL;
-        TrackInfo[] tracks = libVLC.readTracksInfo(mLocation);
-
-        extractTrackInfo(tracks);
-    }
-
-    private void extractTrackInfo(TrackInfo[] tracks) {
-        if (tracks == null)
-            return;
-
-        for (TrackInfo track : tracks) {
-            if (track.Type == TrackInfo.TYPE_VIDEO) {
-                mType = TYPE_VIDEO;
-                mWidth = track.Width;
-                mHeight = track.Height;
-            } else if (mType == TYPE_ALL && track.Type == TrackInfo.TYPE_AUDIO){
-                mType = TYPE_AUDIO;
-            } else if (track.Type == TrackInfo.TYPE_META) {
-                mLength = track.Length;
-                mTitle = track.Title;
-                mArtist = getValueWrapper(track.Artist, UnknownStringType.Artist);
-                mAlbum = getValueWrapper(track.Album, UnknownStringType.Album);
-                mGenre = getValueWrapper(track.Genre, UnknownStringType.Genre);
-                mArtworkURL = track.ArtworkURL;
-                Log.d(TAG, "Title " + mTitle);
-                Log.d(TAG, "Artist " + mArtist);
-                Log.d(TAG, "Genre " + mGenre);
-                Log.d(TAG, "Album " + mAlbum);
-            }
-        }
-
-        /* No useful ES found */
-        if (mType == TYPE_ALL) {
-            int dotIndex = mLocation.lastIndexOf(".");
-            if (dotIndex != -1) {
-                String fileExt = mLocation.substring(dotIndex).toLowerCase(Locale.ENGLISH);
-                if( Media.VIDEO_EXTENSIONS.contains(fileExt) ) {
-                    mType = TYPE_VIDEO;
-                } else if (Media.AUDIO_EXTENSIONS.contains(fileExt)) {
-                    mType = TYPE_AUDIO;
-                }
-            }
-        }
-    }
-
-    public Media(String location, long time, long length, int type,
-            Bitmap picture, String title, String artist, String genre, String album,
-            int width, int height, String artworkURL, int audio, int spu) {
-        mLocation = location;
-        mFilename = null;
-        mTime = time;
-        mAudioTrack = audio;
-        mSpuTrack = spu;
-        mLength = length;
-        mType = type;
-        mPicture = picture;
-        mWidth = width;
-        mHeight = height;
-
-        mTitle = title;
-        mArtist = getValueWrapper(artist, UnknownStringType.Artist);
-        mGenre = getValueWrapper(genre, UnknownStringType.Genre);
-        mAlbum = getValueWrapper(album, UnknownStringType.Album);
-        mArtworkURL = artworkURL;
-    }
-
-    private enum UnknownStringType { Artist , Genre, Album };
-    /**
-     * Uses introspection to read VLC l10n databases, so that we can sever the
-     * hard-coded dependency gracefully for 3rd party libvlc apps while still
-     * maintaining good l10n in VLC for Android.
-     *
-     * @see org.videolan.vlc.util.Util#getValue(String, int)
-     *
-     * @param string The default string
-     * @param type Alias for R.string.xxx
-     * @return The default string if not empty or string from introspection
-     */
-    private static String getValueWrapper(String string, UnknownStringType type) {
-        if(string != null && string.length() > 0) return string;
-
-        try {
-            Class<?> stringClass = Class.forName("org.videolan.vlc.R$string");
-            Class<?> utilClass = Class.forName("org.videolan.vlc.Util");
-
-            Integer value;
-            switch(type) {
-            case Album:
-                value = (Integer)stringClass.getField("unknown_album").get(null);
-                break;
-            case Genre:
-                value = (Integer)stringClass.getField("unknown_genre").get(null);
-                break;
-            case Artist:
-            default:
-                value = (Integer)stringClass.getField("unknown_artist").get(null);
-                break;
-            }
-
-            Method getValueMethod = utilClass.getDeclaredMethod("getValue", String.class, Integer.TYPE);
-            // Util.getValue(string, R.string.xxx);
-            return (String) getValueMethod.invoke(null, string, value);
-        } catch (ClassNotFoundException e) {
-        } catch (IllegalArgumentException e) {
-        } catch (IllegalAccessException e) {
-        } catch (NoSuchFieldException e) {
-        } catch (NoSuchMethodException e) {
-        } catch (InvocationTargetException e) {
-        }
-
-        // VLC for Android translations not available (custom app perhaps)
-        // Use hardcoded English phrases.
-        switch(type) {
-        case Album:
-            return "Unknown Album";
-        case Genre:
-            return "Unknown Genre";
-        case Artist:
-        default:
-            return "Unknown Artist";
-        }
-    }
-
-    /**
-     * Compare the filenames to sort items
-     */
-    @Override
-    public int compareTo(Media another) {
-        return mTitle.toUpperCase(Locale.getDefault()).compareTo(
-                another.getTitle().toUpperCase(Locale.getDefault()));
-    }
-
-    public String getLocation() {
-        return mLocation;
-    }
-
-    public void updateMeta() {
-
-    }
-
-    public String getFileName() {
-        if (mFilename == null) {
-            mFilename = LibVlcUtil.URItoFileName(mLocation);
-        }
-        return mFilename;
-    }
-
-    public long getTime() {
-        return mTime;
-    }
-
-    public void setTime(long time) {
-        mTime = time;
-    }
-
-    public int getAudioTrack() {
-        return mAudioTrack;
-    }
-
-    public void setAudioTrack(int track) {
-        mAudioTrack = track;
-    }
-
-    public int getSpuTrack() {
-        return mSpuTrack;
-    }
-
-    public void setSpuTrack(int track) {
-        mSpuTrack = track;
-    }
-
-    public long getLength() {
-        return mLength;
-    }
-
-    public int getType() {
-        return mType;
-    }
-
-    public int getWidth() {
-        return mWidth;
-    }
-
-    public int getHeight() {
-        return mHeight;
-    }
-
-    /**
-     * Returns the raw picture object. Likely to be NULL in VLC for Android
-     * due to lazy-loading.
-     *
-     * Use {@link org.videolan.vlc.util.Bitmap#getPictureFromCache(Media)} instead.
-     *
-     * @return The raw picture or NULL
-     */
-    public Bitmap getPicture() {
-        return mPicture;
-    }
-
-    /**
-     * Sets the raw picture object.
-     *
-     * In VLC for Android, use {@link org.videolan.vlc.MediaDatabase#setPicture(Media, Bitmap)} instead.
-     *
-     * @param p
-     */
-    public void setPicture(Bitmap p) {
-        mPicture = p;
-    }
-
-    public boolean isPictureParsed() {
-        return mIsPictureParsed;
-    }
-
-    public void setPictureParsed(boolean isParsed) {
-        mIsPictureParsed = isParsed;
-    }
-
-    public String getTitle() {
-        if (mTitle != null && mType != TYPE_VIDEO)
-            return mTitle;
-        else {
-            String fileName = getFileName();
-            if (fileName == null)
-                return "";
-            int end = fileName.lastIndexOf(".");
-            if (end <= 0)
-                return fileName;
-            return fileName.substring(0, end);
-        }
-    }
-
-    public String getSubtitle() {
-        return mType != TYPE_VIDEO ? mArtist + " - " + mAlbum : "";
-    }
-
-    public String getArtist() {
-        return mArtist;
-    }
-
-    public String getGenre() {
-        if(getValueWrapper(null, UnknownStringType.Genre).equals(mGenre))
-            return mGenre;
-        else if( mGenre.length() > 1)/* Make genres case insensitive via normalisation */
-            return Character.toUpperCase(mGenre.charAt(0)) + mGenre.substring(1).toLowerCase(Locale.getDefault());
-        else
-            return mGenre;
-    }
-
-    public String getCopyright() {
-        return mCopyright;
-    }
-
-    public String getAlbum() {
-        return mAlbum;
-    }
-
-    public String getTrackNumber() {
-        return mTrackNumber;
-    }
-
-    public String getDescription() {
-        return mDescription;
-    }
-
-    public String getRating() {
-        return mRating;
-    }
-
-    public String getDate() {
-        return mDate;
-    }
-
-    public String getSettings() {
-        return mSettings;
-    }
-
-    public String getNowPlaying() {
-        return mNowPlaying;
-    }
-
-    public String getPublisher() {
-        return mPublisher;
-    }
-
-    public String getEncodedBy() {
-        return mEncodedBy;
-    }
-
-    public String getTrackID() {
-        return mTrackID;
-    }
-
-    public String getArtworkURL() {
-        return mArtworkURL;
-    }
-}
diff --git a/vlc-android/src/org/videolan/libvlc/MediaList.java b/vlc-android/src/org/videolan/libvlc/MediaList.java
deleted file mode 100644
index 666568e..0000000
--- a/vlc-android/src/org/videolan/libvlc/MediaList.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*****************************************************************************
- * MediaList.java
- *****************************************************************************
- * Copyright © 2013 VLC authors and VideoLAN
- * Copyright © 2013 Edward Wang
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-package org.videolan.libvlc;
-
-import java.util.ArrayList;
-
-import android.os.Bundle;
-
-/**
- * Java/JNI wrapper for the libvlc_media_list_t structure.
- */
-public class MediaList {
-    private static final String TAG = "VLC/LibVLC/MediaList";
-
-    /* Since the libvlc_media_t is not created until the media plays, we have
-     * to cache them here. */
-    private static class MediaHolder {
-        Media m;
-        boolean noVideo; // default false
-        boolean noHardwareAcceleration; // default false
-
-        public MediaHolder(Media media) {
-            m = media; noVideo = false; noHardwareAcceleration = false;
-        }
-        public MediaHolder(Media m_, boolean noVideo_, boolean noHardwareAcceleration_) {
-            m = m_; noVideo = noVideo_; noHardwareAcceleration = noHardwareAcceleration_;
-        }
-    }
-
-    /* TODO: add locking */
-    private ArrayList<MediaHolder> mInternalList;
-    private LibVLC mLibVLC; // Used to create new objects that require a libvlc instance
-    private EventHandler mEventHandler;
-
-    public MediaList(LibVLC libVLC) {
-        mEventHandler = new EventHandler(); // used in init() below to fire events at the correct targets
-        mInternalList = new ArrayList<MediaHolder>();
-        mLibVLC = libVLC;
-    }
-
-    /**
-     * Adds a media URI to the media list.
-     *
-     * @param mrl
-     *            The MRL to add. Must be a location and not a path.
-     *            {@link LibVLC#PathToURI(String)} can be used to convert a path
-     *            to a MRL.
-     */
-    public void add(String mrl) {
-        add(new Media(mLibVLC, mrl));
-    }
-    public void add(Media media) {
-        add(media, false, false);
-    }
-    public void add(Media media, boolean noVideo) {
-        add(media, noVideo, false);
-    }
-    public void add(Media media, boolean noVideo, boolean noHardwareAcceleration) {
-        mInternalList.add(new MediaHolder(media, noVideo, noHardwareAcceleration));
-        signal_list_event(EventHandler.CustomMediaListItemAdded, mInternalList.size() - 1, media.getLocation());
-    }
-
-    /**
-     * Clear the media list. (remove all media)
-     */
-    public void clear() {
-        // Signal to observers of media being deleted.
-        for(int i = 0; i < mInternalList.size(); i++) {
-            signal_list_event(EventHandler.CustomMediaListItemDeleted, i, mInternalList.get(i).m.getLocation());
-        }
-        mInternalList.clear();
-    }
-
-    private boolean isValid(int position) {
-        return position >= 0 && position < mInternalList.size();
-    }
-
-    /**
-     * This function checks the currently playing media for subitems at the given
-     * position, and if any exist, it will expand them at the same position
-     * and replace the current media.
-     *
-     * @param position The position to expand
-     * @return -1 if no subitems were found, 0 if subitems were expanded
-     */
-    public int expandMedia(int position) {
-        ArrayList<String> children = new ArrayList<String>();
-        int ret = expandMedia(mLibVLC, position, children);
-        if(ret == 0) {
-            mEventHandler.callback(EventHandler.CustomMediaListExpanding, new Bundle());
-            this.remove(position);
-            for(String mrl : children) {
-                this.insert(position, mrl);
-            }
-            mEventHandler.callback(EventHandler.CustomMediaListExpandingEnd, new Bundle());
-        }
-        return ret;
-    }
-    private native int expandMedia(LibVLC libvlc_instance, int position, ArrayList<String> children);
-
-    public void loadPlaylist(String mrl) {
-        ArrayList<String> items = new ArrayList<String>();
-        loadPlaylist(mLibVLC, mrl, items);
-        this.clear();
-        for(String item : items) {
-            this.add(item);
-        }
-    }
-    private native void loadPlaylist(LibVLC libvlc_instance, String mrl, ArrayList<String> items);
-
-    public void insert(int position, String mrl) {
-        insert(position, new Media(mLibVLC, mrl));
-    }
-    public void insert(int position, Media media) {
-        mInternalList.add(position, new MediaHolder(media));
-        signal_list_event(EventHandler.CustomMediaListItemAdded, position, media.getLocation());
-    }
-
-    /**
-     * Move a media from one position to another
-     *
-     * @param startPosition start position
-     * @param endPosition end position
-     * @throws IndexOutOfBoundsException
-     */
-    public void move(int startPosition, int endPosition) {
-        if (!(isValid(startPosition)
-              && endPosition >= 0 && endPosition <= mInternalList.size()))
-            throw new IndexOutOfBoundsException("Indexes out of range");
-
-        MediaHolder toMove = mInternalList.get(startPosition);
-        mInternalList.remove(startPosition);
-        if (startPosition >= endPosition)
-            mInternalList.add(endPosition, toMove);
-        else
-            mInternalList.add(endPosition - 1, toMove);
-        Bundle b = new Bundle();
-        b.putInt("index_before", startPosition);
-        b.putInt("index_after", endPosition);
-        mEventHandler.callback(EventHandler.CustomMediaListItemMoved, b);
-    }
-
-    public void remove(int position) {
-        if (!isValid(position))
-            return;
-        String uri = mInternalList.get(position).m.getLocation();
-        mInternalList.remove(position);
-        signal_list_event(EventHandler.CustomMediaListItemDeleted, position, uri);
-    }
-
-    public void remove(String location) {
-        for (int i = 0; i < mInternalList.size(); ++i) {
-            String uri = mInternalList.get(i).m.getLocation();
-            if (uri.equals(location)) {
-                mInternalList.remove(i);
-                signal_list_event(EventHandler.CustomMediaListItemDeleted, i, uri);
-                i--;
-            }
-        }
-    }
-
-    public int size() {
-        return mInternalList.size();
-    }
-
-    public Media getMedia(int position) {
-        if (!isValid(position))
-            return null;
-        return mInternalList.get(position).m;
-    }
-
-    /**
-     * @param position The index of the media in the list
-     * @return null if not found
-     */
-    public String getMRL(int position) {
-        if (!isValid(position))
-            return null;
-        return mInternalList.get(position).m.getLocation();
-    }
-
-    public String[] getMediaOptions(int position) {
-        boolean noHardwareAcceleration = false;
-        boolean noVideo = false;
-        if (isValid(position))
-        {
-            noHardwareAcceleration = mInternalList.get(position).noHardwareAcceleration;
-            noVideo = mInternalList.get(position).noVideo;
-        }
-
-        return mLibVLC.getMediaOptions(noHardwareAcceleration, noVideo);
-    }
-
-    public EventHandler getEventHandler() {
-        return mEventHandler;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("LibVLC Media List: {");
-        for(int i = 0; i < size(); i++) {
-            sb.append(((Integer)i).toString());
-            sb.append(": ");
-            sb.append(getMRL(i));
-            sb.append(", ");
-        }
-        sb.append("}");
-        return sb.toString();
-    }
-
-    private void signal_list_event(int event, int position, String uri) {
-        Bundle b = new Bundle();
-        b.putString("item_uri", uri);
-        b.putInt("item_index", position);
-        mEventHandler.callback(event, b);
-    }
-}
diff --git a/vlc-android/src/org/videolan/libvlc/TrackInfo.java b/vlc-android/src/org/videolan/libvlc/TrackInfo.java
deleted file mode 100644
index b55dc55..0000000
--- a/vlc-android/src/org/videolan/libvlc/TrackInfo.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * TrackInfo.java
- *****************************************************************************
- * Copyright © 2010-2013 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.libvlc;
-
-public class TrackInfo {
-
-    public static final int TYPE_UNKNOWN = -1;
-    public static final int TYPE_AUDIO = 0;
-    public static final int TYPE_VIDEO = 1;
-    public static final int TYPE_TEXT = 2;
-    public static final int TYPE_META = 3;
-
-    public int Type;
-    public int Id;
-    public String Codec;
-    public String Language;
-    public int Bitrate;
-
-    /* Video */
-    public int Height;
-    public int Width;
-    public float Framerate;
-
-    /* Audio */
-    public int Channels;
-    public int Samplerate;
-
-    /* MetaData */
-    public long Length;
-    public String Title;
-    public String Artist;
-    public String Album;
-    public String Genre;
-    public String ArtworkURL;
-}
-- 
1.9.1



More information about the Android mailing list