Esempio n. 1
0
  public boolean setSubtitleTrack(int index, List<MediaStream> allStreams) {
    if (!nativeMode) {
      // find the relative order of our sub index within the sub tracks in VLC
      int vlcIndex = 1; // start at 1 to account for "disabled"
      for (MediaStream stream : allStreams) {
        if (stream.getType() == MediaStreamType.Subtitle && !stream.getIsExternal()) {
          if (stream.getIndex() == index) {
            break;
          }
          vlcIndex++;
        }
      }

      org.videolan.libvlc.MediaPlayer.TrackDescription vlcSub;
      try {
        vlcSub = getSubtitleTracks()[vlcIndex];

      } catch (IndexOutOfBoundsException e) {
        TvApp.getApplication()
            .getLogger()
            .Error("Could not locate subtitle with index %s in vlc track info", index);
        return false;
      } catch (NullPointerException e) {
        TvApp.getApplication()
            .getLogger()
            .Error(
                "No subtitle tracks found in player trying to set subtitle with index %s in vlc track info",
                index);
        return false;
      }

      TvApp.getApplication().getLogger().Info("Setting Vlc sub to " + vlcSub.name);
      return mVlcPlayer.setSpuTrack(vlcSub.id);
    }

    return false;
  }
Esempio n. 2
0
 public void disableSubs() {
   if (!nativeMode && mVlcPlayer != null) mVlcPlayer.setSpuTrack(-1);
 }