Merge branch 'master' into network-rewrite

This commit is contained in:
Shadowghost
2023-06-15 17:53:52 +02:00
74 changed files with 2147 additions and 332 deletions

View File

@@ -27,13 +27,13 @@ public class EncodingOptions
EnableTonemapping = false;
EnableVppTonemapping = false;
TonemappingAlgorithm = "bt2390";
TonemappingMode = "auto";
TonemappingRange = "auto";
TonemappingDesat = 0;
TonemappingThreshold = 0.8;
TonemappingPeak = 100;
TonemappingParam = 0;
VppTonemappingBrightness = 0;
VppTonemappingContrast = 1.2;
VppTonemappingBrightness = 16;
VppTonemappingContrast = 1;
H264Crf = 23;
H265Crf = 28;
DeinterlaceDoubleRate = false;
@@ -137,6 +137,11 @@ public class EncodingOptions
/// </summary>
public string TonemappingAlgorithm { get; set; }
/// <summary>
/// Gets or sets the tone-mapping mode.
/// </summary>
public string TonemappingMode { get; set; }
/// <summary>
/// Gets or sets the tone-mapping range.
/// </summary>
@@ -147,11 +152,6 @@ public class EncodingOptions
/// </summary>
public double TonemappingDesat { get; set; }
/// <summary>
/// Gets or sets the tone-mapping threshold.
/// </summary>
public double TonemappingThreshold { get; set; }
/// <summary>
/// Gets or sets the tone-mapping peak.
/// </summary>

View File

