Skip to content

Commit

Permalink
Check DoVi disabling option not too late
Browse files Browse the repository at this point in the history
  • Loading branch information
courville committed Jan 17, 2023
1 parent 7ea42cb commit da79cd5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/archos/mediacenter/video/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private void reset() {
}

public Player(Context context, Window window, SurfaceController surfaceController, boolean forceSoftwareDecoding) { //force software decoding is specific for floating player
sPlayer =this;
sPlayer = this;
log.debug("Player");
reset();
mSurfaceHolder = null;
Expand Down Expand Up @@ -478,6 +478,9 @@ public void openVideo() {
return;
}

boolean isDoViDisabled = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean(VideoPreferencesCommon.KEY_DISABLE_DOLBY_VISION, false);
CodecDiscovery.disableDoVi(isDoViDisabled); // could be an autoswitch based on HDR DoVi screen capability

// we shouldn't clear the target state, because somebody might have
// called start() previously
log.info("openVideo: " + mUri);
Expand Down Expand Up @@ -980,9 +983,6 @@ public void onPrepared(IMediaPlayer mp) {
mResumeCtx.onPrepared();

boolean refreshRateSwitchEnabled = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean(VideoPreferencesCommon.KEY_ACTIVATE_REFRESHRATE_SWITCH, false);
boolean isDoViDisabled = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean(VideoPreferencesCommon.KEY_DISABLE_DOLBY_VISION, false);
CodecDiscovery.disableDoVi(isDoViDisabled); // could be an autoswitch based on HDR DoVi screen capability
CodecDiscovery.displaySupportsDoVi(dolbyVisionDisplay);
if (mWindow != null && refreshRateSwitchEnabled) {
VideoMetadata.VideoTrack video = mVideoMetadata.getVideoTrack();

Expand Down Expand Up @@ -1014,6 +1014,7 @@ public void onPrepared(IMediaPlayer mp) {
case Display.HdrCapabilities.HDR_TYPE_DOLBY_VISION:
log.debug("CONFIG HDR dolby vision supported");
dolbyVisionDisplay = true;
CodecDiscovery.displaySupportsDoVi(dolbyVisionDisplay); // TODO this is sent too late for capability checking
break;
case Display.HdrCapabilities.HDR_TYPE_HDR10:
log.debug("CONFIG HDR10 supported");
Expand Down

0 comments on commit da79cd5

Please sign in to comment.