mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-30 03:13:17 +01:00
Removed guids from the model project
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
||||
@@ -16,22 +16,22 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
ValidateAudioInput(options);
|
||||
|
||||
var mediaSources = options.MediaSources;
|
||||
List<MediaSourceInfo> mediaSources = options.MediaSources;
|
||||
|
||||
// If the client wants a specific media soure, filter now
|
||||
if (!string.IsNullOrEmpty(options.MediaSourceId))
|
||||
{
|
||||
// Avoid implicitly captured closure
|
||||
var mediaSourceId = options.MediaSourceId;
|
||||
string mediaSourceId = options.MediaSourceId;
|
||||
|
||||
mediaSources = mediaSources
|
||||
.Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var streams = mediaSources.Select(i => BuildAudioItem(i, options)).ToList();
|
||||
List<StreamInfo> streams = mediaSources.Select(i => BuildAudioItem(i, options)).ToList();
|
||||
|
||||
foreach (var stream in streams)
|
||||
foreach (StreamInfo stream in streams)
|
||||
{
|
||||
stream.DeviceId = options.DeviceId;
|
||||
stream.DeviceProfileId = options.Profile.Id;
|
||||
@@ -44,22 +44,22 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
ValidateInput(options);
|
||||
|
||||
var mediaSources = options.MediaSources;
|
||||
List<MediaSourceInfo> mediaSources = options.MediaSources;
|
||||
|
||||
// If the client wants a specific media soure, filter now
|
||||
if (!string.IsNullOrEmpty(options.MediaSourceId))
|
||||
{
|
||||
// Avoid implicitly captured closure
|
||||
var mediaSourceId = options.MediaSourceId;
|
||||
string mediaSourceId = options.MediaSourceId;
|
||||
|
||||
mediaSources = mediaSources
|
||||
.Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var streams = mediaSources.Select(i => BuildVideoItem(i, options)).ToList();
|
||||
List<StreamInfo> streams = mediaSources.Select(i => BuildVideoItem(i, options)).ToList();
|
||||
|
||||
foreach (var stream in streams)
|
||||
foreach (StreamInfo stream in streams)
|
||||
{
|
||||
stream.DeviceId = options.DeviceId;
|
||||
stream.DeviceProfileId = options.Profile.Id;
|
||||
@@ -78,7 +78,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options)
|
||||
{
|
||||
var playlistItem = new StreamInfo
|
||||
StreamInfo playlistItem = new StreamInfo
|
||||
{
|
||||
ItemId = options.ItemId,
|
||||
MediaType = DlnaProfileType.Audio,
|
||||
@@ -86,30 +86,30 @@ namespace MediaBrowser.Model.Dlna
|
||||
RunTimeTicks = item.RunTimeTicks
|
||||
};
|
||||
|
||||
var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
|
||||
var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
MediaStream audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
// Honor the max bitrate setting
|
||||
if (IsAudioEligibleForDirectPlay(item, maxBitrateSetting))
|
||||
{
|
||||
var directPlay = options.Profile.DirectPlayProfiles
|
||||
DirectPlayProfile directPlay = options.Profile.DirectPlayProfiles
|
||||
.FirstOrDefault(i => i.Type == playlistItem.MediaType && IsAudioDirectPlaySupported(i, item, audioStream));
|
||||
|
||||
if (directPlay != null)
|
||||
{
|
||||
var audioCodec = audioStream == null ? null : audioStream.Codec;
|
||||
string audioCodec = audioStream == null ? null : audioStream.Codec;
|
||||
|
||||
// Make sure audio codec profiles are satisfied
|
||||
if (!string.IsNullOrEmpty(audioCodec))
|
||||
{
|
||||
var conditionProcessor = new ConditionProcessor();
|
||||
ConditionProcessor conditionProcessor = new ConditionProcessor();
|
||||
|
||||
var conditions = options.Profile.CodecProfiles.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(audioCodec))
|
||||
IEnumerable<ProfileCondition> conditions = options.Profile.CodecProfiles.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(audioCodec))
|
||||
.SelectMany(i => i.Conditions);
|
||||
|
||||
var audioChannels = audioStream == null ? null : audioStream.Channels;
|
||||
var audioBitrate = audioStream == null ? null : audioStream.BitRate;
|
||||
int? audioChannels = audioStream.Channels;
|
||||
int? audioBitrate = audioStream.BitRate;
|
||||
|
||||
if (conditions.All(c => conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate)))
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
}
|
||||
|
||||
var transcodingProfile = options.Profile.TranscodingProfiles
|
||||
TranscodingProfile transcodingProfile = options.Profile.TranscodingProfiles
|
||||
.FirstOrDefault(i => i.Type == playlistItem.MediaType);
|
||||
|
||||
if (transcodingProfile != null)
|
||||
@@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
playlistItem.AudioCodec = transcodingProfile.AudioCodec;
|
||||
playlistItem.Protocol = transcodingProfile.Protocol;
|
||||
|
||||
var audioTranscodingConditions = options.Profile.CodecProfiles
|
||||
IEnumerable<ProfileCondition> audioTranscodingConditions = options.Profile.CodecProfiles
|
||||
.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec))
|
||||
.Take(1)
|
||||
.SelectMany(i => i.Conditions);
|
||||
@@ -144,7 +144,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
// Honor requested max channels
|
||||
if (options.MaxAudioChannels.HasValue)
|
||||
{
|
||||
var currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value;
|
||||
int currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value;
|
||||
|
||||
playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
// Honor requested max bitrate
|
||||
if (maxBitrateSetting.HasValue)
|
||||
{
|
||||
var currentValue = playlistItem.AudioBitrate ?? maxBitrateSetting.Value;
|
||||
int currentValue = playlistItem.AudioBitrate ?? maxBitrateSetting.Value;
|
||||
|
||||
playlistItem.AudioBitrate = Math.Min(maxBitrateSetting.Value, currentValue);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private StreamInfo BuildVideoItem(MediaSourceInfo item, VideoOptions options)
|
||||
{
|
||||
var playlistItem = new StreamInfo
|
||||
StreamInfo playlistItem = new StreamInfo
|
||||
{
|
||||
ItemId = options.ItemId,
|
||||
MediaType = DlnaProfileType.Video,
|
||||
@@ -171,15 +171,15 @@ namespace MediaBrowser.Model.Dlna
|
||||
RunTimeTicks = item.RunTimeTicks
|
||||
};
|
||||
|
||||
var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
var videoStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||
MediaStream audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
MediaStream videoStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||
|
||||
var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
|
||||
if (IsEligibleForDirectPlay(item, options, maxBitrateSetting))
|
||||
{
|
||||
// See if it can be direct played
|
||||
var directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream);
|
||||
DirectPlayProfile directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream);
|
||||
|
||||
if (directPlay != null)
|
||||
{
|
||||
@@ -191,7 +191,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
// Can't direct play, find the transcoding profile
|
||||
var transcodingProfile = options.Profile.TranscodingProfiles
|
||||
TranscodingProfile transcodingProfile = options.Profile.TranscodingProfiles
|
||||
.FirstOrDefault(i => i.Type == playlistItem.MediaType);
|
||||
|
||||
if (transcodingProfile != null)
|
||||
@@ -206,14 +206,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
playlistItem.AudioStreamIndex = options.AudioStreamIndex;
|
||||
playlistItem.SubtitleStreamIndex = options.SubtitleStreamIndex;
|
||||
|
||||
var videoTranscodingConditions = options.Profile.CodecProfiles
|
||||
IEnumerable<ProfileCondition> videoTranscodingConditions = options.Profile.CodecProfiles
|
||||
.Where(i => i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec))
|
||||
.Take(1)
|
||||
.SelectMany(i => i.Conditions);
|
||||
|
||||
ApplyTranscodingConditions(playlistItem, videoTranscodingConditions);
|
||||
|
||||
var audioTranscodingConditions = options.Profile.CodecProfiles
|
||||
IEnumerable<ProfileCondition> audioTranscodingConditions = options.Profile.CodecProfiles
|
||||
.Where(i => i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec))
|
||||
.Take(1)
|
||||
.SelectMany(i => i.Conditions);
|
||||
@@ -223,7 +223,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
// Honor requested max channels
|
||||
if (options.MaxAudioChannels.HasValue)
|
||||
{
|
||||
var currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value;
|
||||
int currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value;
|
||||
|
||||
playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
// Honor requested max bitrate
|
||||
if (options.MaxAudioTranscodingBitrate.HasValue)
|
||||
{
|
||||
var currentValue = playlistItem.AudioBitrate ?? options.MaxAudioTranscodingBitrate.Value;
|
||||
int currentValue = playlistItem.AudioBitrate ?? options.MaxAudioTranscodingBitrate.Value;
|
||||
|
||||
playlistItem.AudioBitrate = Math.Min(options.MaxAudioTranscodingBitrate.Value, currentValue);
|
||||
}
|
||||
@@ -239,14 +239,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
// Honor max rate
|
||||
if (maxBitrateSetting.HasValue)
|
||||
{
|
||||
var videoBitrate = maxBitrateSetting.Value;
|
||||
int videoBitrate = maxBitrateSetting.Value;
|
||||
|
||||
if (playlistItem.AudioBitrate.HasValue)
|
||||
{
|
||||
videoBitrate -= playlistItem.AudioBitrate.Value;
|
||||
}
|
||||
|
||||
var currentValue = playlistItem.VideoBitrate ?? videoBitrate;
|
||||
int currentValue = playlistItem.VideoBitrate ?? videoBitrate;
|
||||
|
||||
playlistItem.VideoBitrate = Math.Min(videoBitrate, currentValue);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
MediaStream audioStream)
|
||||
{
|
||||
// See if it can be direct played
|
||||
var directPlay = profile.DirectPlayProfiles
|
||||
DirectPlayProfile directPlay = profile.DirectPlayProfiles
|
||||
.FirstOrDefault(i => i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream));
|
||||
|
||||
if (directPlay == null)
|
||||
@@ -269,28 +269,28 @@ namespace MediaBrowser.Model.Dlna
|
||||
return null;
|
||||
}
|
||||
|
||||
var container = mediaSource.Container;
|
||||
string container = mediaSource.Container;
|
||||
|
||||
var conditions = profile.ContainerProfiles
|
||||
IEnumerable<ProfileCondition> conditions = profile.ContainerProfiles
|
||||
.Where(i => i.Type == DlnaProfileType.Video && i.GetContainers().Contains(container, StringComparer.OrdinalIgnoreCase))
|
||||
.SelectMany(i => i.Conditions);
|
||||
|
||||
var conditionProcessor = new ConditionProcessor();
|
||||
ConditionProcessor conditionProcessor = new ConditionProcessor();
|
||||
|
||||
var width = videoStream == null ? null : videoStream.Width;
|
||||
var height = videoStream == null ? null : videoStream.Height;
|
||||
var bitDepth = videoStream == null ? null : videoStream.BitDepth;
|
||||
var videoBitrate = videoStream == null ? null : videoStream.BitRate;
|
||||
var videoLevel = videoStream == null ? null : videoStream.Level;
|
||||
var videoProfile = videoStream == null ? null : videoStream.Profile;
|
||||
var videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate;
|
||||
int? width = videoStream == null ? null : videoStream.Width;
|
||||
int? height = videoStream == null ? null : videoStream.Height;
|
||||
int? bitDepth = videoStream == null ? null : videoStream.BitDepth;
|
||||
int? videoBitrate = videoStream == null ? null : videoStream.BitRate;
|
||||
double? videoLevel = videoStream == null ? null : videoStream.Level;
|
||||
string videoProfile = videoStream == null ? null : videoStream.Profile;
|
||||
float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate;
|
||||
|
||||
var audioBitrate = audioStream == null ? null : audioStream.BitRate;
|
||||
var audioChannels = audioStream == null ? null : audioStream.Channels;
|
||||
var audioProfile = audioStream == null ? null : audioStream.Profile;
|
||||
int? audioBitrate = audioStream == null ? null : audioStream.BitRate;
|
||||
int? audioChannels = audioStream == null ? null : audioStream.Channels;
|
||||
string audioProfile = audioStream == null ? null : audioStream.Profile;
|
||||
|
||||
var timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp;
|
||||
var packetLength = videoStream == null ? null : videoStream.PacketLength;
|
||||
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp;
|
||||
int? packetLength = videoStream == null ? null : videoStream.PacketLength;
|
||||
|
||||
// Check container conditions
|
||||
if (!conditions.All(i => conditionProcessor.IsVideoConditionSatisfied(i,
|
||||
@@ -309,7 +309,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return null;
|
||||
}
|
||||
|
||||
var videoCodec = videoStream == null ? null : videoStream.Codec;
|
||||
string videoCodec = videoStream == null ? null : videoStream.Codec;
|
||||
|
||||
if (string.IsNullOrEmpty(videoCodec))
|
||||
{
|
||||
@@ -338,7 +338,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (audioStream != null)
|
||||
{
|
||||
var audioCodec = audioStream.Codec;
|
||||
string audioCodec = audioStream.Codec;
|
||||
|
||||
if (string.IsNullOrEmpty(audioCodec))
|
||||
{
|
||||
@@ -420,10 +420,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private void ApplyTranscodingConditions(StreamInfo item, IEnumerable<ProfileCondition> conditions)
|
||||
{
|
||||
foreach (var condition in conditions
|
||||
foreach (ProfileCondition condition in conditions
|
||||
.Where(i => !string.IsNullOrEmpty(i.Value)))
|
||||
{
|
||||
var value = condition.Value;
|
||||
string value = condition.Value;
|
||||
|
||||
switch (condition.Property)
|
||||
{
|
||||
@@ -515,7 +515,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (profile.Container.Length > 0)
|
||||
{
|
||||
// Check container type
|
||||
var mediaContainer = item.Container ?? string.Empty;
|
||||
string mediaContainer = item.Container ?? string.Empty;
|
||||
if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return false;
|
||||
@@ -536,7 +536,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (profile.Container.Length > 0)
|
||||
{
|
||||
// Check container type
|
||||
var mediaContainer = item.Container ?? string.Empty;
|
||||
string mediaContainer = item.Container ?? string.Empty;
|
||||
if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return false;
|
||||
@@ -544,21 +544,21 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
// Check video codec
|
||||
var videoCodecs = profile.GetVideoCodecs();
|
||||
List<string> videoCodecs = profile.GetVideoCodecs();
|
||||
if (videoCodecs.Count > 0)
|
||||
{
|
||||
var videoCodec = videoStream == null ? null : videoStream.Codec;
|
||||
string videoCodec = videoStream == null ? null : videoStream.Codec;
|
||||
if (string.IsNullOrEmpty(videoCodec) || !videoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var audioCodecs = profile.GetAudioCodecs();
|
||||
List<string> audioCodecs = profile.GetAudioCodecs();
|
||||
if (audioCodecs.Count > 0)
|
||||
{
|
||||
// Check audio codecs
|
||||
var audioCodec = audioStream == null ? null : audioStream.Codec;
|
||||
string audioCodec = audioStream == null ? null : audioStream.Codec;
|
||||
if (string.IsNullOrEmpty(audioCodec) || !audioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -79,9 +79,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
throw new ArgumentNullException(baseUrl);
|
||||
}
|
||||
|
||||
var dlnaCommand = BuildDlnaParam(this);
|
||||
string dlnaCommand = BuildDlnaParam(this);
|
||||
|
||||
var extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container;
|
||||
string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container;
|
||||
|
||||
baseUrl = baseUrl.TrimEnd('/');
|
||||
|
||||
@@ -98,11 +98,11 @@ namespace MediaBrowser.Model.Dlna
|
||||
return string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand);
|
||||
}
|
||||
|
||||
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||
|
||||
private static string BuildDlnaParam(StreamInfo item)
|
||||
{
|
||||
var usCulture = new CultureInfo("en-US");
|
||||
|
||||
var list = new List<string>
|
||||
List<string> list = new List<string>
|
||||
{
|
||||
item.DeviceProfileId ?? string.Empty,
|
||||
item.DeviceId ?? string.Empty,
|
||||
@@ -110,16 +110,16 @@ namespace MediaBrowser.Model.Dlna
|
||||
(item.IsDirectStream).ToString().ToLower(),
|
||||
item.VideoCodec ?? string.Empty,
|
||||
item.AudioCodec ?? string.Empty,
|
||||
item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(usCulture) : string.Empty,
|
||||
item.SubtitleStreamIndex.HasValue ? item.SubtitleStreamIndex.Value.ToString(usCulture) : string.Empty,
|
||||
item.VideoBitrate.HasValue ? item.VideoBitrate.Value.ToString(usCulture) : string.Empty,
|
||||
item.AudioBitrate.HasValue ? item.AudioBitrate.Value.ToString(usCulture) : string.Empty,
|
||||
item.MaxAudioChannels.HasValue ? item.MaxAudioChannels.Value.ToString(usCulture) : string.Empty,
|
||||
item.MaxFramerate.HasValue ? item.MaxFramerate.Value.ToString(usCulture) : string.Empty,
|
||||
item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(usCulture) : string.Empty,
|
||||
item.MaxHeight.HasValue ? item.MaxHeight.Value.ToString(usCulture) : string.Empty,
|
||||
item.StartPositionTicks.ToString(usCulture),
|
||||
item.VideoLevel.HasValue ? item.VideoLevel.Value.ToString(usCulture) : string.Empty
|
||||
item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(UsCulture) : string.Empty,
|
||||
item.SubtitleStreamIndex.HasValue ? item.SubtitleStreamIndex.Value.ToString(UsCulture) : string.Empty,
|
||||
item.VideoBitrate.HasValue ? item.VideoBitrate.Value.ToString(UsCulture) : string.Empty,
|
||||
item.AudioBitrate.HasValue ? item.AudioBitrate.Value.ToString(UsCulture) : string.Empty,
|
||||
item.MaxAudioChannels.HasValue ? item.MaxAudioChannels.Value.ToString(UsCulture) : string.Empty,
|
||||
item.MaxFramerate.HasValue ? item.MaxFramerate.Value.ToString(UsCulture) : string.Empty,
|
||||
item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(UsCulture) : string.Empty,
|
||||
item.MaxHeight.HasValue ? item.MaxHeight.Value.ToString(UsCulture) : string.Empty,
|
||||
item.StartPositionTicks.ToString(UsCulture),
|
||||
item.VideoLevel.HasValue ? item.VideoLevel.Value.ToString(UsCulture) : string.Empty
|
||||
};
|
||||
|
||||
return string.Format("Params={0}", string.Join(";", list.ToArray()));
|
||||
@@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
if (MediaSource != null)
|
||||
{
|
||||
var audioStreams = MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio);
|
||||
IEnumerable<MediaStream> audioStreams = MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (AudioStreamIndex.HasValue)
|
||||
{
|
||||
@@ -172,7 +172,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetAudioStream;
|
||||
MediaStream stream = TargetAudioStream;
|
||||
return stream == null ? null : stream.SampleRate;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetVideoStream;
|
||||
MediaStream stream = TargetVideoStream;
|
||||
return stream == null || !IsDirectStream ? null : stream.BitDepth;
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetVideoStream;
|
||||
MediaStream stream = TargetVideoStream;
|
||||
return MaxFramerate.HasValue && !IsDirectStream
|
||||
? MaxFramerate
|
||||
: stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate;
|
||||
@@ -210,7 +210,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetVideoStream;
|
||||
MediaStream stream = TargetVideoStream;
|
||||
return VideoLevel.HasValue && !IsDirectStream
|
||||
? VideoLevel
|
||||
: stream == null ? null : stream.Level;
|
||||
@@ -224,7 +224,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetVideoStream;
|
||||
MediaStream stream = TargetVideoStream;
|
||||
return !IsDirectStream
|
||||
? null
|
||||
: stream == null ? null : stream.PacketLength;
|
||||
@@ -238,7 +238,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetVideoStream;
|
||||
MediaStream stream = TargetVideoStream;
|
||||
return !string.IsNullOrEmpty(VideoProfile) && !IsDirectStream
|
||||
? VideoProfile
|
||||
: stream == null ? null : stream.Profile;
|
||||
@@ -252,7 +252,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetAudioStream;
|
||||
MediaStream stream = TargetAudioStream;
|
||||
return AudioBitrate.HasValue && !IsDirectStream
|
||||
? AudioBitrate
|
||||
: stream == null ? null : stream.BitRate;
|
||||
@@ -266,8 +266,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetAudioStream;
|
||||
var streamChannels = stream == null ? null : stream.Channels;
|
||||
MediaStream stream = TargetAudioStream;
|
||||
int? streamChannels = stream == null ? null : stream.Channels;
|
||||
|
||||
return MaxAudioChannels.HasValue && !IsDirectStream
|
||||
? (streamChannels.HasValue ? Math.Min(MaxAudioChannels.Value, streamChannels.Value) : MaxAudioChannels.Value)
|
||||
@@ -282,7 +282,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetAudioStream;
|
||||
MediaStream stream = TargetAudioStream;
|
||||
|
||||
return IsDirectStream
|
||||
? (stream == null ? null : stream.Codec)
|
||||
@@ -304,10 +304,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (RunTimeTicks.HasValue)
|
||||
{
|
||||
var totalBitrate = TargetTotalBitrate;
|
||||
int? totalBitrate = TargetTotalBitrate;
|
||||
|
||||
return totalBitrate.HasValue ?
|
||||
Convert.ToInt64(totalBitrate * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) :
|
||||
Convert.ToInt64(totalBitrate.Value * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) :
|
||||
(long?)null;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var stream = TargetVideoStream;
|
||||
MediaStream stream = TargetVideoStream;
|
||||
|
||||
return VideoBitrate.HasValue && !IsDirectStream
|
||||
? VideoBitrate
|
||||
@@ -331,7 +331,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase)
|
||||
TransportStreamTimestamp defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase)
|
||||
? TransportStreamTimestamp.Valid
|
||||
: TransportStreamTimestamp.None;
|
||||
|
||||
@@ -353,17 +353,17 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var videoStream = TargetVideoStream;
|
||||
MediaStream videoStream = TargetVideoStream;
|
||||
|
||||
if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)
|
||||
{
|
||||
var size = new ImageSize
|
||||
ImageSize size = new ImageSize
|
||||
{
|
||||
Width = videoStream.Width.Value,
|
||||
Height = videoStream.Height.Value
|
||||
};
|
||||
|
||||
var newSize = DrawingUtils.Resize(size,
|
||||
ImageSize newSize = DrawingUtils.Resize(size,
|
||||
null,
|
||||
null,
|
||||
MaxWidth,
|
||||
@@ -380,17 +380,17 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
get
|
||||
{
|
||||
var videoStream = TargetVideoStream;
|
||||
MediaStream videoStream = TargetVideoStream;
|
||||
|
||||
if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue)
|
||||
{
|
||||
var size = new ImageSize
|
||||
ImageSize size = new ImageSize
|
||||
{
|
||||
Width = videoStream.Width.Value,
|
||||
Height = videoStream.Height.Value
|
||||
};
|
||||
|
||||
var newSize = DrawingUtils.Resize(size,
|
||||
ImageSize newSize = DrawingUtils.Resize(size,
|
||||
null,
|
||||
null,
|
||||
MaxWidth,
|
||||
|
||||
Reference in New Issue
Block a user