Commit 2bf1fc1e authored by Edward Wang's avatar Edward Wang

Add an option to use time-stretching audio

parent 41cce1ca
......@@ -289,6 +289,9 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz, jboolean
jmethodID methodId = (*env)->GetMethodID(env, cls, "getAout", "()I");
bool use_opensles = (*env)->CallIntMethod(env, thiz, methodId) == AOUT_OPENSLES;
methodId = (*env)->GetMethodID(env, cls, "timeStretchingEnabled", "()Z");
bool enable_time_stretch = (*env)->CallBooleanMethod(env, thiz, methodId);
verbosity = verbose;
libvlc_log_subscribe(&debug_subscriber, debug_log, &verbosity);
......@@ -301,6 +304,7 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz, jboolean
"--no-plugins-cache",
"--no-drop-late-frames",
"--avcodec-fast",
enable_time_stretch ? "--audio-time-stretch" : "--no-audio-time-stretch",
use_opensles ? "--aout=opensles" : "--aout=android_audiotrack",
};
libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
......
......@@ -130,6 +130,8 @@
<string name="aout_audiotrack">AudioTrack (native)</string>
<string name="aout_audiotrack_java">AudioTrack (Java)</string>
<string name="aout_opensles">OpenSL ES</string>
<string name="enable_time_stretching_audio">Enable time-stretching audio</string>
<string name="enable_time_stretching_audio_detail">Speed up and slow down audio without changing the pitch (requires a fast device)</string>
<string-array name="aouts_froyo">
<item>@string/aout_audiotrack_java</item>
<item>@string/aout_audiotrack</item>
......
......@@ -46,8 +46,12 @@
<ListPreference
android:key="aout"
android:defaultValue="@string/aout_audiotrack_java"
android:title="@string/aout" >
</ListPreference>
android:title="@string/aout" />
<CheckBoxPreference
android:key="enable_time_stretching_audio"
android:title="@string/enable_time_stretching_audio"
android:summary="@string/enable_time_stretching_audio_detail"
android:defaultValue="false" />
<PreferenceScreen android:title="@string/advanced_debugging">
<Preference
android:title="@string/quit"
......
......@@ -176,6 +176,11 @@ public class LibVLC {
}
}
public boolean timeStretchingEnabled() {
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
return p.getBoolean("enable_time_stretching_audio", false);
}
/**
* Initialize the libVLC class
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment