|
|
@ -30,7 +30,7 @@ namespace Jellyfin.Api.Helpers
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Transcoding job helpers.
|
|
|
|
/// Transcoding job helpers.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class TranscodingJobHelper
|
|
|
|
public class TranscodingJobHelper : IDisposable
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// The active transcoding jobs.
|
|
|
|
/// The active transcoding jobs.
|
|
|
@ -46,7 +46,6 @@ namespace Jellyfin.Api.Helpers
|
|
|
|
private readonly EncodingHelper _encodingHelper;
|
|
|
|
private readonly EncodingHelper _encodingHelper;
|
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
private readonly IIsoManager _isoManager;
|
|
|
|
private readonly IIsoManager _isoManager;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<TranscodingJobHelper> _logger;
|
|
|
|
private readonly ILogger<TranscodingJobHelper> _logger;
|
|
|
|
private readonly IMediaEncoder _mediaEncoder;
|
|
|
|
private readonly IMediaEncoder _mediaEncoder;
|
|
|
|
private readonly IMediaSourceManager _mediaSourceManager;
|
|
|
|
private readonly IMediaSourceManager _mediaSourceManager;
|
|
|
@ -90,10 +89,12 @@ namespace Jellyfin.Api.Helpers
|
|
|
|
_authorizationContext = authorizationContext;
|
|
|
|
_authorizationContext = authorizationContext;
|
|
|
|
_isoManager = isoManager;
|
|
|
|
_isoManager = isoManager;
|
|
|
|
_loggerFactory = loggerFactory;
|
|
|
|
_loggerFactory = loggerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
_encodingHelper = new EncodingHelper(mediaEncoder, fileSystem, subtitleEncoder, configuration);
|
|
|
|
_encodingHelper = new EncodingHelper(mediaEncoder, fileSystem, subtitleEncoder, configuration);
|
|
|
|
|
|
|
|
|
|
|
|
DeleteEncodedMediaCache();
|
|
|
|
DeleteEncodedMediaCache();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sessionManager!.PlaybackProgress += OnPlaybackProgress;
|
|
|
|
|
|
|
|
sessionManager!.PlaybackStart += OnPlaybackProgress;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -834,6 +835,14 @@ namespace Jellyfin.Api.Helpers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnPlaybackProgress(object sender, PlaybackProgressEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(e.PlaySessionId))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PingTranscodingJob(e.PlaySessionId, e.IsPaused);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Deletes the encoded media cache.
|
|
|
|
/// Deletes the encoded media cache.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -850,5 +859,28 @@ namespace Jellyfin.Api.Helpers
|
|
|
|
_fileSystem.DeleteFile(file);
|
|
|
|
_fileSystem.DeleteFile(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Dispose transcoding job helper.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Dispose(true);
|
|
|
|
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Dispose throttler.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="disposing">Disposing.</param>
|
|
|
|
|
|
|
|
protected virtual void Dispose(bool disposing)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (disposing)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_loggerFactory.Dispose();
|
|
|
|
|
|
|
|
_sessionManager!.PlaybackProgress -= OnPlaybackProgress;
|
|
|
|
|
|
|
|
_sessionManager!.PlaybackStart -= OnPlaybackProgress;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|