Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.x bugfix #1

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
30658b5
AudioService: update widgets on track change
edwardcwang Jul 20, 2013
d7d44e4
jni: pick a reasonable default resolution
edwardcwang Jul 21, 2013
b5d7fb4
jni: add LibVLC.removeIndex
edwardcwang Jul 5, 2013
aef9e13
HistoryFragment: add a context menu
edwardcwang Jul 5, 2013
0be3095
jni: control playback with media_player and remove media_list_player
edwardcwang Jul 21, 2013
a54de88
jni: expand subitems
edwardcwang Jul 21, 2013
264aea7
Add a function for getting the java Surface object
mstorsjo Feb 17, 2013
8e7aa5c
Bump the tested hash, making the vout work on Android 4.3
mstorsjo Jul 26, 2013
8ba80bd
On the road to 0.1.3-release
jbkempf Jul 26, 2013
29533df
Bump the tested hash to the latest version of vlc.git
mstorsjo Jul 29, 2013
b36d134
AudioService: fix open MRL with existing items
edwardcwang Jul 27, 2013
7d8d890
DirectoryViewFragment: fix item selection in a folder with subfolers
edwardcwang Jul 27, 2013
1da43e1
Set the input type for the OpenMRL dialog input field
mstorsjo Jul 29, 2013
19dda55
fix some lint warnings
XilasZ Aug 5, 2013
3a2b293
AudioService: fix video stream playback
edwardcwang Aug 12, 2013
31c1af0
HistoryFragment: fix (null) items when deleting in HistoryFragment
edwardcwang Aug 29, 2013
93f83fa
VideoPlayerActivity: fix lock with horizontally native tablets
edwardcwang Sep 1, 2013
f235138
VideoPlayerActivity; use SCREEN_ORIENTATION_LOCKED on API 18+
edwardcwang Sep 1, 2013
b2a822f
Support NDK r9
funman Aug 9, 2013
b13c550
No need to match NDKr9 and NDKr9a differently (for now)
funman Aug 12, 2013
7dfbaa5
Bump targetSdkVersion to 18
edwardcwang Aug 12, 2013
5d3da41
widget: fix widget updates when launcher is restarted
XilasZ Aug 14, 2013
589f420
Remove media from the cache when deleting to prevent phantom media in…
XilasZ Aug 15, 2013
bb3ac1a
MediaDatabase: work around devices with broken /data
edwardcwang Aug 26, 2013
cb28e48
HistoryAdapter: fix album art
edwardcwang Sep 1, 2013
47582bf
Revert "fix some lint warnings"
jbkempf Sep 9, 2013
b7d4632
jni: plug leaks
edwardcwang Sep 9, 2013
5687062
res: typo
edwardcwang Sep 15, 2013
ea2fa67
jni: version check before using private structures
edwardcwang Sep 1, 2013
dfb864a
Bump version for 0.1.4
jbkempf Nov 26, 2013
c14c54f
Bump the vlc hash for release
jbkempf Nov 26, 2013
bf90b31
thumbnailer: do not wait until video position becomes *strictly* supe…
flx42 Nov 27, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changes between 0.1.2 and 0.1.3-git:
Changes between 0.1.2 and 0.1.3:
--------------------------------

Core:
* Fix the video output for Android 4.3

Main Application:
* Fix crashes in SQLite management
* Expand playlist subitems


Changes between 0.1.1 and 0.1.2:
Expand Down
6 changes: 5 additions & 1 deletion compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ fi
# try to detect NDK version
REL=$(grep -o '^r[0-9]*.*' $ANDROID_NDK/RELEASE.TXT 2>/dev/null|cut -b2-)
case "$REL" in
9*)
GCCVER=4.8
CXXSTL="/"${GCCVER}
;;
8?*)
# we don't use 4.4.3 because it doesn't handle threads correctly.
# TODO : clang?
Expand Down Expand Up @@ -80,7 +84,7 @@ export PATH=${NDK_TOOLCHAIN_PATH}:${PATH}
ANDROID_PATH="`pwd`"

# 1/ libvlc, libvlccore and its plugins
TESTED_HASH=28811d453
TESTED_HASH=9f5c45fa0
if [ ! -d "vlc" ]; then
echo "VLC source not found, cloning"
git clone git://git.videolan.org/vlc.git vlc
Expand Down
2 changes: 1 addition & 1 deletion java-libs/ActionBarSherlock/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

