mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	- add an option for dropping specific subtitle formats using the DLNA SubtitleProfile
This commit is contained in:
		
							parent
							
								
									13ac3e3665
								
							
						
					
					
						commit
						7d86ef6f22
					
				@ -1,4 +1,4 @@
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Globalization;
 | 
					using System.Globalization;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
@ -462,6 +462,11 @@ namespace Jellyfin.Api.Helpers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        private void AddSubtitles(StreamState state, IEnumerable<MediaStream> subtitles, StringBuilder builder, ClaimsPrincipal user)
 | 
					        private void AddSubtitles(StreamState state, IEnumerable<MediaStream> subtitles, StringBuilder builder, ClaimsPrincipal user)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            if (state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Drop)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var selectedIndex = state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Hls ? (int?)null : state.SubtitleStream.Index;
 | 
					            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}\"";
 | 
					            const string Format = "#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"{0}\",DEFAULT={1},FORCED={2},AUTOSELECT=YES,URI=\"{3}\",LANGUAGE=\"{4}\"";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1220,7 +1220,9 @@ namespace MediaBrowser.Model.Dlna
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, playMethod, _transcoderSupport, item.Container, null);
 | 
					                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);
 | 
					                    _logger.LogDebug("Not eligible for {0} due to unsupported subtitles", playMethod);
 | 
				
			||||||
                    return (false, TranscodeReason.SubtitleCodecNotSupported);
 | 
					                    return (false, TranscodeReason.SubtitleCodecNotSupported);
 | 
				
			||||||
 | 
				
			|||||||
@ -25,6 +25,11 @@ namespace MediaBrowser.Model.Dlna
 | 
				
			|||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Serve the subtitles as a separate HLS stream.
 | 
					        /// Serve the subtitles as a separate HLS stream.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        Hls = 3
 | 
					        Hls = 3,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Drop the subtitle.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        Drop = 4
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user