jellyfin-server/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs

66 lines
2.3 KiB
C#
Raw Normal View History

2016-03-27 21:11:27 +00:00
using MediaBrowser.Controller.Configuration;
2015-01-02 06:12:58 +00:00
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Session;
2015-03-23 04:08:06 +00:00
using MediaBrowser.Model.Dlna;
2015-01-02 06:12:58 +00:00
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using System;
using System.IO;
2016-06-19 06:18:29 +00:00
using System.Threading.Tasks;
2016-11-01 04:07:12 +00:00
using MediaBrowser.Model.Diagnostics;
2015-01-02 06:12:58 +00:00
namespace MediaBrowser.MediaEncoding.Encoder
{
public class VideoEncoder : BaseEncoder
{
2016-11-01 04:07:12 +00: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-02 06:12:58 +00:00
{
}
2017-03-19 18:59:05 +00:00
protected override string GetCommandLineArguments(EncodingJob state)
2015-01-02 06:12:58 +00:00
{
// Get the output codec name
var encodingOptions = GetEncodingOptions();
2015-01-02 06:12:58 +00:00
2017-03-19 18:59:05 +00:00
return EncodingHelper.GetProgressiveVideoFullCommandLine(state, encodingOptions, state.OutputFilePath, "superfast");
2015-01-02 06:12:58 +00: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-05 06:00:13 +00:00
protected override bool IsVideoEncoder
{
get { return true; }
}
2016-11-01 04:07:12 +00:00
2015-01-02 06:12:58 +00:00
}
2016-08-07 20:13:30 +00:00
}