using CliWrap; using ErsatzTV.Core; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Interfaces.FFmpeg; using ErsatzTV.Core.Interfaces.Streaming; using ErsatzTV.Infrastructure.Data; using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.Streaming; public class GetErrorProcessHandler( IDbContextFactory dbContextFactory, IFFmpegProcessService ffmpegProcessService) : FFmpegProcessHandler(dbContextFactory) { protected override async Task> GetProcess( TvContext dbContext, GetErrorProcess request, Channel channel, string ffmpegPath, string ffprobePath, CancellationToken cancellationToken) { Command process = await ffmpegProcessService.ForError( ffmpegPath, channel, request.Now, request.MaybeDuration, request.ErrorMessage, request.HlsRealtime, request.PtsOffset, channel.FFmpegProfile.VaapiDisplay, channel.FFmpegProfile.VaapiDriver, channel.FFmpegProfile.VaapiDevice, Optional(channel.FFmpegProfile.QsvExtraHardwareFrames)); return new PlayoutItemProcessModel( process, Option.None, request.MaybeDuration, request.Until, true, request.Now.ToUnixTimeSeconds(), Option.None, Optional(channel.PlayoutOffset), !request.HlsRealtime); } }