mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-28 11:28:27 +01:00
Enable TreatWarningsAsErrors for MediaBrowser.Model
This commit is contained in:
@@ -34,20 +34,20 @@ namespace MediaBrowser.Model.Dlna
|
||||
public DeviceProfile Profile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
|
||||
/// Gets or sets a media source id. Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
|
||||
/// </summary>
|
||||
public string MediaSourceId { get; set; }
|
||||
|
||||
public string DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allows an override of supported number of audio channels
|
||||
/// Example: DeviceProfile supports five channel, but user only has stereo speakers
|
||||
/// Gets or sets an override of supported number of audio channels
|
||||
/// Example: DeviceProfile supports five channel, but user only has stereo speakers.
|
||||
/// </summary>
|
||||
public int? MaxAudioChannels { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The application's configured quality setting.
|
||||
/// Gets or sets the application's configured quality setting.
|
||||
/// </summary>
|
||||
public int? MaxBitrate { get; set; }
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
/// <summary>
|
||||
/// Gets the maximum bitrate.
|
||||
/// </summary>
|
||||
/// <param name="isAudio">Whether or not this is audio.</param>
|
||||
/// <returns>System.Nullable<System.Int32>.</returns>
|
||||
public int? GetMaxBitrate(bool isAudio)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public class CodecProfile
|
||||
{
|
||||
public CodecProfile()
|
||||
{
|
||||
Conditions = Array.Empty<ProfileCondition>();
|
||||
ApplyConditions = Array.Empty<ProfileCondition>();
|
||||
}
|
||||
|
||||
[XmlAttribute("type")]
|
||||
public CodecType Type { get; set; }
|
||||
|
||||
@@ -22,12 +28,6 @@ namespace MediaBrowser.Model.Dlna
|
||||
[XmlAttribute("container")]
|
||||
public string Container { get; set; }
|
||||
|
||||
public CodecProfile()
|
||||
{
|
||||
Conditions = Array.Empty<ProfileCondition>();
|
||||
ApplyConditions = Array.Empty<ProfileCondition>();
|
||||
}
|
||||
|
||||
public string[] GetCodecs()
|
||||
{
|
||||
return ContainerProfile.SplitValue(Codec);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
|
||||
@@ -9,6 +9,11 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public class ContainerProfile
|
||||
{
|
||||
public ContainerProfile()
|
||||
{
|
||||
Conditions = Array.Empty<ProfileCondition>();
|
||||
}
|
||||
|
||||
[XmlAttribute("type")]
|
||||
public DlnaProfileType Type { get; set; }
|
||||
|
||||
@@ -17,11 +22,6 @@ namespace MediaBrowser.Model.Dlna
|
||||
[XmlAttribute("container")]
|
||||
public string Container { get; set; }
|
||||
|
||||
public ContainerProfile()
|
||||
{
|
||||
Conditions = Array.Empty<ProfileCondition>();
|
||||
}
|
||||
|
||||
public string[] GetContainers()
|
||||
{
|
||||
return SplitValue(Container);
|
||||
|
||||
@@ -81,13 +81,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
DlnaFlags.DlnaV15;
|
||||
|
||||
// if (isDirectStream)
|
||||
//{
|
||||
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
|
||||
//}
|
||||
// else if (runtimeTicks.HasValue)
|
||||
//{
|
||||
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
|
||||
//}
|
||||
// {
|
||||
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
|
||||
// }
|
||||
// else if (runtimeTicks.HasValue)
|
||||
// {
|
||||
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
|
||||
// }
|
||||
|
||||
string dlnaflags = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -150,16 +150,18 @@ namespace MediaBrowser.Model.Dlna
|
||||
DlnaFlags.DlnaV15;
|
||||
|
||||
// if (isDirectStream)
|
||||
//{
|
||||
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
|
||||
//}
|
||||
// else if (runtimeTicks.HasValue)
|
||||
//{
|
||||
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
|
||||
//}
|
||||
// {
|
||||
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
|
||||
// }
|
||||
// else if (runtimeTicks.HasValue)
|
||||
// {
|
||||
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
|
||||
// }
|
||||
|
||||
string dlnaflags = string.Format(CultureInfo.InvariantCulture, ";DLNA.ORG_FLAGS={0}",
|
||||
DlnaMaps.FlagsToString(flagValue));
|
||||
string dlnaflags = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
";DLNA.ORG_FLAGS={0}",
|
||||
DlnaMaps.FlagsToString(flagValue));
|
||||
|
||||
ResponseProfile mediaProfile = _profile.GetVideoMediaProfile(
|
||||
container,
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
public interface IDeviceDiscovery
|
||||
{
|
||||
event EventHandler<GenericEventArgs<UpnpDeviceInfo>> DeviceDiscovered;
|
||||
|
||||
event EventHandler<GenericEventArgs<UpnpDeviceInfo>> DeviceLeft;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace MediaBrowser.Model.Dlna
|
||||
string.Equals(container, "mpegts", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(container, "m2ts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
||||
return ResolveVideoMPEG2TSFormat(videoCodec, audioCodec, width, height, timestampType);
|
||||
}
|
||||
|
||||
@@ -323,7 +322,6 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (string.Equals(videoCodec, "wmv", StringComparison.OrdinalIgnoreCase) &&
|
||||
(string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "wmapro", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
|
||||
if (width.HasValue && height.HasValue)
|
||||
{
|
||||
if ((width.Value <= 720) && (height.Value <= 576))
|
||||
@@ -479,7 +477,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
if (string.Equals(container, "jpeg", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(container, "jpg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ResolveImageJPGFormat(width, height);
|
||||
}
|
||||
|
||||
if (string.Equals(container, "png", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
||||
@@ -4,14 +4,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public class ResolutionConfiguration
|
||||
{
|
||||
public int MaxWidth { get; set; }
|
||||
|
||||
public int MaxBitrate { get; set; }
|
||||
|
||||
public ResolutionConfiguration(int maxWidth, int maxBitrate)
|
||||
{
|
||||
MaxWidth = maxWidth;
|
||||
MaxBitrate = maxBitrate;
|
||||
}
|
||||
|
||||
public int MaxWidth { get; set; }
|
||||
|
||||
public int MaxBitrate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public class ResponseProfile
|
||||
{
|
||||
public ResponseProfile()
|
||||
{
|
||||
Conditions = Array.Empty<ProfileCondition>();
|
||||
}
|
||||
|
||||
[XmlAttribute("container")]
|
||||
public string Container { get; set; }
|
||||
|
||||
@@ -28,11 +33,6 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public ProfileCondition[] Conditions { get; set; }
|
||||
|
||||
public ResponseProfile()
|
||||
{
|
||||
Conditions = Array.Empty<ProfileCondition>();
|
||||
}
|
||||
|
||||
public string[] GetContainers()
|
||||
{
|
||||
return ContainerProfile.SplitValue(Container);
|
||||
|
||||
@@ -7,6 +7,46 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public class SearchCriteria
|
||||
{
|
||||
public SearchCriteria(string search)
|
||||
{
|
||||
if (search.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String can't be empty.", nameof(search));
|
||||
}
|
||||
|
||||
SearchType = SearchType.Unknown;
|
||||
|
||||
string[] factors = RegexSplit(search, "(and|or)");
|
||||
foreach (string factor in factors)
|
||||
{
|
||||
string[] subFactors = RegexSplit(factor.Trim().Trim('(').Trim(')').Trim(), "\\s", 3);
|
||||
|
||||
if (subFactors.Length == 3)
|
||||
{
|
||||
if (string.Equals("upnp:class", subFactors[0], StringComparison.OrdinalIgnoreCase)
|
||||
&& (string.Equals("=", subFactors[1], StringComparison.Ordinal) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
if (string.Equals("\"object.item.imageItem\"", subFactors[2], StringComparison.Ordinal) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.Image;
|
||||
}
|
||||
else if (string.Equals("\"object.item.videoItem\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.Video;
|
||||
}
|
||||
else if (string.Equals("\"object.container.playlistContainer\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.Playlist;
|
||||
}
|
||||
else if (string.Equals("\"object.container.album.musicAlbum\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.MusicAlbum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SearchType SearchType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -31,45 +71,5 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
return Regex.Split(str, term, RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
public SearchCriteria(string search)
|
||||
{
|
||||
if (search.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String can't be empty.", nameof(search));
|
||||
}
|
||||
|
||||
SearchType = SearchType.Unknown;
|
||||
|
||||
string[] factors = RegexSplit(search, "(and|or)");
|
||||
foreach (string factor in factors)
|
||||
{
|
||||
string[] subFactors = RegexSplit(factor.Trim().Trim('(').Trim(')').Trim(), "\\s", 3);
|
||||
|
||||
if (subFactors.Length == 3)
|
||||
{
|
||||
if (string.Equals("upnp:class", subFactors[0], StringComparison.OrdinalIgnoreCase) &&
|
||||
(string.Equals("=", subFactors[1], StringComparison.Ordinal) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
if (string.Equals("\"object.item.imageItem\"", subFactors[2], StringComparison.Ordinal) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.Image;
|
||||
}
|
||||
else if (string.Equals("\"object.item.videoItem\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.Video;
|
||||
}
|
||||
else if (string.Equals("\"object.container.playlistContainer\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.Playlist;
|
||||
}
|
||||
else if (string.Equals("\"object.container.album.musicAlbum\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SearchType = SearchType.MusicAlbum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public class SortCriteria
|
||||
{
|
||||
public SortOrder SortOrder => SortOrder.Ascending;
|
||||
|
||||
public SortCriteria(string value)
|
||||
{
|
||||
}
|
||||
|
||||
public SortOrder SortOrder => SortOrder.Ascending;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
}
|
||||
|
||||
public static string NormalizeMediaSourceFormatIntoSingleContainer(string inputContainer, string _, DeviceProfile profile, DlnaProfileType type)
|
||||
public static string NormalizeMediaSourceFormatIntoSingleContainer(string inputContainer, DeviceProfile profile, DlnaProfileType type)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputContainer))
|
||||
{
|
||||
@@ -274,14 +274,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (options.ForceDirectPlay)
|
||||
{
|
||||
playlistItem.PlayMethod = PlayMethod.DirectPlay;
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, item.Path, options.Profile, DlnaProfileType.Audio);
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Audio);
|
||||
return playlistItem;
|
||||
}
|
||||
|
||||
if (options.ForceDirectStream)
|
||||
{
|
||||
playlistItem.PlayMethod = PlayMethod.DirectStream;
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, item.Path, options.Profile, DlnaProfileType.Audio);
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Audio);
|
||||
return playlistItem;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
playlistItem.PlayMethod = PlayMethod.DirectStream;
|
||||
}
|
||||
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, item.Path, options.Profile, DlnaProfileType.Audio);
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Audio);
|
||||
|
||||
return playlistItem;
|
||||
}
|
||||
@@ -698,7 +698,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (directPlay != null)
|
||||
{
|
||||
playlistItem.PlayMethod = directPlay.Value;
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, item.Path, options.Profile, DlnaProfileType.Video);
|
||||
playlistItem.Container = NormalizeMediaSourceFormatIntoSingleContainer(item.Container, options.Profile, DlnaProfileType.Video);
|
||||
|
||||
if (subtitleStream != null)
|
||||
{
|
||||
@@ -1404,7 +1404,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Bitrate exceeds {PlayBackMethod} limit: media bitrate: {MediaBitrate}, max bitrate: {MaxBitrate}",
|
||||
playMethod, itemBitrate, requestedMaxBitrate);
|
||||
playMethod,
|
||||
itemBitrate,
|
||||
requestedMaxBitrate);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user