mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 10:43:30 +01:00
Add option to always burn in subtitles if transcoding is triggered (#12430)
This commit is contained in:
@@ -49,6 +49,11 @@ namespace MediaBrowser.Model.Dlna
|
||||
/// </summary>
|
||||
public bool AllowVideoStreamCopy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether always burn in subtitles when transcoding.
|
||||
/// </summary>
|
||||
public bool AlwaysBurnInSubtitleWhenTranscoding { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the item id.
|
||||
/// </summary>
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
// Aliases
|
||||
internal const TranscodeReason ContainerReasons = TranscodeReason.ContainerNotSupported | TranscodeReason.ContainerBitrateExceedsLimit;
|
||||
internal const TranscodeReason AudioReasons = TranscodeReason.AudioCodecNotSupported | TranscodeReason.AudioBitrateNotSupported | TranscodeReason.AudioChannelsNotSupported | TranscodeReason.AudioProfileNotSupported | TranscodeReason.AudioSampleRateNotSupported | TranscodeReason.SecondaryAudioNotSupported | TranscodeReason.AudioBitDepthNotSupported | TranscodeReason.AudioIsExternal;
|
||||
internal const TranscodeReason VideoReasons = TranscodeReason.VideoCodecNotSupported | TranscodeReason.VideoResolutionNotSupported | TranscodeReason.AnamorphicVideoNotSupported | TranscodeReason.InterlacedVideoNotSupported | TranscodeReason.VideoBitDepthNotSupported | TranscodeReason.VideoBitrateNotSupported | TranscodeReason.VideoFramerateNotSupported | TranscodeReason.VideoLevelNotSupported | TranscodeReason.RefFramesNotSupported;
|
||||
internal const TranscodeReason DirectStreamReasons = AudioReasons | TranscodeReason.ContainerNotSupported;
|
||||
internal const TranscodeReason VideoReasons = TranscodeReason.VideoCodecNotSupported | TranscodeReason.VideoResolutionNotSupported | TranscodeReason.AnamorphicVideoNotSupported | TranscodeReason.InterlacedVideoNotSupported | TranscodeReason.VideoBitDepthNotSupported | TranscodeReason.VideoBitrateNotSupported | TranscodeReason.VideoFramerateNotSupported | TranscodeReason.VideoLevelNotSupported | TranscodeReason.RefFramesNotSupported | TranscodeReason.VideoRangeTypeNotSupported | TranscodeReason.VideoProfileNotSupported;
|
||||
internal const TranscodeReason DirectStreamReasons = AudioReasons | TranscodeReason.ContainerNotSupported | TranscodeReason.VideoCodecTagNotSupported;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly ITranscoderSupport _transcoderSupport;
|
||||
@@ -352,7 +352,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return TranscodeReason.VideoBitrateNotSupported;
|
||||
|
||||
case ProfileConditionValue.VideoCodecTag:
|
||||
return TranscodeReason.VideoCodecNotSupported;
|
||||
return TranscodeReason.VideoCodecTagNotSupported;
|
||||
|
||||
case ProfileConditionValue.VideoFramerate:
|
||||
return TranscodeReason.VideoFramerateNotSupported;
|
||||
@@ -765,7 +765,19 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol);
|
||||
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
if (options.AlwaysBurnInSubtitleWhenTranscoding && (playlistItem.TranscodeReasons & (VideoReasons | TranscodeReason.ContainerBitrateExceedsLimit)) != 0)
|
||||
{
|
||||
playlistItem.SubtitleDeliveryMethod = SubtitleDeliveryMethod.Encode;
|
||||
foreach (SubtitleProfile profile in options.Profile.SubtitleProfiles)
|
||||
{
|
||||
profile.Method = SubtitleDeliveryMethod.Encode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
}
|
||||
|
||||
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
||||
playlistItem.SubtitleCodecs = new[] { subtitleProfile.Format };
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace MediaBrowser.Model.MediaInfo
|
||||
{
|
||||
EnableDirectPlay = true;
|
||||
EnableDirectStream = true;
|
||||
AlwaysBurnInSubtitleWhenTranscoding = false;
|
||||
DirectPlayProtocols = new MediaProtocol[] { MediaProtocol.Http };
|
||||
}
|
||||
|
||||
@@ -40,6 +41,8 @@ namespace MediaBrowser.Model.MediaInfo
|
||||
|
||||
public bool EnableDirectStream { get; set; }
|
||||
|
||||
public bool AlwaysBurnInSubtitleWhenTranscoding { get; set; }
|
||||
|
||||
public IReadOnlyList<MediaProtocol> DirectPlayProtocols { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace MediaBrowser.Model.Session
|
||||
// Video Constraints
|
||||
VideoProfileNotSupported = 1 << 6,
|
||||
VideoRangeTypeNotSupported = 1 << 24,
|
||||
VideoCodecTagNotSupported = 1 << 25,
|
||||
VideoLevelNotSupported = 1 << 7,
|
||||
VideoResolutionNotSupported = 1 << 8,
|
||||
VideoBitDepthNotSupported = 1 << 9,
|
||||
|
||||
Reference in New Issue
Block a user