Skip to content

fix(overlays): derive dynamic-range badges from Dolby Vision metadata - #365

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
RXWatcher:fix/dolby-vision-range-badges
Jul 16, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
RXWatcher:fix/dolby-vision-range-badges

Conversation

@RXWatcher

@RXWatcher RXWatcher commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Part of #367.

Problem

Files with Dolby Vision show a generic "HDR" badge on detail pages, version pickers, the player HUD, and card overlays. The web badge sites read only the FileVersion.hdr boolean and push a hardcoded "HDR" literal, even though the payload already carries video_tracks[].dolby_vision / dv_profile / video_range_type / color_transfer (the Media Info dialog renders these correctly). On the server, card-overlay rollup picks the best file by resolution with first-scanned tie-breaking, so one generic-HDR (or stale-probed) file at max resolution masks a DV sibling for a whole card/series.

Approach

  • New shared web helper web/src/lib/videoRange.ts derives a label ("DV", "DV HDR10", "DV HDR10+", "DV HLG", "HDR10+", "HDR10", "HLG") from probed track metadata; the hdr boolean remains the last-resort "HDR" fallback. Used in QualityBadges, VersionDropdown, VersionFlyout, and playback-info. Badge styling unchanged — text/logic only.
  • internal/overlays/summary.go: hdrTypeFromTracks now reads video_range_type and hdr10_plus with color transfer as the fallback, sharing the web helper's exact detection order — server card overlays can now label HDR10+, and rows whose only signal is the range-type enum (e.g. catalog-seeded imports) no longer fall through to the bare-boolean tier.
  • internal/overlays/summary.go: bestFile breaks same-resolution ties by range-metadata richness (DV > explicit HDR10+/HDR10/HLG > bare hdr boolean > SDR); full ties still keep the earliest file, so selection stays deterministic. Unit tests added for tie-breaking, normalizeHDR, and the DV-sibling rollup case.

Risks / notes

  • Files probed before DV/video-range fields existed have no track metadata, so they still show generic "HDR" until re-probed — expected, and the reason the boolean fallback stays. (Follow-up candidate: teach probe repair to re-probe rows missing range metadata.)
  • BuildSummary derives every overlay field from the single best file, so the new tie-break can also change a card's audio/codec/aspect badges when it flips the winner (e.g. a DV file with AC3 now beats a generic-HDR sibling with Atmos). The previous winner among same-resolution files was arbitrary scan order, so this is a change between two arbitrary-but-deterministic choices, not a regression.
  • The dynamic-range vocabulary now lives in two implementations (Go + TS), and silo-android / silo-apple have the same generic-HDR badge problem. Follow-up candidate: expose a server-computed video_range_label (additive) on version payloads and the overlay summary so all clients share one source of truth.
  • One player HUD test expectation updated: the fixture is a DV Profile 8.1 file, so "Auto-switched from" now truthfully reads "… DV" instead of "… HDR".
  • selectDefaultVersion matching still uses the boolean and is unaffected.
  • Full web test suite has 4 failures in unrelated suites that also fail on pristine upstream/main (verified).

Verification

go build ./..., go test ./internal/overlays/... pass; ESLint/Prettier/tsc clean; videoRange suite plus affected suites pass.

AI-use disclosure: implemented by Claude (Claude Code) under human direction and review.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added clearer video range labels for Dolby Vision, HDR10+, HDR10, HLG, and HDR content.
    • Improved quality badges and version details to show the most accurate available range information.
    • Playback details now display consistent video range labels, including Dolby Vision.
  • Bug Fixes

    • Improved media selection when multiple versions share the same resolution by prioritizing richer HDR metadata.
    • Added support for detecting HDR formats from additional video metadata sources.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 98753354-6b4e-4867-86ac-5d2578fadb17

📥 Commits

Reviewing files that changed from the base of the PR and between 02b6648 and 35a079f.

📒 Files selected for processing (9)
  • internal/overlays/summary.go
  • internal/overlays/summary_test.go
  • web/src/lib/videoRange.test.ts
  • web/src/lib/videoRange.ts
  • web/src/pages/ItemDetail/components/QualityBadges.tsx
  • web/src/pages/ItemDetail/components/VersionDropdown.tsx
  • web/src/pages/ItemDetail/components/VersionFlyout.tsx
  • web/src/player/playback-info.test.ts
  • web/src/player/playback-info.ts

