ITrickplayManager.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. using Jellyfin.Data.Entities;
  6. using MediaBrowser.Controller.Entities;
  7. using MediaBrowser.Model.Configuration;
  8. namespace MediaBrowser.Controller.Trickplay;
  9. /// <summary>
  10. /// Interface ITrickplayManager.
  11. /// </summary>
  12. public interface ITrickplayManager
  13. {
  14. /// <summary>
  15. /// Generates new trickplay images and metadata.
  16. /// </summary>
  17. /// <param name="video">The video.</param>
  18. /// <param name="replace">Whether or not existing data should be replaced.</param>
  19. /// <param name="cancellationToken">CancellationToken to use for operation.</param>
  20. /// <returns>Task.</returns>
  21. Task RefreshTrickplayDataAsync(Video video, bool replace, CancellationToken cancellationToken);
  22. /// <summary>
  23. /// Creates trickplay tiles out of individual thumbnails.
  24. /// </summary>
  25. /// <param name="images">Ordered file paths of the thumbnails to be used.</param>
  26. /// <param name="width">The width of a single thumbnail.</param>
  27. /// <param name="options">The trickplay options.</param>
  28. /// <param name="outputDir">The output directory.</param>
  29. /// <returns>The associated trickplay information.</returns>
  30. /// <remarks>
  31. /// The output directory will be DELETED and replaced if it already exists.
  32. /// </remarks>
  33. TrickplayInfo CreateTiles(List<string> images, int width, TrickplayOptions options, string outputDir);
  34. /// <summary>
  35. /// Get available trickplay resolutions and corresponding info.
  36. /// </summary>
  37. /// <param name="itemId">The item.</param>
  38. /// <returns>Map of width resolutions to trickplay tiles info.</returns>
  39. Task<Dictionary<int, TrickplayInfo>> GetTrickplayResolutions(Guid itemId);
  40. /// <summary>
  41. /// Saves trickplay info.
  42. /// </summary>
  43. /// <param name="info">The trickplay info.</param>
  44. /// <returns>Task.</returns>
  45. Task SaveTrickplayInfo(TrickplayInfo info);
  46. /// <summary>
  47. /// Gets all trickplay infos for all media streams of an item.
  48. /// </summary>
  49. /// <param name="item">The item.</param>
  50. /// <returns>A map of media source id to a map of tile width to trickplay info.</returns>
  51. Task<Dictionary<string, Dictionary<int, TrickplayInfo>>> GetTrickplayManifest(BaseItem item);
  52. /// <summary>
  53. /// Gets the path to a trickplay tile image.
  54. /// </summary>
  55. /// <param name="item">The item.</param>
  56. /// <param name="width">The width of a single thumbnail.</param>
  57. /// <param name="index">The tile's index.</param>
  58. /// <returns>The absolute path.</returns>
  59. string GetTrickplayTilePath(BaseItem item, int width, int index);
  60. /// <summary>
  61. /// Gets the trickplay HLS playlist.
  62. /// </summary>
  63. /// <param name="itemId">The item.</param>
  64. /// <param name="width">The width of a single thumbnail.</param>
  65. /// <param name="apiKey">Optional api key of the requesting user.</param>
  66. /// <returns>The text content of the .m3u8 playlist.</returns>
  67. Task<string?> GetHlsPlaylist(Guid itemId, int width, string? apiKey);
  68. }