[Android] Save spu track & delay for each video

Geoffrey Métais git at videolan.org
Fri Jan 20 18:24:07 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 20 16:53:08 2017 +0100| [c738a71a46da6ccad12b43a35c9896a47fa1d42a] | committer: Geoffrey Métais

Save spu track & delay for each video

> https://code.videolan.org/videolan/vlc-android/commit/c738a71a46da6ccad12b43a35c9896a47fa1d42a
---

 .../src/org/videolan/medialibrary/media/MediaWrapper.java         | 1 +
 vlc-android/src/org/videolan/vlc/PlaybackService.java             | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
index 20591ce..10bc99c 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
@@ -75,6 +75,7 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
     public final static int META_AUDIODELAY = 152;
     //Spu
     public final static int META_SUBTITLE_TRACK = 200;
+    public final static int META_SUBTITLE_DELAY = 201;
     //Various
     public final static int META_APPLICATION_SPECIFIC = 250;
 
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index e83c71d..2e6cbc6 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -684,6 +684,8 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
             //Save audio delay
             if (mSettings.getBoolean("save_individual_audio_delay", false))
                 media.setLongMeta(mMedialibrary, MediaWrapper.META_AUDIODELAY, mMediaPlayer.getAudioDelay());
+            media.setLongMeta(mMedialibrary, MediaWrapper.META_SUBTITLE_DELAY, mMediaPlayer.getSpuDelay());
+            media.setLongMeta(mMedialibrary, MediaWrapper.META_SUBTITLE_TRACK, mMediaPlayer.getSpuTrack());
         }
     }
 
@@ -691,8 +693,12 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         MediaWrapper media = mMedialibrary.findMedia(getCurrentMediaWrapper());
         if (media == null || media.getId() == 0)
             return;
-        if (mSettings.getBoolean("save_individual_audio_delay", false))
+        if (canSwitchToVideo()) {
+            if (mSettings.getBoolean("save_individual_audio_delay", false))
                 mMediaPlayer.setAudioDelay(media.getMetaLong(mMedialibrary, MediaWrapper.META_AUDIODELAY));
+            mMediaPlayer.setSpuTrack((int) media.getMetaLong(mMedialibrary, MediaWrapper.META_SUBTITLE_TRACK));
+            mMediaPlayer.setSpuDelay(media.getMetaLong(mMedialibrary, MediaWrapper.META_SUBTITLE_DELAY));
+        }
     }
 
     private final MediaWrapperList.EventListener mListEventListener = new MediaWrapperList.EventListener() {



More information about the Android mailing list