[Android] libvlcjni: YV12 option

Edward Wang git at videolan.org
Wed Jan 2 23:31:17 CET 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Wed Jan  2 12:44:05 2013 -0500| [63e6d597433dcc1a46d1ab81c72f5d7cda5fc8d0] | committer: Edward Wang

libvlcjni: YV12 option

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=63e6d597433dcc1a46d1ab81c72f5d7cda5fc8d0
---

 vlc-android/jni/libvlcjni.c                                   |    4 ++++
 vlc-android/src/org/videolan/vlc/LibVLC.java                  |    4 ++++
 vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java |    3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index d17b40f..8c7abea 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -407,6 +407,9 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz, jboolean
     methodId = (*env)->GetMethodID(env, cls, "timeStretchingEnabled", "()Z");
     bool enable_time_stretch = (*env)->CallBooleanMethod(env, thiz, methodId);
 
+    methodId = (*env)->GetMethodID(env, cls, "yv12Enabled", "()Z");
+    bool yv12enabled = (*env)->CallBooleanMethod(env, thiz, methodId);
+
     methodId = (*env)->GetMethodID(env, cls, "getSubtitlesEncoding", "()Ljava/lang/String;");
     jstring subsencoding = (*env)->CallObjectMethod(env, thiz, methodId);
     const char *subsencodingstr = (*env)->GetStringUTFChars(env, subsencoding, 0);
@@ -429,6 +432,7 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz, jboolean
         "--subsdec-encoding", subsencodingstr,
         enable_time_stretch ? "--audio-time-stretch" : "--no-audio-time-stretch",
         use_opensles ? "--aout=opensles" : "--aout=android_audiotrack",
+        yv12enabled ? "--androidsurface-chroma=YV12" : "--androidsurface-chroma=RV32",
     };
     libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
 
diff --git a/vlc-android/src/org/videolan/vlc/LibVLC.java b/vlc-android/src/org/videolan/vlc/LibVLC.java
index 0845372..234420f 100644
--- a/vlc-android/src/org/videolan/vlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/vlc/LibVLC.java
@@ -179,6 +179,10 @@ public class LibVLC {
         final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
         return p.getBoolean("enable_time_stretching_audio", false);
     }
+    public boolean yv12Enabled() {
+        final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
+        return (p.getBoolean("enable_yv12_format", false) && Util.isGingerbreadOrLater());
+    }
 
     /**
      * Initialize the libVLC class
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index 7caf348..cf34390 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -207,7 +207,8 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
         if (key.equalsIgnoreCase("enable_iomx") ||
             key.equalsIgnoreCase("subtitles_text_encoding") ||
             key.equalsIgnoreCase("aout") ||
-            key.equalsIgnoreCase("enable_time_stretching_audio")) {
+            key.equalsIgnoreCase("enable_time_stretching_audio") ||
+            key.equalsIgnoreCase("enable_yv12_format")) {
                 LibVLC.restart();
         }
     }



More information about the Android mailing list