mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update subtitle transcoding
This commit is contained in:
parent
26487dc455
commit
e5fdf31ec4
@ -770,7 +770,6 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
{
|
{
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// For sync we can handle the longer extraction times
|
// For sync we can handle the longer extraction times
|
||||||
if (context == EncodingContext.Static && subtitleStream.IsTextSubtitleStream)
|
if (context == EncodingContext.Static && subtitleStream.IsTextSubtitleStream)
|
||||||
@ -779,6 +778,7 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new SubtitleProfile
|
return new SubtitleProfile
|
||||||
{
|
{
|
||||||
|
@ -28,15 +28,20 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsLanguage(string language)
|
public bool SupportsLanguage(string subLanguage)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(language))
|
if (string.IsNullOrEmpty(Language))
|
||||||
{
|
{
|
||||||
language = "und";
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(subLanguage))
|
||||||
|
{
|
||||||
|
subLanguage = "und";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<string> languages = GetLanguages();
|
List<string> languages = GetLanguages();
|
||||||
return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, language);
|
return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -105,6 +105,18 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return GetMediaStreamsForItem(list);
|
return GetMediaStreamsForItem(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int GetMaxAllowedBitrateForExternalSubtitleStream()
|
||||||
|
{
|
||||||
|
// This is abitrary but at some point it becomes too slow to extract subtitles on the fly
|
||||||
|
// We need to learn more about when this is the case vs. when it isn't
|
||||||
|
if (Environment.ProcessorCount >= 8)
|
||||||
|
{
|
||||||
|
return 10000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 2000000;
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<MediaStream> GetMediaStreamsForItem(IEnumerable<MediaStream> streams)
|
private IEnumerable<MediaStream> GetMediaStreamsForItem(IEnumerable<MediaStream> streams)
|
||||||
{
|
{
|
||||||
var list = streams.ToList();
|
var list = streams.ToList();
|
||||||
@ -117,9 +129,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
var videoStream = list.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
var videoStream = list.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||||
|
|
||||||
// This is abitrary but at some point it becomes too slow to extract subtitles on the fly
|
int maxAllowedBitrateForExternalSubtitleStream = GetMaxAllowedBitrateForExternalSubtitleStream();
|
||||||
// We need to learn more about when this is the case vs. when it isn't
|
|
||||||
const int maxAllowedBitrateForExternalSubtitleStream = 10000000;
|
|
||||||
|
|
||||||
var videoBitrate = videoStream == null ? maxAllowedBitrateForExternalSubtitleStream : videoStream.BitRate ?? maxAllowedBitrateForExternalSubtitleStream;
|
var videoBitrate = videoStream == null ? maxAllowedBitrateForExternalSubtitleStream : videoStream.BitRate ?? maxAllowedBitrateForExternalSubtitleStream;
|
||||||
|
|
||||||
|
@ -13,6 +13,12 @@ namespace MediaBrowser.Server.Mono.Native
|
|||||||
{
|
{
|
||||||
public abstract class BaseMonoApp : INativeApp
|
public abstract class BaseMonoApp : INativeApp
|
||||||
{
|
{
|
||||||
|
protected StartupOptions StartupOptions { get; private set; }
|
||||||
|
protected BaseMonoApp(StartupOptions startupOptions)
|
||||||
|
{
|
||||||
|
StartupOptions = startupOptions;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shutdowns this instance.
|
/// Shutdowns this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -111,7 +117,15 @@ namespace MediaBrowser.Server.Mono.Native
|
|||||||
|
|
||||||
public bool SupportsLibraryMonitor
|
public bool SupportsLibraryMonitor
|
||||||
{
|
{
|
||||||
get { return false; }
|
get
|
||||||
|
{
|
||||||
|
if (StartupOptions.ContainsOption("-allowrealtimemonitor"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConfigureAutoRun(bool autorun)
|
public void ConfigureAutoRun(bool autorun)
|
||||||
@ -170,6 +184,7 @@ namespace MediaBrowser.Server.Mono.Native
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Uname _unixName;
|
private Uname _unixName;
|
||||||
|
|
||||||
private Uname GetUnixName()
|
private Uname GetUnixName()
|
||||||
{
|
{
|
||||||
if (_unixName == null)
|
if (_unixName == null)
|
||||||
|
@ -7,6 +7,11 @@ namespace MediaBrowser.Server.Mono.Native
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class NativeApp : BaseMonoApp
|
internal class NativeApp : BaseMonoApp
|
||||||
{
|
{
|
||||||
|
public NativeApp(StartupOptions startupOptions)
|
||||||
|
: base(startupOptions)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shutdowns this instance.
|
/// Shutdowns this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -80,7 +80,7 @@ namespace MediaBrowser.Server.Mono
|
|||||||
var fileSystem = new ManagedFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")), false, true);
|
var fileSystem = new ManagedFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")), false, true);
|
||||||
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
|
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
|
||||||
|
|
||||||
var nativeApp = new NativeApp();
|
var nativeApp = new NativeApp(options);
|
||||||
|
|
||||||
_appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);
|
_appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user