android.library=true
# Project target.
target=android-17
target=android-18
2 changes: 1 addition & 1 deletion java-libs/SlidingMenu/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

android.library=true
# Project target.
target=android-17
target=android-18
2 changes: 1 addition & 1 deletion java-libs/WheelView/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ android.library=true
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-17
target=android-18
6 changes: 3 additions & 3 deletions vlc-android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.videolan.vlc"
android:installLocation="auto"
android:versionCode="1300"
android:versionName="0.1.3-git" >
android:versionCode="1400"
android:versionName="0.1.4" >

<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="17" />
android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
149 changes: 103 additions & 46 deletions vlc-android/jni/libvlcjni.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
* libvlcjni.c
*****************************************************************************
* Copyright © 2010-2012 VLC authors and VideoLAN
* 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
Expand Down Expand Up @@ -180,22 +180,14 @@ static libvlc_media_player_t *getMediaPlayer(JNIEnv *env, jobject thiz)
return (libvlc_media_player_t*)(intptr_t)getLong(env, thiz, "mInternalMediaPlayerInstance");
}

static libvlc_media_list_player_t *getMediaListPlayer(JNIEnv *env, jobject thiz)
{
return (libvlc_media_list_player_t*)(intptr_t)getLong(env, thiz, "mMediaListPlayerInstance");
}

static void releaseMediaPlayer(JNIEnv *env, jobject thiz)
{
libvlc_media_list_player_t* p_mlp = getMediaListPlayer(env, thiz);
if (p_mlp)
libvlc_media_player_t* p_mp = getMediaPlayer(env, thiz);
if (p_mp)
{
libvlc_media_list_player_stop(p_mlp);
libvlc_media_list_player_release(p_mlp);
/* libvlc_media_list_player_release frees the media player, so
* we don't free it ourselves. */
libvlc_media_player_stop(p_mp);
libvlc_media_player_release(p_mp);
setLong(env, thiz, "mInternalMediaPlayerInstance", 0);
setLong(env, thiz, "mMediaListPlayerInstance", 0);
}
}

Expand All @@ -211,12 +203,18 @@ static jobject debugBufferInstance = NULL;
static pthread_mutex_t vout_android_lock;
static void *vout_android_surf = NULL;
static void *vout_android_gui = NULL;
static jobject vout_android_java_surf = NULL;

void *jni_LockAndGetAndroidSurface() {
pthread_mutex_lock(&vout_android_lock);
return vout_android_surf;
}

jobject jni_LockAndGetAndroidJavaSurface() {
pthread_mutex_lock(&vout_android_lock);
return vout_android_java_surf;
}

void jni_UnlockAndroidSurface() {
pthread_mutex_unlock(&vout_android_lock);
}
Expand Down Expand Up @@ -316,6 +314,7 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)
}

end:
(*env)->DeleteLocalRef(env, bundle);
if (isAttached)
(*myVm)->DetachCurrentThread(myVm);
}
Expand All @@ -339,30 +338,37 @@ void Java_org_videolan_libvlc_LibVLC_attachSurface(JNIEnv *env, jobject thiz, jo
jclass clz;
jfieldID fid;

pthread_mutex_lock(&vout_android_lock);
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);
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");
}
fid = (*env)->GetFieldID(env, clz, "mNativeSurface", "I");
vout_android_surf = (void*)(*env)->GetIntField(env, surf, fid);
(*env)->DeleteLocalRef(env, clz);
}
vout_android_surf = (void*)(*env)->GetIntField(env, surf, fid);
(*env)->DeleteLocalRef(env, clz);

vout_android_gui = (*env)->NewGlobalRef(env, gui);
pthread_mutex_unlock(&vout_android_lock);
vout_android_java_surf = (*env)->NewGlobalRef(env, surf);
}

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);
}

