update subtitle transcoding

This commit is contained in:
Luke Pulverenti 2015-10-05 12:05:08 -04:00
parent 26487dc455
commit e5fdf31ec4
6 changed files with 49 additions and 14 deletions

View file

@ -770,12 +770,12 @@ namespace MediaBrowser.Model.Dlna
{
return profile;
}
}
// For sync we can handle the longer extraction times
if (context == EncodingContext.Static && subtitleStream.IsTextSubtitleStream)
{
return profile;
// For sync we can handle the longer extraction times
if (context == EncodingContext.Static && subtitleStream.IsTextSubtitleStream)
{
return profile;
}
}
}
}

View file

@ -28,15 +28,20 @@ namespace MediaBrowser.Model.Dlna
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();
return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, language);
return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);
}
}
}

View file

@ -105,6 +105,18 @@ namespace MediaBrowser.Server.Implementations.Library
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)
{
var list = streams.ToList();
@ -117,9 +129,7 @@ namespace MediaBrowser.Server.Implementations.Library
{
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
// We need to learn more about when this is the case vs. when it isn't
const int maxAllowedBitrateForExternalSubtitleStream = 10000000;
int maxAllowedBitrateForExternalSubtitleStream = GetMaxAllowedBitrateForExternalSubtitleStream();
var videoBitrate = videoStream == null ? maxAllowedBitrateForExternalSubtitleStream : videoStream.BitRate ?? maxAllowedBitrateForExternalSubtitleStream;

View file

@ -13,6 +13,12 @@ namespace MediaBrowser.Server.Mono.Native
{
public abstract class BaseMonoApp : INativeApp
{
protected StartupOptions StartupOptions { get; private set; }
protected BaseMonoApp(StartupOptions startupOptions)
{
StartupOptions = startupOptions;
}
/// <summary>
/// Shutdowns this instance.
/// </summary>
@ -111,7 +117,15 @@ namespace MediaBrowser.Server.Mono.Native
public bool SupportsLibraryMonitor
{
get { return false; }
get
{
if (StartupOptions.ContainsOption("-allowrealtimemonitor"))
{
return true;
}
return false;
}
}
public void ConfigureAutoRun(bool autorun)
@ -170,6 +184,7 @@ namespace MediaBrowser.Server.Mono.Native
}
private Uname _unixName;
private Uname GetUnixName()
{
if (_unixName == null)

View file

@ -7,6 +7,11 @@ namespace MediaBrowser.Server.Mono.Native
/// </summary>
internal class NativeApp : BaseMonoApp
{
public NativeApp(StartupOptions startupOptions)
: base(startupOptions)
{
}
/// <summary>
/// Shutdowns this instance.
/// </summary>

View file

@ -80,7 +80,7 @@ namespace MediaBrowser.Server.Mono
var fileSystem = new ManagedFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")), false, true);
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
var nativeApp = new NativeApp();
var nativeApp = new NativeApp(options);
_appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);