using System;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Streaming;
namespace MediaBrowser.Controller.MediaEncoding;
/// 
/// A service for managing media transcoding.
/// 
public interface ITranscodeManager
{
    /// 
    /// Get transcoding job.
    /// 
    /// Playback session id.
    /// The transcoding job.
    public TranscodingJob? GetTranscodingJob(string playSessionId);
    /// 
    /// Get transcoding job.
    /// 
    /// Path to the transcoding file.
    /// The .
    /// The transcoding job.
    public TranscodingJob? GetTranscodingJob(string path, TranscodingJobType type);
    /// 
    /// Ping transcoding job.
    /// 
    /// Play session id.
    /// Is user paused.
    /// Play session id is null.
    public void PingTranscodingJob(string playSessionId, bool? isUserPaused);
    /// 
    /// Kills the single transcoding job.
    /// 
    /// The device id.
    /// The play session identifier.
    /// The delete files.
    /// Task.
    public Task KillTranscodingJobs(string deviceId, string? playSessionId, Func deleteFiles);
    /// 
    /// Report the transcoding progress to the session manager.
    /// 
    /// The  of which the progress will be reported.
    /// The  of the current transcoding job.
    /// The current transcoding position.
    /// The framerate of the transcoding job.
    /// The completion percentage of the transcode.
    /// The number of bytes transcoded.
    /// The bitrate of the transcoding job.
    public void ReportTranscodingProgress(
        TranscodingJob job,
        StreamState state,
        TimeSpan? transcodingPosition,
        float? framerate,
        double? percentComplete,
        long? bytesTranscoded,
        int? bitRate);
    /// 
    /// Starts FFMpeg.
    /// 
    /// The state.
    /// The output path.
    /// The command line arguments for FFmpeg.
    /// The user id.
    /// The .
    /// The cancellation token source.
    /// The working directory.
    /// Task.
    public Task StartFfMpeg(
        StreamState state,
        string outputPath,
        string commandLineArguments,
        Guid userId,
        TranscodingJobType transcodingJobType,
        CancellationTokenSource cancellationTokenSource,
        string? workingDirectory = null);
    /// 
    /// Called when [transcode begin request].
    /// 
    /// The path.
    /// The type.
    /// The .
    public TranscodingJob? OnTranscodeBeginRequest(string path, TranscodingJobType type);
    /// 
    /// Called when [transcode end].
    /// 
    /// The transcode job.
    public void OnTranscodeEndRequest(TranscodingJob job);
    /// 
    /// Transcoding lock.
    /// 
    /// The output path of the transcoded file.
    /// The cancellation token.
    /// An .
    ValueTask LockAsync(string outputPath, CancellationToken cancellationToken);
}