IMediaEncoder.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using MediaBrowser.Model.Configuration;
  8. using MediaBrowser.Model.Dlna;
  9. using MediaBrowser.Model.Drawing;
  10. using MediaBrowser.Model.Dto;
  11. using MediaBrowser.Model.Entities;
  12. using MediaBrowser.Model.MediaInfo;
  13. namespace MediaBrowser.Controller.MediaEncoding
  14. {
  15. /// <summary>
  16. /// Interface IMediaEncoder.
  17. /// </summary>
  18. public interface IMediaEncoder : ITranscoderSupport
  19. {
  20. /// <summary>
  21. /// Gets the encoder path.
  22. /// </summary>
  23. /// <value>The encoder path.</value>
  24. string EncoderPath { get; }
  25. /// <summary>
  26. /// Gets the probe path.
  27. /// </summary>
  28. /// <value>The probe path.</value>
  29. string ProbePath { get; }
  30. /// <summary>
  31. /// Gets the version of encoder.
  32. /// </summary>
  33. /// <returns>The version of encoder.</returns>
  34. Version EncoderVersion { get; }
  35. /// <summary>
  36. /// Gets a value indicating whether p key pausing is supported.
  37. /// </summary>
  38. /// <value><c>true</c> if p key pausing is supported, <c>false</c> otherwise.</value>
  39. bool IsPkeyPauseSupported { get; }
  40. /// <summary>
  41. /// Gets a value indicating whether the configured Vaapi device is from AMD(radeonsi/r600 Mesa driver).
  42. /// </summary>
  43. /// <value><c>true</c> if the Vaapi device is an AMD(radeonsi/r600 Mesa driver) GPU, <c>false</c> otherwise.</value>
  44. bool IsVaapiDeviceAmd { get; }
  45. /// <summary>
  46. /// Gets a value indicating whether the configured Vaapi device is from Intel(iHD driver).
  47. /// </summary>
  48. /// <value><c>true</c> if the Vaapi device is an Intel(iHD driver) GPU, <c>false</c> otherwise.</value>
  49. bool IsVaapiDeviceInteliHD { get; }
  50. /// <summary>
  51. /// Gets a value indicating whether the configured Vaapi device is from Intel(legacy i965 driver).
  52. /// </summary>
  53. /// <value><c>true</c> if the Vaapi device is an Intel(legacy i965 driver) GPU, <c>false</c> otherwise.</value>
  54. bool IsVaapiDeviceInteli965 { get; }
  55. /// <summary>
  56. /// Gets a value indicating whether the configured Vaapi device supports vulkan drm format modifier.
  57. /// </summary>
  58. /// <value><c>true</c> if the Vaapi device supports vulkan drm format modifier, <c>false</c> otherwise.</value>
  59. bool IsVaapiDeviceSupportVulkanFmtModifier { get; }
  60. /// <summary>
  61. /// Whether given encoder codec is supported.
  62. /// </summary>
  63. /// <param name="encoder">The encoder.</param>
  64. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  65. bool SupportsEncoder(string encoder);
  66. /// <summary>
  67. /// Whether given decoder codec is supported.
  68. /// </summary>
  69. /// <param name="decoder">The decoder.</param>
  70. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  71. bool SupportsDecoder(string decoder);
  72. /// <summary>
  73. /// Whether given hardware acceleration type is supported.
  74. /// </summary>
  75. /// <param name="hwaccel">The hwaccel.</param>
  76. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  77. bool SupportsHwaccel(string hwaccel);
  78. /// <summary>
  79. /// Whether given filter is supported.
  80. /// </summary>
  81. /// <param name="filter">The filter.</param>
  82. /// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
  83. bool SupportsFilter(string filter);
  84. /// <summary>
  85. /// Whether filter is supported with the given option.
  86. /// </summary>
  87. /// <param name="option">The option.</param>
  88. /// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
  89. bool SupportsFilterWithOption(FilterOptionType option);
  90. /// <summary>
  91. /// Extracts the audio image.
  92. /// </summary>
  93. /// <param name="path">The path.</param>
  94. /// <param name="imageStreamIndex">Index of the image stream.</param>
  95. /// <param name="cancellationToken">The cancellation token.</param>
  96. /// <returns>Task{Stream}.</returns>
  97. Task<string> ExtractAudioImage(string path, int? imageStreamIndex, CancellationToken cancellationToken);
  98. /// <summary>
  99. /// Extracts the video image.
  100. /// </summary>
  101. /// <param name="inputFile">Input file.</param>
  102. /// <param name="container">Video container type.</param>
  103. /// <param name="mediaSource">Media source information.</param>
  104. /// <param name="videoStream">Media stream information.</param>
  105. /// <param name="threedFormat">Video 3D format.</param>
  106. /// <param name="offset">Time offset.</param>
  107. /// <param name="cancellationToken">CancellationToken to use for operation.</param>
  108. /// <returns>Location of video image.</returns>
  109. Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream videoStream, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
  110. /// <summary>
  111. /// Extracts the video image.
  112. /// </summary>
  113. /// <param name="inputFile">Input file.</param>
  114. /// <param name="container">Video container type.</param>
  115. /// <param name="mediaSource">Media source information.</param>
  116. /// <param name="imageStream">Media stream information.</param>
  117. /// <param name="imageStreamIndex">Index of the stream to extract from.</param>
  118. /// <param name="targetFormat">The format of the file to write.</param>
  119. /// <param name="cancellationToken">CancellationToken to use for operation.</param>
  120. /// <returns>Location of video image.</returns>
  121. Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream imageStream, int? imageStreamIndex, ImageFormat? targetFormat, CancellationToken cancellationToken);
  122. /// <summary>
  123. /// Extracts the video images on interval.
  124. /// </summary>
  125. /// <param name="inputFile">Input file.</param>
  126. /// <param name="container">Video container type.</param>
  127. /// <param name="mediaSource">Media source information.</param>
  128. /// <param name="imageStream">Media stream information.</param>
  129. /// <param name="interval">The interval.</param>
  130. /// <param name="maxWidth">The maximum width.</param>
  131. /// <param name="allowHwAccel">Allow for hardware acceleration.</param>
  132. /// <param name="allowHwEncode">Allow for hardware encoding. allowHwAccel must also be true.</param>
  133. /// <param name="encodingHelper">EncodingHelper instance.</param>
  134. /// <param name="cancellationToken">The cancellation token.</param>
  135. /// <returns>Directory where images where extracted. A given image made before another will always be named with a lower number.</returns>
  136. Task<string> ExtractVideoImagesOnIntervalAccelerated(
  137. string inputFile,
  138. string container,
  139. MediaSourceInfo mediaSource,
  140. MediaStream imageStream,
  141. TimeSpan interval,
  142. int maxWidth,
  143. bool allowHwAccel,
  144. bool allowHwEncode,
  145. EncodingHelper encodingHelper,
  146. CancellationToken cancellationToken);
  147. /// <summary>
  148. /// Gets the media info.
  149. /// </summary>
  150. /// <param name="request">The request.</param>
  151. /// <param name="cancellationToken">The cancellation token.</param>
  152. /// <returns>Task.</returns>
  153. Task<MediaInfo> GetMediaInfo(MediaInfoRequest request, CancellationToken cancellationToken);
  154. /// <summary>
  155. /// Gets the input argument.
  156. /// </summary>
  157. /// <param name="inputFile">The input file.</param>
  158. /// <param name="mediaSource">The mediaSource.</param>
  159. /// <returns>System.String.</returns>
  160. string GetInputArgument(string inputFile, MediaSourceInfo mediaSource);
  161. /// <summary>
  162. /// Gets the input argument.
  163. /// </summary>
  164. /// <param name="inputFiles">The input files.</param>
  165. /// <param name="mediaSource">The mediaSource.</param>
  166. /// <returns>System.String.</returns>
  167. string GetInputArgument(IReadOnlyList<string> inputFiles, MediaSourceInfo mediaSource);
  168. /// <summary>
  169. /// Gets the input argument for an external subtitle file.
  170. /// </summary>
  171. /// <param name="inputFile">The input file.</param>
  172. /// <returns>System.String.</returns>
  173. string GetExternalSubtitleInputArgument(string inputFile);
  174. /// <summary>
  175. /// Gets the time parameter.
  176. /// </summary>
  177. /// <param name="ticks">The ticks.</param>
  178. /// <returns>System.String.</returns>
  179. string GetTimeParameter(long ticks);
  180. Task ConvertImage(string inputPath, string outputPath);
  181. /// <summary>
  182. /// Escapes the subtitle filter path.
  183. /// </summary>
  184. /// <param name="path">The path.</param>
  185. /// <returns>System.String.</returns>
  186. string EscapeSubtitleFilterPath(string path);
  187. /// <summary>
  188. /// Sets the path to find FFmpeg.
  189. /// </summary>
  190. void SetFFmpegPath();
  191. /// <summary>
  192. /// Updates the encoder path.
  193. /// </summary>
  194. /// <param name="path">The path.</param>
  195. /// <param name="pathType">The type of path.</param>
  196. void UpdateEncoderPath(string path, string pathType);
  197. /// <summary>
  198. /// Gets the primary playlist of .vob files.
  199. /// </summary>
  200. /// <param name="path">The to the .vob files.</param>
  201. /// <param name="titleNumber">The title number to start with.</param>
  202. /// <returns>A playlist.</returns>
  203. IReadOnlyList<string> GetPrimaryPlaylistVobFiles(string path, uint? titleNumber);
  204. /// <summary>
  205. /// Gets the primary playlist of .m2ts files.
  206. /// </summary>
  207. /// <param name="path">The to the .m2ts files.</param>
  208. /// <returns>A playlist.</returns>
  209. IReadOnlyList<string> GetPrimaryPlaylistM2tsFiles(string path);
  210. /// <summary>
  211. /// Generates a FFmpeg concat config for the source.
  212. /// </summary>
  213. /// <param name="source">The <see cref="MediaSourceInfo"/>.</param>
  214. /// <param name="concatFilePath">The path the config should be written to.</param>
  215. void GenerateConcatConfig(MediaSourceInfo source, string concatFilePath);
  216. }
  217. }