TranscodingProfile.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using System.ComponentModel;
  3. using System.Xml.Serialization;
  4. using Jellyfin.Data.Enums;
  5. namespace MediaBrowser.Model.Dlna;
  6. /// <summary>
  7. /// A class for transcoding profile information.
  8. /// Note for client developers: Conditions defined in <see cref="CodecProfile"/> has higher priority and can override values defined here.
  9. /// </summary>
  10. public class TranscodingProfile
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="TranscodingProfile" /> class.
  14. /// </summary>
  15. public TranscodingProfile()
  16. {
  17. Conditions = [];
  18. }
  19. /// <summary>
  20. /// Initializes a new instance of the <see cref="TranscodingProfile" /> class copying the values from another instance.
  21. /// </summary>
  22. /// <param name="other">Another instance of <see cref="TranscodingProfile" /> to be copied.</param>
  23. public TranscodingProfile(TranscodingProfile other)
  24. {
  25. ArgumentNullException.ThrowIfNull(other);
  26. Container = other.Container;
  27. Type = other.Type;
  28. VideoCodec = other.VideoCodec;
  29. AudioCodec = other.AudioCodec;
  30. Protocol = other.Protocol;
  31. EstimateContentLength = other.EstimateContentLength;
  32. EnableMpegtsM2TsMode = other.EnableMpegtsM2TsMode;
  33. TranscodeSeekInfo = other.TranscodeSeekInfo;
  34. CopyTimestamps = other.CopyTimestamps;
  35. Context = other.Context;
  36. EnableSubtitlesInManifest = other.EnableSubtitlesInManifest;
  37. MaxAudioChannels = other.MaxAudioChannels;
  38. MinSegments = other.MinSegments;
  39. SegmentLength = other.SegmentLength;
  40. BreakOnNonKeyFrames = other.BreakOnNonKeyFrames;
  41. Conditions = other.Conditions;
  42. EnableAudioVbrEncoding = other.EnableAudioVbrEncoding;
  43. }
  44. /// <summary>
  45. /// Gets or sets the container.
  46. /// </summary>
  47. [XmlAttribute("container")]
  48. public string Container { get; set; } = string.Empty;
  49. /// <summary>
  50. /// Gets or sets the DLNA profile type.
  51. /// </summary>
  52. [XmlAttribute("type")]
  53. public DlnaProfileType Type { get; set; }
  54. /// <summary>
  55. /// Gets or sets the video codec.
  56. /// </summary>
  57. [XmlAttribute("videoCodec")]
  58. public string VideoCodec { get; set; } = string.Empty;
  59. /// <summary>
  60. /// Gets or sets the audio codec.
  61. /// </summary>
  62. [XmlAttribute("audioCodec")]
  63. public string AudioCodec { get; set; } = string.Empty;
  64. /// <summary>
  65. /// Gets or sets the protocol.
  66. /// </summary>
  67. [XmlAttribute("protocol")]
  68. public MediaStreamProtocol Protocol { get; set; } = MediaStreamProtocol.http;
  69. /// <summary>
  70. /// Gets or sets a value indicating whether the content length should be estimated.
  71. /// </summary>
  72. [DefaultValue(false)]
  73. [XmlAttribute("estimateContentLength")]
  74. public bool EstimateContentLength { get; set; }
  75. /// <summary>
  76. /// Gets or sets a value indicating whether M2TS mode is enabled.
  77. /// </summary>
  78. [DefaultValue(false)]
  79. [XmlAttribute("enableMpegtsM2TsMode")]
  80. public bool EnableMpegtsM2TsMode { get; set; }
  81. /// <summary>
  82. /// Gets or sets the transcoding seek info mode.
  83. /// </summary>
  84. [DefaultValue(TranscodeSeekInfo.Auto)]
  85. [XmlAttribute("transcodeSeekInfo")]
  86. public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
  87. /// <summary>
  88. /// Gets or sets a value indicating whether timestamps should be copied.
  89. /// </summary>
  90. [DefaultValue(false)]
  91. [XmlAttribute("copyTimestamps")]
  92. public bool CopyTimestamps { get; set; }
  93. /// <summary>
  94. /// Gets or sets the encoding context.
  95. /// </summary>
  96. [DefaultValue(EncodingContext.Streaming)]
  97. [XmlAttribute("context")]
  98. public EncodingContext Context { get; set; }
  99. /// <summary>
  100. /// Gets or sets a value indicating whether subtitles are allowed in the manifest.
  101. /// </summary>
  102. [DefaultValue(false)]
  103. [XmlAttribute("enableSubtitlesInManifest")]
  104. public bool EnableSubtitlesInManifest { get; set; }
  105. /// <summary>
  106. /// Gets or sets the maximum audio channels.
  107. /// </summary>
  108. [XmlAttribute("maxAudioChannels")]
  109. public string? MaxAudioChannels { get; set; }
  110. /// <summary>
  111. /// Gets or sets the minimum amount of segments.
  112. /// </summary>
  113. [DefaultValue(0)]
  114. [XmlAttribute("minSegments")]
  115. public int MinSegments { get; set; }
  116. /// <summary>
  117. /// Gets or sets the segment length.
  118. /// </summary>
  119. [DefaultValue(0)]
  120. [XmlAttribute("segmentLength")]
  121. public int SegmentLength { get; set; }
  122. /// <summary>
  123. /// Gets or sets a value indicating whether breaking the video stream on non-keyframes is supported.
  124. /// </summary>
  125. [DefaultValue(false)]
  126. [XmlAttribute("breakOnNonKeyFrames")]
  127. public bool BreakOnNonKeyFrames { get; set; }
  128. /// <summary>
  129. /// Gets or sets the profile conditions.
  130. /// </summary>
  131. public ProfileCondition[] Conditions { get; set; }
  132. /// <summary>
  133. /// Gets or sets a value indicating whether variable bitrate encoding is supported.
  134. /// </summary>
  135. [DefaultValue(true)]
  136. [XmlAttribute("enableAudioVbrEncoding")]
  137. public bool EnableAudioVbrEncoding { get; set; } = true;
  138. }