From 68de105dc21f4d1114a3b1db81f177caae747ef6 Mon Sep 17 00:00:00 2001 From: Jim Cartlidge Date: Sun, 13 Sep 2020 13:49:11 +0100 Subject: [PATCH] Comments part 1 --- Emby.Dlna/Common/Argument.cs | 20 +- Emby.Dlna/Common/DeviceIcon.cs | 32 +- Emby.Dlna/Common/DeviceService.cs | 33 +- Emby.Dlna/Common/ServiceAction.cs | 21 +- Emby.Dlna/Common/StateVariable.cs | 31 +- .../Dlna/DeviceIdentification.cs | 23 +- MediaBrowser.Model/Dlna/DeviceProfile.cs | 364 +++++++++++++----- MediaBrowser.Model/Dlna/XmlAttribute.cs | 9 + 8 files changed, 377 insertions(+), 156 deletions(-) diff --git a/Emby.Dlna/Common/Argument.cs b/Emby.Dlna/Common/Argument.cs index f375e6049c..430a3b47d5 100644 --- a/Emby.Dlna/Common/Argument.cs +++ b/Emby.Dlna/Common/Argument.cs @@ -1,13 +1,23 @@ -#pragma warning disable CS1591 - namespace Emby.Dlna.Common { + /// + /// DLNA Query parameter type, used when quering DLNA devices via SOAP. + /// public class Argument { - public string Name { get; set; } + /// + /// Gets or sets name of the DLNA argument. + /// + public string Name { get; set; } = string.Empty; - public string Direction { get; set; } + /// + /// Gets or sets the direction of the parameter. + /// + public string Direction { get; set; } = string.Empty; - public string RelatedStateVariable { get; set; } + /// + /// Gets or sets the related DLNA state variable for this argument. + /// + public string RelatedStateVariable { get; set; } = string.Empty; } } diff --git a/Emby.Dlna/Common/DeviceIcon.cs b/Emby.Dlna/Common/DeviceIcon.cs index c3f7fa8aaa..f9fd1dcec6 100644 --- a/Emby.Dlna/Common/DeviceIcon.cs +++ b/Emby.Dlna/Common/DeviceIcon.cs @@ -1,29 +1,41 @@ -#pragma warning disable CS1591 - using System.Globalization; namespace Emby.Dlna.Common { + /// + /// Defines the . + /// public class DeviceIcon { - public string Url { get; set; } + /// + /// Gets or sets the Url. + /// + public string Url { get; set; } = string.Empty; - public string MimeType { get; set; } + /// + /// Gets or sets the MimeType. + /// + public string MimeType { get; set; } = string.Empty; + /// + /// Gets or sets the Width. + /// public int Width { get; set; } + /// + /// Gets or sets the Height. + /// public int Height { get; set; } - public string Depth { get; set; } + /// + /// Gets or sets the Depth. + /// + public string Depth { get; set; } = string.Empty; /// public override string ToString() { - return string.Format( - CultureInfo.InvariantCulture, - "{0}x{1}", - Height, - Width); + return string.Format(CultureInfo.InvariantCulture, "{0}x{1}", Height, Width); } } } diff --git a/Emby.Dlna/Common/DeviceService.cs b/Emby.Dlna/Common/DeviceService.cs index 44c0a0412a..c1369558ec 100644 --- a/Emby.Dlna/Common/DeviceService.cs +++ b/Emby.Dlna/Common/DeviceService.cs @@ -1,21 +1,36 @@ -#pragma warning disable CS1591 - namespace Emby.Dlna.Common { + /// + /// Defines the . + /// public class DeviceService { - public string ServiceType { get; set; } + /// + /// Gets or sets the Service Type. + /// + public string ServiceType { get; set; } = string.Empty; - public string ServiceId { get; set; } + /// + /// Gets or sets the Service Id. + /// + public string ServiceId { get; set; } = string.Empty; - public string ScpdUrl { get; set; } + /// + /// Gets or sets the Scpd Url. + /// + public string ScpdUrl { get; set; } = string.Empty; - public string ControlUrl { get; set; } + /// + /// Gets or sets the Control Url. + /// + public string ControlUrl { get; set; } = string.Empty; - public string EventSubUrl { get; set; } + /// + /// Gets or sets the EventSubUrl. + /// + public string EventSubUrl { get; set; } = string.Empty; /// - public override string ToString() - => ServiceId; + public override string ToString() => ServiceId; } } diff --git a/Emby.Dlna/Common/ServiceAction.cs b/Emby.Dlna/Common/ServiceAction.cs index d458d7f3f6..02b81a0aa7 100644 --- a/Emby.Dlna/Common/ServiceAction.cs +++ b/Emby.Dlna/Common/ServiceAction.cs @@ -1,24 +1,31 @@ -#pragma warning disable CS1591 - using System.Collections.Generic; namespace Emby.Dlna.Common { + /// + /// Defines the . + /// public class ServiceAction { + /// + /// Initializes a new instance of the class. + /// public ServiceAction() { ArgumentList = new List(); } - public string Name { get; set; } + /// + /// Gets or sets the name of the action. + /// + public string Name { get; set; } = string.Empty; + /// + /// Gets the ArgumentList. + /// public List ArgumentList { get; } /// - public override string ToString() - { - return Name; - } + public override string ToString() => Name; } } diff --git a/Emby.Dlna/Common/StateVariable.cs b/Emby.Dlna/Common/StateVariable.cs index 6daf7ab6b2..fd733e0853 100644 --- a/Emby.Dlna/Common/StateVariable.cs +++ b/Emby.Dlna/Common/StateVariable.cs @@ -1,27 +1,34 @@ -#pragma warning disable CS1591 - using System; using System.Collections.Generic; namespace Emby.Dlna.Common { + /// + /// Defines the . + /// public class StateVariable { - public StateVariable() - { - AllowedValues = Array.Empty(); - } + /// + /// Gets or sets the name of the state variable. + /// + public string Name { get; set; } = string.Empty; - public string Name { get; set; } - - public string DataType { get; set; } + /// + /// Gets or sets the data type of the state variable. + /// + public string DataType { get; set; } = string.Empty; + /// + /// Gets or sets a value indicating whether it sends events. + /// public bool SendsEvents { get; set; } - public IReadOnlyList AllowedValues { get; set; } + /// + /// Gets or sets the allowed values range. + /// + public IReadOnlyList AllowedValues { get; set; } = Array.Empty(); /// - public override string ToString() - => Name; + public override string ToString() => Name; } } diff --git a/MediaBrowser.Model/Dlna/DeviceIdentification.cs b/MediaBrowser.Model/Dlna/DeviceIdentification.cs index 43407383a8..c511801f4f 100644 --- a/MediaBrowser.Model/Dlna/DeviceIdentification.cs +++ b/MediaBrowser.Model/Dlna/DeviceIdentification.cs @@ -11,59 +11,54 @@ namespace MediaBrowser.Model.Dlna /// Gets or sets the name of the friendly. /// /// The name of the friendly. - public string FriendlyName { get; set; } + public string FriendlyName { get; set; } = string.Empty; /// /// Gets or sets the model number. /// /// The model number. - public string ModelNumber { get; set; } + public string ModelNumber { get; set; } = string.Empty; /// /// Gets or sets the serial number. /// /// The serial number. - public string SerialNumber { get; set; } + public string SerialNumber { get; set; } = string.Empty; /// /// Gets or sets the name of the model. /// /// The name of the model. - public string ModelName { get; set; } + public string ModelName { get; set; } = string.Empty; /// /// Gets or sets the model description. /// /// The model description. - public string ModelDescription { get; set; } + public string ModelDescription { get; set; } = string.Empty; /// /// Gets or sets the model URL. /// /// The model URL. - public string ModelUrl { get; set; } + public string ModelUrl { get; set; } = string.Empty; /// /// Gets or sets the manufacturer. /// /// The manufacturer. - public string Manufacturer { get; set; } + public string Manufacturer { get; set; } = string.Empty; /// /// Gets or sets the manufacturer URL. /// /// The manufacturer URL. - public string ManufacturerUrl { get; set; } + public string ManufacturerUrl { get; set; } = string.Empty; /// /// Gets or sets the headers. /// /// The headers. - public HttpHeaderInfo[] Headers { get; set; } - - public DeviceIdentification() - { - Headers = Array.Empty(); - } + public HttpHeaderInfo[] Headers { get; set; } = Array.Empty(); } } diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 7e921b1fdf..8b2a94fd45 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -1,6 +1,5 @@ #nullable disable -#pragma warning disable CS1591 - +#pragma warning disable CA1819 // Properties should not return arrays using System; using System.Linq; using System.Xml.Serialization; @@ -8,107 +7,15 @@ using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { + /// + /// Defines the . + /// [XmlRoot("Profile")] public class DeviceProfile { /// - /// Gets or sets the name. + /// Initializes a new instance of the class. /// - /// The name. - public string Name { get; set; } - - [XmlIgnore] - public string Id { get; set; } - - /// - /// Gets or sets the identification. - /// - /// The identification. - public DeviceIdentification Identification { get; set; } - - public string FriendlyName { get; set; } - - public string Manufacturer { get; set; } - - public string ManufacturerUrl { get; set; } - - public string ModelName { get; set; } - - public string ModelDescription { get; set; } - - public string ModelNumber { get; set; } - - public string ModelUrl { get; set; } - - public string SerialNumber { get; set; } - - public bool EnableAlbumArtInDidl { get; set; } - - public bool EnableSingleAlbumArtLimit { get; set; } - - public bool EnableSingleSubtitleLimit { get; set; } - - public string SupportedMediaTypes { get; set; } - - public string UserId { get; set; } - - public string AlbumArtPn { get; set; } - - public int MaxAlbumArtWidth { get; set; } - - public int MaxAlbumArtHeight { get; set; } - - public int? MaxIconWidth { get; set; } - - public int? MaxIconHeight { get; set; } - - public long? MaxStreamingBitrate { get; set; } - - public long? MaxStaticBitrate { get; set; } - - public int? MusicStreamingTranscodingBitrate { get; set; } - - public int? MaxStaticMusicBitrate { get; set; } - - /// - /// Controls the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace. - /// - public string SonyAggregationFlags { get; set; } - - public string ProtocolInfo { get; set; } - - public int TimelineOffsetSeconds { get; set; } - - public bool RequiresPlainVideoItems { get; set; } - - public bool RequiresPlainFolders { get; set; } - - public bool EnableMSMediaReceiverRegistrar { get; set; } - - public bool IgnoreTranscodeByteRangeRequests { get; set; } - - public XmlAttribute[] XmlRootAttributes { get; set; } - - /// - /// Gets or sets the direct play profiles. - /// - /// The direct play profiles. - public DirectPlayProfile[] DirectPlayProfiles { get; set; } - - /// - /// Gets or sets the transcoding profiles. - /// - /// The transcoding profiles. - public TranscodingProfile[] TranscodingProfiles { get; set; } - - public ContainerProfile[] ContainerProfiles { get; set; } - - public CodecProfile[] CodecProfiles { get; set; } - - public ResponseProfile[] ResponseProfiles { get; set; } - - public SubtitleProfile[] SubtitleProfiles { get; set; } - public DeviceProfile() { DirectPlayProfiles = Array.Empty(); @@ -126,11 +33,217 @@ namespace MediaBrowser.Model.Dlna MusicStreamingTranscodingBitrate = 128000; } + /// + /// Gets or sets the Name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the Id. + /// + [XmlIgnore] + public string Id { get; set; } + + /// + /// Gets or sets the Identification. + /// + public DeviceIdentification Identification { get; set; } + + /// + /// Gets or sets the FriendlyName. + /// + public string FriendlyName { get; set; } + + /// + /// Gets or sets the Manufacturer. + /// + public string Manufacturer { get; set; } + + /// + /// Gets or sets the ManufacturerUrl. + /// + public string ManufacturerUrl { get; set; } + + /// + /// Gets or sets the ModelName. + /// + public string ModelName { get; set; } + + /// + /// Gets or sets the ModelDescription. + /// + public string ModelDescription { get; set; } + + /// + /// Gets or sets the ModelNumber. + /// + public string ModelNumber { get; set; } + + /// + /// Gets or sets the ModelUrl. + /// + public string ModelUrl { get; set; } + + /// + /// Gets or sets the SerialNumber. + /// + public string SerialNumber { get; set; } + + /// + /// Gets or sets a value indicating whether EnableAlbumArtInDidl. + /// + public bool EnableAlbumArtInDidl { get; set; } + + /// + /// Gets or sets a value indicating whether EnableSingleAlbumArtLimit. + /// + public bool EnableSingleAlbumArtLimit { get; set; } + + /// + /// Gets or sets a value indicating whether EnableSingleSubtitleLimit. + /// + public bool EnableSingleSubtitleLimit { get; set; } + + /// + /// Gets or sets the SupportedMediaTypes. + /// + public string SupportedMediaTypes { get; set; } + + /// + /// Gets or sets the UserId. + /// + public string UserId { get; set; } + + /// + /// Gets or sets the AlbumArtPn. + /// + public string AlbumArtPn { get; set; } + + /// + /// Gets or sets the MaxAlbumArtWidth. + /// + public int MaxAlbumArtWidth { get; set; } + + /// + /// Gets or sets the MaxAlbumArtHeight. + /// + public int MaxAlbumArtHeight { get; set; } + + /// + /// Gets or sets the MaxIconWidth. + /// + public int? MaxIconWidth { get; set; } + + /// + /// Gets or sets the MaxIconHeight. + /// + public int? MaxIconHeight { get; set; } + + /// + /// Gets or sets the MaxStreamingBitrate. + /// + public long? MaxStreamingBitrate { get; set; } + + /// + /// Gets or sets the MaxStaticBitrate. + /// + public long? MaxStaticBitrate { get; set; } + + /// + /// Gets or sets the MusicStreamingTranscodingBitrate. + /// + public int? MusicStreamingTranscodingBitrate { get; set; } + + /// + /// Gets or sets the MaxStaticMusicBitrate. + /// + public int? MaxStaticMusicBitrate { get; set; } + + /// + /// Gets or sets the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace. + /// + public string SonyAggregationFlags { get; set; } + + /// + /// Gets or sets the ProtocolInfo. + /// + public string ProtocolInfo { get; set; } + + /// + /// Gets or sets the TimelineOffsetSeconds. + /// + public int TimelineOffsetSeconds { get; set; } + + /// + /// Gets or sets a value indicating whether RequiresPlainVideoItems. + /// + public bool RequiresPlainVideoItems { get; set; } + + /// + /// Gets or sets a value indicating whether RequiresPlainFolders. + /// + public bool RequiresPlainFolders { get; set; } + + /// + /// Gets or sets a value indicating whether EnableMSMediaReceiverRegistrar. + /// + public bool EnableMSMediaReceiverRegistrar { get; set; } + + /// + /// Gets or sets a value indicating whether IgnoreTranscodeByteRangeRequests. + /// + public bool IgnoreTranscodeByteRangeRequests { get; set; } + + /// + /// Gets or sets the XmlRootAttributes. + /// + public XmlAttribute[] XmlRootAttributes { get; set; } + + /// + /// Gets or sets the direct play profiles. + /// + public DirectPlayProfile[] DirectPlayProfiles { get; set; } + + /// + /// Gets or sets the transcoding profiles. + /// + public TranscodingProfile[] TranscodingProfiles { get; set; } + + /// + /// Gets or sets the ContainerProfiles. + /// + public ContainerProfile[] ContainerProfiles { get; set; } + + /// + /// Gets or sets the CodecProfiles. + /// + public CodecProfile[] CodecProfiles { get; set; } + + /// + /// Gets or sets the ResponseProfiles. + /// + public ResponseProfile[] ResponseProfiles { get; set; } + + /// + /// Gets or sets the SubtitleProfiles. + /// + public SubtitleProfile[] SubtitleProfiles { get; set; } + + /// + /// The GetSupportedMediaTypes. + /// + /// The . public string[] GetSupportedMediaTypes() { return ContainerProfile.SplitValue(SupportedMediaTypes); } + /// + /// Gets the audio transcoding profile. + /// + /// The container. + /// The audio Codec. + /// A . public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec) { container = (container ?? string.Empty).TrimStart('.'); @@ -158,6 +271,13 @@ namespace MediaBrowser.Model.Dlna return null; } + /// + /// Gets the video transcoding profile. + /// + /// The container. + /// The audio Codec. + /// The video Codec. + /// The . public TranscodingProfile GetVideoTranscodingProfile(string container, string audioCodec, string videoCodec) { container = (container ?? string.Empty).TrimStart('.'); @@ -190,6 +310,16 @@ namespace MediaBrowser.Model.Dlna return null; } + /// + /// Gets the audio media profile. + /// + /// The container. + /// The audio codec. + /// The audio channels. + /// The audio bitrate. + /// The audio sample rate. + /// The audio bit depth. + /// The . public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate, int? audioSampleRate, int? audioBitDepth) { foreach (var i in ResponseProfiles) @@ -231,6 +361,11 @@ namespace MediaBrowser.Model.Dlna return null; } + /// + /// Gets the model profile condition. + /// + /// The c. + /// The . private ProfileCondition GetModelProfileCondition(ProfileCondition c) { return new ProfileCondition @@ -242,6 +377,13 @@ namespace MediaBrowser.Model.Dlna }; } + /// + /// Gets the image media profile. + /// + /// The container. + /// The width. + /// The height. + /// The . public ResponseProfile GetImageMediaProfile(string container, int? width, int? height) { foreach (var i in ResponseProfiles) @@ -277,7 +419,31 @@ namespace MediaBrowser.Model.Dlna return null; } - public ResponseProfile GetVideoMediaProfile(string container, + /// + /// Gets the video media profile. + /// + /// The container. + /// The audio codec. + /// The video codec. + /// The width. + /// The height. + /// The bit depth. + /// The video bitrate. + /// The video profile. + /// The video level. + /// The video framerate. + /// The packet length. + /// The timestamp. + /// True if anamorphic. + /// True if interlaced. + /// The ref frames. + /// The number of video streams. + /// The number of audio streams. + /// The video Codec tag. + /// True if Avc. + /// The . + public ResponseProfile GetVideoMediaProfile( + string container, string audioCodec, string videoCodec, int? width, diff --git a/MediaBrowser.Model/Dlna/XmlAttribute.cs b/MediaBrowser.Model/Dlna/XmlAttribute.cs index 3a8939a797..03bb2e4b11 100644 --- a/MediaBrowser.Model/Dlna/XmlAttribute.cs +++ b/MediaBrowser.Model/Dlna/XmlAttribute.cs @@ -5,11 +5,20 @@ using System.Xml.Serialization; namespace MediaBrowser.Model.Dlna { + /// + /// Defines the . + /// public class XmlAttribute { + /// + /// Gets or sets the name of the attribute. + /// [XmlAttribute("name")] public string Name { get; set; } + /// + /// Gets or sets the value of the attribute. + /// [XmlAttribute("value")] public string Value { get; set; } }