fix(playback): restore SDR alternate fallback for burn-in subtitles
#617 renamed HDR/4K burn-in refusals to subtitle_conversion_unsupported when the subtitle alone forced adaptation, but terminalAllowsAlternateFileV3 still only recognized the old HDR/4K reasons. Selecting a PGS track on an HDR source therefore skipped the SDR alternate and returned adaptation_unavailable. Co-authored-by: Quick <Quick104@users.noreply.github.com>
This commit is contained in:
@@ -2360,15 +2360,29 @@ func shouldTryAlternateFileV3(qualityPreference string) bool {
|
||||
}
|
||||
|
||||
const (
|
||||
terminalNoAlternateVersionV3 = "no_alternate_version"
|
||||
terminalHDRTranscodeUnsupportedV3 = "hdr_transcode_unsupported"
|
||||
terminalNoAlternateVersionV3 = "no_alternate_version"
|
||||
terminalHDRTranscodeUnsupportedV3 = "hdr_transcode_unsupported"
|
||||
terminalSubtitleConversionUnsupportedV3 = "subtitle_conversion_unsupported"
|
||||
)
|
||||
|
||||
// terminalAllowsAlternateFileV3 reports whether a planner terminal should
|
||||
// trigger another media-file attempt before the response is finalized.
|
||||
//
|
||||
// subtitle_conversion_unsupported is included because a burn-in-only
|
||||
// adaptation can rename an HDR or 4K blocker to that reason (see
|
||||
// planVideoTranscodeV3's subtitleForcedAdaptation path). The underlying
|
||||
// incompatibility is still version-shaped: an SDR / lower-resolution
|
||||
// alternate may burn the same subtitle successfully.
|
||||
func terminalAllowsAlternateFileV3(terminal *playback.TerminalV3) bool {
|
||||
if terminal == nil {
|
||||
return false
|
||||
}
|
||||
return terminal.Reason == terminalNoAlternateVersionV3 || terminal.Reason == terminalHDRTranscodeUnsupportedV3
|
||||
switch terminal.Reason {
|
||||
case terminalNoAlternateVersionV3, terminalHDRTranscodeUnsupportedV3, terminalSubtitleConversionUnsupportedV3:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func replanAllowsAlternateFileV3(operation playback.ReplanOperationV3, qualityPreference string) bool {
|
||||
|
||||
@@ -117,7 +117,7 @@ func TestShouldTryAlternateFileV3PinsOriginalQuality(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTerminalAllowsAlternateFileV3IncludesHDRIncompatibility(t *testing.T) {
|
||||
for _, reason := range []string{"no_alternate_version", "hdr_transcode_unsupported"} {
|
||||
for _, reason := range []string{"no_alternate_version", "hdr_transcode_unsupported", "subtitle_conversion_unsupported"} {
|
||||
if !terminalAllowsAlternateFileV3(&playback.TerminalV3{Reason: reason}) {
|
||||
t.Fatalf("terminal reason %q should permit alternate selection", reason)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user