aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Lyzo <ashephard0@gmail.com>2023-12-19 21:34:49 +0300
committerDmitry Lyzo <ashephard0@gmail.com>2026-05-18 16:58:16 +0300
commit5c10076110f565850df45752ad0ebcd12644b7d8 (patch)
tree9bc61d34aac446a2fd59a85d38fb5e1f133c3af5
parent118050611bff0d74691ce71e5cd802237c1248ef (diff)
Use stream compatibility errors for DirectPlay profile searching
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs25
1 files changed, 10 insertions, 15 deletions
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index a8d35adda0..02284f9f06 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -25,6 +25,7 @@ namespace MediaBrowser.Model.Dlna
internal const TranscodeReason VideoCodecReasons = TranscodeReason.VideoResolutionNotSupported | TranscodeReason.AnamorphicVideoNotSupported | TranscodeReason.InterlacedVideoNotSupported | TranscodeReason.VideoBitDepthNotSupported | TranscodeReason.VideoBitrateNotSupported | TranscodeReason.VideoFramerateNotSupported | TranscodeReason.VideoLevelNotSupported | TranscodeReason.RefFramesNotSupported | TranscodeReason.VideoRangeTypeNotSupported | TranscodeReason.VideoProfileNotSupported | TranscodeReason.VideoRotationNotSupported;
internal const TranscodeReason VideoReasons = TranscodeReason.VideoCodecNotSupported | VideoCodecReasons;
internal const TranscodeReason DirectStreamReasons = AudioReasons | TranscodeReason.ContainerNotSupported | TranscodeReason.VideoCodecTagNotSupported;
+ internal const TranscodeReason GenericReasons = TranscodeReason.VideoCodecNotSupported | TranscodeReason.AudioCodecNotSupported | TranscodeReason.ContainerNotSupported;
private readonly ILogger _logger;
private readonly ITranscoderSupport _transcoderSupport;
@@ -1295,24 +1296,18 @@ namespace MediaBrowser.Model.Dlna
// Check container conditions
var containerProfileReasons = GetCompatibilityContainer(options, mediaSource, container, videoStream);
- // Check video conditions
- var videoCodecProfileReasons = videoStream is null ? default : GetCompatibilityVideoCodec(options, mediaSource, container, videoStream);
+ // FIXME: Throw if DirectPlayErrors has no value?
+ var videoCodecProfileReasons = (videoStream?.DirectPlayErrors ?? 0) & ~GenericReasons;
- // Check audio candidates profile conditions
- var audioStreamMatches = candidateAudioStreams.ToDictionary(s => s, audioStream => GetCompatibilityAudioCodecDirect(options, mediaSource, container, audioStream, true, mediaSource.IsSecondaryAudio(audioStream) ?? false));
+ // FIXME: Throw if DirectPlayErrors has no value?
+ var audioStreamMatches = candidateAudioStreams.ToDictionary(s => s, audioStream => (audioStream.DirectPlayErrors ?? 0) & ~GenericReasons);
- TranscodeReason subtitleProfileReasons = 0;
- if (subtitleStream is not null)
- {
- var subtitleProfile = GetSubtitleProfile(mediaSource, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.DirectPlay, _transcoderSupport, container, null);
+ // FIXME: Throw if DirectPlayErrors has no value?
+ var subtitleProfileReasons = (subtitleStream?.DirectPlayErrors ?? 0) & ~GenericReasons;
- if (subtitleProfile.Method != SubtitleDeliveryMethod.Drop
- && subtitleProfile.Method != SubtitleDeliveryMethod.External
- && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
- {
- _logger.LogDebug("Not eligible for {0} due to unsupported subtitles", PlayMethod.DirectPlay);
- subtitleProfileReasons |= TranscodeReason.SubtitleCodecNotSupported;
- }
+ if ((subtitleProfileReasons & TranscodeReason.SubtitleCodecNotSupported) != 0)
+ {
+ _logger.LogDebug("Not eligible for {0} due to unsupported subtitles", PlayMethod.DirectPlay);
}
var containerSupported = false;