52 lines
2.0 KiB
C#
52 lines
2.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Plugin.SRFPlay.Api.Models;
|
|
using Jellyfin.Plugin.SRFPlay.Configuration;
|
|
using MediaBrowser.Model.Dto;
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
namespace Jellyfin.Plugin.SRFPlay.Services.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Factory for creating MediaSourceInfo objects with consistent configuration.
|
|
/// </summary>
|
|
public interface IMediaSourceFactory
|
|
{
|
|
/// <summary>
|
|
/// Creates a MediaSourceInfo for a chapter with proper stream authentication and proxy registration.
|
|
/// </summary>
|
|
/// <param name="chapter">The chapter containing stream resources.</param>
|
|
/// <param name="itemId">The unique item ID for proxy registration.</param>
|
|
/// <param name="urn">The URN of the content.</param>
|
|
/// <param name="qualityPreference">The preferred quality.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>A configured MediaSourceInfo, or null if stream URL cannot be resolved.</returns>
|
|
Task<MediaSourceInfo?> CreateMediaSourceAsync(
|
|
Chapter chapter,
|
|
string itemId,
|
|
string urn,
|
|
QualityPreference qualityPreference,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Builds a proxy URL for an item.
|
|
/// </summary>
|
|
/// <param name="itemId">The item ID.</param>
|
|
/// <returns>The full proxy URL including server address.</returns>
|
|
string BuildProxyUrl(string itemId);
|
|
|
|
/// <summary>
|
|
/// Gets the server base URL (configured public URL or smart URL).
|
|
/// </summary>
|
|
/// <returns>The server base URL without trailing slash.</returns>
|
|
string GetServerBaseUrl();
|
|
|
|
/// <summary>
|
|
/// Creates MediaStream metadata based on quality preference.
|
|
/// </summary>
|
|
/// <param name="quality">The quality preference.</param>
|
|
/// <returns>List of MediaStream objects for video and audio.</returns>
|
|
IReadOnlyList<MediaStream> CreateMediaStreams(QualityPreference quality);
|
|
}
|