mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-17 15:53:42 +01:00
Merge remote-tracking branch 'upstream/master' into remove-common-process
This commit is contained in:
@@ -732,6 +732,14 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
var charset = CharsetDetector.DetectFromStream(stream).Detected?.EncodingName;
|
||||
|
||||
// UTF16 is automatically converted to UTF8 by FFmpeg, do not specify a character encoding
|
||||
if ((path.EndsWith(".ass") || path.EndsWith(".ssa"))
|
||||
&& (string.Equals(charset, "utf-16le", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(charset, "utf-16be", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
charset = "";
|
||||
}
|
||||
|
||||
_logger.LogDebug("charset {0} detected for {Path}", charset ?? "null", path);
|
||||
|
||||
return charset;
|
||||
@@ -754,10 +762,10 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
|
||||
return _httpClient.Get(opts);
|
||||
|
||||
case MediaProtocol.File:
|
||||
return Task.FromResult<Stream>(File.OpenRead(path));
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(protocol));
|
||||
case MediaProtocol.File:
|
||||
return Task.FromResult<Stream>(File.OpenRead(path));
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(protocol));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user