mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Apply review suggestions
This commit is contained in:
parent
2351eeba56
commit
5a5da33f44
@ -407,10 +407,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
continue;
|
||||
}
|
||||
|
||||
var formatStr = format.ToString();
|
||||
if (directPlayProfile.SupportsContainer(formatStr))
|
||||
if (directPlayProfile.SupportsContainer(format))
|
||||
{
|
||||
return formatStr;
|
||||
return format;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1317,6 +1316,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
var containerSupported = false;
|
||||
TranscodeReason[] rankings = [TranscodeReason.VideoCodecNotSupported, VideoCodecReasons, TranscodeReason.AudioCodecNotSupported, AudioCodecReasons, ContainerReasons];
|
||||
|
||||
// Check DirectPlay profiles to see if it can be direct played
|
||||
var analyzedProfiles = profile.DirectPlayProfiles
|
||||
@ -1382,7 +1382,6 @@ namespace MediaBrowser.Model.Dlna
|
||||
playMethod = PlayMethod.DirectStream;
|
||||
}
|
||||
|
||||
TranscodeReason[] rankings = [TranscodeReason.VideoCodecNotSupported, VideoCodecReasons, TranscodeReason.AudioCodecNotSupported, AudioCodecReasons, ContainerReasons];
|
||||
var ranked = GetRank(ref failureReasons, rankings);
|
||||
|
||||
return (Result: (Profile: directPlayProfile, PlayMethod: playMethod, AudioStreamIndex: selectedAudioStream?.Index, TranscodeReason: failureReasons), Order: order, Rank: ranked);
|
||||
|
@ -91,7 +91,7 @@ public static class ContainerHelper
|
||||
{
|
||||
foreach (var profile in allProfileContainers)
|
||||
{
|
||||
if (container.Equals(profile, StringComparison.OrdinalIgnoreCase))
|
||||
if (!profile.IsEmpty && container.Equals(profile, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return !isNegativeList;
|
||||
}
|
||||
@ -118,7 +118,7 @@ public static class ContainerHelper
|
||||
return true;
|
||||
}
|
||||
|
||||
var allInputContainers = inputContainer.Split(',');
|
||||
var allInputContainers = Split(inputContainer);
|
||||
foreach (var container in allInputContainers)
|
||||
{
|
||||
foreach (var profile in profileContainers)
|
||||
|
@ -40,6 +40,11 @@ public class ContainerHelperTests
|
||||
public void ContainsContainer_NotInList_ReturnsFalse(string container, string? extension)
|
||||
{
|
||||
Assert.False(ContainerHelper.ContainsContainer(container, extension));
|
||||
|
||||
if (extension is not null)
|
||||
{
|
||||
Assert.False(ContainerHelper.ContainsContainer(container, extension.AsSpan()));
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -51,4 +56,28 @@ public class ContainerHelperTests
|
||||
{
|
||||
Assert.True(ContainerHelper.ContainsContainer(container, extension.AsSpan()));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(new string[] { "mp3", "mpeg" }, false, "mpeg")]
|
||||
[InlineData(new string[] { "mp3", "mpeg", "avi" }, false, "avi")]
|
||||
[InlineData(new string[] { "mp3", "", "avi" }, false, "mp3")]
|
||||
[InlineData(new string[] { "mp3", "mpeg" }, true, "avi")]
|
||||
[InlineData(new string[] { "mp3", "mpeg", "avi" }, true, "mkv")]
|
||||
[InlineData(new string[] { "mp3", "", "avi" }, true, "")]
|
||||
public void ContainsContainer_ThreeArgs_InList_ReturnsTrue(string[] containers, bool isNegativeList, string inputContainer)
|
||||
{
|
||||
Assert.True(ContainerHelper.ContainsContainer(containers, isNegativeList, inputContainer));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(new string[] { "mp3", "mpeg" }, false, "avi")]
|
||||
[InlineData(new string[] { "mp3", "mpeg", "avi" }, false, "mkv")]
|
||||
[InlineData(new string[] { "mp3", "", "avi" }, false, "")]
|
||||
[InlineData(new string[] { "mp3", "mpeg" }, true, "mpeg")]
|
||||
[InlineData(new string[] { "mp3", "mpeg", "avi" }, true, "mp3")]
|
||||
[InlineData(new string[] { "mp3", "", "avi" }, true, "avi")]
|
||||
public void ContainsContainer_ThreeArgs_InList_ReturnsFalse(string[] containers, bool isNegativeList, string inputContainer)
|
||||
{
|
||||
Assert.False(ContainerHelper.ContainsContainer(containers, isNegativeList, inputContainer));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user