mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-23 15:30:56 -04:00
Apply suggestions from code review
Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
This commit is contained in:
parent
51dab0958d
commit
5ff08338d5
@ -578,7 +578,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
args += _encodingHelper.GetOutputSizeParam(state, _encodingOptions, codec);
|
args += _encodingHelper.GetOutputSizeParam(state, _encodingOptions, codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(state.SubtitleStream != null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream))
|
if (state.SubtitleStream == null || !state.SubtitleStream.IsExternal || state.SubtitleStream.IsTextSubtitleStream)
|
||||||
{
|
{
|
||||||
args += " -start_at_zero";
|
args += " -start_at_zero";
|
||||||
}
|
}
|
||||||
|
@ -1194,7 +1194,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (string.Equals(videoEncoder, "h264_amf", StringComparison.OrdinalIgnoreCase)
|
else if (string.Equals(videoEncoder, "h264_amf", StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(videoEncoder, "hevc_amf", StringComparison.OrdinalIgnoreCase))
|
|| string.Equals(videoEncoder, "hevc_amf", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
param += " -level " + level;
|
param += " -level " + level;
|
||||||
}
|
}
|
||||||
@ -1205,7 +1205,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
// NVENC cannot adjust the given level, just throw an error.
|
// NVENC cannot adjust the given level, just throw an error.
|
||||||
}
|
}
|
||||||
else if (!string.Equals(videoEncoder, "h264_omx", StringComparison.OrdinalIgnoreCase)
|
else if (!string.Equals(videoEncoder, "h264_omx", StringComparison.OrdinalIgnoreCase)
|
||||||
|| !string.Equals(videoEncoder, "libx265", StringComparison.OrdinalIgnoreCase))
|
|| !string.Equals(videoEncoder, "libx265", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
param += " -level " + level;
|
param += " -level " + level;
|
||||||
}
|
}
|
||||||
@ -1931,7 +1931,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}]{3}[base];[base][sub]overlay\"";
|
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}]{3}[base];[base][sub]overlay\"";
|
||||||
}
|
}
|
||||||
else if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
|
else if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(outputVideoCodec, "hevc_qsv", StringComparison.OrdinalIgnoreCase))
|
|| string.Equals(outputVideoCodec, "hevc_qsv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
QSV in FFMpeg can now setup hardware overlay for transcodes.
|
QSV in FFMpeg can now setup hardware overlay for transcodes.
|
||||||
|
@ -1025,12 +1025,10 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
if (streamInfo != null && streamInfo.Tags != null)
|
if (streamInfo != null && streamInfo.Tags != null)
|
||||||
{
|
{
|
||||||
var bps = GetDictionaryValue(streamInfo.Tags, "BPS-eng") ?? GetDictionaryValue(streamInfo.Tags, "BPS");
|
var bps = GetDictionaryValue(streamInfo.Tags, "BPS-eng") ?? GetDictionaryValue(streamInfo.Tags, "BPS");
|
||||||
if (!string.IsNullOrEmpty(bps))
|
if (!string.IsNullOrEmpty(bps)
|
||||||
|
&& int.TryParse(bps, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsedBps))
|
||||||
{
|
{
|
||||||
if (int.TryParse(bps, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsedBps))
|
return parsedBps;
|
||||||
{
|
|
||||||
return parsedBps;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1042,12 +1040,9 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
if (streamInfo != null && streamInfo.Tags != null)
|
if (streamInfo != null && streamInfo.Tags != null)
|
||||||
{
|
{
|
||||||
var duration = GetDictionaryValue(streamInfo.Tags, "DURATION-eng") ?? GetDictionaryValue(streamInfo.Tags, "DURATION");
|
var duration = GetDictionaryValue(streamInfo.Tags, "DURATION-eng") ?? GetDictionaryValue(streamInfo.Tags, "DURATION");
|
||||||
if (!string.IsNullOrEmpty(duration))
|
if (!string.IsNullOrEmpty(duration) && TimeSpan.TryParse(duration, out var parsedDuration))
|
||||||
{
|
{
|
||||||
if (TimeSpan.TryParse(duration, out var parsedDuration))
|
return parsedDuration.TotalSeconds;
|
||||||
{
|
|
||||||
return parsedDuration.TotalSeconds;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1059,12 +1054,10 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||||||
if (streamInfo != null && streamInfo.Tags != null)
|
if (streamInfo != null && streamInfo.Tags != null)
|
||||||
{
|
{
|
||||||
var numberOfBytes = GetDictionaryValue(streamInfo.Tags, "NUMBER_OF_BYTES-eng") ?? GetDictionaryValue(streamInfo.Tags, "NUMBER_OF_BYTES");
|
var numberOfBytes = GetDictionaryValue(streamInfo.Tags, "NUMBER_OF_BYTES-eng") ?? GetDictionaryValue(streamInfo.Tags, "NUMBER_OF_BYTES");
|
||||||
if (!string.IsNullOrEmpty(numberOfBytes))
|
if (!string.IsNullOrEmpty(numberOfBytes)
|
||||||
|
&& long.TryParse(numberOfBytes, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsedBytes))
|
||||||
{
|
{
|
||||||
if (long.TryParse(numberOfBytes, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsedBytes))
|
return parsedBytes;
|
||||||
{
|
|
||||||
return parsedBytes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,12 +928,12 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
defaultBitrate = GetDefaultAudioBitrate(targetAudioCodec, targetAudioChannels);
|
defaultBitrate = GetDefaultAudioBitrate(targetAudioCodec, targetAudioChannels);
|
||||||
}
|
}
|
||||||
else if (targetAudioChannels.HasValue
|
else if (targetAudioChannels.HasValue
|
||||||
&& audioStream.Channels.HasValue
|
&& audioStream.Channels.HasValue
|
||||||
&& audioStream.Channels.Value <= targetAudioChannels.Value
|
&& audioStream.Channels.Value <= targetAudioChannels.Value
|
||||||
&& !string.IsNullOrEmpty(audioStream.Codec)
|
&& !string.IsNullOrEmpty(audioStream.Codec)
|
||||||
&& targetAudioCodecs != null
|
&& targetAudioCodecs != null
|
||||||
&& targetAudioCodecs.Length > 0
|
&& targetAudioCodecs.Length > 0
|
||||||
&& !Array.Exists(targetAudioCodecs, elem => string.Equals(audioStream.Codec, elem, StringComparison.OrdinalIgnoreCase)))
|
&& !Array.Exists(targetAudioCodecs, elem => string.Equals(audioStream.Codec, elem, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
// Shift the bitrate if we're transcoding to a different audio codec.
|
// Shift the bitrate if we're transcoding to a different audio codec.
|
||||||
defaultBitrate = GetDefaultAudioBitrate(targetAudioCodec, audioStream.Channels.Value);
|
defaultBitrate = GetDefaultAudioBitrate(targetAudioCodec, audioStream.Channels.Value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user