@@ -757,8 +757,8 @@ namespace MediaBrowser.Model.Dlna
if (options.AllowVideoStreamCopy)
{
// prefer direct copy profile
float videoFramerate = videoStream is null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;
TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : item.Timestamp;
float videoFramerate = videoStream?.AverageFrameRate ?? videoStream?.RealFrameRate ?? 0;
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : item.Timestamp;
int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio);
int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video);
@@ -768,7 +768,7 @@ namespace MediaBrowser.Model.Dlna
if (ContainerProfile.ContainsContainer(videoCodecs, item.VideoStream?.Codec))
{
var videoCodec = transcodingProfile.VideoCodec;
var videoCodec = videoStream?.Codec;
var container = transcodingProfile.Container;
var appliedVideoConditions = options.Profile.CodecProfiles
.Where(i => i.Type == CodecType.Video &&
@@ -905,7 +905,7 @@ namespace MediaBrowser.Model.Dlna
var appliedVideoConditions = options.Profile.CodecProfiles
.Where(i => i.Type == CodecType.Video &&
i.ContainsAnyCodec(videoCodec, container) &&
i.ContainsAnyCodec(videoStream?.Codec, container) &&
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoRangeType, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)));
var isFirstAppliedCodecProfile = true;
foreach (var i in appliedVideoConditions)
@@ -937,7 +937,7 @@ namespace MediaBrowser.Model.Dlna
var appliedAudioConditions = options.Profile.CodecProfiles
.Where(i => i.Type == CodecType.VideoAudio &&
i.ContainsAnyCodec(audioCodec, container) &&
i.ContainsAnyCodec(audioStream?.Codec, container) &&
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio)));
isFirstAppliedCodecProfile = true;
foreach (var codecProfile in appliedAudioConditions)
@@ -1176,7 +1176,8 @@ namespace MediaBrowser.Model.Dlna
profile,
"VideoCodecProfile",
profile.CodecProfiles
.Where(codecProfile => codecProfile.Type == CodecType.Video && codecProfile.ContainsAnyCodec(videoStream?.Codec, container) &&
.Where(codecProfile => codecProfile.Type == CodecType.Video &&
codecProfile.ContainsAnyCodec(videoStream?.Codec, container) &&
!checkVideoConditions(codecProfile.ApplyConditions).Any())
.SelectMany(codecProfile => checkVideoConditions(codecProfile.Conditions)));
@@ -1585,7 +1586,8 @@ namespace MediaBrowser.Model.Dlna
bool? isSecondaryAudio)
{
return codecProfiles
.Where(profile => profile.Type == CodecType.VideoAudio && profile.ContainsAnyCodec(codec, container) &&
.Where(profile => profile.Type == CodecType.VideoAudio &&
profile.ContainsAnyCodec(codec, container) &&
profile.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)))
.SelectMany(profile => profile.Conditions)
.Where(condition => !ConditionProcessor.IsVideoAudioConditionSatisfied(condition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio));
@@ -1602,7 +1604,8 @@ namespace MediaBrowser.Model.Dlna
bool checkConditions)
{
var conditions = codecProfiles
.Where(profile => profile.Type == CodecType.Audio && profile.ContainsAnyCodec(codec, container) &&
.Where(profile => profile.Type == CodecType.Audio &&
profile.ContainsAnyCodec(codec, container) &&
profile.ApplyConditions.All(applyCondition => ConditionProcessor.IsAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth)))
.SelectMany(profile => profile.Conditions);

View File

@@ -1,31 +0,0 @@
#nullable disable
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Net
{
/// <summary>
/// Class WebSocketMessage.
/// </summary>
/// <typeparam name="T">The type of the data.</typeparam>
public class WebSocketMessage<T>
{
/// <summary>
/// Gets or sets the type of the message.
/// </summary>
/// <value>The type of the message.</value>
public SessionMessageType MessageType { get; set; }
public Guid MessageId { get; set; }
public string ServerId { get; set; }
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>The data.</value>
public T Data { get; set; }
}
}

View File

@@ -1,42 +1,30 @@
using System;
namespace MediaBrowser.Model.SyncPlay
namespace MediaBrowser.Model.SyncPlay;
/// <summary>
/// Group update without data.
/// </summary>
public abstract class GroupUpdate
{
/// <summary>
/// Class GroupUpdate.
/// Initializes a new instance of the <see cref="GroupUpdate"/> class.
/// </summary>
/// <typeparam name="T">The type of the data of the message.</typeparam>
public class GroupUpdate<T>
/// <param name="groupId">The group identifier.</param>
protected GroupUpdate(Guid groupId)
{
/// <summary>
/// Initializes a new instance of the <see cref="GroupUpdate{T}"/> class.
/// </summary>
/// <param name="groupId">The group identifier.</param>
/// <param name="type">The update type.</param>
/// <param name="data">The update data.</param>
public GroupUpdate(Guid groupId, GroupUpdateType type, T data)
{
GroupId = groupId;
Type = type;
Data = data;
}
/// <summary>
/// Gets the group identifier.
/// </summary>
/// <value>The group identifier.</value>
public Guid GroupId { get; }
/// <summary>
/// Gets the update type.
/// </summary>
/// <value>The update type.</value>
public GroupUpdateType Type { get; }
/// <summary>
/// Gets the update data.
/// </summary>
/// <value>The update data.</value>
public T Data { get; }
GroupId = groupId;
}
/// <summary>
/// Gets the group identifier.
/// </summary>
/// <value>The group identifier.</value>
public Guid GroupId { get; }
/// <summary>
/// Gets the update type.
/// </summary>
/// <value>The update type.</value>
public GroupUpdateType Type { get; init; }
}

View File

@@ -0,0 +1,31 @@
#pragma warning disable SA1649
using System;
namespace MediaBrowser.Model.SyncPlay;
/// <summary>
/// Class GroupUpdate.
/// </summary>
/// <typeparam name="T">The type of the data of the message.</typeparam>
public class GroupUpdate<T> : GroupUpdate
{
/// <summary>
/// Initializes a new instance of the <see cref="GroupUpdate{T}"/> class.
/// </summary>
/// <param name="groupId">The group identifier.</param>
/// <param name="type">The update type.</param>
/// <param name="data">The update data.</param>
public GroupUpdate(Guid groupId, GroupUpdateType type, T data)
: base(groupId)
{
Data = data;
Type = type;
}
/// <summary>
/// Gets the update data.
/// </summary>
/// <value>The update data.</value>
public T Data { get; }
}

View File

@@ -19,7 +19,7 @@ namespace MediaBrowser.Model.SyncPlay
/// <param name="isPlaying">The playing item status.</param>
/// <param name="shuffleMode">The shuffle mode.</param>
/// <param name="repeatMode">The repeat mode.</param>
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<SyncPlayQueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
{
Reason = reason;
LastUpdate = lastUpdate;
@@ -47,7 +47,7 @@ namespace MediaBrowser.Model.SyncPlay
/// Gets the playlist.
/// </summary>
/// <value>The playlist.</value>
public IReadOnlyList<QueueItem> Playlist { get; }
public IReadOnlyList<SyncPlayQueueItem> Playlist { get; }
/// <summary>
/// Gets the playing item index in the playlist.

View File

@@ -5,13 +5,13 @@ namespace MediaBrowser.Model.SyncPlay
/// <summary>
/// Class QueueItem.
/// </summary>
public class QueueItem
public class SyncPlayQueueItem
{
/// <summary>
/// Initializes a new instance of the <see cref="QueueItem"/> class.
/// Initializes a new instance of the <see cref="SyncPlayQueueItem"/> class.
/// </summary>
/// <param name="itemId">The item identifier.</param>
public QueueItem(Guid itemId)
public SyncPlayQueueItem(Guid itemId)
{
ItemId = itemId;
}