2019-01-13 13:02:23 -07:00
|
|
|
using System;
|
2019-01-13 12:26:04 -07:00
|
|
|
using MediaBrowser.Controller.Configuration;
|
2018-12-14 02:40:55 -07:00
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
using MediaBrowser.Controller.MediaEncoding;
|
|
|
|
using MediaBrowser.Controller.Session;
|
2019-01-13 12:26:04 -07:00
|
|
|
using MediaBrowser.Model.Diagnostics;
|
2018-12-14 02:40:55 -07:00
|
|
|
using MediaBrowser.Model.IO;
|
2018-12-14 16:48:06 -07:00
|
|
|
using Microsoft.Extensions.Logging;
|
2018-12-14 02:40:55 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
{
|
|
|
|
public class AudioEncoder : BaseEncoder
|
|
|
|
{
|
|
|
|
public AudioEncoder(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)
|
|
|
|
{
|
|
|
|
var encodingOptions = GetEncodingOptions();
|
|
|
|
|
|
|
|
return EncodingHelper.GetProgressiveAudioFullCommandLine(state, encodingOptions, state.OutputFilePath);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override string GetOutputFileExtension(EncodingJob state)
|
|
|
|
{
|
|
|
|
var ext = base.GetOutputFileExtension(state);
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ext))
|
|
|
|
{
|
|
|
|
return ext;
|
|
|
|
}
|
|
|
|
|
|
|
|
var audioCodec = state.Options.AudioCodec;
|
|
|
|
|
|
|
|
if (string.Equals("aac", audioCodec, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".aac";
|
|
|
|
}
|
|
|
|
if (string.Equals("mp3", audioCodec, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".mp3";
|
|
|
|
}
|
|
|
|
if (string.Equals("vorbis", audioCodec, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".ogg";
|
|
|
|
}
|
|
|
|
if (string.Equals("wma", audioCodec, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return ".wma";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-01-13 13:31:14 -07:00
|
|
|
protected override bool IsVideoEncoder => false;
|
2018-12-14 02:40:55 -07:00
|
|
|
}
|
|
|
|
}
|