support audio sync transcoding

This commit is contained in:
Luke Pulverenti
2015-01-02 00:36:27 -05:00
parent 24e1f9834a
commit c93740461e
22 changed files with 157 additions and 47 deletions

View File

@@ -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;
}
}
}