diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-19 15:11:50 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-19 15:11:50 -0500 |
| commit | 55538764fa06a64795c099fc6496df9dbb4156bd (patch) | |
| tree | 8c1f94861ecebdf634b70a7265945b6f8f13aff1 /MediaBrowser.Model/Dlna | |
| parent | 3b52035ee064a5d9aa215d9515211d4508585d39 (diff) | |
| parent | c5430f86b0b5863482e7c4f7e55a79c7d88c133b (diff) | |
Merge pull request #575 from EraYaN/reformat
Reformat all C# server code to conform with code standards
Diffstat (limited to 'MediaBrowser.Model/Dlna')
42 files changed, 168 insertions, 226 deletions
diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs index 9480311b53..33e2982e93 100644 --- a/MediaBrowser.Model/Dlna/AudioOptions.cs +++ b/MediaBrowser.Model/Dlna/AudioOptions.cs @@ -1,6 +1,5 @@ -using MediaBrowser.Model.Dto; -using System.Collections.Generic; using System; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Model.Dlna { @@ -84,4 +83,4 @@ namespace MediaBrowser.Model.Dlna return null; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs index c40408e9b5..9ea248908b 100644 --- a/MediaBrowser.Model/Dlna/CodecProfile.cs +++ b/MediaBrowser.Model/Dlna/CodecProfile.cs @@ -1,7 +1,5 @@ -using MediaBrowser.Model.Extensions; -using System.Collections.Generic; using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Dlna { @@ -22,7 +20,7 @@ namespace MediaBrowser.Model.Dlna public CodecProfile() { - Conditions = new ProfileCondition[] {}; + Conditions = new ProfileCondition[] { }; ApplyConditions = new ProfileCondition[] { }; } diff --git a/MediaBrowser.Model/Dlna/CodecType.cs b/MediaBrowser.Model/Dlna/CodecType.cs index 415cae7acf..d777be4c22 100644 --- a/MediaBrowser.Model/Dlna/CodecType.cs +++ b/MediaBrowser.Model/Dlna/CodecType.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum CodecType { @@ -6,4 +6,4 @@ VideoAudio = 1, Audio = 2 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index 5bcee6de29..dc0c5f1397 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -1,8 +1,7 @@ -using MediaBrowser.Model.Extensions; -using MediaBrowser.Model.MediaInfo; using System; -using System.Collections.Generic; using System.Globalization; +using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { @@ -24,7 +23,7 @@ namespace MediaBrowser.Model.Dlna int? numVideoStreams, int? numAudioStreams, string videoCodecTag, - bool? isAvc ) + bool? isAvc) { switch (condition.Property) { @@ -130,8 +129,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - int expected; - if (int.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected)) + if (int.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected)) { switch (condition.Condition) { @@ -185,8 +183,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - bool expected; - if (bool.TryParse(condition.Value, out expected)) + if (bool.TryParse(condition.Value, out var expected)) { switch (condition.Condition) { @@ -210,8 +207,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - float expected; - if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected)) + if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected)) { switch (condition.Condition) { @@ -239,8 +235,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - double expected; - if (double.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected)) + if (double.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected)) { switch (condition.Condition) { @@ -268,7 +263,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - TransportStreamTimestamp expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true); + var expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true); switch (condition.Condition) { diff --git a/MediaBrowser.Model/Dlna/ContainerProfile.cs b/MediaBrowser.Model/Dlna/ContainerProfile.cs index ccad4cead4..073324c264 100644 --- a/MediaBrowser.Model/Dlna/ContainerProfile.cs +++ b/MediaBrowser.Model/Dlna/ContainerProfile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Xml.Serialization; using MediaBrowser.Model.Extensions; diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index 88d7573e60..901d81c5ff 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { @@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Dlna // 0 = native, 1 = transcoded var orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - DlnaFlags flagValue = DlnaFlags.BackgroundTransferMode | + var flagValue = DlnaFlags.BackgroundTransferMode | DlnaFlags.InteractiveTransferMode | DlnaFlags.DlnaV15; @@ -66,7 +66,7 @@ namespace MediaBrowser.Model.Dlna // 0 = native, 1 = transcoded string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - DlnaFlags flagValue = DlnaFlags.StreamingTransferMode | + var flagValue = DlnaFlags.StreamingTransferMode | DlnaFlags.BackgroundTransferMode | DlnaFlags.InteractiveTransferMode | DlnaFlags.DlnaV15; @@ -131,7 +131,7 @@ namespace MediaBrowser.Model.Dlna // 0 = native, 1 = transcoded string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - DlnaFlags flagValue = DlnaFlags.StreamingTransferMode | + var flagValue = DlnaFlags.StreamingTransferMode | DlnaFlags.BackgroundTransferMode | DlnaFlags.InteractiveTransferMode | DlnaFlags.DlnaV15; @@ -168,7 +168,7 @@ namespace MediaBrowser.Model.Dlna videoCodecTag, isAvc); - List<string> orgPnValues = new List<string>(); + var orgPnValues = new List<string>(); if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn)) { @@ -183,7 +183,7 @@ namespace MediaBrowser.Model.Dlna } } - List<string> contentFeatureList = new List<string>(); + var contentFeatureList = new List<string>(); foreach (string orgPn in orgPnValues) { diff --git a/MediaBrowser.Model/Dlna/DeviceIdentification.cs b/MediaBrowser.Model/Dlna/DeviceIdentification.cs index 97f4409daf..84573521aa 100644 --- a/MediaBrowser.Model/Dlna/DeviceIdentification.cs +++ b/MediaBrowser.Model/Dlna/DeviceIdentification.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public class DeviceIdentification { @@ -55,7 +55,7 @@ public DeviceIdentification() { - Headers = new HttpHeaderInfo[] {}; + Headers = new HttpHeaderInfo[] { }; } } } diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 4bf7d6b8d5..6894f45edc 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -1,8 +1,7 @@ -using MediaBrowser.Model.Extensions; -using MediaBrowser.Model.MediaInfo; -using System.Collections.Generic; -using System.Xml.Serialization; using System; +using System.Xml.Serialization; +using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { @@ -22,7 +21,7 @@ namespace MediaBrowser.Model.Dlna /// Gets or sets the identification. /// </summary> /// <value>The identification.</value> - public MediaBrowser.Model.Dlna.DeviceIdentification Identification { get; set; } + public DeviceIdentification Identification { get; set; } public string FriendlyName { get; set; } public string Manufacturer { get; set; } @@ -239,7 +238,7 @@ namespace MediaBrowser.Model.Dlna var conditionProcessor = new ConditionProcessor(); var anyOff = false; - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height)) { diff --git a/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs b/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs index b2afdf2924..c78f0d9b2b 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Model.Dlna { public class DeviceProfileInfo diff --git a/MediaBrowser.Model/Dlna/DeviceProfileType.cs b/MediaBrowser.Model/Dlna/DeviceProfileType.cs index f881a45395..2449fa434a 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfileType.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfileType.cs @@ -1,8 +1,8 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum DeviceProfileType { System = 0, User = 1 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs index 4279b545d6..5a54847d74 100644 --- a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs +++ b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using System.Xml.Serialization; namespace MediaBrowser.Model.Dlna diff --git a/MediaBrowser.Model/Dlna/DlnaFlags.cs b/MediaBrowser.Model/Dlna/DlnaFlags.cs index 28c93464d9..d076e73ece 100644 --- a/MediaBrowser.Model/Dlna/DlnaFlags.cs +++ b/MediaBrowser.Model/Dlna/DlnaFlags.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Model.Dlna { diff --git a/MediaBrowser.Model/Dlna/DlnaMaps.cs b/MediaBrowser.Model/Dlna/DlnaMaps.cs index 8dadc32d60..880d057240 100644 --- a/MediaBrowser.Model/Dlna/DlnaMaps.cs +++ b/MediaBrowser.Model/Dlna/DlnaMaps.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public class DlnaMaps { diff --git a/MediaBrowser.Model/Dlna/DlnaProfileType.cs b/MediaBrowser.Model/Dlna/DlnaProfileType.cs index 1bad14081a..6a23bbb040 100644 --- a/MediaBrowser.Model/Dlna/DlnaProfileType.cs +++ b/MediaBrowser.Model/Dlna/DlnaProfileType.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum DlnaProfileType { @@ -6,4 +6,4 @@ Video = 1, Photo = 2 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/EncodingContext.cs b/MediaBrowser.Model/Dlna/EncodingContext.cs index f83d8ddc82..7352bdd19d 100644 --- a/MediaBrowser.Model/Dlna/EncodingContext.cs +++ b/MediaBrowser.Model/Dlna/EncodingContext.cs @@ -5,4 +5,4 @@ namespace MediaBrowser.Model.Dlna Streaming = 0, Static = 1 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/HeaderMatchType.cs b/MediaBrowser.Model/Dlna/HeaderMatchType.cs index 7a0d5c24f9..b0a1438f6d 100644 --- a/MediaBrowser.Model/Dlna/HeaderMatchType.cs +++ b/MediaBrowser.Model/Dlna/HeaderMatchType.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum HeaderMatchType { @@ -6,4 +6,4 @@ Regex = 1, Substring = 2 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/HttpHeaderInfo.cs b/MediaBrowser.Model/Dlna/HttpHeaderInfo.cs index b4fa4e0afd..d157275048 100644 --- a/MediaBrowser.Model/Dlna/HttpHeaderInfo.cs +++ b/MediaBrowser.Model/Dlna/HttpHeaderInfo.cs @@ -1,5 +1,4 @@ -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; +using System.Xml.Serialization; namespace MediaBrowser.Model.Dlna { @@ -14,4 +13,4 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("match")] public HeaderMatchType Match { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/IDeviceDiscovery.cs b/MediaBrowser.Model/Dlna/IDeviceDiscovery.cs index 70191ff23c..3de3fe761d 100644 --- a/MediaBrowser.Model/Dlna/IDeviceDiscovery.cs +++ b/MediaBrowser.Model/Dlna/IDeviceDiscovery.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Model.Events; namespace MediaBrowser.Model.Dlna diff --git a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs index 14723bd273..c0ff54c3fc 100644 --- a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs +++ b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public interface ITranscoderSupport { diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfile.cs b/MediaBrowser.Model/Dlna/MediaFormatProfile.cs index f3d04335fb..7c56fc5f45 100644 --- a/MediaBrowser.Model/Dlna/MediaFormatProfile.cs +++ b/MediaBrowser.Model/Dlna/MediaFormatProfile.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Model.Dlna { public enum MediaFormatProfile diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs index 81d58336bf..672784589f 100644 --- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs +++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.Extensions; -using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; using System.Linq; +using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { @@ -91,7 +91,7 @@ namespace MediaBrowser.Model.Dlna if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg2video")) { - List<MediaFormatProfile> list = new List<MediaFormatProfile>(); + var list = new List<MediaFormatProfile>(); list.Add(ValueOf("MPEG_TS_SD_NA" + suffix)); list.Add(ValueOf("MPEG_TS_SD_EU" + suffix)); @@ -167,7 +167,7 @@ namespace MediaBrowser.Model.Dlna return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) }; } - return new MediaFormatProfile[]{}; + return new MediaFormatProfile[] { }; } private MediaFormatProfile ValueOf(string value) diff --git a/MediaBrowser.Model/Dlna/PlaybackErrorCode.cs b/MediaBrowser.Model/Dlna/PlaybackErrorCode.cs index 4ed4129854..5080bc2863 100644 --- a/MediaBrowser.Model/Dlna/PlaybackErrorCode.cs +++ b/MediaBrowser.Model/Dlna/PlaybackErrorCode.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Model.Dlna { public enum PlaybackErrorCode diff --git a/MediaBrowser.Model/Dlna/ProfileCondition.cs b/MediaBrowser.Model/Dlna/ProfileCondition.cs index 39f99b92ee..b83566f6e2 100644 --- a/MediaBrowser.Model/Dlna/ProfileCondition.cs +++ b/MediaBrowser.Model/Dlna/ProfileCondition.cs @@ -1,4 +1,4 @@ -using System.Xml.Serialization; +using System.Xml.Serialization; namespace MediaBrowser.Model.Dlna { @@ -35,4 +35,4 @@ namespace MediaBrowser.Model.Dlna IsRequired = isRequired; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/ProfileConditionType.cs b/MediaBrowser.Model/Dlna/ProfileConditionType.cs index b0a94c5b30..2628412622 100644 --- a/MediaBrowser.Model/Dlna/ProfileConditionType.cs +++ b/MediaBrowser.Model/Dlna/ProfileConditionType.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum ProfileConditionType { @@ -8,4 +8,4 @@ GreaterThanEqual = 3, EqualsAny = 4 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs index a96e9ac364..bae46bdcfc 100644 --- a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs +++ b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum ProfileConditionValue { @@ -26,4 +26,4 @@ AudioSampleRate = 22, AudioBitDepth = 23 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/ResolutionConfiguration.cs b/MediaBrowser.Model/Dlna/ResolutionConfiguration.cs index 8efdb06609..6b1f854407 100644 --- a/MediaBrowser.Model/Dlna/ResolutionConfiguration.cs +++ b/MediaBrowser.Model/Dlna/ResolutionConfiguration.cs @@ -11,4 +11,4 @@ namespace MediaBrowser.Model.Dlna MaxBitrate = maxBitrate; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs index 4cde26a03c..cf92633c31 100644 --- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs +++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Dlna diff --git a/MediaBrowser.Model/Dlna/ResolutionOptions.cs b/MediaBrowser.Model/Dlna/ResolutionOptions.cs index 6b711cfa0d..30c078b55b 100644 --- a/MediaBrowser.Model/Dlna/ResolutionOptions.cs +++ b/MediaBrowser.Model/Dlna/ResolutionOptions.cs @@ -5,4 +5,4 @@ namespace MediaBrowser.Model.Dlna public int? MaxWidth { get; set; } public int? MaxHeight { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/ResponseProfile.cs b/MediaBrowser.Model/Dlna/ResponseProfile.cs index 742253fa35..8c6b0806fd 100644 --- a/MediaBrowser.Model/Dlna/ResponseProfile.cs +++ b/MediaBrowser.Model/Dlna/ResponseProfile.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; namespace MediaBrowser.Model.Dlna { @@ -28,7 +26,7 @@ namespace MediaBrowser.Model.Dlna public ResponseProfile() { - Conditions = new ProfileCondition[] {}; + Conditions = new ProfileCondition[] { }; } public string[] GetContainers() diff --git a/MediaBrowser.Model/Dlna/SearchCriteria.cs b/MediaBrowser.Model/Dlna/SearchCriteria.cs index 50ee4a3783..4f47c28219 100644 --- a/MediaBrowser.Model/Dlna/SearchCriteria.cs +++ b/MediaBrowser.Model/Dlna/SearchCriteria.cs @@ -1,6 +1,6 @@ -using MediaBrowser.Model.Extensions; using System; using System.Text.RegularExpressions; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Dlna { diff --git a/MediaBrowser.Model/Dlna/SearchType.cs b/MediaBrowser.Model/Dlna/SearchType.cs index 27b2078792..05c59f5de6 100644 --- a/MediaBrowser.Model/Dlna/SearchType.cs +++ b/MediaBrowser.Model/Dlna/SearchType.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum SearchType { @@ -9,4 +9,4 @@ Playlist = 4, MusicAlbum = 5 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/SortCriteria.cs b/MediaBrowser.Model/Dlna/SortCriteria.cs index ecaf32614c..b5c1ac408e 100644 --- a/MediaBrowser.Model/Dlna/SortCriteria.cs +++ b/MediaBrowser.Model/Dlna/SortCriteria.cs @@ -1,13 +1,10 @@ -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.Dlna { public class SortCriteria { - public SortOrder SortOrder - { - get { return SortOrder.Ascending; } - } + public SortOrder SortOrder => SortOrder.Ascending; public SortCriteria(string value) { diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index c571d83849..ec05e2eb72 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -1,13 +1,13 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Extensions; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Session; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Session; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Model.Dlna { @@ -77,7 +77,7 @@ namespace MediaBrowser.Model.Dlna var streams = new List<StreamInfo>(); foreach (MediaSourceInfo i in mediaSources) { - StreamInfo streamInfo = BuildVideoItem(i, options); + var streamInfo = BuildVideoItem(i, options); if (streamInfo != null) { streams.Add(streamInfo); @@ -284,7 +284,7 @@ namespace MediaBrowser.Model.Dlna { var transcodeReasons = new List<TranscodeReason>(); - StreamInfo playlistItem = new StreamInfo + var playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Audio, @@ -308,14 +308,14 @@ namespace MediaBrowser.Model.Dlna return playlistItem; } - MediaStream audioStream = item.GetDefaultAudioStream(null); + var audioStream = item.GetDefaultAudioStream(null); var directPlayInfo = GetAudioDirectPlayMethods(item, audioStream, options); var directPlayMethods = directPlayInfo.Item1; transcodeReasons.AddRange(directPlayInfo.Item2); - ConditionProcessor conditionProcessor = new ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); int? inputAudioChannels = audioStream == null ? null : audioStream.Channels; int? inputAudioBitrate = audioStream == null ? null : audioStream.BitDepth; @@ -328,7 +328,7 @@ namespace MediaBrowser.Model.Dlna // Make sure audio codec profiles are satisfied var conditions = new List<ProfileCondition>(); - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Audio && i.ContainsAnyCodec(audioCodec, item.Container)) { @@ -383,7 +383,7 @@ namespace MediaBrowser.Model.Dlna } TranscodingProfile transcodingProfile = null; - foreach (TranscodingProfile i in options.Profile.TranscodingProfiles) + foreach (var i in options.Profile.TranscodingProfiles) { if (i.Type == playlistItem.MediaType && i.Context == options.Context) { @@ -405,7 +405,7 @@ namespace MediaBrowser.Model.Dlna SetStreamInfoOptionsFromTranscodingProfile(playlistItem, transcodingProfile); var audioCodecProfiles = new List<CodecProfile>(); - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Audio && i.ContainsAnyCodec(transcodingProfile.AudioCodec, transcodingProfile.Container)) { @@ -416,10 +416,10 @@ namespace MediaBrowser.Model.Dlna } var audioTranscodingConditions = new List<ProfileCondition>(); - foreach (CodecProfile i in audioCodecProfiles) + foreach (var i in audioCodecProfiles) { bool applyConditions = true; - foreach (ProfileCondition applyCondition in i.ApplyConditions) + foreach (var applyCondition in i.ApplyConditions) { if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) { @@ -478,7 +478,7 @@ namespace MediaBrowser.Model.Dlna var transcodeReasons = new List<TranscodeReason>(); DirectPlayProfile directPlayProfile = null; - foreach (DirectPlayProfile i in options.Profile.DirectPlayProfiles) + foreach (var i in options.Profile.DirectPlayProfiles) { if (i.Type == DlnaProfileType.Audio && IsAudioDirectPlaySupported(i, item, audioStream)) { @@ -607,7 +607,7 @@ namespace MediaBrowser.Model.Dlna { int highestScore = -1; - foreach (MediaStream stream in item.MediaStreams) + foreach (var stream in item.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && stream.Score.HasValue) { @@ -619,7 +619,7 @@ namespace MediaBrowser.Model.Dlna } var topStreams = new List<MediaStream>(); - foreach (MediaStream stream in item.MediaStreams) + foreach (var stream in item.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && stream.Score.HasValue && stream.Score.Value == highestScore) { @@ -630,9 +630,9 @@ namespace MediaBrowser.Model.Dlna // If multiple streams have an equal score, try to pick the most efficient one if (topStreams.Count > 1) { - foreach (MediaStream stream in topStreams) + foreach (var stream in topStreams) { - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (profile.Method == SubtitleDeliveryMethod.External && StringHelper.EqualsIgnoreCase(profile.Format, stream.Codec)) { @@ -688,8 +688,7 @@ namespace MediaBrowser.Model.Dlna if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels)) { - int transcodingMaxAudioChannels; - if (int.TryParse(transcodingProfile.MaxAudioChannels, NumberStyles.Any, CultureInfo.InvariantCulture, out transcodingMaxAudioChannels)) + if (int.TryParse(transcodingProfile.MaxAudioChannels, NumberStyles.Any, CultureInfo.InvariantCulture, out var transcodingMaxAudioChannels)) { playlistItem.TranscodingMaxAudioChannels = transcodingMaxAudioChannels; } @@ -705,7 +704,7 @@ namespace MediaBrowser.Model.Dlna var transcodeReasons = new List<TranscodeReason>(); - StreamInfo playlistItem = new StreamInfo + var playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Video, @@ -716,15 +715,15 @@ namespace MediaBrowser.Model.Dlna }; playlistItem.SubtitleStreamIndex = options.SubtitleStreamIndex ?? GetDefaultSubtitleStreamIndex(item, options.Profile.SubtitleProfiles); - MediaStream subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null; + var subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null; - MediaStream audioStream = item.GetDefaultAudioStream(options.AudioStreamIndex ?? item.DefaultAudioStreamIndex); + var audioStream = item.GetDefaultAudioStream(options.AudioStreamIndex ?? item.DefaultAudioStreamIndex); if (audioStream != null) { playlistItem.AudioStreamIndex = audioStream.Index; } - MediaStream videoStream = item.VideoStream; + var videoStream = item.VideoStream; // TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough var directPlayEligibilityResult = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true) ?? 0, subtitleStream, options, PlayMethod.DirectPlay); @@ -751,7 +750,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, item.Container, null); + var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, item.Container, null); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -775,7 +774,7 @@ namespace MediaBrowser.Model.Dlna // Can't direct play, find the transcoding profile TranscodingProfile transcodingProfile = null; - foreach (TranscodingProfile i in options.Profile.TranscodingProfiles) + foreach (var i in options.Profile.TranscodingProfiles) { if (i.Type == playlistItem.MediaType && i.Context == options.Context) { @@ -793,7 +792,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol); + var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -804,10 +803,10 @@ namespace MediaBrowser.Model.Dlna SetStreamInfoOptionsFromTranscodingProfile(playlistItem, transcodingProfile); - ConditionProcessor conditionProcessor = new ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); var isFirstAppliedCodecProfile = true; - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Video && i.ContainsAnyCodec(transcodingProfile.VideoCodec, transcodingProfile.Container)) { @@ -863,7 +862,7 @@ namespace MediaBrowser.Model.Dlna playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate); isFirstAppliedCodecProfile = true; - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.VideoAudio && i.ContainsAnyCodec(transcodingProfile.AudioCodec, transcodingProfile.Container)) { @@ -1011,7 +1010,7 @@ namespace MediaBrowser.Model.Dlna // See if it can be direct played DirectPlayProfile directPlay = null; - foreach (DirectPlayProfile i in profile.DirectPlayProfiles) + foreach (var i in profile.DirectPlayProfiles) { if (i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream)) { @@ -1032,19 +1031,19 @@ namespace MediaBrowser.Model.Dlna string container = mediaSource.Container; var conditions = new List<ProfileCondition>(); - foreach (ContainerProfile i in profile.ContainerProfiles) + foreach (var i in profile.ContainerProfiles) { if (i.Type == DlnaProfileType.Video && i.ContainsContainer(container)) { - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { conditions.Add(c); } } } - ConditionProcessor conditionProcessor = new ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); int? width = videoStream == null ? null : videoStream.Width; int? height = videoStream == null ? null : videoStream.Height; @@ -1090,7 +1089,7 @@ namespace MediaBrowser.Model.Dlna string videoCodec = videoStream == null ? null : videoStream.Codec; conditions = new List<ProfileCondition>(); - foreach (CodecProfile i in profile.CodecProfiles) + foreach (var i in profile.CodecProfiles) { if (i.Type == CodecType.Video && i.ContainsAnyCodec(videoCodec, container)) { @@ -1137,7 +1136,7 @@ namespace MediaBrowser.Model.Dlna conditions = new List<ProfileCondition>(); bool? isSecondaryAudio = audioStream == null ? null : mediaSource.IsSecondaryAudio(audioStream); - foreach (CodecProfile i in profile.CodecProfiles) + foreach (var i in profile.CodecProfiles) { if (i.Type == CodecType.VideoAudio && i.ContainsAnyCodec(audioCodec, container)) { @@ -1206,7 +1205,7 @@ namespace MediaBrowser.Model.Dlna { if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, playMethod, _transcoderSupport, item.Container, null); + var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, playMethod, _transcoderSupport, item.Container, null); if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed) { @@ -1230,7 +1229,7 @@ namespace MediaBrowser.Model.Dlna if (!subtitleStream.IsExternal && (playMethod != PlayMethod.Transcode || !string.Equals(transcodingSubProtocol, "hls", StringComparison.OrdinalIgnoreCase))) { // Look for supported embedded subs of the same format - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (!profile.SupportsLanguage(subtitleStream.Language)) { @@ -1259,7 +1258,7 @@ namespace MediaBrowser.Model.Dlna } // Look for supported embedded subs of a convertible format - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (!profile.SupportsLanguage(subtitleStream.Language)) { @@ -1328,7 +1327,7 @@ namespace MediaBrowser.Model.Dlna private static SubtitleProfile GetExternalSubtitleProfile(MediaSourceInfo mediaSource, MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, ITranscoderSupport transcoderSupport, bool allowConversion) { - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (profile.Method != SubtitleDeliveryMethod.External && profile.Method != SubtitleDeliveryMethod.Hls) { @@ -1491,8 +1490,7 @@ namespace MediaBrowser.Model.Dlna continue; } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1526,8 +1524,7 @@ namespace MediaBrowser.Model.Dlna } } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1551,8 +1548,7 @@ namespace MediaBrowser.Model.Dlna continue; } - bool isAvc; - if (bool.TryParse(value, out isAvc)) + if (bool.TryParse(value, out var isAvc)) { if (isAvc && condition.Condition == ProfileConditionType.Equals) { @@ -1572,8 +1568,7 @@ namespace MediaBrowser.Model.Dlna continue; } - bool isAnamorphic; - if (bool.TryParse(value, out isAnamorphic)) + if (bool.TryParse(value, out var isAnamorphic)) { if (isAnamorphic && condition.Condition == ProfileConditionType.Equals) { @@ -1603,8 +1598,7 @@ namespace MediaBrowser.Model.Dlna } } - bool isInterlaced; - if (bool.TryParse(value, out isInterlaced)) + if (bool.TryParse(value, out var isInterlaced)) { if (!isInterlaced && condition.Condition == ProfileConditionType.Equals) { @@ -1645,8 +1639,7 @@ namespace MediaBrowser.Model.Dlna } } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1680,8 +1673,7 @@ namespace MediaBrowser.Model.Dlna } } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1727,8 +1719,7 @@ namespace MediaBrowser.Model.Dlna continue; } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1752,8 +1743,7 @@ namespace MediaBrowser.Model.Dlna continue; } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1777,8 +1767,7 @@ namespace MediaBrowser.Model.Dlna continue; } - float num; - if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1802,8 +1791,7 @@ namespace MediaBrowser.Model.Dlna continue; } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { @@ -1827,8 +1815,7 @@ namespace MediaBrowser.Model.Dlna continue; } - int num; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num)) { if (condition.Condition == ProfileConditionType.Equals) { diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index ec76d93f07..522c109803 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -1,13 +1,13 @@ -using MediaBrowser.Model.Drawing; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Session; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; namespace MediaBrowser.Model.Dlna { @@ -56,8 +56,7 @@ namespace MediaBrowser.Model.Dlna public string GetOption(string name) { - string value; - if (StreamOptions.TryGetValue(name, out value)) + if (StreamOptions.TryGetValue(name, out var value)) { return value; } @@ -127,22 +126,11 @@ namespace MediaBrowser.Model.Dlna public Dictionary<string, string> StreamOptions { get; private set; } - public string MediaSourceId - { - get - { - return MediaSource == null ? null : MediaSource.Id; - } - } + public string MediaSourceId => MediaSource == null ? null : MediaSource.Id; - public bool IsDirectStream - { - get - { - return PlayMethod == PlayMethod.DirectStream || - PlayMethod == PlayMethod.DirectPlay; - } - } + public bool IsDirectStream => + PlayMethod == PlayMethod.DirectStream || + PlayMethod == PlayMethod.DirectPlay; public string ToUrl(string baseUrl, string accessToken) { @@ -156,7 +144,7 @@ namespace MediaBrowser.Model.Dlna throw new ArgumentNullException(nameof(baseUrl)); } - List<string> list = new List<string>(); + var list = new List<string>(); foreach (NameValuePair pair in BuildParams(this, accessToken)) { if (string.IsNullOrEmpty(pair.Value)) @@ -222,7 +210,7 @@ namespace MediaBrowser.Model.Dlna private static List<NameValuePair> BuildParams(StreamInfo item, string accessToken) { - List<NameValuePair> list = new List<NameValuePair>(); + var list = new List<NameValuePair>(); string audioCodecs = item.AudioCodecs.Length == 0 ? string.Empty : @@ -357,8 +345,8 @@ namespace MediaBrowser.Model.Dlna public List<SubtitleStreamInfo> GetExternalSubtitles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) { - List<SubtitleStreamInfo> list = GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, enableAllProfiles, baseUrl, accessToken); - List<SubtitleStreamInfo> newList = new List<SubtitleStreamInfo>(); + var list = GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, enableAllProfiles, baseUrl, accessToken); + var newList = new List<SubtitleStreamInfo>(); // First add the selected track foreach (SubtitleStreamInfo stream in list) @@ -379,7 +367,7 @@ namespace MediaBrowser.Model.Dlna public List<SubtitleStreamInfo> GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) { - List<SubtitleStreamInfo> list = new List<SubtitleStreamInfo>(); + var list = new List<SubtitleStreamInfo>(); // HLS will preserve timestamps so we can just grab the full subtitle stream long startPositionTicks = StringHelper.EqualsIgnoreCase(SubProtocol, "hls") @@ -389,7 +377,7 @@ namespace MediaBrowser.Model.Dlna // First add the selected track if (SubtitleStreamIndex.HasValue) { - foreach (MediaStream stream in MediaSource.MediaStreams) + foreach (var stream in MediaSource.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && stream.Index == SubtitleStreamIndex.Value) { @@ -400,7 +388,7 @@ namespace MediaBrowser.Model.Dlna if (!includeSelectedTrackOnly) { - foreach (MediaStream stream in MediaSource.MediaStreams) + foreach (var stream in MediaSource.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && (!SubtitleStreamIndex.HasValue || stream.Index != SubtitleStreamIndex.Value)) { @@ -416,16 +404,16 @@ namespace MediaBrowser.Model.Dlna { if (enableAllProfiles) { - foreach (SubtitleProfile profile in DeviceProfile.SubtitleProfiles) + foreach (var profile in DeviceProfile.SubtitleProfiles) { - SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, new[] { profile }, transcoderSupport); + var info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, new[] { profile }, transcoderSupport); list.Add(info); } } else { - SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, DeviceProfile.SubtitleProfiles, transcoderSupport); + var info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, DeviceProfile.SubtitleProfiles, transcoderSupport); list.Add(info); } @@ -433,8 +421,8 @@ namespace MediaBrowser.Model.Dlna private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles, ITranscoderSupport transcoderSupport) { - SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(MediaSource, stream, subtitleProfiles, PlayMethod, transcoderSupport, Container, SubProtocol); - SubtitleStreamInfo info = new SubtitleStreamInfo + var subtitleProfile = StreamBuilder.GetSubtitleProfile(MediaSource, stream, subtitleProfiles, PlayMethod, transcoderSupport, Container, SubProtocol); + var info = new SubtitleStreamInfo { IsForced = stream.IsForced, Language = stream.Language, @@ -513,7 +501,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetAudioStream; + var stream = TargetAudioStream; return stream == null ? null : stream.SampleRate; } } @@ -595,7 +583,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return MaxFramerate.HasValue && !IsDirectStream ? MaxFramerate : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate; @@ -633,8 +621,7 @@ namespace MediaBrowser.Model.Dlna return null; } - int result; - if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result)) + if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -650,8 +637,7 @@ namespace MediaBrowser.Model.Dlna return null; } - int result; - if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result)) + if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -667,8 +653,7 @@ namespace MediaBrowser.Model.Dlna return null; } - double result; - if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) + if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -684,8 +669,7 @@ namespace MediaBrowser.Model.Dlna return null; } - int result; - if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out result)) + if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { return result; } @@ -700,7 +684,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return !IsDirectStream ? null : stream == null ? null : stream.PacketLength; @@ -738,7 +722,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return !IsDirectStream ? null : stream == null ? null : stream.CodecTag; @@ -752,7 +736,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetAudioStream; + var stream = TargetAudioStream; return AudioBitrate.HasValue && !IsDirectStream ? AudioBitrate : stream == null ? null : stream.BitRate; @@ -792,8 +776,7 @@ namespace MediaBrowser.Model.Dlna return defaultValue; } - int result; - if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result)) + if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return Math.Min(result, defaultValue ?? result); } @@ -808,7 +791,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetAudioStream; + var stream = TargetAudioStream; string inputCodec = stream == null ? null : stream.Codec; @@ -833,7 +816,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; string inputCodec = stream == null ? null : stream.Codec; @@ -889,7 +872,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return VideoBitrate.HasValue && !IsDirectStream ? VideoBitrate @@ -901,7 +884,7 @@ namespace MediaBrowser.Model.Dlna { get { - TransportStreamTimestamp defaultValue = StringHelper.EqualsIgnoreCase(Container, "m2ts") + var defaultValue = StringHelper.EqualsIgnoreCase(Container, "m2ts") ? TransportStreamTimestamp.Valid : TransportStreamTimestamp.None; @@ -911,13 +894,7 @@ namespace MediaBrowser.Model.Dlna } } - public int? TargetTotalBitrate - { - get - { - return (TargetAudioBitrate ?? 0) + (TargetVideoBitrate ?? 0); - } - } + public int? TargetTotalBitrate => (TargetAudioBitrate ?? 0) + (TargetVideoBitrate ?? 0); public bool? IsTargetAnamorphic { @@ -972,11 +949,11 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream videoStream = TargetVideoStream; + var videoStream = TargetVideoStream; if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - ImageSize size = new ImageSize + var size = new ImageSize { Width = videoStream.Width.Value, Height = videoStream.Height.Value @@ -985,7 +962,7 @@ namespace MediaBrowser.Model.Dlna double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null; double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null; - ImageSize newSize = DrawingUtils.Resize(size, + var newSize = DrawingUtils.Resize(size, 0, 0, maxWidth ?? 0, @@ -1002,11 +979,11 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream videoStream = TargetVideoStream; + var videoStream = TargetVideoStream; if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - ImageSize size = new ImageSize + var size = new ImageSize { Width = videoStream.Width.Value, Height = videoStream.Height.Value @@ -1015,7 +992,7 @@ namespace MediaBrowser.Model.Dlna double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null; double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null; - ImageSize newSize = DrawingUtils.Resize(size, + var newSize = DrawingUtils.Resize(size, 0, 0, maxWidth ?? 0, @@ -1076,9 +1053,9 @@ namespace MediaBrowser.Model.Dlna public List<MediaStream> GetSelectableStreams(MediaStreamType type) { - List<MediaStream> list = new List<MediaStream>(); + var list = new List<MediaStream>(); - foreach (MediaStream stream in MediaSource.MediaStreams) + foreach (var stream in MediaSource.MediaStreams) { if (type == stream.Type) { diff --git a/MediaBrowser.Model/Dlna/SubtitleDeliveryMethod.cs b/MediaBrowser.Model/Dlna/SubtitleDeliveryMethod.cs index b4e13c5baa..925c1f9fcb 100644 --- a/MediaBrowser.Model/Dlna/SubtitleDeliveryMethod.cs +++ b/MediaBrowser.Model/Dlna/SubtitleDeliveryMethod.cs @@ -19,4 +19,4 @@ namespace MediaBrowser.Model.Dlna /// </summary> Hls = 3 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/SubtitleProfile.cs b/MediaBrowser.Model/Dlna/SubtitleProfile.cs index f85ba4a7a3..f950b6cb82 100644 --- a/MediaBrowser.Model/Dlna/SubtitleProfile.cs +++ b/MediaBrowser.Model/Dlna/SubtitleProfile.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Model.Extensions; using System.Xml.Serialization; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Dlna { diff --git a/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs b/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs index 7a89308dcc..e81c26e69b 100644 --- a/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs +++ b/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs @@ -12,4 +12,4 @@ namespace MediaBrowser.Model.Dlna public SubtitleDeliveryMethod DeliveryMethod { get; set; } public bool IsExternalUrl { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs b/MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs index 564ce5c605..eac5d4b362 100644 --- a/MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs +++ b/MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs @@ -1,8 +1,8 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public enum TranscodeSeekInfo { Auto = 0, Bytes = 1 } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs index 8453fdf6d6..dc2f0c90d2 100644 --- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; namespace MediaBrowser.Model.Dlna { diff --git a/MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs b/MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs index f4b9d1e9bc..4edbb503bb 100644 --- a/MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs +++ b/MediaBrowser.Model/Dlna/UpnpDeviceInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using MediaBrowser.Model.Net; diff --git a/MediaBrowser.Model/Dlna/VideoOptions.cs b/MediaBrowser.Model/Dlna/VideoOptions.cs index 041d2cd5d1..9c4a38292a 100644 --- a/MediaBrowser.Model/Dlna/VideoOptions.cs +++ b/MediaBrowser.Model/Dlna/VideoOptions.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { /// <summary> /// Class VideoOptions. @@ -8,4 +8,4 @@ public int? AudioStreamIndex { get; set; } public int? SubtitleStreamIndex { get; set; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Dlna/XmlAttribute.cs b/MediaBrowser.Model/Dlna/XmlAttribute.cs index e8e13ba0de..aa64177a8a 100644 --- a/MediaBrowser.Model/Dlna/XmlAttribute.cs +++ b/MediaBrowser.Model/Dlna/XmlAttribute.cs @@ -1,4 +1,4 @@ -using System.Xml.Serialization; +using System.Xml.Serialization; namespace MediaBrowser.Model.Dlna { @@ -10,4 +10,4 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("value")] public string Value { get; set; } } -}
\ No newline at end of file +} |
