using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Controller.Trickplay;
///
/// Interface ITrickplayManager.
///
public interface ITrickplayManager
{
///
/// Generates new trickplay images and metadata.
///
/// The video.
/// Whether or not existing data should be replaced.
/// The library options.
/// CancellationToken to use for operation.
/// Task.
Task RefreshTrickplayDataAsync(Video video, bool replace, LibraryOptions? libraryOptions, CancellationToken cancellationToken);
///
/// Creates trickplay tiles out of individual thumbnails.
///
/// Ordered file paths of the thumbnails to be used.
/// The width of a single thumbnail.
/// The trickplay options.
/// The output directory.
/// The associated trickplay information.
///
/// The output directory will be DELETED and replaced if it already exists.
///
TrickplayInfo CreateTiles(IReadOnlyList images, int width, TrickplayOptions options, string outputDir);
///
/// Get available trickplay resolutions and corresponding info.
///
/// The item.
/// Map of width resolutions to trickplay tiles info.
Task> GetTrickplayResolutions(Guid itemId);
///
/// Gets the item ids of all items with trickplay info.
///
/// The limit of items to return.
/// The offset to start the query at.
/// The list of item ids that have trickplay info.
Task> GetTrickplayItemsAsync(int limit, int offset);
///
/// Saves trickplay info.
///
/// The trickplay info.
/// Task.
Task SaveTrickplayInfo(TrickplayInfo info);
///
/// Gets all trickplay infos for all media streams of an item.
///
/// The item.
/// A map of media source id to a map of tile width to trickplay info.
Task>> GetTrickplayManifest(BaseItem item);
///
/// Gets the path to a trickplay tile image.
///
/// The item.
/// The width of a single thumbnail.
/// The tile's index.
/// Whether or not the tile should be saved next to the media file.
/// The absolute path.
Task GetTrickplayTilePathAsync(BaseItem item, int width, int index, bool saveWithMedia);
///
/// Gets the path to a trickplay tile image.
///
/// The item.
/// The amount of images for the tile width.
/// The amount of images for the tile height.
/// The width of a single thumbnail.
/// Whether or not the tile should be saved next to the media file.
/// The absolute path.
string GetTrickplayDirectory(BaseItem item, int tileWidth, int tileHeight, int width, bool saveWithMedia = false);
///
/// Migrates trickplay images between local and media directories.
///
/// The video.
/// The library options.
/// CancellationToken to use for operation.
/// Task.
Task MoveGeneratedTrickplayDataAsync(Video video, LibraryOptions? libraryOptions, CancellationToken cancellationToken);
///
/// Gets the trickplay HLS playlist.
///
/// The item.
/// The width of a single thumbnail.
/// Optional api key of the requesting user.
/// The text content of the .m3u8 playlist.
Task GetHlsPlaylist(Guid itemId, int width, string? apiKey);
}