📝 Walkthrough

Walkthrough

Backend and frontend video-range handling now detect Dolby Vision and HDR variants from richer metadata, prioritize the best matching media, and display normalized range labels across item details, version selectors, flyouts, and playback information.

Changes

HDR and Dolby Vision range labeling

Layer / File(s) Summary
Backend range normalization and selection
internal/overlays/summary.go, internal/overlays/summary_test.go
HDR normalization recognizes Dolby Vision, HDR10+, HDR10, and HLG range metadata; file selection now uses range richness as a resolution tie-breaker, with coverage for these cases.
Frontend range label utility
web/src/lib/videoRange.ts, web/src/lib/videoRange.test.ts
Adds shared video-track types, normalized DV/HDR label generation, and ranked selection across versions with table-driven tests.
Detail and playback label integration
web/src/pages/ItemDetail/components/*, web/src/player/playback-info.ts, web/src/player/playback-info.test.ts
Uses normalized range labels in quality badges, version controls, flyouts, requested-source details, and playback range formatting.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Possibly related PRs

Suggested labels: v1

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7bca82634

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/overlays/summary.go Outdated
Comment on lines +76 to +78
for _, track := range file.VideoTracks {
if track.DolbyVision != "" {
return 3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rank all Dolby Vision metadata in tie-breaks

When same-resolution files are compared, this only gives the DV rank to tracks with a non-empty DolbyVision string. The model/API also carries DV through DVProfile and VideoRangeType (and the new web helper handles those fields), so an imported or seeded row with dv_profile or a DOVI... range type but an empty dolby_vision string still ties with generic HDR and can be masked by the first-scanned file, leaving card overlays at generic HDR. Include DVProfile > 0 and/or VideoRangeType with the DOVI prefix in this rank so the new tie-breaker works for all stored DV metadata.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed reachable — ffprobe writes DolbyVision and DVProfile together, but catalog-seeded tracks take the three fields independently, so dv_profile-only or DOVI*-range-type-only rows exist. Fixed in 244d73e: one shared hasDolbyVision predicate (string, profile > 0, or DOVI-prefixed range type) now feeds both rangeRank and normalizeHDR, matching the web helper; tests added for both paths.

@raiden202

Copy link
Copy Markdown
Contributor

I found substantial overlap while auditing #368. This PR predates ours and should own the dynamic-range classification and same-resolution overlay tie-breaking; its subtype vocabulary is also more complete than the implementation currently in #368.

I have marked #368 as draft. After this lands, I will rebase and narrow #368 to its unique work: 4K normalization, DD+ Atmos / TrueHD Atmos, audio selectors, player quality labels, and related fallbacks. Any remaining reusable model/chapter-thumbnail DV detection will be separated as a small follow-up rather than competing with this PR.

Cross-linking both efforts under #367. No action is required from this branch for our overlap cleanup.

@raiden202

Copy link
Copy Markdown
Contributor

Two robustness details from the overlap comparison are worth folding into this canonical implementation before #368 drops its duplicate range logic:

  1. web/src/lib/videoRange.ts derives HDR10+, HDR10, and HLG from video_range_type / hdr10_plus, but server hdrTypeFromTracks still checks only color_transfer. A seeded/imported track with video_range_type: DOVIWithHDR10 and no color transfer therefore renders DV HDR10 in web version UI but only DV in server card overlays. The current server test includes both fields, which hides that mismatch. Standalone HDR10Plus and HLG range-type cases have the same issue.
  2. models.VideoTrack.VideoRange is independently stored and catalog-seeded. A row with video_range: DolbyVision but no dolby_vision, dv_profile, or DOVI* range type is currently missed by both hasDolbyVision and trackHasDolbyVision.

Suggested regression cases: range-type-only DOVIWithHDR10, HDR10Plus, and HLG on the server, plus video_range: DolbyVision in both Go and TypeScript predicates. With those incorporated here, #368 can remove its overlapping DV classifier completely after rebasing.

RXWatcher and others added 2 commits July 10, 2026 13:29
Dolby Vision files were labeled with a generic "HDR" badge everywhere
outside the Media Info dialog, because badge sites only consulted the
bare FileVersion.hdr boolean even though the payload carries
video_tracks[].dolby_vision / dv_profile / video_range_type /
color_transfer.

Web: add a shared helper (web/src/lib/videoRange.ts) that derives a
display label ("DV", "DV HDR10", "DV HLG", "HDR10+", "HDR10", "HLG")
from the probed video tracks, mirroring the server-side normalizeHDR
vocabulary, with the hdr boolean kept as the last-resort fallback for
stale pre-DV probe rows. Use it in QualityBadges, VersionDropdown,
VersionFlyout, and the player HUD (playback-info) in place of the
hardcoded "HDR" literal. Badge styling is unchanged.

Server: in internal/overlays/summary.go, break bestFile resolution
ties by richness of dynamic-range metadata (DV > explicit HDR10/HLG
via color_transfer > bare hdr boolean > SDR) so a first-scanned
generic-HDR file no longer masks a Dolby Vision sibling on card
overlays. Full ties still keep the earliest file, so the selection
stays deterministic.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Probed rows set DolbyVision and DVProfile together, but catalog-seeded
or imported tracks can carry only dv_profile or a DOVI* video_range_type
with an empty dolby_vision string. Share one hasDolbyVision predicate
between rangeRank and normalizeHDR so those rows rank and label as DV,
matching the web videoRange helper.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Quick104
Quick104 force-pushed the fix/dolby-vision-range-badges branch from 244d73e to 35d5f72 Compare July 10, 2026 17:35
Review follow-up: hdrTypeFromTracks only inspected color_transfer, so
server card overlays could never label HDR10+ and a track whose only
signal is video_range_type (e.g. catalog-seeded rows without probed
color metadata) fell through to the bare-boolean tier of rangeRank —
inconsistent with hasDolbyVision, which already reads the range type.
The server now shares the web helper's detection order exactly, making
the web/server vocabulary mirror claim true.

Also drops the unused video_range field from the web VideoRangeTrack
interface.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Quick104
Quick104 merged commit 0f9584e into Silo-Server:main Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Jul 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35a079fc44

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 334 to +338
if (track?.video_range) {
return track.video_range;
}
if (version?.hdr) {
return "HDR";
}
if (version) {
return "SDR";
return videoRangeLabel(version) || "SDR";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use detailed range data before coarse video_range

For DV/HDR rows that have the new dv_profile or video_range_type metadata but also still carry the coarse video_range field, this branch returns the old coarse value (HDR/DolbyVision) before the new videoRangeLabel(version) fallback can inspect the detailed fields. That leaves the Current Source File row in the player overlay showing a generic range for exactly the imported/seeded rows this change is trying to handle; prefer the detailed helper before falling back to track.video_range.

Useful? React with 👍 / 👎.

Comment on lines +76 to +80
if hasDolbyVision(file.VideoTracks) {
return 3
}
if hdrTypeFromTracks(file.VideoTracks) != "" {
return 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rank specific range variants in server rollups

When two same-resolution versions are both DV/explicit HDR but differ in specificity—e.g. a profile-only DV row scanned before a DOVIWithELHDR10Plus row, or HLG before HDR10+—this collapses them to the same rank and keeps the first file. The new web rollup ranks those labels separately, so card overlays can continue to show a generic/lesser range while detail/version badges show the richer one; carry the same label ranking into the server tie-breaker.

Useful? React with 👍 / 👎.

Comment on lines +15 to +16
const rangeLabel = bestVideoRangeLabel(versions);
if (rangeLabel) badges.push(rangeLabel);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep range badges tied to the chosen quality tier

When an item has a higher-resolution non-DV version plus a lower-resolution DV version, pickBestAttributes still contributes the higher resolution while this scans every version and returns DV, so the detail header can show adjacent badges like 2160p and DV even though no 2160p DV file exists. Rank the range label from the same selected version/quality tier, or otherwise render it as independent availability, to avoid advertising a nonexistent combination.

Useful? React with 👍 / 👎.

Quick104 added a commit to Rhainland/silo-server that referenced this pull request Jul 16, 2026
Semantic resolution for the QualityBadges conflict with Silo-Server#365: the
selected-version summary now carries the Dolby Vision-aware video range
label (videoRangeLabel) instead of the boolean HDR flag, computed from
the selected file's video tracks only. Also hardens the variant lookup
against missing parts/versions arrays, matching versionRankingUtils.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants