Refactor: standardize namespace and using directive style
Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
namespace MediaBrowser.Model.Dlna;
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::System.Globalization;
|
||||
using global::System.Linq;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Extensions;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@@ -15,12 +17,10 @@ using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Session;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
/// <summary>
|
||||
/// Class StreamBuilder.
|
||||
/// </summary>
|
||||
public class StreamBuilder
|
||||
/// <summary>
|
||||
/// Class StreamBuilder.
|
||||
/// </summary>
|
||||
public class StreamBuilder
|
||||
{
|
||||
// Aliases
|
||||
internal const TranscodeReason ContainerReasons = TranscodeReason.ContainerNotSupported | TranscodeReason.ContainerBitrateExceedsLimit;
|
||||
@@ -86,7 +86,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
MediaSource = item,
|
||||
RunTimeTicks = item.RunTimeTicks,
|
||||
Context = options.Context,
|
||||
DeviceProfile = options.Profile
|
||||
DeviceProfile = options.Profile,
|
||||
};
|
||||
|
||||
if (options.ForceDirectPlay)
|
||||
@@ -130,6 +130,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
var remuxContainer = item.TranscodingContainer ?? "ts";
|
||||
string[] supportedHlsContainers = ["ts", "mp4"];
|
||||
|
||||
// If the container specified for the profile is an HLS supported container, use that container instead, overriding the preference
|
||||
// The client should be responsible to ensure this container is compatible
|
||||
remuxContainer = Array.Exists(supportedHlsContainers, element => string.Equals(element, directPlayInfo.Profile?.Container, StringComparison.OrdinalIgnoreCase)) ? directPlayInfo.Profile?.Container : remuxContainer;
|
||||
@@ -323,6 +324,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return TranscodeReason.AudioSampleRateNotSupported;
|
||||
|
||||
case ProfileConditionValue.Has64BitOffsets:
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -333,6 +335,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return TranscodeReason.AnamorphicVideoNotSupported;
|
||||
|
||||
case ProfileConditionValue.IsAvc:
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -346,14 +349,17 @@ namespace MediaBrowser.Model.Dlna
|
||||
return TranscodeReason.StreamCountExceedsLimit;
|
||||
|
||||
case ProfileConditionValue.NumAudioStreams:
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
case ProfileConditionValue.NumVideoStreams:
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
case ProfileConditionValue.PacketLength:
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -385,6 +391,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return TranscodeReason.VideoRangeTypeNotSupported;
|
||||
|
||||
case ProfileConditionValue.VideoTimestamp:
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@@ -655,7 +662,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
Context = options.Context,
|
||||
DeviceProfile = options.Profile,
|
||||
SubtitleStreamIndex = options.SubtitleStreamIndex ?? GetDefaultSubtitleStreamIndex(item, options.Profile.SubtitleProfiles),
|
||||
AlwaysBurnInSubtitleWhenTranscoding = options.AlwaysBurnInSubtitleWhenTranscoding
|
||||
AlwaysBurnInSubtitleWhenTranscoding = options.AlwaysBurnInSubtitleWhenTranscoding,
|
||||
};
|
||||
|
||||
var subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null;
|
||||
@@ -668,6 +675,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
// Collect candidate audio streams
|
||||
ICollection<MediaStream> candidateAudioStreams = audioStream is null ? [] : [audioStream];
|
||||
|
||||
// When the index is explicitly required by client or the default is specified by user, don't do any stream reselection.
|
||||
if (!item.DefaultAudioIndexSource.HasFlag(AudioIndexSource.User) && (options.AudioStreamIndex is null or < 0))
|
||||
{
|
||||
@@ -706,7 +714,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
var videoStream = item.VideoStream;
|
||||
|
||||
var bitrateLimitExceeded = IsBitrateLimitExceeded(item, options.GetMaxBitrate(false) ?? 0);
|
||||
var bitrateLimitExceeded = this.IsBitrateLimitExceeded(item, options.GetMaxBitrate(false) ?? 0);
|
||||
var isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || !bitrateLimitExceeded);
|
||||
var isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || !bitrateLimitExceeded);
|
||||
TranscodeReason transcodeReasons = 0;
|
||||
@@ -722,7 +730,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
transcodeReasons = TranscodeReason.ContainerBitrateExceedsLimit;
|
||||
}
|
||||
|
||||
_logger.LogDebug(
|
||||
this._logger.LogDebug(
|
||||
"Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
|
||||
options.Profile.Name ?? "Unknown Profile",
|
||||
item.Path ?? "Unknown path",
|
||||
@@ -733,7 +741,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (isEligibleForDirectPlay || isEligibleForDirectStream)
|
||||
{
|
||||
// See if it can be direct played
|
||||
var directPlayInfo = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, candidateAudioStreams, subtitleStream, isEligibleForDirectPlay, isEligibleForDirectStream);
|
||||
var directPlayInfo = this.GetVideoDirectPlayProfile(options, item, videoStream, audioStream, candidateAudioStreams, subtitleStream, isEligibleForDirectPlay, isEligibleForDirectStream);
|
||||
var directPlay = directPlayInfo.PlayMethod;
|
||||
transcodeReasons |= directPlayInfo.TranscodeReasons;
|
||||
|
||||
@@ -771,14 +779,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (subtitleStream is not null)
|
||||
{
|
||||
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, directPlayProfile?.Container, null);
|
||||
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, this._transcoderSupport, directPlayProfile?.Container, null);
|
||||
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogDebug(
|
||||
this._logger.LogDebug(
|
||||
"DirectPlay Result for Profile: {0}, Path: {1}, PlayMethod: {2}, AudioStreamIndex: {3}, SubtitleStreamIndex: {4}, Reasons: {5}",
|
||||
options.Profile.Name ?? "Anonymous Profile",
|
||||
item.Path ?? "Unknown path",
|
||||
@@ -794,19 +802,19 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
// Can't direct play, find the transcoding profile
|
||||
// If we do this for direct-stream we will overwrite the info
|
||||
var (transcodingProfile, playMethod) = GetVideoTranscodeProfile(item, options, videoStream, audioStream, playlistItem);
|
||||
var (transcodingProfile, playMethod) = this.GetVideoTranscodeProfile(item, options, videoStream, audioStream, playlistItem);
|
||||
|
||||
if (transcodingProfile is not null && playMethod.HasValue)
|
||||
{
|
||||
SetStreamInfoOptionsFromTranscodingProfile(item, playlistItem, transcodingProfile);
|
||||
|
||||
BuildStreamVideoItem(playlistItem, options, item, videoStream, audioStream, candidateAudioStreams, transcodingProfile.Container, transcodingProfile.VideoCodec, transcodingProfile.AudioCodec);
|
||||
this.BuildStreamVideoItem(playlistItem, options, item, videoStream, audioStream, candidateAudioStreams, transcodingProfile.Container, transcodingProfile.VideoCodec, transcodingProfile.AudioCodec);
|
||||
|
||||
playlistItem.PlayMethod = PlayMethod.Transcode;
|
||||
|
||||
if (subtitleStream is not null)
|
||||
{
|
||||
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol);
|
||||
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, this._transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol);
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
||||
playlistItem.SubtitleCodecs = [subtitleProfile.Format];
|
||||
@@ -814,12 +822,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if ((playlistItem.TranscodeReasons & (VideoReasons | TranscodeReason.ContainerBitrateExceedsLimit)) != 0)
|
||||
{
|
||||
ApplyTranscodingConditions(playlistItem, transcodingProfile.Conditions, null, true, true);
|
||||
this.ApplyTranscodingConditions(playlistItem, transcodingProfile.Conditions, null, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogDebug(
|
||||
this._logger.LogDebug(
|
||||
"StreamBuilder.BuildVideoItem( Profile={0}, Path={1}, AudioStreamIndex={2}, SubtitleStreamIndex={3} ) => ( PlayMethod={4}, TranscodeReason={5} ) {6}",
|
||||
options.Profile.Name ?? "Anonymous Profile",
|
||||
item.Path ?? "Unknown path",
|
||||
@@ -1059,6 +1067,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
.Where(i => i.Type == CodecType.Video &&
|
||||
i.ContainsAnyCodec(playlistItem.VideoCodecs, container, useSubContainer) &&
|
||||
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoRangeType, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numStreams, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)))
|
||||
|
||||
// Reverse codec profiles for backward compatibility - first codec profile has higher priority
|
||||
.Reverse();
|
||||
foreach (var condition in appliedVideoConditions)
|
||||
@@ -1090,6 +1099,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
.Where(i => i.Type == CodecType.VideoAudio &&
|
||||
i.ContainsAnyCodec(playlistItem.AudioCodecs, container) &&
|
||||
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio)))
|
||||
|
||||
// Reverse codec profiles for backward compatibility - first codec profile has higher priority
|
||||
.Reverse();
|
||||
|
||||
@@ -1106,6 +1116,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
var maxBitrateSetting = options.GetMaxBitrate(false);
|
||||
|
||||
// Honor max rate
|
||||
if (maxBitrateSetting.HasValue)
|
||||
{
|
||||
@@ -1518,7 +1529,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
new SubtitleProfile
|
||||
{
|
||||
Method = SubtitleDeliveryMethod.Encode,
|
||||
Format = subtitleStream.Codec
|
||||
Format = subtitleStream.Codec,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2309,13 +2320,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
var profile = options.Profile;
|
||||
|
||||
var failures = AggregateFailureConditions(
|
||||
var failures = this.AggregateFailureConditions(
|
||||
mediaSource,
|
||||
profile,
|
||||
"VideoCodecProfile",
|
||||
profile.ContainerProfiles
|
||||
.Where(containerProfile => containerProfile.Type == DlnaProfileType.Video && containerProfile.ContainsContainer(container))
|
||||
.SelectMany(containerProfile => CheckVideoConditions(containerProfile.Conditions, mediaSource, videoStream)));
|
||||
.SelectMany(containerProfile => this.CheckVideoConditions(containerProfile.Conditions, mediaSource, videoStream)));
|
||||
|
||||
return failures;
|
||||
}
|
||||
@@ -2334,15 +2345,15 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
string videoCodec = videoStream.Codec;
|
||||
|
||||
var failures = AggregateFailureConditions(
|
||||
var failures = this.AggregateFailureConditions(
|
||||
mediaSource,
|
||||
profile,
|
||||
"VideoCodecProfile",
|
||||
profile.CodecProfiles
|
||||
.Where(codecProfile => codecProfile.Type == CodecType.Video &&
|
||||
codecProfile.ContainsAnyCodec(videoCodec, container) &&
|
||||
!CheckVideoConditions(codecProfile.ApplyConditions, mediaSource, videoStream).Any())
|
||||
.SelectMany(codecProfile => CheckVideoConditions(codecProfile.Conditions, mediaSource, videoStream)));
|
||||
!this.CheckVideoConditions(codecProfile.ApplyConditions.ToArray(), mediaSource, videoStream).Any())
|
||||
.SelectMany(codecProfile => this.CheckVideoConditions(codecProfile.Conditions.ToArray(), mediaSource, videoStream)));
|
||||
|
||||
return failures;
|
||||
}
|
||||
@@ -2373,7 +2384,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
? GetProfileConditionsForVideoAudio(profile.CodecProfiles, container, audioCodec, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)
|
||||
: GetProfileConditionsForAudio(profile.CodecProfiles, container, audioCodec, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, true);
|
||||
|
||||
var failures = AggregateFailureConditions(mediaSource, profile, "AudioCodecProfile", audioFailureConditions);
|
||||
var failures = this.AggregateFailureConditions(mediaSource, profile, "AudioCodecProfile", audioFailureConditions);
|
||||
|
||||
return failures;
|
||||
}
|
||||
@@ -2390,7 +2401,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
/// <returns>Transcode reasons if the audio stream is not fully compatible for direct playback.</returns>
|
||||
private TranscodeReason GetCompatibilityAudioCodecDirect(MediaOptions options, MediaSourceInfo mediaSource, string container, MediaStream audioStream, bool isVideo, bool isSecondaryAudio)
|
||||
{
|
||||
var failures = GetCompatibilityAudioCodec(options, mediaSource, container, audioStream, null, isVideo, isSecondaryAudio);
|
||||
var failures = this.GetCompatibilityAudioCodec(options, mediaSource, container, audioStream, null, isVideo, isSecondaryAudio);
|
||||
|
||||
if (audioStream.IsExternal)
|
||||
{
|
||||
@@ -2400,4 +2411,3 @@ namespace MediaBrowser.Model.Dlna
|
||||
return failures;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user