BaseEncodingJobOptions.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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 level.
  60. /// </summary>
  61. /// <value>The level.</value>
  62. public string Level { get; set; }
  63. /// <summary>
  64. /// Gets or sets the framerate.
  65. /// </summary>
  66. /// <value>The framerate.</value>
  67. public float? Framerate { get; set; }
  68. public float? MaxFramerate { get; set; }
  69. public bool CopyTimestamps { get; set; }
  70. /// <summary>
  71. /// Gets or sets the start time ticks.
  72. /// </summary>
  73. /// <value>The start time ticks.</value>
  74. public long? StartTimeTicks { get; set; }
  75. /// <summary>
  76. /// Gets or sets the width.
  77. /// </summary>
  78. /// <value>The width.</value>
  79. public int? Width { get; set; }
  80. /// <summary>
  81. /// Gets or sets the height.
  82. /// </summary>
  83. /// <value>The height.</value>
  84. public int? Height { get; set; }
  85. /// <summary>
  86. /// Gets or sets the width of the max.
  87. /// </summary>
  88. /// <value>The width of the max.</value>
  89. public int? MaxWidth { get; set; }
  90. /// <summary>
  91. /// Gets or sets the height of the max.
  92. /// </summary>
  93. /// <value>The height of the max.</value>
  94. public int? MaxHeight { get; set; }
  95. /// <summary>
  96. /// Gets or sets the video bit rate.
  97. /// </summary>
  98. /// <value>The video bit rate.</value>
  99. public int? VideoBitRate { get; set; }
  100. /// <summary>
  101. /// Gets or sets the index of the subtitle stream.
  102. /// </summary>
  103. /// <value>The index of the subtitle stream.</value>
  104. public int? SubtitleStreamIndex { get; set; }
  105. public SubtitleDeliveryMethod SubtitleMethod { get; set; }
  106. public int? MaxRefFrames { get; set; }
  107. public int? MaxVideoBitDepth { get; set; }
  108. public bool RequireAvc { get; set; }
  109. public bool DeInterlace { get; set; }
  110. public bool RequireNonAnamorphic { get; set; }
  111. public int? TranscodingMaxAudioChannels { get; set; }
  112. public int? CpuCoreLimit { get; set; }
  113. public string LiveStreamId { get; set; }
  114. public bool EnableMpegtsM2TsMode { get; set; }
  115. /// <summary>
  116. /// Gets or sets the video codec.
  117. /// </summary>
  118. /// <value>The video codec.</value>
  119. public string VideoCodec { get; set; }
  120. public string SubtitleCodec { get; set; }
  121. public string TranscodeReasons { get; set; }
  122. /// <summary>
  123. /// Gets or sets the index of the audio stream.
  124. /// </summary>
  125. /// <value>The index of the audio stream.</value>
  126. public int? AudioStreamIndex { get; set; }
  127. /// <summary>
  128. /// Gets or sets the index of the video stream.
  129. /// </summary>
  130. /// <value>The index of the video stream.</value>
  131. public int? VideoStreamIndex { get; set; }
  132. public EncodingContext Context { get; set; }
  133. public Dictionary<string, string> StreamOptions { get; set; }
  134. public string GetOption(string qualifier, string name)
  135. {
  136. var value = GetOption(qualifier + "-" + name);
  137. if (string.IsNullOrEmpty(value))
  138. {
  139. value = GetOption(name);
  140. }
  141. return value;
  142. }
  143. public string GetOption(string name)
  144. {
  145. if (StreamOptions.TryGetValue(name, out var value))
  146. {
  147. return value;
  148. }
  149. return null;
  150. }
  151. }
  152. }