2016-03-27 14:11:27 -07:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
2015-01-01 23:12:58 -07:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using MediaBrowser.Controller.MediaEncoding;
|
|
|
|
|
using MediaBrowser.Controller.Session;
|
2015-03-22 21:08:06 -07:00
|
|
|
|
using MediaBrowser.Model.Dlna;
|
2015-01-01 23:12:58 -07:00
|
|
|
|
using MediaBrowser.Model.IO;
|
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2016-06-18 23:18:29 -07:00
|
|
|
|
using System.Threading.Tasks;
|
2016-10-31 21:07:12 -07:00
|
|
|
|
using MediaBrowser.Model.Diagnostics;
|
2015-01-01 23:12:58 -07:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
|
{
|
|
|
|
|
public class VideoEncoder : BaseEncoder
|
|
|
|
|
{
|
2016-10-31 21:07:12 -07:00
|
|
|
|
public VideoEncoder(MediaEncoder mediaEncoder, ILogger logger, IServerConfigurationManager configurationManager, IFileSystem fileSystem, IIsoManager isoManager, ILibraryManager libraryManager, ISessionManager sessionManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IProcessFactory processFactory) : base(mediaEncoder, logger, configurationManager, fileSystem, isoManager, libraryManager, sessionManager, subtitleEncoder, mediaSourceManager, processFactory)
|
2015-01-01 23:12:58 -07:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-19 11:59:05 -07:00
|
|
|
|
protected override string GetCommandLineArguments(EncodingJob state)
|
2015-01-01 23:12:58 -07:00
|
|
|
|
{
|
|
|
|
|
// Get the output codec name
|
2017-02-02 09:02:01 -07:00
|
|
|
|
var encodingOptions = GetEncodingOptions();
|
2015-01-01 23:12:58 -07:00
|
|
|
|
|
2017-03-19 11:59:05 -07:00
|
|
|
|
return EncodingHelper.GetProgressiveVideoFullCommandLine(state, encodingOptions, state.OutputFilePath, "superfast");
|
2015-01-01 23:12:58 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string GetOutputFileExtension(EncodingJob state)
|
|
|
|
|
{
|
|
|
|
|
var ext = base.GetOutputFileExtension(state);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ext))
|
|
|
|
|
{
|
|
|
|
|
return ext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var videoCodec = state.Options.VideoCodec;
|
|
|
|
|
|
|
|
|
|
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ".ts";
|
|
|
|
|
}
|
|
|
|
|
if (string.Equals(videoCodec, "theora", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ".ogv";
|
|
|
|
|
}
|
|
|
|
|
if (string.Equals(videoCodec, "vpx", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ".webm";
|
|
|
|
|
}
|
|
|
|
|
if (string.Equals(videoCodec, "wmv", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return ".asf";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2015-01-04 23:00:13 -07:00
|
|
|
|
|
|
|
|
|
protected override bool IsVideoEncoder
|
|
|
|
|
{
|
|
|
|
|
get { return true; }
|
|
|
|
|
}
|
2016-10-31 21:07:12 -07:00
|
|
|
|
|
2015-01-01 23:12:58 -07:00
|
|
|
|
}
|
2016-08-07 13:13:30 -07:00
|
|
|
|
}
|