Rework PR 6203

This commit is contained in:
Shadowghost
2024-09-17 20:29:43 +02:00
parent 41ac5f8d76
commit 2351eeba56
14 changed files with 1848 additions and 1291 deletions

View File

@@ -1,82 +1,130 @@
#pragma warning disable CS1591
using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Dlna
namespace MediaBrowser.Model.Dlna;
/// <summary>
/// A class for transcoding profile information.
/// </summary>
public class TranscodingProfile
{
public class TranscodingProfile
/// <summary>
/// Initializes a new instance of the <see cref="TranscodingProfile" /> class.
/// </summary>
public TranscodingProfile()
{
public TranscodingProfile()
{
Conditions = Array.Empty<ProfileCondition>();
}
[XmlAttribute("container")]
public string Container { get; set; } = string.Empty;
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; } = string.Empty;
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; } = string.Empty;
[XmlAttribute("protocol")]
public MediaStreamProtocol Protocol { get; set; } = MediaStreamProtocol.http;
[DefaultValue(false)]
[XmlAttribute("estimateContentLength")]
public bool EstimateContentLength { get; set; }
[DefaultValue(false)]
[XmlAttribute("enableMpegtsM2TsMode")]
public bool EnableMpegtsM2TsMode { get; set; }
[DefaultValue(TranscodeSeekInfo.Auto)]
[XmlAttribute("transcodeSeekInfo")]
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
[DefaultValue(false)]
[XmlAttribute("copyTimestamps")]
public bool CopyTimestamps { get; set; }
[DefaultValue(EncodingContext.Streaming)]
[XmlAttribute("context")]
public EncodingContext Context { get; set; }
[DefaultValue(false)]
[XmlAttribute("enableSubtitlesInManifest")]
public bool EnableSubtitlesInManifest { get; set; }
[XmlAttribute("maxAudioChannels")]
public string? MaxAudioChannels { get; set; }
[DefaultValue(0)]
[XmlAttribute("minSegments")]
public int MinSegments { get; set; }
[DefaultValue(0)]
[XmlAttribute("segmentLength")]
public int SegmentLength { get; set; }
[DefaultValue(false)]
[XmlAttribute("breakOnNonKeyFrames")]
public bool BreakOnNonKeyFrames { get; set; }
public ProfileCondition[] Conditions { get; set; }
[DefaultValue(true)]
[XmlAttribute("enableAudioVbrEncoding")]
public bool EnableAudioVbrEncoding { get; set; } = true;
public string[] GetAudioCodecs()
{
return ContainerProfile.SplitValue(AudioCodec);
}
Conditions = [];
}
/// <summary>
/// Gets or sets the container.
/// </summary>
[XmlAttribute("container")]
public string Container { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the DLNA profile type.
/// </summary>
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
/// <summary>
/// Gets or sets the video codec.
/// </summary>
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the audio codec.
/// </summary>
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the protocol.
/// </summary>
[XmlAttribute("protocol")]
public MediaStreamProtocol Protocol { get; set; } = MediaStreamProtocol.http;
/// <summary>
/// Gets or sets a value indicating whether the content length should be estimated.
/// </summary>
[DefaultValue(false)]
[XmlAttribute("estimateContentLength")]
public bool EstimateContentLength { get; set; }
/// <summary>
/// Gets or sets a value indicating whether M2TS mode is enabled.
/// </summary>
[DefaultValue(false)]
[XmlAttribute("enableMpegtsM2TsMode")]
public bool EnableMpegtsM2TsMode { get; set; }
/// <summary>
/// Gets or sets the transcoding seek info mode.
/// </summary>
[DefaultValue(TranscodeSeekInfo.Auto)]
[XmlAttribute("transcodeSeekInfo")]
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
/// <summary>
/// Gets or sets a value indicating whether timestamps should be copied.
/// </summary>
[DefaultValue(false)]
[XmlAttribute("copyTimestamps")]
public bool CopyTimestamps { get; set; }
/// <summary>
/// Gets or sets the encoding context.
/// </summary>
[DefaultValue(EncodingContext.Streaming)]
[XmlAttribute("context")]
public EncodingContext Context { get; set; }
/// <summary>
/// Gets or sets a value indicating whether subtitles are allowed in the manifest.
/// </summary>
[DefaultValue(false)]
[XmlAttribute("enableSubtitlesInManifest")]
public bool EnableSubtitlesInManifest { get; set; }
/// <summary>
/// Gets or sets the maximum audio channels.
/// </summary>
[XmlAttribute("maxAudioChannels")]
public string? MaxAudioChannels { get; set; }
/// <summary>
/// Gets or sets the minimum amount of segments.
/// </summary>
[DefaultValue(0)]
[XmlAttribute("minSegments")]
public int MinSegments { get; set; }
/// <summary>
/// Gets or sets the segment length.
/// </summary>
[DefaultValue(0)]
[XmlAttribute("segmentLength")]
public int SegmentLength { get; set; }
/// <summary>
/// Gets or sets a value indicating whether breaking the video stream on non-keyframes is supported.
/// </summary>
[DefaultValue(false)]
[XmlAttribute("breakOnNonKeyFrames")]
public bool BreakOnNonKeyFrames { get; set; }
/// <summary>
/// Gets or sets the profile conditions.
/// </summary>
public ProfileCondition[] Conditions { get; set; }
/// <summary>
/// Gets or sets a value indicating whether variable bitrate encoding is supported.
/// </summary>
[DefaultValue(true)]
[XmlAttribute("enableAudioVbrEncoding")]
public bool EnableAudioVbrEncoding { get; set; } = true;
}