2021-05-06 22:39:20 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-07-24 17:58:50 +00:00
|
|
|
#pragma warning disable CA1002, CS1591
|
2020-08-22 19:56:24 +00:00
|
|
|
|
2019-01-13 20:01:16 +00:00
|
|
|
using System;
|
2019-01-13 19:25:32 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
2020-05-20 17:07:53 +00:00
|
|
|
using Jellyfin.Data.Entities;
|
2019-01-13 19:25:32 +00:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2018-12-27 23:27:57 +00:00
|
|
|
using MediaBrowser.Controller.Persistence;
|
|
|
|
using MediaBrowser.Model.Dto;
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
using MediaBrowser.Model.MediaInfo;
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Library
|
|
|
|
{
|
|
|
|
public interface IMediaSourceManager
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Adds the parts.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="providers">The providers.</param>
|
|
|
|
void AddParts(IEnumerable<IMediaSourceProvider> providers);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the media streams.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="itemId">The item identifier.</param>
|
|
|
|
/// <returns>IEnumerable<MediaStream>.</returns>
|
|
|
|
List<MediaStream> GetMediaStreams(Guid itemId);
|
2020-09-28 20:04:31 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the media streams.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="mediaSourceId">The media source identifier.</param>
|
|
|
|
/// <returns>IEnumerable<MediaStream>.</returns>
|
|
|
|
List<MediaStream> GetMediaStreams(string mediaSourceId);
|
2020-09-28 20:04:31 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the media streams.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="query">The query.</param>
|
|
|
|
/// <returns>IEnumerable<MediaStream>.</returns>
|
|
|
|
List<MediaStream> GetMediaStreams(MediaStreamQuery query);
|
|
|
|
|
|
|
|
/// <summary>
|
2019-10-07 11:53:28 +00:00
|
|
|
/// Gets the media attachments.
|
|
|
|
/// </summary>
|
2019-12-26 22:09:00 +00:00
|
|
|
/// <param name="itemId">The item identifier.</param>
|
2019-10-07 11:53:28 +00:00
|
|
|
/// <returns>IEnumerable<MediaAttachment>.</returns>
|
|
|
|
List<MediaAttachment> GetMediaAttachments(Guid itemId);
|
2019-11-07 16:28:11 +00:00
|
|
|
|
2019-10-07 11:53:28 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the media attachments.
|
|
|
|
/// </summary>
|
2019-12-26 22:09:00 +00:00
|
|
|
/// <param name="query">The query.</param>
|
2019-10-07 11:53:28 +00:00
|
|
|
/// <returns>IEnumerable<MediaAttachment>.</returns>
|
|
|
|
List<MediaAttachment> GetMediaAttachments(MediaAttachmentQuery query);
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the playack media sources.
|
|
|
|
/// </summary>
|
2021-07-24 17:58:50 +00:00
|
|
|
/// <param name="item">Item to use.</param>
|
|
|
|
/// <param name="user">User to use for operation.</param>
|
|
|
|
/// <param name="allowMediaProbe">Option to allow media probe.</param>
|
|
|
|
/// <param name="enablePathSubstitution">Option to enable path substitution.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for operation.</param>
|
|
|
|
/// <returns>List of media sources wrapped in an awaitable task.</returns>
|
2020-05-20 17:07:53 +00:00
|
|
|
Task<List<MediaSourceInfo>> GetPlaybackMediaSources(BaseItem item, User user, bool allowMediaProbe, bool enablePathSubstitution, CancellationToken cancellationToken);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the static media sources.
|
|
|
|
/// </summary>
|
2021-07-24 17:58:50 +00:00
|
|
|
/// <param name="item">Item to use.</param>
|
|
|
|
/// <param name="enablePathSubstitution">Option to enable path substitution.</param>
|
|
|
|
/// <param name="user">User to use for operation.</param>
|
|
|
|
/// <returns>List of media sources.</returns>
|
2020-05-20 17:07:53 +00:00
|
|
|
List<MediaSourceInfo> GetStaticMediaSources(BaseItem item, bool enablePathSubstitution, User user = null);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the static media source.
|
|
|
|
/// </summary>
|
2021-07-24 17:58:50 +00:00
|
|
|
/// <param name="item">Item to use.</param>
|
|
|
|
/// <param name="mediaSourceId">Media source to get.</param>
|
|
|
|
/// <param name="liveStreamId">Live stream to use.</param>
|
|
|
|
/// <param name="enablePathSubstitution">Option to enable path substitution.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for operation.</param>
|
|
|
|
/// <returns>The static media source wrapped in an awaitable task.</returns>
|
2018-12-27 23:27:57 +00:00
|
|
|
Task<MediaSourceInfo> GetMediaSource(BaseItem item, string mediaSourceId, string liveStreamId, bool enablePathSubstitution, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Opens the media source.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
/// <returns>Task<MediaSourceInfo>.</returns>
|
|
|
|
Task<LiveStreamResponse> OpenLiveStream(LiveStreamRequest request, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
Task<Tuple<LiveStreamResponse, IDirectStreamProvider>> OpenLiveStreamInternal(LiveStreamRequest request, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the live stream.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">The identifier.</param>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
/// <returns>Task<MediaSourceInfo>.</returns>
|
|
|
|
Task<MediaSourceInfo> GetLiveStream(string id, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetLiveStreamWithDirectStreamProvider(string id, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Closes the media source.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">The live stream identifier.</param>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
Task CloseLiveStream(string id);
|
|
|
|
|
|
|
|
Task<MediaSourceInfo> GetLiveStreamMediaInfo(string id, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
bool SupportsDirectStream(string path, MediaProtocol protocol);
|
|
|
|
|
|
|
|
MediaProtocol GetPathProtocol(string path);
|
|
|
|
|
2020-05-20 17:07:53 +00:00
|
|
|
void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, string cacheKey, bool addProbeDelay, bool isLiveStream, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
Task<IDirectStreamProvider> GetDirectStreamProviderByUniqueId(string uniqueId, CancellationToken cancellationToken);
|
|
|
|
}
|
|
|
|
|
|
|
|
public interface IDirectStreamProvider
|
|
|
|
{
|
|
|
|
Task CopyToAsync(Stream stream, CancellationToken cancellationToken);
|
2020-11-03 23:38:47 +00:00
|
|
|
|
|
|
|
string GetFilePath();
|
2018-12-27 23:27:57 +00:00
|
|
|
}
|
|
|
|
}
|