mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-07 16:28:56 +01:00
Replace == null with is null
This commit is contained in:
@@ -77,7 +77,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return MaxBitrate;
|
||||
}
|
||||
|
||||
if (Profile == null)
|
||||
if (Profile is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public static bool ContainsContainer(string[]? profileContainers, bool isNegativeList, string? inputContainer)
|
||||
{
|
||||
if (profileContainers == null || profileContainers.Length == 0)
|
||||
if (profileContainers is null || profileContainers.Length == 0)
|
||||
{
|
||||
// Empty profiles always support all containers/codecs
|
||||
return true;
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
var playProfiles = playProfile == null ? profile.DirectPlayProfiles : new[] { playProfile };
|
||||
var playProfiles = playProfile is null ? profile.DirectPlayProfiles : new[] { playProfile };
|
||||
foreach (var format in formats)
|
||||
{
|
||||
foreach (var directPlayProfile in playProfiles)
|
||||
@@ -370,7 +370,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
var directPlayProfile = options.Profile.DirectPlayProfiles
|
||||
.FirstOrDefault(x => x.Type == DlnaProfileType.Audio && IsAudioDirectPlaySupported(x, item, audioStream));
|
||||
|
||||
if (directPlayProfile == null)
|
||||
if (directPlayProfile is null)
|
||||
{
|
||||
_logger.LogDebug(
|
||||
"Profile: {0}, No audio direct play profiles found for {1} with codec {2}",
|
||||
@@ -422,7 +422,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private static TranscodeReason GetTranscodeReasonsFromDirectPlayProfile(MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream, IEnumerable<DirectPlayProfile> directPlayProfiles)
|
||||
{
|
||||
var mediaType = videoStream == null ? DlnaProfileType.Audio : DlnaProfileType.Video;
|
||||
var mediaType = videoStream is null ? DlnaProfileType.Audio : DlnaProfileType.Video;
|
||||
|
||||
var containerSupported = false;
|
||||
var audioSupported = false;
|
||||
@@ -436,9 +436,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
containerSupported = true;
|
||||
|
||||
videoSupported = videoStream == null || profile.SupportsVideoCodec(videoStream.Codec);
|
||||
videoSupported = videoStream is null || profile.SupportsVideoCodec(videoStream.Codec);
|
||||
|
||||
audioSupported = audioStream == null || profile.SupportsAudioCodec(audioStream.Codec);
|
||||
audioSupported = audioStream is null || profile.SupportsAudioCodec(audioStream.Codec);
|
||||
|
||||
if (videoSupported && audioSupported)
|
||||
{
|
||||
@@ -586,7 +586,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
// Collect candidate audio streams
|
||||
ICollection<MediaStream> candidateAudioStreams = audioStream == null ? Array.Empty<MediaStream>() : new[] { audioStream };
|
||||
ICollection<MediaStream> candidateAudioStreams = audioStream is null ? Array.Empty<MediaStream>() : new[] { audioStream };
|
||||
if (!options.AudioStreamIndex.HasValue || options.AudioStreamIndex < 0)
|
||||
{
|
||||
if (audioStream?.IsDefault == true)
|
||||
@@ -729,8 +729,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (options.AllowVideoStreamCopy)
|
||||
{
|
||||
// prefer direct copy profile
|
||||
float videoFramerate = videoStream == null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;
|
||||
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : item.Timestamp;
|
||||
float videoFramerate = videoStream is null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;
|
||||
TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : item.Timestamp;
|
||||
int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio);
|
||||
int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video);
|
||||
|
||||
@@ -832,13 +832,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
double? videoLevel = videoStream?.Level;
|
||||
string videoProfile = videoStream?.Profile;
|
||||
string videoRangeType = videoStream?.VideoRangeType;
|
||||
float videoFramerate = videoStream == null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;
|
||||
float videoFramerate = videoStream is null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;
|
||||
bool? isAnamorphic = videoStream?.IsAnamorphic;
|
||||
bool? isInterlaced = videoStream?.IsInterlaced;
|
||||
string videoCodecTag = videoStream?.CodecTag;
|
||||
bool? isAvc = videoStream?.IsAVC;
|
||||
|
||||
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : item.Timestamp;
|
||||
TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : item.Timestamp;
|
||||
int? packetLength = videoStream?.PacketLength;
|
||||
int? refFrames = videoStream?.RefFrames;
|
||||
|
||||
@@ -870,12 +870,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
int audioBitrate = GetAudioBitrate(options.GetMaxBitrate(false) ?? 0, playlistItem.TargetAudioCodec, audioStream, playlistItem);
|
||||
playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);
|
||||
|
||||
bool? isSecondaryAudio = audioStream == null ? null : item.IsSecondaryAudio(audioStream);
|
||||
int? inputAudioBitrate = audioStream == null ? null : audioStream.BitRate;
|
||||
int? audioChannels = audioStream == null ? null : audioStream.Channels;
|
||||
string audioProfile = audioStream == null ? null : audioStream.Profile;
|
||||
int? inputAudioSampleRate = audioStream == null ? null : audioStream.SampleRate;
|
||||
int? inputAudioBitDepth = audioStream == null ? null : audioStream.BitDepth;
|
||||
bool? isSecondaryAudio = audioStream is null ? null : item.IsSecondaryAudio(audioStream);
|
||||
int? inputAudioBitrate = audioStream is null ? null : audioStream.BitRate;
|
||||
int? audioChannels = audioStream is null ? null : audioStream.Channels;
|
||||
string audioProfile = audioStream is null ? null : audioStream.Profile;
|
||||
int? inputAudioSampleRate = audioStream is null ? null : audioStream.SampleRate;
|
||||
int? inputAudioBitDepth = audioStream is null ? null : audioStream.BitDepth;
|
||||
|
||||
var appliedAudioConditions = options.Profile.CodecProfiles
|
||||
.Where(i => i.Type == CodecType.VideoAudio &&
|
||||
@@ -965,7 +965,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
int defaultBitrate;
|
||||
int encoderAudioBitrateLimit = int.MaxValue;
|
||||
|
||||
if (audioStream == null)
|
||||
if (audioStream is null)
|
||||
{
|
||||
defaultBitrate = 192000;
|
||||
}
|
||||
@@ -1080,13 +1080,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
double? videoLevel = videoStream?.Level;
|
||||
string videoProfile = videoStream?.Profile;
|
||||
string videoRangeType = videoStream?.VideoRangeType;
|
||||
float videoFramerate = videoStream == null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;
|
||||
float videoFramerate = videoStream is null ? 0 : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate ?? 0;
|
||||
bool? isAnamorphic = videoStream?.IsAnamorphic;
|
||||
bool? isInterlaced = videoStream?.IsInterlaced;
|
||||
string videoCodecTag = videoStream?.CodecTag;
|
||||
bool? isAvc = videoStream?.IsAVC;
|
||||
|
||||
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp;
|
||||
TransportStreamTimestamp? timestamp = videoStream is null ? TransportStreamTimestamp.None : mediaSource.Timestamp;
|
||||
int? packetLength = videoStream?.PacketLength;
|
||||
int? refFrames = videoStream?.RefFrames;
|
||||
|
||||
@@ -1177,7 +1177,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (candidateAudioStreams.Any())
|
||||
{
|
||||
selectedAudioStream = candidateAudioStreams.FirstOrDefault(audioStream => directPlayProfile.SupportsAudioCodec(audioStream.Codec));
|
||||
if (selectedAudioStream == null)
|
||||
if (selectedAudioStream is null)
|
||||
{
|
||||
directPlayProfileReasons |= TranscodeReason.AudioCodecNotSupported;
|
||||
}
|
||||
@@ -1501,12 +1501,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
throw new ArgumentException("DeviceId is required");
|
||||
}
|
||||
|
||||
if (options.Profile == null)
|
||||
if (options.Profile is null)
|
||||
{
|
||||
throw new ArgumentException("Profile is required");
|
||||
}
|
||||
|
||||
if (options.MediaSources == null)
|
||||
if (options.MediaSources is null)
|
||||
{
|
||||
throw new ArgumentException("MediaSources is required");
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
var stream = TargetVideoStream;
|
||||
return MaxFramerate.HasValue && !IsDirectStream
|
||||
? MaxFramerate
|
||||
: stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate;
|
||||
: stream is null ? null : stream.AverageFrameRate ?? stream.RealFrameRate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
return !IsDirectStream
|
||||
? defaultValue
|
||||
: MediaSource == null ? defaultValue : MediaSource.Timestamp ?? TransportStreamTimestamp.None;
|
||||
: MediaSource is null ? defaultValue : MediaSource.Timestamp ?? TransportStreamTimestamp.None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,18 +71,18 @@ namespace MediaBrowser.Model.Drawing
|
||||
int? fillHeight)
|
||||
{
|
||||
// Return original size if input is invalid.
|
||||
if ((fillWidth == null || fillWidth == 0)
|
||||
&& (fillHeight == null || fillHeight == 0))
|
||||
if ((fillWidth is null || fillWidth == 0)
|
||||
&& (fillHeight is null || fillHeight == 0))
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
if (fillWidth == null || fillWidth == 0)
|
||||
if (fillWidth is null || fillWidth == 0)
|
||||
{
|
||||
fillWidth = 1;
|
||||
}
|
||||
|
||||
if (fillHeight == null || fillHeight == 0)
|
||||
if (fillHeight is null || fillHeight == 0)
|
||||
{
|
||||
fillHeight = 1;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dto
|
||||
|
||||
public void InferTotalBitrate(bool force = false)
|
||||
{
|
||||
if (MediaStreams == null)
|
||||
if (MediaStreams is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(instance);
|
||||
|
||||
if (instance.ProviderIds == null)
|
||||
if (instance.ProviderIds is null)
|
||||
{
|
||||
id = null;
|
||||
return false;
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace MediaBrowser.Model.Notifications
|
||||
{
|
||||
NotificationOption opt = GetOptions(notificationType);
|
||||
|
||||
return opt == null
|
||||
return opt is null
|
||||
|| !opt.DisabledServices.Contains(service, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace MediaBrowser.Model.Updates
|
||||
[JsonPropertyName("version")]
|
||||
public string Version
|
||||
{
|
||||
get => _version == null ? string.Empty : _version.ToString();
|
||||
get => _version is null ? string.Empty : _version.ToString();
|
||||
|
||||
set => _version = SysVersion.Parse(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user