mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
60 lines
2.2 KiB
C#
60 lines
2.2 KiB
C#
using System;
|
|
using MediaBrowser.Controller.Configuration;
|
|
using MediaBrowser.Controller.Library;
|
|
using MediaBrowser.Controller.MediaEncoding;
|
|
using MediaBrowser.Controller.Session;
|
|
using MediaBrowser.Model.Diagnostics;
|
|
using MediaBrowser.Model.IO;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace MediaBrowser.MediaEncoding.Encoder
|
|
{
|
|
public class VideoEncoder : BaseEncoder
|
|
{
|
|
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)
|
|
{
|
|
}
|
|
|
|
protected override string GetCommandLineArguments(EncodingJob state)
|
|
{
|
|
// Get the output codec name
|
|
var encodingOptions = GetEncodingOptions();
|
|
|
|
return EncodingHelper.GetProgressiveVideoFullCommandLine(state, encodingOptions, state.OutputFilePath, "superfast");
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
protected override bool IsVideoEncoder => true;
|
|
}
|
|
}
|