Revert "Return more precise transcoding reasons"

This reverts commit de8bb15c

Signed-off-by: gnattu <gnattuoc@me.com>
This commit is contained in:
gnattu 2024-09-14 01:24:57 +08:00
parent 118c583bff
commit 6a5f22fc2f

View File

@ -1415,49 +1415,16 @@ namespace MediaBrowser.Model.Dlna
return profileMatch; return profileMatch;
} }
TranscodeReason inferredReason = 0;
var failureReasons = analyzedProfiles[false] var failureReasons = analyzedProfiles[false]
.Select(analysis => analysis.Result) .Select(analysis => analysis.Result)
.Where(result => !containerSupported || !result.TranscodeReason.HasFlag(TranscodeReason.ContainerNotSupported)) .Where(result => !containerSupported || !result.TranscodeReason.HasFlag(TranscodeReason.ContainerNotSupported))
.Select(result => result.TranscodeReason) .FirstOrDefault().TranscodeReason;
.ToList(); if (failureReasons == 0)
if (failureReasons.FirstOrDefault() == 0)
{ {
inferredReason = TranscodeReason.DirectPlayError; failureReasons = TranscodeReason.DirectPlayError;
}
else
{
var videoCodecNotSupportedCount = failureReasons.Count(r => r.HasFlag(TranscodeReason.VideoCodecNotSupported));
var audioCodecNotSupportedCount = failureReasons.Count(r => r.HasFlag(TranscodeReason.AudioCodecNotSupported));
if (!containerSupported)
{
inferredReason |= TranscodeReason.ContainerNotSupported;
}
if (videoCodecNotSupportedCount == failureReasons.Count)
{
inferredReason |= TranscodeReason.VideoCodecNotSupported;
}
if (audioCodecNotSupportedCount == failureReasons.Count)
{
inferredReason |= TranscodeReason.AudioCodecNotSupported;
}
foreach (var transcodeReason in failureReasons)
{
var temp = transcodeReason;
temp &= ~TranscodeReason.ContainerNotSupported;
temp &= ~TranscodeReason.VideoCodecNotSupported;
temp &= ~TranscodeReason.AudioCodecNotSupported;
inferredReason |= temp;
}
} }
return (Profile: null, PlayMethod: null, AudioStreamIndex: null, TranscodeReasons: inferredReason); return (Profile: null, PlayMethod: null, AudioStreamIndex: null, TranscodeReasons: failureReasons);
} }
private TranscodeReason CheckVideoAudioStreamDirectPlay(MediaOptions options, MediaSourceInfo mediaSource, string container, MediaStream audioStream) private TranscodeReason CheckVideoAudioStreamDirectPlay(MediaOptions options, MediaSourceInfo mediaSource, string container, MediaStream audioStream)