Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option for dropping specific subtitle formats using the DLNA SubtitleProfile #6920

Merged
merged 1 commit into from
Dec 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Jellyfin.Api/Helpers/DynamicHlsHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
Expand Down Expand Up @@ -462,6 +462,11 @@ private bool EnableAdaptiveBitrateStreaming(StreamState state, bool isLiveStream

private void AddSubtitles(StreamState state, IEnumerable<MediaStream> subtitles, StringBuilder builder, ClaimsPrincipal user)
{
if (state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Drop)
{
return;
}
marius-luca-87 marked this conversation as resolved.
Show resolved Hide resolved

var selectedIndex = state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Hls ? (int?)null : state.SubtitleStream.Index;
const string Format = "#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"{0}\",DEFAULT={1},FORCED={2},AUTOSELECT=YES,URI=\"{3}\",LANGUAGE=\"{4}\"";

Expand Down
4 changes: 3 additions & 1 deletion MediaBrowser.Model/Dlna/StreamBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,9 @@ private void LogConditionFailure(DeviceProfile profile, string type, ProfileCond
{
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, playMethod, _transcoderSupport, item.Container, null);

if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
if (subtitleProfile.Method != SubtitleDeliveryMethod.Drop
&& subtitleProfile.Method != SubtitleDeliveryMethod.External
&& subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
{
_logger.LogDebug("Not eligible for {0} due to unsupported subtitles", playMethod);
return (false, TranscodeReason.SubtitleCodecNotSupported);
Expand Down
7 changes: 6 additions & 1 deletion MediaBrowser.Model/Dlna/SubtitleDeliveryMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public enum SubtitleDeliveryMethod
/// <summary>
/// Serve the subtitles as a separate HLS stream.
/// </summary>
Hls = 3
Hls = 3,

/// <summary>
/// Drop the subtitle.
/// </summary>
Drop = 4
}
}