[Android] apply ES selection after the MediaPlayerPlaying event

Sébastien Toque git at videolan.org
Sat Dec 8 21:50:44 CET 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat Dec  8 21:49:10 2012 +0100| [55a6e600dad1aa480ea2da35edf6e21c69c45184] | committer: Sébastien Toque

apply ES selection after the MediaPlayerPlaying event

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

 .../vlc/gui/video/VideoPlayerActivity.java         |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index f175077..2580fbf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -548,6 +548,7 @@ public class VideoPlayerActivity extends Activity {
             switch (msg.getData().getInt("event")) {
                 case EventManager.MediaPlayerPlaying:
                     Log.i(TAG, "MediaPlayerPlaying");
+                    activity.setESTracks();
                     break;
                 case EventManager.MediaPlayerPaused:
                     Log.i(TAG, "MediaPlayerPaused");
@@ -1183,18 +1184,18 @@ public class VideoPlayerActivity extends Activity {
                 ? "- " + Util.millisToString(length - time)
                 : Util.millisToString(length));
 
+        return time;
+    }
+
+    private void setESTracks() {
         if (mLastAudioTrack >= 0) {
             mLibVLC.setAudioTrack(mLastAudioTrack);
-            if (mLibVLC.getAudioTrack() == mLastAudioTrack)
-                mLastAudioTrack = -1;
+            mLastAudioTrack = -1;
         }
         if (mLastSpuTrack >= 0) {
             mLibVLC.setSpuTrack(mLastSpuTrack);
-            if (mLibVLC.getSpuTrack() == mLastSpuTrack)
-                mLastSpuTrack = -1;
+            mLastSpuTrack = -1;
         }
-
-        return time;
     }
 
     private void setTracksAndSubtitles () {
@@ -1280,12 +1281,7 @@ public class VideoPlayerActivity extends Activity {
                 mLibVLC.setTime(media.getTime());
 
             mLastAudioTrack = media.getAudioTrack();
-            /* FIXME : bug in vlc
-             * if setSpuTrack(0) is called before the playback has started,
-             * it will disable the video track instead of subtitles.
-             * So don't restore the disable item */
-            if (media.getSpuTrack() != 0)
-                mLastSpuTrack = media.getSpuTrack();
+            mLastSpuTrack = media.getSpuTrack();
 
             try {
                 title = URLDecoder.decode(mLocation, "UTF-8");



More information about the Android mailing list