mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 14:33:06 +03:00
Replace != null with is not null
This commit is contained in:
@@ -682,7 +682,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
public string GetGraphicalSubCanvasSize(EncodingJobInfo state)
|
||||
{
|
||||
if (state.SubtitleStream != null
|
||||
if (state.SubtitleStream is not null
|
||||
&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode
|
||||
&& !state.SubtitleStream.IsTextSubtitleStream)
|
||||
{
|
||||
@@ -932,7 +932,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
.Append(GetInputPathArgument(state));
|
||||
|
||||
// sub2video for external graphical subtitles
|
||||
if (state.SubtitleStream != null
|
||||
if (state.SubtitleStream is not null
|
||||
&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode
|
||||
&& !state.SubtitleStream.IsTextSubtitleStream
|
||||
&& state.SubtitleStream.IsExternal)
|
||||
@@ -963,7 +963,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
arg.Append(" -i file:\"").Append(subtitlePath).Append('\"');
|
||||
}
|
||||
|
||||
if (state.AudioStream != null && state.AudioStream.IsExternal)
|
||||
if (state.AudioStream is not null && state.AudioStream.IsExternal)
|
||||
{
|
||||
// Also seek the external audio stream.
|
||||
var seekAudioParam = GetFastSeekCommandLineParameter(state, options, segmentContainer);
|
||||
@@ -1231,7 +1231,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
var maxrate = request.MaxFramerate;
|
||||
|
||||
if (maxrate.HasValue && state.VideoStream != null)
|
||||
if (maxrate.HasValue && state.VideoStream is not null)
|
||||
{
|
||||
var contentRate = state.VideoStream.AverageFrameRate ?? state.VideoStream.RealFrameRate;
|
||||
|
||||
@@ -1981,7 +1981,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
var bitrate = request.VideoBitRate;
|
||||
|
||||
if (videoStream != null)
|
||||
if (videoStream is not null)
|
||||
{
|
||||
var isUpscaling = request.Height.HasValue
|
||||
&& videoStream.Height.HasValue
|
||||
@@ -2130,7 +2130,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
// Boost volume to 200% when downsampling from 6ch to 2ch
|
||||
if (channels.HasValue
|
||||
&& channels.Value <= 2
|
||||
&& state.AudioStream != null
|
||||
&& state.AudioStream is not null
|
||||
&& state.AudioStream.Channels.HasValue
|
||||
&& state.AudioStream.Channels.Value > 5
|
||||
&& !encodingOptions.DownMixAudioBoost.Equals(1))
|
||||
@@ -2139,7 +2139,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
var isCopyingTimestamps = state.CopyTimestamps || state.TranscodingType != TranscodingJobType.Progressive;
|
||||
if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode && !isCopyingTimestamps)
|
||||
if (state.SubtitleStream is not null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode && !isCopyingTimestamps)
|
||||
{
|
||||
var seconds = TimeSpan.FromTicks(state.StartTimeTicks ?? 0).TotalSeconds;
|
||||
|
||||
@@ -2326,20 +2326,20 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
// We have media info, but we don't know the stream index
|
||||
if (state.VideoStream != null && state.VideoStream.Index == -1)
|
||||
if (state.VideoStream is not null && state.VideoStream.Index == -1)
|
||||
{
|
||||
return "-sn";
|
||||
}
|
||||
|
||||
// We have media info, but we don't know the stream index
|
||||
if (state.AudioStream != null && state.AudioStream.Index == -1)
|
||||
if (state.AudioStream is not null && state.AudioStream.Index == -1)
|
||||
{
|
||||
return state.IsInputVideo ? "-sn" : string.Empty;
|
||||
}
|
||||
|
||||
var args = string.Empty;
|
||||
|
||||
if (state.VideoStream != null)
|
||||
if (state.VideoStream is not null)
|
||||
{
|
||||
int videoStreamIndex = FindIndex(state.MediaSource.MediaStreams, state.VideoStream);
|
||||
|
||||
@@ -2354,12 +2354,12 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
args += "-vn";
|
||||
}
|
||||
|
||||
if (state.AudioStream != null)
|
||||
if (state.AudioStream is not null)
|
||||
{
|
||||
int audioStreamIndex = FindIndex(state.MediaSource.MediaStreams, state.AudioStream);
|
||||
if (state.AudioStream.IsExternal)
|
||||
{
|
||||
bool hasExternalGraphicsSubs = state.SubtitleStream != null
|
||||
bool hasExternalGraphicsSubs = state.SubtitleStream is not null
|
||||
&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode
|
||||
&& state.SubtitleStream.IsExternal
|
||||
&& !state.SubtitleStream.IsTextSubtitleStream;
|
||||
@@ -2427,7 +2427,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
var stream = streams.FirstOrDefault(s => s.Index == desiredIndex.Value);
|
||||
|
||||
if (stream != null)
|
||||
if (stream is not null)
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
@@ -2875,7 +2875,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doDeintHevc = state.DeInterlace("h265", true) || state.DeInterlace("hevc", true);
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
|
||||
@@ -2990,7 +2990,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
var doCuTonemap = IsHwTonemapAvailable(state, options);
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasAssSubs = hasSubs
|
||||
@@ -3180,7 +3180,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
var doOclTonemap = IsHwTonemapAvailable(state, options);
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasAssSubs = hasSubs
|
||||
@@ -3402,7 +3402,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
var doOclTonemap = IsHwTonemapAvailable(state, options);
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasAssSubs = hasSubs
|
||||
@@ -3605,7 +3605,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doTonemap = doVaVppTonemap || doOclTonemap;
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasAssSubs = hasSubs
|
||||
@@ -3882,7 +3882,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doTonemap = doVaVppTonemap || doOclTonemap;
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasAssSubs = hasSubs
|
||||
@@ -4078,7 +4078,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doVkTonemap = IsVulkanHwTonemapAvailable(state, options);
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasAssSubs = hasSubs
|
||||
@@ -4277,7 +4277,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var doDeintH2645 = doDeintH264 || doDeintHevc;
|
||||
var doOclTonemap = IsHwTonemapAvailable(state, options);
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
|
||||
@@ -4445,7 +4445,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasSubs = state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasTextSubs = hasSubs && state.SubtitleStream.IsTextSubtitleStream;
|
||||
var hasGraphicalSubs = hasSubs && !state.SubtitleStream.IsTextSubtitleStream;
|
||||
|
||||
@@ -4495,7 +4495,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (overlayFilters?.Count > 0
|
||||
&& subFilters?.Count > 0
|
||||
&& state.SubtitleStream != null)
|
||||
&& state.SubtitleStream is not null)
|
||||
{
|
||||
// overlay graphical/text subtitles
|
||||
var subStr = string.Format(
|
||||
@@ -4582,7 +4582,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
public static int GetVideoColorBitDepth(EncodingJobInfo state)
|
||||
{
|
||||
var videoStream = state.VideoStream;
|
||||
if (videoStream != null)
|
||||
if (videoStream is not null)
|
||||
{
|
||||
if (videoStream.BitDepth.HasValue)
|
||||
{
|
||||
@@ -5196,7 +5196,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
#nullable disable
|
||||
public void TryStreamCopy(EncodingJobInfo state)
|
||||
{
|
||||
if (state.VideoStream != null && CanStreamCopyVideo(state, state.VideoStream))
|
||||
if (state.VideoStream is not null && CanStreamCopyVideo(state, state.VideoStream))
|
||||
{
|
||||
state.OutputVideoCodec = "copy";
|
||||
}
|
||||
@@ -5205,13 +5205,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var user = state.User;
|
||||
|
||||
// If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not
|
||||
if (user != null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding))
|
||||
if (user is not null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding))
|
||||
{
|
||||
state.OutputVideoCodec = "copy";
|
||||
}
|
||||
}
|
||||
|
||||
if (state.AudioStream != null
|
||||
if (state.AudioStream is not null
|
||||
&& CanStreamCopyAudio(state, state.AudioStream, state.SupportedAudioCodecs))
|
||||
{
|
||||
state.OutputAudioCodec = "copy";
|
||||
@@ -5221,7 +5221,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var user = state.User;
|
||||
|
||||
// If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not
|
||||
if (user != null && !user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding))
|
||||
if (user is not null && !user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding))
|
||||
{
|
||||
state.OutputAudioCodec = "copy";
|
||||
}
|
||||
@@ -5418,7 +5418,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
state.SubtitleDeliveryMethod = videoRequest.SubtitleMethod;
|
||||
state.AudioStream = GetMediaStream(mediaStreams, videoRequest.AudioStreamIndex, MediaStreamType.Audio);
|
||||
|
||||
if (state.SubtitleStream != null && !state.SubtitleStream.IsExternal)
|
||||
if (state.SubtitleStream is not null && !state.SubtitleStream.IsExternal)
|
||||
{
|
||||
state.InternalSubtitleStreamOffset = mediaStreams.Where(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal).ToList().IndexOf(state.SubtitleStream);
|
||||
}
|
||||
@@ -5436,7 +5436,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
var request = state.BaseRequest;
|
||||
var supportedAudioCodecs = state.SupportedAudioCodecs;
|
||||
if (request != null && supportedAudioCodecs != null && supportedAudioCodecs.Length > 0)
|
||||
if (request is not null && supportedAudioCodecs is not null && supportedAudioCodecs.Length > 0)
|
||||
{
|
||||
var supportedAudioCodecsList = supportedAudioCodecs.ToList();
|
||||
|
||||
@@ -5449,7 +5449,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
var supportedVideoCodecs = state.SupportedVideoCodecs;
|
||||
if (request != null && supportedVideoCodecs != null && supportedVideoCodecs.Length > 0)
|
||||
if (request is not null && supportedVideoCodecs is not null && supportedVideoCodecs.Length > 0)
|
||||
{
|
||||
var supportedVideoCodecsList = supportedVideoCodecs.ToList();
|
||||
|
||||
@@ -5617,7 +5617,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (IsCopyCodec(videoCodec))
|
||||
{
|
||||
if (state.VideoStream != null
|
||||
if (state.VideoStream is not null
|
||||
&& string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase)
|
||||
&& !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -5647,7 +5647,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
args += keyFrameArg;
|
||||
|
||||
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
var hasGraphicalSubs = state.SubtitleStream is not null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
|
||||
|
||||
var hasCopyTs = false;
|
||||
|
||||
@@ -5667,7 +5667,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
args += " -avoid_negative_ts disabled";
|
||||
|
||||
if (!(state.SubtitleStream != null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream))
|
||||
if (!(state.SubtitleStream is not null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream))
|
||||
{
|
||||
args += " -start_at_zero";
|
||||
}
|
||||
@@ -5694,7 +5694,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
public string GetProgressiveVideoAudioArguments(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
{
|
||||
// If the video doesn't have an audio stream, return a default.
|
||||
if (state.AudioStream is null && state.VideoStream != null)
|
||||
if (state.AudioStream is null && state.VideoStream is not null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user