Expand Down Expand Up @@ -515,6 +521,10 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
"--no-stats",
"--no-plugins-cache",
"--no-drop-late-frames",
/* The VLC default is to pick the highest resolution possible
* (i.e. 1080p). For mobile, pick a more sane default for slow
* mobile data networks and slower hardware. */
"--preferred-resolution", "360",
"--avcodec-fast",
"--avcodec-threads=0",
"--subsdec-encoding", subsencodingstr,
Expand Down Expand Up @@ -673,7 +683,6 @@ static void create_player_and_play(JNIEnv* env, jobject thiz,
libvlc_media_list_t* p_mlist = getMediaList(env, thiz);

/* Create a media player playing environment */
libvlc_media_list_player_t* p_mlp = libvlc_media_list_player_new((libvlc_instance_t*)(intptr_t)instance);
libvlc_media_player_t *mp = libvlc_media_player_new((libvlc_instance_t*)(intptr_t)instance);

jobject myJavaLibVLC = (*env)->NewGlobalRef(env, thiz);
Expand Down Expand Up @@ -702,14 +711,49 @@ static void create_player_and_play(JNIEnv* env, jobject thiz,
for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++)
libvlc_event_attach(ev, mp_events[i], vlc_event_callback, myVm);

libvlc_media_list_player_set_media_list(p_mlp, p_mlist);
libvlc_media_list_player_set_media_player(p_mlp, mp);

/* Keep a pointer to this media player */
setLong(env, thiz, "mMediaListPlayerInstance", (jlong)(intptr_t)p_mlp);
setLong(env, thiz, "mInternalMediaPlayerInstance", (jlong)(intptr_t)mp);

libvlc_media_list_player_play_item_at_index(p_mlp, position);
setInt(env, thiz, "mInternalMediaPlayerIndex", (jint)position);
libvlc_media_list_lock(p_mlist);
libvlc_media_t* p_md = libvlc_media_list_item_at_index(p_mlist, position);
libvlc_media_list_unlock(p_mlist);
libvlc_media_player_set_media(mp, p_md);
libvlc_media_player_play(mp);
}

jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz)
{
int current_position = getInt(env, thiz, "mInternalMediaPlayerIndex");
libvlc_media_list_t* p_mlist = getMediaList(env, thiz);
libvlc_media_list_lock(p_mlist);
libvlc_media_t* p_md = libvlc_media_list_item_at_index(p_mlist, current_position);
libvlc_media_list_unlock(p_mlist);
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);
libvlc_media_list_lock(p_mlist);
for(int i = subitem_count - 1; i >= 0; i--) {
libvlc_media_list_insert_media(p_mlist, libvlc_media_list_item_at_index(p_subitems, i), current_position+1);
}
libvlc_media_list_remove_index(p_mlist, current_position);
libvlc_media_list_unlock(p_mlist);
}
libvlc_media_list_release(p_subitems);
if(subitem_count > 0) {
create_player_and_play(env, thiz,
getLong(env, thiz, "mLibVlcInstance"), current_position);
return (jint)current_position;
} else
return -1;
} else {
return -1;
}
}

