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