mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-02-02 16:38:34 +00:00
increase unification of param building
This commit is contained in:
@@ -1736,5 +1736,79 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
return threads;
|
||||
}
|
||||
|
||||
public string GetSubtitleEmbedArguments(EncodingJobInfo state)
|
||||
{
|
||||
if (state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Embed)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var format = state.SupportedSubtitleCodecs.FirstOrDefault();
|
||||
string codec;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(format) || string.Equals(format, state.SubtitleStream.Codec, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
codec = "copy";
|
||||
}
|
||||
else
|
||||
{
|
||||
codec = format;
|
||||
}
|
||||
|
||||
// Muxing in dvbsub via either copy or -codec dvbsub does not seem to work
|
||||
// It doesn't throw any errors but vlc on android will not render them
|
||||
// They will need to be converted to an alternative format
|
||||
// TODO: This is incorrectly assuming that dvdsub will be supported by the player
|
||||
// The api will need to be expanded to accomodate this.
|
||||
if (string.Equals(state.SubtitleStream.Codec, "DVBSUB", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
codec = "dvdsub";
|
||||
}
|
||||
|
||||
var args = " -codec:s:0 " + codec;
|
||||
|
||||
args += " -disposition:s:0 default";
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public string GetProgressiveVideoAudioArguments(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
{
|
||||
// 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 = 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 += " " + GetAudioFilterParam(state, encodingOptions, false);
|
||||
|
||||
return args;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
public int? OutputVideoBitrate { get; set; }
|
||||
public MediaStream SubtitleStream { get; set; }
|
||||
public SubtitleDeliveryMethod SubtitleDeliveryMethod { get; set; }
|
||||
public List<string> SupportedSubtitleCodecs { get; set; }
|
||||
|
||||
public int InternalSubtitleStreamOffset { get; set; }
|
||||
public MediaSourceInfo MediaSource { get; set; }
|
||||
@@ -64,6 +65,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
get { return BaseRequest.CopyTimestamps; }
|
||||
}
|
||||
|
||||
public int? OutputAudioBitrate;
|
||||
public int? OutputAudioChannels;
|
||||
public int? OutputAudioSampleRate;
|
||||
public bool DeInterlace { get; set; }
|
||||
@@ -74,8 +76,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
_logger = logger;
|
||||
RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
PlayableStreamFileNames = new List<string>();
|
||||
SupportedAudioCodecs = new List<string>();
|
||||
SupportedVideoCodecs = new List<string>();
|
||||
SupportedVideoCodecs = new List<string>();
|
||||
SupportedSubtitleCodecs = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -198,6 +198,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
[ApiMember(Name = "VideoCodec", Description = "Optional. Specify a video codec to encode to, e.g. h264. If omitted the server will auto-select using the url's extension. Options: h264, mpeg4, theora, vpx, wmv.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||
public string VideoCodec { get; set; }
|
||||
|
||||
public string SubtitleCodec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the audio stream.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user