increase unification of param building

This commit is contained in:
Luke Pulverenti
2017-03-19 02:10:11 -04:00
parent 41060c9a38
commit 59ac045c6b
12 changed files with 98 additions and 130 deletions

View File

@@ -47,7 +47,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
EncodingHelper.GetMapArgs(state),
videoArguments,
threads,
GetAudioArguments(state),
EncodingHelper.GetProgressiveVideoAudioArguments(state, encodingOptions),
format,
state.OutputFilePath
).Trim();
@@ -114,49 +114,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
return args;
}
/// <summary>
/// Gets audio arguments to pass to ffmpeg
/// </summary>
/// <param name="state">The state.</param>
/// <returns>System.String.</returns>
private string GetAudioArguments(EncodingJob state)
{
// If the video doesn't have an audio stream, return a default.
if (state.AudioStream == null && state.VideoStream != null)
{
return string.Empty;
}
// Get the output codec name
var codec = EncodingHelper.GetAudioEncoder(state);
var args = "-codec:a:0 " + codec;
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
{
return args;
}
// Add the number of audio channels
var channels = state.OutputAudioChannels;
if (channels.HasValue)
{
args += " -ac " + channels.Value;
}
var bitrate = state.OutputAudioBitrate;
if (bitrate.HasValue)
{
args += " -ab " + bitrate.Value.ToString(UsCulture);
}
args += " " + EncodingHelper.GetAudioFilterParam(state, GetEncodingOptions(), false);
return args;
}
protected override string GetOutputFileExtension(EncodingJob state)
{
var ext = base.GetOutputFileExtension(state);