Series: issue-6450

Issue: https://github.com/jellyfin/jellyfin/issues/6450

Enable DirectPlay responses
Rewrite DirectPlay and DirectStream resolution
Prefer copy transcode video codec options
Enhance condition processor
Support DirectStream and Transcode with parity
Rework audio stream selection and add tests for ExternalAudio
Update MediaInfoHelper to only call StreamBuilder once
This commit is contained in:
Isaac Gordezky
2022-01-23 23:49:14 +00:00
committed by Cody Robibero
parent d871dded9f
commit 5e779f20ee
13 changed files with 859 additions and 822 deletions

View File

@@ -27,6 +27,8 @@ namespace MediaBrowser.Model.Dlna
public bool ForceDirectStream { get; set; }
public bool AllowAudioStreamCopy { get; set; }
public Guid ItemId { get; set; }
public MediaSourceInfo[] MediaSources { get; set; }

File diff suppressed because it is too large Load Diff

View File

@@ -10,5 +10,7 @@ namespace MediaBrowser.Model.Dlna
public int? AudioStreamIndex { get; set; }
public int? SubtitleStreamIndex { get; set; }
public bool AllowVideoStreamCopy { get; set; }
}
}

View File

@@ -161,7 +161,7 @@ namespace MediaBrowser.Model.Dto
public MediaStream GetDefaultAudioStream(int? defaultIndex)
{
if (defaultIndex.HasValue)
if (defaultIndex.HasValue && defaultIndex != -1)
{
var val = defaultIndex.Value;

View File

@@ -16,6 +16,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: InternalsVisibleTo("Jellyfin.Model.Tests")]
[assembly: InternalsVisibleTo("Jellyfin.Dlna.Tests")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from

View File

@@ -31,21 +31,16 @@ namespace MediaBrowser.Model.Session
AudioChannelsNotSupported = 1 << 14,
AudioProfileNotSupported = 1 << 15,
AudioSampleRateNotSupported = 1 << 16,
AudioBitDepthNotSupported = 1 << 20,
AudioBitDepthNotSupported = 1 << 17,
// Bitrate Constraints
ContainerBitrateExceedsLimit = 1 << 17,
VideoBitrateNotSupported = 1 << 18,
AudioBitrateNotSupported = 1 << 19,
ContainerBitrateExceedsLimit = 1 << 18,
VideoBitrateNotSupported = 1 << 19,
AudioBitrateNotSupported = 1 << 20,
// Errors
UnknownVideoStreamInfo = 1 << 20,
UnknownAudioStreamInfo = 1 << 21,
DirectPlayError = 1 << 22,
// Aliases
ContainerReasons = ContainerNotSupported | ContainerBitrateExceedsLimit,
AudioReasons = AudioCodecNotSupported | AudioBitrateNotSupported | AudioChannelsNotSupported | AudioProfileNotSupported | AudioSampleRateNotSupported | SecondaryAudioNotSupported | AudioBitDepthNotSupported | AudioIsExternal,
VideoReasons = VideoCodecNotSupported | VideoResolutionNotSupported | AnamorphicVideoNotSupported | InterlacedVideoNotSupported | VideoBitDepthNotSupported | VideoBitrateNotSupported | VideoFramerateNotSupported | VideoLevelNotSupported | RefFramesNotSupported,
UnknownVideoStreamInfo = 1 << 21,
UnknownAudioStreamInfo = 1 << 22,
DirectPlayError = 1 << 23,
}
}

View File

@@ -1,22 +1,34 @@
#pragma warning disable CS1591
using System;
using System.Linq;
namespace MediaBrowser.Model.Session
{
/// <summary>
/// Extension methods for serializing TranscodeReason.
/// </summary>
public static class TranscodeReasonExtensions
{
private static TranscodeReason[] values = Enum.GetValues<TranscodeReason>();
private static readonly TranscodeReason[] _values = Enum.GetValues<TranscodeReason>();
public static string Serialize(this MediaBrowser.Model.Session.TranscodeReason reasons, string sep = ",")
/// <summary>
/// Serializes a TranscodeReason into a delimiter-separated string.
/// </summary>
/// <param name="reasons">The <see cref="TranscodeReason"/> enumeration.</param>
/// <param name="sep">The string separator to use. defualt <c>,</c>.</param>
/// <returns>string of transcode reasons delimited.</returns>
public static string Serialize(this TranscodeReason reasons, string sep = ",")
{
return string.Join(sep, reasons.ToArray());
}
public static TranscodeReason[] ToArray(this MediaBrowser.Model.Session.TranscodeReason reasons)
/// <summary>
/// Serializes a TranscodeReason into an array of individual TranscodeReason bits.
/// </summary>
/// <param name="reasons">The <see cref="TranscodeReason"/> enumeration.</param>
/// <returns>Array of <c>TranscodeReason</c>.</returns>
public static TranscodeReason[] ToArray(this TranscodeReason reasons)
{
return values.Where(r => r != 0 && reasons.HasFlag(r)).ToArray();
return _values.Where(r => r != 0 && reasons.HasFlag(r)).ToArray();
}
}
}

View File

@@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Session
public HardwareEncodingType? HardwareAccelerationType { get; set; }
public TranscodeReason[] TranscodeReasons { get => TranscodeReason.ToArray(); }
public TranscodeReason[] TranscodeReasons => TranscodeReason.ToArray();
[JsonIgnore]
public TranscodeReason TranscodeReason { get; set; }