diff options
Diffstat (limited to 'MediaBrowser.Model/Entities')
| -rw-r--r-- | MediaBrowser.Model/Entities/CollectionTypeOptions.cs | 59 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/IHasShares.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 46 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/PlaylistUserPermissions.cs | 30 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/Share.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/VirtualFolderInfo.cs | 1 |
6 files changed, 110 insertions, 49 deletions
diff --git a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs index e1894d84a..fc4cfdd66 100644 --- a/MediaBrowser.Model/Entities/CollectionTypeOptions.cs +++ b/MediaBrowser.Model/Entities/CollectionTypeOptions.cs @@ -1,16 +1,49 @@ -#pragma warning disable CS1591 +#pragma warning disable SA1300 // Lowercase required for backwards compat. -namespace MediaBrowser.Model.Entities +namespace MediaBrowser.Model.Entities; + +/// <summary> +/// The collection type options. +/// </summary> +public enum CollectionTypeOptions { - public enum CollectionTypeOptions - { - Movies = 0, - TvShows = 1, - Music = 2, - MusicVideos = 3, - HomeVideos = 4, - BoxSets = 5, - Books = 6, - Mixed = 7 - } + /// <summary> + /// Movies. + /// </summary> + movies = 0, + + /// <summary> + /// TV Shows. + /// </summary> + tvshows = 1, + + /// <summary> + /// Music. + /// </summary> + music = 2, + + /// <summary> + /// Music Videos. + /// </summary> + musicvideos = 3, + + /// <summary> + /// Home Videos (and Photos). + /// </summary> + homevideos = 4, + + /// <summary> + /// Box Sets. + /// </summary> + boxsets = 5, + + /// <summary> + /// Books. + /// </summary> + books = 6, + + /// <summary> + /// Mixed Movies and TV Shows. + /// </summary> + mixed = 7 } diff --git a/MediaBrowser.Model/Entities/IHasShares.cs b/MediaBrowser.Model/Entities/IHasShares.cs index b34d1a037..8c4ba6c42 100644 --- a/MediaBrowser.Model/Entities/IHasShares.cs +++ b/MediaBrowser.Model/Entities/IHasShares.cs @@ -1,4 +1,6 @@ -namespace MediaBrowser.Model.Entities; +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities; /// <summary> /// Interface for access to shares. @@ -8,5 +10,5 @@ public interface IHasShares /// <summary> /// Gets or sets the shares. /// </summary> - Share[] Shares { get; set; } + IReadOnlyList<PlaylistUserPermissions> Shares { get; set; } } diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index ae4a008bb..0d2d7c696 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -707,34 +707,48 @@ namespace MediaBrowser.Model.Entities return (VideoRange.Unknown, VideoRangeType.Unknown); } - var colorTransfer = ColorTransfer; - - if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase)) - { - return (VideoRange.HDR, VideoRangeType.HDR10); - } - - if (string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase)) - { - return (VideoRange.HDR, VideoRangeType.HLG); - } - 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); + var isDoViProfile = dvProfile == 5 || dvProfile == 7 || dvProfile == 8; + var isDoViFlag = rpuPresentFlag && blPresentFlag && (dvBlCompatId == 0 || dvBlCompatId == 1 || dvBlCompatId == 4 || dvBlCompatId == 2 || dvBlCompatId == 6); - if ((isDoViHDRProfile && isDoViHDRFlag) + if ((isDoViProfile && isDoViFlag) || string.Equals(codecTag, "dovi", StringComparison.OrdinalIgnoreCase) || string.Equals(codecTag, "dvh1", StringComparison.OrdinalIgnoreCase) || string.Equals(codecTag, "dvhe", StringComparison.OrdinalIgnoreCase) || string.Equals(codecTag, "dav1", StringComparison.OrdinalIgnoreCase)) { - return (VideoRange.HDR, VideoRangeType.DOVI); + return dvProfile switch + { + 5 => (VideoRange.HDR, VideoRangeType.DOVI), + 8 => dvBlCompatId switch + { + 1 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10), + 4 => (VideoRange.HDR, VideoRangeType.DOVIWithHLG), + 2 => (VideoRange.SDR, VideoRangeType.DOVIWithSDR), + // While not in Dolby Spec, Profile 8 CCid 6 media are possible to create, and since CCid 6 stems from Bluray (Profile 7 originally) an HDR10 base layer is guaranteed to exist. + 6 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10), + // There is no other case to handle here as per Dolby Spec. Default case included for completeness and linting purposes + _ => (VideoRange.SDR, VideoRangeType.SDR) + }, + 7 => (VideoRange.HDR, VideoRangeType.HDR10), + _ => (VideoRange.SDR, VideoRangeType.SDR) + }; + } + + var colorTransfer = ColorTransfer; + + if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase)) + { + return (VideoRange.HDR, VideoRangeType.HDR10); + } + else if (string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase)) + { + return (VideoRange.HDR, VideoRangeType.HLG); } return (VideoRange.SDR, VideoRangeType.SDR); diff --git a/MediaBrowser.Model/Entities/PlaylistUserPermissions.cs b/MediaBrowser.Model/Entities/PlaylistUserPermissions.cs new file mode 100644 index 000000000..b5f017d2b --- /dev/null +++ b/MediaBrowser.Model/Entities/PlaylistUserPermissions.cs @@ -0,0 +1,30 @@ +using System; + +namespace MediaBrowser.Model.Entities; + +/// <summary> +/// Class to hold data on user permissions for playlists. +/// </summary> +public class PlaylistUserPermissions +{ + /// <summary> + /// Initializes a new instance of the <see cref="PlaylistUserPermissions"/> class. + /// </summary> + /// <param name="userId">The user id.</param> + /// <param name="canEdit">Edit permission.</param> + public PlaylistUserPermissions(Guid userId, bool canEdit = false) + { + UserId = userId; + CanEdit = canEdit; + } + + /// <summary> + /// Gets or sets the user id. + /// </summary> + public Guid UserId { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether the user has edit permissions. + /// </summary> + public bool CanEdit { get; set; } +} diff --git a/MediaBrowser.Model/Entities/Share.cs b/MediaBrowser.Model/Entities/Share.cs deleted file mode 100644 index 186aad189..000000000 --- a/MediaBrowser.Model/Entities/Share.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace MediaBrowser.Model.Entities; - -/// <summary> -/// Class to hold data on sharing permissions. -/// </summary> -public class Share -{ - /// <summary> - /// Gets or sets the user id. - /// </summary> - public string? UserId { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether the user has edit permissions. - /// </summary> - public bool CanEdit { get; set; } -} diff --git a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs index 2b2bda12c..89bb72c3c 100644 --- a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs +++ b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs @@ -37,7 +37,6 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the type of the collection. /// </summary> /// <value>The type of the collection.</value> - [JsonConverter(typeof(JsonLowerCaseConverter<CollectionTypeOptions?>))] public CollectionTypeOptions? CollectionType { get; set; } public LibraryOptions LibraryOptions { get; set; } |
