aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/TranscodingProfile.cs
blob: 5797d425068b9afcaf7f68d14f59a7e03d042e91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Jellyfin.Data.Enums;

namespace MediaBrowser.Model.Dlna;

/// <summary>
/// A class for transcoding profile information.
/// Note for client developers: Conditions defined in <see cref="CodecProfile"/> has higher priority and can override values defined here.
/// </summary>
public class TranscodingProfile
{
    /// <summary>
    /// Initializes a new instance of the <see cref="TranscodingProfile" /> class.
    /// </summary>
    public TranscodingProfile()
    {
        Conditions = [];
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="TranscodingProfile" /> class copying the values from another instance.
    /// </summary>
    /// <param name="other">Another instance of <see cref="TranscodingProfile" /> to be copied.</param>
    public TranscodingProfile(TranscodingProfile other)
    {
        ArgumentNullException.ThrowIfNull(other);

        Container = other.Container;
        Type = other.Type;
        VideoCodec = other.VideoCodec;
        AudioCodec = other.AudioCodec;
        Protocol = other.Protocol;
        EstimateContentLength = other.EstimateContentLength;
        EnableMpegtsM2TsMode = other.EnableMpegtsM2TsMode;
        TranscodeSeekInfo = other.TranscodeSeekInfo;
        CopyTimestamps = other.CopyTimestamps;
        Context = other.Context;
        EnableSubtitlesInManifest = other.EnableSubtitlesInManifest;
        MaxAudioChannels = other.MaxAudioChannels;
        MinSegments = other.MinSegments;
        SegmentLength = other.SegmentLength;
        BreakOnNonKeyFrames = other.BreakOnNonKeyFrames;
        Conditions = other.Conditions;
        EnableAudioVbrEncoding = other.EnableAudioVbrEncoding;
    }

    /// <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;
}