Backport pull request #9092 from jellyfin/release-10.8.z

Don't add additional entries if HEVC encoding is disabled

Original-merge: 2a5efeb3bb5938b614cb159868e98d56487040c9

Merged-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Dmitry Lyzo 2023-01-22 14:06:19 -05:00 committed by Joshua M. Boniface
parent 2b1a7ddd32
commit 71a708cdb8

View File

@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Api.Extensions;
using Jellyfin.Api.Models.StreamingDtos;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
@ -203,9 +204,11 @@ namespace Jellyfin.Api.Helpers
{
builder.Append(flacWaPlaylist);
}
var encodingOptions = _serverConfigurationManager.GetEncodingOptions();
// Provide SDR HEVC entrance for backward compatibility.
if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec)
if (encodingOptions.AllowHevcEncoding
&& EncodingHelper.IsCopyCodec(state.OutputVideoCodec)
&& !string.IsNullOrEmpty(state.VideoStream.VideoRange)
&& string.Equals(state.VideoStream.VideoRange, "HDR", StringComparison.OrdinalIgnoreCase)
&& string.Equals(state.ActualOutputVideoCodec, "hevc", StringComparison.OrdinalIgnoreCase))