Duncan Tourolle ed4cc0990c
All checks were successful
🏗️ Build Plugin / build (push) Successful in 2m47s
🧪 Test Plugin / test (push) Successful in 1m22s
🚀 Release Plugin / build-and-release (push) Successful in 2m39s
mixed refactor
2025-12-06 20:18:43 +01:00

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);
}