diff options
Diffstat (limited to 'MediaBrowser.MediaEncoding')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 45 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj | 5 |
2 files changed, 48 insertions, 2 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 7fb27e25f..a7d8b6f1d 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -1,10 +1,16 @@ +using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Channels; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; +using MediaBrowser.Controller.Session; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Serialization; using System; -using System.Collections.Concurrent; using System.Diagnostics; using System.Globalization; using System.IO; @@ -51,11 +57,26 @@ namespace MediaBrowser.MediaEncoding.Encoder public string Version { get; private set; } - public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, string version) + protected readonly IServerConfigurationManager ConfigurationManager; + protected readonly IFileSystem FileSystem; + protected readonly ILiveTvManager LiveTvManager; + protected readonly IIsoManager IsoManager; + protected readonly ILibraryManager LibraryManager; + protected readonly IChannelManager ChannelManager; + protected readonly ISessionManager SessionManager; + + public MediaEncoder(ILogger logger, IJsonSerializer jsonSerializer, string ffMpegPath, string ffProbePath, string version, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILiveTvManager liveTvManager, IIsoManager isoManager, ILibraryManager libraryManager, IChannelManager channelManager, ISessionManager sessionManager) { _logger = logger; _jsonSerializer = jsonSerializer; Version = version; + ConfigurationManager = configurationManager; + FileSystem = fileSystem; + LiveTvManager = liveTvManager; + IsoManager = isoManager; + LibraryManager = libraryManager; + ChannelManager = channelManager; + SessionManager = sessionManager; FFProbePath = ffProbePath; FFMpegPath = ffMpegPath; } @@ -511,5 +532,25 @@ namespace MediaBrowser.MediaEncoding.Encoder throw new ApplicationException(msg); } } + + public async Task<string> EncodeAudio(EncodingJobOptions options, + IProgress<double> progress, + CancellationToken cancellationToken) + { + var job = await new AudioEncoder(this, + _logger, + ConfigurationManager, + FileSystem, + LiveTvManager, + IsoManager, + LibraryManager, + ChannelManager, + SessionManager) + .Start(options, progress, cancellationToken).ConfigureAwait(false); + + await job.TaskCompletionSource.Task.ConfigureAwait(false); + + return job.OutputFilePath; + } } } diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj index 5c472ebc8..9daa3319f 100644 --- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj +++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj @@ -57,7 +57,12 @@ </Compile> <Compile Include="BdInfo\BdInfoExaminer.cs" /> <Compile Include="Configuration\EncodingConfigurationFactory.cs" /> + <Compile Include="Encoder\AudioEncoder.cs" /> + <Compile Include="Encoder\BaseEncoder.cs" /> + <Compile Include="Encoder\EncodingJob.cs" /> + <Compile Include="Encoder\EncodingJobFactory.cs" /> <Compile Include="Encoder\EncodingUtils.cs" /> + <Compile Include="Encoder\JobLogger.cs" /> <Compile Include="Encoder\MediaEncoder.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Subtitles\ISubtitleParser.cs" /> |
