mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.1 KiB
31 lines
1.1 KiB
using System; |
|
using System.Threading.Tasks; |
|
using ErsatzTV.Core.Domain; |
|
using ErsatzTV.Core.Interfaces.FFmpeg; |
|
using ErsatzTV.Core.Interfaces.Repositories; |
|
using LanguageExt; |
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
namespace ErsatzTV.Core.FFmpeg; |
|
|
|
public class FFmpegProcessServiceFactory : IFFmpegProcessServiceFactory |
|
{ |
|
private readonly IConfigElementRepository _configElementRepository; |
|
private readonly IServiceProvider _serviceProvider; |
|
|
|
public FFmpegProcessServiceFactory(IConfigElementRepository configElementRepository, IServiceProvider serviceProvider) |
|
{ |
|
_configElementRepository = configElementRepository; |
|
_serviceProvider = serviceProvider; |
|
} |
|
|
|
public async Task<IFFmpegProcessService> GetService() |
|
{ |
|
Option<bool> useExperimentalTranscoder = |
|
await _configElementRepository.GetValue<bool>(ConfigElementKey.FFmpegUseExperimentalTranscoder); |
|
|
|
return await useExperimentalTranscoder.IfNoneAsync(false) |
|
? _serviceProvider.GetRequiredService<FFmpegLibraryProcessService>() |
|
: _serviceProvider.GetRequiredService<FFmpegProcessService>(); |
|
} |
|
}
|
|
|