IMediaEncoder.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.Dlna;
  8. using MediaBrowser.Model.Dto;
  9. using MediaBrowser.Model.Entities;
  10. using MediaBrowser.Model.MediaInfo;
  11. namespace MediaBrowser.Controller.MediaEncoding
  12. {
  13. /// <summary>
  14. /// Interface IMediaEncoder.
  15. /// </summary>
  16. public interface IMediaEncoder : ITranscoderSupport
  17. {
  18. /// <summary>
  19. /// Gets the encoder path.
  20. /// </summary>
  21. /// <value>The encoder path.</value>
  22. string EncoderPath { get; }
  23. /// <summary>
  24. /// Gets the probe path.
  25. /// </summary>
  26. /// <value>The probe path.</value>
  27. string ProbePath { get; }
  28. /// <summary>
  29. /// Whether given encoder codec is supported.
  30. /// </summary>
  31. /// <param name="encoder">The encoder.</param>
  32. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  33. bool SupportsEncoder(string encoder);
  34. /// <summary>
  35. /// Whether given decoder codec is supported.
  36. /// </summary>
  37. /// <param name="decoder">The decoder.</param>
  38. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  39. bool SupportsDecoder(string decoder);
  40. /// <summary>
  41. /// Whether given hardware acceleration type is supported.
  42. /// </summary>
  43. /// <param name="hwaccel">The hwaccel.</param>
  44. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  45. bool SupportsHwaccel(string hwaccel);
  46. /// <summary>
  47. /// Whether given filter is supported.
  48. /// </summary>
  49. /// <param name="filter">The filter.</param>
  50. /// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
  51. bool SupportsFilter(string filter);
  52. /// <summary>
  53. /// Whether filter is supported with the given option.
  54. /// </summary>
  55. /// <param name="option">The option.</param>
  56. /// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
  57. bool SupportsFilterWithOption(FilterOptionType option);
  58. /// <summary>
  59. /// Get the version of media encoder.
  60. /// </summary>
  61. /// <returns>The version of media encoder.</returns>
  62. Version GetMediaEncoderVersion();
  63. /// <summary>
  64. /// Extracts the audio image.
  65. /// </summary>
  66. /// <param name="path">The path.</param>
  67. /// <param name="imageStreamIndex">Index of the image stream.</param>
  68. /// <param name="cancellationToken">The cancellation token.</param>
  69. /// <returns>Task{Stream}.</returns>
  70. Task<string> ExtractAudioImage(string path, int? imageStreamIndex, CancellationToken cancellationToken);
  71. /// <summary>
  72. /// Extracts the video image.
  73. /// </summary>
  74. /// <param name="inputFile">Input file.</param>
  75. /// <param name="container">Video container type.</param>
  76. /// <param name="mediaSource">Media source information.</param>
  77. /// <param name="videoStream">Media stream information.</param>
  78. /// <param name="threedFormat">Video 3D format.</param>
  79. /// <param name="offset">Time offset.</param>
  80. /// <param name="cancellationToken">CancellationToken to use for operation.</param>
  81. /// <returns>Location of video image.</returns>
  82. Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream videoStream, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
  83. /// <summary>
  84. /// Extracts the video image.
  85. /// </summary>
  86. /// <param name="inputFile">Input file.</param>
  87. /// <param name="container">Video container type.</param>
  88. /// <param name="mediaSource">Media source information.</param>
  89. /// <param name="imageStream">Media stream information.</param>
  90. /// <param name="imageStreamIndex">Index of the stream to extract from.</param>
  91. /// <param name="cancellationToken">CancellationToken to use for operation.</param>
  92. /// <returns>Location of video image.</returns>
  93. Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream imageStream, int? imageStreamIndex, CancellationToken cancellationToken);
  94. /// <summary>
  95. /// Extracts the video images on interval.
  96. /// </summary>
  97. /// <param name="inputFile">Input file.</param>
  98. /// <param name="container">Video container type.</param>
  99. /// <param name="videoStream">Media stream information.</param>
  100. /// <param name="mediaSource">Media source information.</param>
  101. /// <param name="threedFormat">Video 3D format.</param>
  102. /// <param name="interval">Time interval.</param>
  103. /// <param name="targetDirectory">Directory to write images.</param>
  104. /// <param name="filenamePrefix">Filename prefix to use.</param>
  105. /// <param name="maxWidth">Maximum width of image.</param>
  106. /// <param name="cancellationToken">CancellationToken to use for operation.</param>
  107. /// <returns>A task.</returns>
  108. Task ExtractVideoImagesOnInterval(
  109. string inputFile,
  110. string container,
  111. MediaStream videoStream,
  112. MediaSourceInfo mediaSource,
  113. Video3DFormat? threedFormat,
  114. TimeSpan interval,
  115. string targetDirectory,
  116. string filenamePrefix,
  117. int? maxWidth,
  118. CancellationToken cancellationToken);
  119. /// <summary>
  120. /// Gets the media info.
  121. /// </summary>
  122. /// <param name="request">The request.</param>
  123. /// <param name="cancellationToken">The cancellation token.</param>
  124. /// <returns>Task.</returns>
  125. Task<MediaInfo> GetMediaInfo(MediaInfoRequest request, CancellationToken cancellationToken);
  126. /// <summary>
  127. /// Gets the input argument.
  128. /// </summary>
  129. /// <param name="inputFile">The input file.</param>
  130. /// <param name="mediaSource">The mediaSource.</param>
  131. /// <returns>System.String.</returns>
  132. string GetInputArgument(string inputFile, MediaSourceInfo mediaSource);
  133. /// <summary>
  134. /// Gets the time parameter.
  135. /// </summary>
  136. /// <param name="ticks">The ticks.</param>
  137. /// <returns>System.String.</returns>
  138. string GetTimeParameter(long ticks);
  139. Task ConvertImage(string inputPath, string outputPath);
  140. /// <summary>
  141. /// Escapes the subtitle filter path.
  142. /// </summary>
  143. /// <param name="path">The path.</param>
  144. /// <returns>System.String.</returns>
  145. string EscapeSubtitleFilterPath(string path);
  146. /// <summary>
  147. /// Sets the path to find FFmpeg.
  148. /// </summary>
  149. void SetFFmpegPath();
  150. /// <summary>
  151. /// Updates the encoder path.
  152. /// </summary>
  153. /// <param name="path">The path.</param>
  154. /// <param name="pathType">The type of path.</param>
  155. void UpdateEncoderPath(string path, string pathType);
  156. /// <summary>
  157. /// Gets the primary playlist of .vob files.
  158. /// </summary>
  159. /// <param name="path">The to the .vob files.</param>
  160. /// <param name="titleNumber">The title number to start with.</param>
  161. /// <returns>A playlist.</returns>
  162. IEnumerable<string> GetPrimaryPlaylistVobFiles(string path, uint? titleNumber);
  163. }
  164. }