diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2022-06-26 20:55:36 -0400 |
|---|---|---|
| committer | Joshua Boniface <joshua@boniface.me> | 2022-06-29 01:26:15 -0400 |
| commit | fe32b5e33353e6154e067c5fb196a36cdecc0cea (patch) | |
| tree | 89adb4b3b4af1ee94afa5d7a1732ce07731d8d7d /MediaBrowser.Model/Entities/MediaStream.cs | |
| parent | e61c80fed7201124809ac21a1b26facf1daddf90 (diff) | |
Merge pull request #7964 from jellyfin/dovi-side-data
(cherry picked from commit 39d185c7b19ed2da1ae46566152fb1cf182266cd)
Signed-off-by: Joshua Boniface <joshua@boniface.me>
Diffstat (limited to 'MediaBrowser.Model/Entities/MediaStream.cs')
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 101 |
1 files changed, 98 insertions, 3 deletions
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 48408e584..58988b6fa 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -73,6 +73,54 @@ namespace MediaBrowser.Model.Entities public string ColorPrimaries { get; set; } /// <summary> + /// Gets or sets the Dolby Vision version major. + /// </summary> + /// <value>The Dolby Vision version major.</value> + public int? DvVersionMajor { get; set; } + + /// <summary> + /// Gets or sets the Dolby Vision version minor. + /// </summary> + /// <value>The Dolby Vision version minor.</value> + public int? DvVersionMinor { get; set; } + + /// <summary> + /// Gets or sets the Dolby Vision profile. + /// </summary> + /// <value>The Dolby Vision profile.</value> + public int? DvProfile { get; set; } + + /// <summary> + /// Gets or sets the Dolby Vision level. + /// </summary> + /// <value>The Dolby Vision level.</value> + public int? DvLevel { get; set; } + + /// <summary> + /// Gets or sets the Dolby Vision rpu present flag. + /// </summary> + /// <value>The Dolby Vision rpu present flag.</value> + public int? RpuPresentFlag { get; set; } + + /// <summary> + /// Gets or sets the Dolby Vision el present flag. + /// </summary> + /// <value>The Dolby Vision el present flag.</value> + public int? ElPresentFlag { get; set; } + + /// <summary> + /// Gets or sets the Dolby Vision bl present flag. + /// </summary> + /// <value>The Dolby Vision bl present flag.</value> + public int? BlPresentFlag { get; set; } + + /// <summary> + /// Gets or sets the Dolby Vision bl signal compatibility id. + /// </summary> + /// <value>The Dolby Vision bl signal compatibility id.</value> + public int? DvBlSignalCompatibilityId { get; set; } + + /// <summary> /// Gets or sets the comment. /// </summary> /// <value>The comment.</value> @@ -124,6 +172,47 @@ namespace MediaBrowser.Model.Entities } } + /// <summary> + /// Gets the video dovi title. + /// </summary> + /// <value>The video dovi title.</value> + public string VideoDoViTitle + { + get + { + var dvProfile = DvProfile; + var rpuPresentFlag = RpuPresentFlag == 1; + var blPresentFlag = BlPresentFlag == 1; + var dvBlCompatId = DvBlSignalCompatibilityId; + + if (rpuPresentFlag + && blPresentFlag + && (dvProfile == 4 + || dvProfile == 5 + || dvProfile == 7 + || dvProfile == 8 + || dvProfile == 9)) + { + var title = "DV Profile " + dvProfile; + + if (dvBlCompatId > 0) + { + title += "." + dvBlCompatId; + } + + return dvBlCompatId switch + { + 1 => title + " (HDR10)", + 2 => title + " (SDR)", + 4 => title + " (HLG)", + _ => title + }; + } + + return null; + } + } + public string LocalizedUndefined { get; set; } public string LocalizedDefault { get; set; } @@ -582,11 +671,17 @@ namespace MediaBrowser.Model.Entities return ("HDR", "HLG"); } - // For some Dolby Vision files, no color transfer is provided, so check the codec - var codecTag = CodecTag; + var dvProfile = DvProfile; + var rpuPresentFlag = RpuPresentFlag == 1; + var blPresentFlag = BlPresentFlag == 1; + var dvBlCompatId = DvBlSignalCompatibilityId; + + var isDoViHDRProfile = dvProfile == 5 || dvProfile == 7 || dvProfile == 8; + var isDoViHDRFlag = rpuPresentFlag && blPresentFlag && (dvBlCompatId == 0 || dvBlCompatId == 1 || dvBlCompatId == 4); - if (string.Equals(codecTag, "dovi", StringComparison.OrdinalIgnoreCase) + if ((isDoViHDRProfile && isDoViHDRFlag) + || string.Equals(codecTag, "dovi", StringComparison.OrdinalIgnoreCase) || string.Equals(codecTag, "dvh1", StringComparison.OrdinalIgnoreCase) || string.Equals(codecTag, "dvhe", StringComparison.OrdinalIgnoreCase) || string.Equals(codecTag, "dav1", StringComparison.OrdinalIgnoreCase)) |