jint Java_org_videolan_libvlc_LibVLC_readMedia(JNIEnv *env, jobject thiz,
Expand Down Expand Up @@ -766,6 +810,10 @@ void Java_org_videolan_libvlc_LibVLC_getMediaListItems(
libvlc_media_list_unlock( p_mlist );
}

void Java_org_videolan_libvlc_LibVLC_removeIndex(JNIEnv *env, jobject thiz, jlong instance, jint position) {
libvlc_media_list_remove_index((libvlc_media_list_t*)(intptr_t)instance, position);
}

jfloat Java_org_videolan_libvlc_LibVLC_getRate(JNIEnv *env, jobject thiz) {
libvlc_media_player_t* mp = getMediaPlayer(env, thiz);
if(mp)
Expand Down Expand Up @@ -994,14 +1042,14 @@ jlong Java_org_videolan_libvlc_LibVLC_getLengthFromLocation(JNIEnv *env, jobject

jboolean Java_org_videolan_libvlc_LibVLC_hasMediaPlayer(JNIEnv *env, jobject thiz)
{
return !!getMediaListPlayer(env, thiz);
return !!getMediaPlayer(env, thiz);
}

jboolean Java_org_videolan_libvlc_LibVLC_isPlaying(JNIEnv *env, jobject thiz)
{
libvlc_media_list_player_t *mp = getMediaListPlayer(env, thiz);
libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
if (mp)
return !!libvlc_media_list_player_is_playing(mp);
return !!libvlc_media_player_is_playing(mp);
else
return 0;
}
Expand All @@ -1016,37 +1064,46 @@ jboolean Java_org_videolan_libvlc_LibVLC_isSeekable(JNIEnv *env, jobject thiz)

void Java_org_videolan_libvlc_LibVLC_play(JNIEnv *env, jobject thiz)
{
libvlc_media_list_player_t *mp = getMediaListPlayer(env, thiz);
libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
if (mp)
libvlc_media_list_player_play(mp);
libvlc_media_player_play(mp);
}

void Java_org_videolan_libvlc_LibVLC_pause(JNIEnv *env, jobject thiz)
{
libvlc_media_list_player_t *mp = getMediaListPlayer(env, thiz);
libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
if (mp)
libvlc_media_list_player_pause(mp);
libvlc_media_player_pause(mp);
}

void Java_org_videolan_libvlc_LibVLC_stop(JNIEnv *env, jobject thiz)
{
libvlc_media_list_player_t *mp = getMediaListPlayer(env, thiz);
libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
if (mp)
libvlc_media_list_player_stop(mp);
libvlc_media_player_stop(mp);
}

void Java_org_videolan_libvlc_LibVLC_previous(JNIEnv *env, jobject thiz)
{
libvlc_media_list_player_t *mp = getMediaListPlayer(env, thiz);
if (mp)
libvlc_media_list_player_previous(mp);
int current_position = getInt(env, thiz, "mInternalMediaPlayerIndex");

if(current_position-1 >= 0) {
setInt(env, thiz, "mInternalMediaPlayerIndex", (jint)(current_position-1));
create_player_and_play(env, thiz,
getLong(env, thiz, "mLibVlcInstance"), current_position-1);
}
}

void Java_org_videolan_libvlc_LibVLC_next(JNIEnv *env, jobject thiz)
{
libvlc_media_list_player_t *mp = getMediaListPlayer(env, thiz);
if (mp)
libvlc_media_list_player_next(mp);
libvlc_media_list_t* p_mlist = getMediaList(env, thiz);
int current_position = getInt(env, thiz, "mInternalMediaPlayerIndex");

if(current_position+1 < libvlc_media_list_count(p_mlist)) {
setInt(env, thiz, "mInternalMediaPlayerIndex", (jint)(current_position+1));
create_player_and_play(env, thiz,
getLong(env, thiz, "mLibVlcInstance"), current_position+1);
}
}

jint Java_org_videolan_libvlc_LibVLC_getVolume(JNIEnv *env, jobject thiz)
Expand Down
10 changes: 5 additions & 5 deletions vlc-android/jni/thumbnailer.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ jbyteArray Java_org_videolan_libvlc_LibVLC_getThumbnail(JNIEnv *env, jobject thi
libvlc_media_player_play(mp);
libvlc_media_player_set_position(mp, THUMBNAIL_POSITION);

int loops = 100;
for (;;) {
float pos = libvlc_media_player_get_position(mp);
if (pos > THUMBNAIL_POSITION || !loops--)
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(50000);
usleep(wait_time);
}

/* Wait for the thumbnail to be generated. */
Expand Down
2 changes: 1 addition & 1 deletion vlc-android/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# project structure.

# Project target.
target=android-17
target=android-18
android.library.reference.1=../java-libs/ActionBarSherlock
android.library.reference.2=../java-libs/SlidingMenu
android.library.reference.3=../java-libs/WheelView
9 changes: 9 additions & 0 deletions vlc-android/res/menu/history_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/history_view_play"
android:title="@string/play" />
<item
android:id="@+id/history_view_delete"
android:title="@string/delete" />
</menu>
2 changes: 1 addition & 1 deletion vlc-android/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<!-- Preferences -->
<string name="preferences">Préférences</string>
<string name="library_prefs_category">Bibliothèque multimédia</string>
<string name="directories_summary">Sélectionnez les repertoires de votre bilbiothèque multimédia</string>
<string name="directories_summary">Sélectionnez les repertoires de votre bibliothèque multimédia</string>
<string name="add_custom_path">Ajouter un répertoire</string>
<string name="add_custom_path_description">Entrer un répertoire additionnel à scanner:</string>
<string name="remove_custom_path">Retirer le répertoire</string>
Expand Down
Loading