| 
														
															@@ -195,7 +195,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return AsyncFile.OpenRead(fileInfo.Path); 
														 | 
														
														 | 
														
															             return AsyncFile.OpenRead(fileInfo.Path); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        private async Task<SubtitleInfo> GetReadableFile( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        internal async Task<SubtitleInfo> GetReadableFile( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             MediaSourceInfo mediaSource, 
														 | 
														
														 | 
														
															             MediaSourceInfo mediaSource, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             MediaStream subtitleStream, 
														 | 
														
														 | 
														
															             MediaStream subtitleStream, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             CancellationToken cancellationToken) 
														 | 
														
														 | 
														
															             CancellationToken cancellationToken) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -205,9 +205,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 string outputFormat; 
														 | 
														
														 | 
														
															                 string outputFormat; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 string outputCodec; 
														 | 
														
														 | 
														
															                 string outputCodec; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if (string.Equals(subtitleStream.Codec, "ass", StringComparison.OrdinalIgnoreCase) || 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    string.Equals(subtitleStream.Codec, "ssa", StringComparison.OrdinalIgnoreCase) || 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    string.Equals(subtitleStream.Codec, "srt", StringComparison.OrdinalIgnoreCase)) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if (string.Equals(subtitleStream.Codec, "ass", StringComparison.OrdinalIgnoreCase) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    || string.Equals(subtitleStream.Codec, "ssa", StringComparison.OrdinalIgnoreCase) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    || string.Equals(subtitleStream.Codec, "srt", StringComparison.OrdinalIgnoreCase)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 { 
														 | 
														
														 | 
														
															                 { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     // Extract 
														 | 
														
														 | 
														
															                     // Extract 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     outputCodec = "copy"; 
														 | 
														
														 | 
														
															                     outputCodec = "copy"; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -238,7 +238,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             var currentFormat = (Path.GetExtension(subtitleStream.Path) ?? subtitleStream.Codec) 
														 | 
														
														 | 
														
															             var currentFormat = (Path.GetExtension(subtitleStream.Path) ?? subtitleStream.Codec) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 .TrimStart('.'); 
														 | 
														
														 | 
														
															                 .TrimStart('.'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (TryGetReader(currentFormat, out _)) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (!TryGetReader(currentFormat, out _)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             { 
														 | 
														
														 | 
														
															             { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 // Convert 
														 | 
														
														 | 
														
															                 // Convert 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 var outputPath = GetSubtitleCachePath(mediaSource, subtitleStream.Index, ".srt"); 
														 | 
														
														 | 
														
															                 var outputPath = GetSubtitleCachePath(mediaSource, subtitleStream.Index, ".srt"); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -248,12 +248,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return new SubtitleInfo(outputPath, MediaProtocol.File, "srt", true); 
														 | 
														
														 | 
														
															                 return new SubtitleInfo(outputPath, MediaProtocol.File, "srt", true); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (subtitleStream.IsExternal) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                return new SubtitleInfo(subtitleStream.Path, _mediaSourceManager.GetPathProtocol(subtitleStream.Path), currentFormat, true); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            return new SubtitleInfo(subtitleStream.Path, mediaSource.Protocol, currentFormat, true); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // It's possbile that the subtitleStream and mediaSource don't share the same protocol (e.g. .STRM file with local subs) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return new SubtitleInfo(subtitleStream.Path, _mediaSourceManager.GetPathProtocol(subtitleStream.Path), currentFormat, true); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         private bool TryGetReader(string format, [NotNullWhen(true)] out ISubtitleParser? value) 
														 | 
														
														 | 
														
															         private bool TryGetReader(string format, [NotNullWhen(true)] out ISubtitleParser? value) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -756,7 +752,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        private struct SubtitleInfo 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        internal readonly struct SubtitleInfo 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         { 
														 | 
														
														 | 
														
															         { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             public SubtitleInfo(string path, MediaProtocol protocol, string format, bool isExternal) 
														 | 
														
														 | 
														
															             public SubtitleInfo(string path, MediaProtocol protocol, string format, bool isExternal) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             { 
														 | 
														
														 | 
														
															             { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -766,13 +762,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 IsExternal = isExternal; 
														 | 
														
														 | 
														
															                 IsExternal = isExternal; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            public string Path { get; set; } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            public string Path { get; } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            public MediaProtocol Protocol { get; set; } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            public MediaProtocol Protocol { get; } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            public string Format { get; set; } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            public string Format { get; } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            public bool IsExternal { get; set; } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            public bool IsExternal { get; } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |