BaseEncodingJobOptions.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System;
  4. using System.Collections.Generic;
  5. using MediaBrowser.Model.Dlna;
  6. namespace MediaBrowser.Controller.MediaEncoding
  7. {
  8. public class BaseEncodingJobOptions
  9. {
  10. public BaseEncodingJobOptions()
  11. {
  12. EnableAutoStreamCopy = true;
  13. AllowVideoStreamCopy = true;
  14. AllowAudioStreamCopy = true;
  15. Context = EncodingContext.Streaming;
  16. StreamOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  17. }
  18. /// <summary>
  19. /// Gets or sets the id.
  20. /// </summary>
  21. /// <value>The id.</value>
  22. public Guid Id { get; set; }
  23. public string MediaSourceId { get; set; }
  24. public string DeviceId { get; set; }
  25. public string Container { get; set; }
  26. /// <summary>
  27. /// Gets or sets the audio codec.
  28. /// </summary>
  29. /// <value>The audio codec.</value>
  30. public string AudioCodec { get; set; }
  31. public bool EnableAutoStreamCopy { get; set; }
  32. public bool AllowVideoStreamCopy { get; set; }
  33. public bool AllowAudioStreamCopy { get; set; }
  34. public bool BreakOnNonKeyFrames { get; set; }
  35. /// <summary>
  36. /// Gets or sets the audio sample rate.
  37. /// </summary>
  38. /// <value>The audio sample rate.</value>
  39. public int? AudioSampleRate { get; set; }
  40. public int? MaxAudioBitDepth { get; set; }
  41. /// <summary>
  42. /// Gets or sets the audio bit rate.
  43. /// </summary>
  44. /// <value>The audio bit rate.</value>
  45. public int? AudioBitRate { get; set; }
  46. /// <summary>
  47. /// Gets or sets the audio channels.
  48. /// </summary>
  49. /// <value>The audio channels.</value>
  50. public int? AudioChannels { get; set; }
  51. public int? MaxAudioChannels { get; set; }
  52. public bool Static { get; set; }
  53. /// <summary>
  54. /// Gets or sets the profile.
  55. /// </summary>
  56. /// <value>The profile.</value>
  57. public string Profile { get; set; }
  58. /// <summary>
  59. /// Gets or sets the video range type.
  60. /// </summary>
  61. /// <value>The video range type.</value>
  62. public string VideoRangeType { get; set; }
  63. /// <summary>
  64. /// Gets or sets the level.
  65. /// </summary>
  66. /// <value>The level.</value>
  67. public string Level { get; set; }
  68. /// <summary>
  69. /// Gets or sets the codec tag.
  70. /// </summary>
  71. /// <value>The codec tag.</value>
  72. public string CodecTag { get; set; }
  73. /// <summary>
  74. /// Gets or sets the framerate.
  75. /// </summary>
  76. /// <value>The framerate.</value>
  77. public float? Framerate { get; set; }
  78. public float? MaxFramerate { get; set; }
  79. public bool CopyTimestamps { get; set; }
  80. /// <summary>
  81. /// Gets or sets the start time ticks.
  82. /// </summary>
  83. /// <value>The start time ticks.</value>
  84. public long? StartTimeTicks { get; set; }
  85. /// <summary>
  86. /// Gets or sets the width.
  87. /// </summary>
  88. /// <value>The width.</value>
  89. public int? Width { get; set; }
  90. /// <summary>
  91. /// Gets or sets the height.
  92. /// </summary>
  93. /// <value>The height.</value>
  94. public int? Height { get; set; }
  95. /// <summary>
  96. /// Gets or sets the width of the max.
  97. /// </summary>
  98. /// <value>The width of the max.</value>
  99. public int? MaxWidth { get; set; }
  100. /// <summary>
  101. /// Gets or sets the height of the max.
  102. /// </summary>
  103. /// <value>The height of the max.</value>
  104. public int? MaxHeight { get; set; }
  105. /// <summary>
  106. /// Gets or sets the video bit rate.
  107. /// </summary>
  108. /// <value>The video bit rate.</value>
  109. public int? VideoBitRate { get; set; }
  110. /// <summary>
  111. /// Gets or sets the index of the subtitle stream.
  112. /// </summary>
  113. /// <value>The index of the subtitle stream.</value>
  114. public int? SubtitleStreamIndex { get; set; }
  115. public SubtitleDeliveryMethod SubtitleMethod { get; set; }
  116. public int? MaxRefFrames { get; set; }
  117. public int? MaxVideoBitDepth { get; set; }
  118. public bool RequireAvc { get; set; }
  119. public bool DeInterlace { get; set; }
  120. public bool RequireNonAnamorphic { get; set; }
  121. public int? TranscodingMaxAudioChannels { get; set; }
  122. public int? CpuCoreLimit { get; set; }
  123. public string LiveStreamId { get; set; }
  124. public bool EnableMpegtsM2TsMode { get; set; }
  125. /// <summary>
  126. /// Gets or sets the video codec.
  127. /// </summary>
  128. /// <value>The video codec.</value>
  129. public string VideoCodec { get; set; }
  130. public string SubtitleCodec { get; set; }
  131. public string TranscodeReasons { get; set; }
  132. /// <summary>
  133. /// Gets or sets the index of the audio stream.
  134. /// </summary>
  135. /// <value>The index of the audio stream.</value>
  136. public int? AudioStreamIndex { get; set; }
  137. /// <summary>
  138. /// Gets or sets the index of the video stream.
  139. /// </summary>
  140. /// <value>The index of the video stream.</value>
  141. public int? VideoStreamIndex { get; set; }
  142. public EncodingContext Context { get; set; }
  143. public Dictionary<string, string> StreamOptions { get; set; }
  144. public bool EnableAudioVbrEncoding { get; set; }
  145. public bool AlwaysBurnInSubtitleWhenTranscoding { get; set; }
  146. public string GetOption(string qualifier, string name)
  147. {
  148. var value = GetOption(qualifier + "-" + name);
  149. if (string.IsNullOrEmpty(value))
  150. {
  151. value = GetOption(name);
  152. }
  153. return value;
  154. }
  155. public string GetOption(string name)
  156. {
  157. if (StreamOptions.TryGetValue(name, out var value))
  158. {
  159. return value;
  160. }
  161. return null;
  162. }
  163. }
  164. }