ITrickplayManager.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. using MediaBrowser.Controller.Entities;
  6. using MediaBrowser.Model.Entities;
  7. namespace MediaBrowser.Controller.Trickplay;
  8. /// <summary>
  9. /// Interface ITrickplayManager.
  10. /// </summary>
  11. public interface ITrickplayManager
  12. {
  13. /// <summary>
  14. /// Generate or replace trickplay data.
  15. /// </summary>
  16. /// <param name="video">The video.</param>
  17. /// <param name="replace">Whether or not existing data should be replaced.</param>
  18. /// <param name="cancellationToken">CancellationToken to use for operation.</param>
  19. /// <returns>Task.</returns>
  20. Task RefreshTrickplayDataAsync(Video video, bool replace, CancellationToken cancellationToken);
  21. /// <summary>
  22. /// Get available trickplay resolutions and corresponding info.
  23. /// </summary>
  24. /// <param name="itemId">The item.</param>
  25. /// <returns>Map of width resolutions to trickplay tiles info.</returns>
  26. Dictionary<int, TrickplayTilesInfo> GetTilesResolutions(Guid itemId);
  27. /// <summary>
  28. /// Saves trickplay tiles info.
  29. /// </summary>
  30. /// <param name="itemId">The item.</param>
  31. /// <param name="tilesInfo">The trickplay tiles info.</param>
  32. void SaveTilesInfo(Guid itemId, TrickplayTilesInfo tilesInfo);
  33. /// <summary>
  34. /// Gets the trickplay manifest.
  35. /// </summary>
  36. /// <param name="item">The item.</param>
  37. /// <returns>A map of media source id to a map of tile width to tile info.</returns>
  38. Dictionary<Guid, Dictionary<int, TrickplayTilesInfo>> GetTrickplayManifest(BaseItem item);
  39. /// <summary>
  40. /// Gets the path to a trickplay tiles image.
  41. /// </summary>
  42. /// <param name="item">The item.</param>
  43. /// <param name="width">The width of a single tile.</param>
  44. /// <param name="index">The tile grid's index.</param>
  45. /// <returns>The absolute path.</returns>
  46. string GetTrickplayTilePath(BaseItem item, int width, int index);
  47. /// <summary>
  48. /// Gets the trickplay HLS playlist.
  49. /// </summary>
  50. /// <param name="itemId">The item.</param>
  51. /// <param name="width">The width of a single tile.</param>
  52. /// <param name="apiKey">Optional api key of the requesting user.</param>
  53. /// <returns>The text content of the .m3u8 playlist.</returns>
  54. string? GetHlsPlaylist(Guid itemId, int width, string? apiKey);
  55. }