Skip to content

Commit

Permalink
VideoDbInfo: sets last audioTrack and subtitleTrack correctly from pl…
Browse files Browse the repository at this point in the history
…ayParams if not played before

Solves issue of not being able to resume on foreign first audioTrack that happens in the video attached to issue #1355

See nova-video-player/aos-AVP#1355
  • Loading branch information
courville committed Dec 29, 2024
1 parent 0e389b2 commit fa4f669
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/com/archos/mediacenter/utils/videodb/VideoDbInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@
import com.archos.mediascraper.ScrapeStatus;
import com.archos.mediascraper.ShowTags;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class VideoDbInfo implements Parcelable {

private static final Logger log = LoggerFactory.getLogger(VideoDbInfo.class);

public VideoDbInfo() {}

public VideoDbInfo(String path) {
Expand Down Expand Up @@ -197,15 +202,19 @@ public static VideoDbInfo fromCursor(Cursor c, boolean shouldMoveToNext) {
result.duration = c.getInt(IDX_DURATION);
result.resume = c.getInt(IDX_BOOKMARK);
result.bookmark = c.getInt(IDX_ARCHOS_BOOKMARK);
result.lastTimePlayed = c.getLong(IDX_LAST_TIME_PLAYED);
int playerParams = c.getInt(IDX_PLAYER_PARAMS);
// ensure that audioTrack is -1 if not played before
if (playerParams != 0) result.audioTrack = VideoStore.paramsToAudioTrack(playerParams);
// ensure that audioTrack is -1 if not played before (playParams is 0 if not played before but 0 could be a valid audioTrack if played before)
if (result.lastTimePlayed > 0) result.audioTrack = VideoStore.paramsToAudioTrack(playerParams);
else result.audioTrack = -1;
result.subtitleTrack = VideoStore.paramsToSubtitleTrack(playerParams);
log.debug("fromCursor: lastTimePlayed={}, playerParams={}, paramsToAudioTrack={}, audioTrack={}", result.lastTimePlayed, playerParams, VideoStore.paramsToAudioTrack(playerParams), result.audioTrack);
// ensure that audioTrack is -1 if not played before (playParams is 0 if not played before but 0 could be a valid audioTrack if played before)
if (result.lastTimePlayed > 0) result.subtitleTrack = VideoStore.paramsToSubtitleTrack(playerParams);
else result.subtitleTrack = -1;
log.debug("fromCursor: result.lastTimePlayed={}, playerParams={}, paramsToSubtitleTrack={}, subtitleTrack={}", result.lastTimePlayed, playerParams, VideoStore.paramsToSubtitleTrack(playerParams), result.subtitleTrack);
result.subtitleDelay = c.getInt(IDX_SUBTITLE_DELAY);
result.subtitleRatio = c.getInt(IDX_SUBTITLE_RATIO);
result.nbSubtitles = c.getInt(IDX_NB_SUBTITLES);
result.lastTimePlayed = c.getLong(IDX_LAST_TIME_PLAYED);
result.traktSeen = c.getInt(IDX_TRAKT_SEEN);
result.traktLibrary = c.getInt(IDX_TRAKT_LIBRARY);
result.traktResume = c.getInt(IDX_TRAKT_RESUME);
Expand Down

0 comments on commit fa4f669

Please sign in to comment.