add IgnoreDts option

This commit is contained in:
Luke Pulverenti 2017-04-30 16:03:28 -04:00
parent 7ef16a449a
commit 7ee588060d
7 changed files with 56 additions and 22 deletions

View file

@ -420,7 +420,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
SupportsDirectPlay = false, SupportsDirectPlay = false,
SupportsDirectStream = true, SupportsDirectStream = true,
SupportsTranscoding = true, SupportsTranscoding = true,
IsInfiniteStream = true IsInfiniteStream = true,
IgnoreDts = true
}; };
mediaSource.InferTotalBitrate(); mediaSource.InferTotalBitrate();

View file

@ -1517,12 +1517,6 @@ namespace MediaBrowser.Controller.MediaEncoding
inputModifier += " " + GetFastSeekCommandLineParameter(state.BaseRequest); inputModifier += " " + GetFastSeekCommandLineParameter(state.BaseRequest);
inputModifier = inputModifier.Trim(); inputModifier = inputModifier.Trim();
//inputModifier += " -fflags +genpts+ignidx+igndts";
//if (state.IsVideoRequest && genPts)
//{
// inputModifier += " -fflags +genpts";
//}
if (!string.IsNullOrEmpty(state.InputAudioSync)) if (!string.IsNullOrEmpty(state.InputAudioSync))
{ {
inputModifier += " -async " + state.InputAudioSync; inputModifier += " -async " + state.InputAudioSync;
@ -1538,6 +1532,21 @@ namespace MediaBrowser.Controller.MediaEncoding
inputModifier += " -re"; inputModifier += " -re";
} }
var flags = new List<string>();
if (state.IgnoreDts)
{
flags.Add("+igndts");
}
if (state.IgnoreIndex)
{
flags.Add("+ignidx");
}
if (flags.Count > 0)
{
inputModifier += " -fflags " + string.Join("", flags.ToArray());
}
var videoDecoder = GetVideoDecoder(state, encodingOptions); var videoDecoder = GetVideoDecoder(state, encodingOptions);
if (!string.IsNullOrWhiteSpace(videoDecoder)) if (!string.IsNullOrWhiteSpace(videoDecoder))
{ {
@ -1633,6 +1642,7 @@ namespace MediaBrowser.Controller.MediaEncoding
state.RunTimeTicks = mediaSource.RunTimeTicks; state.RunTimeTicks = mediaSource.RunTimeTicks;
state.RemoteHttpHeaders = mediaSource.RequiredHttpHeaders; state.RemoteHttpHeaders = mediaSource.RequiredHttpHeaders;
state.ReadInputAtNativeFramerate = mediaSource.ReadAtNativeFramerate; state.ReadInputAtNativeFramerate = mediaSource.ReadAtNativeFramerate;
state.IgnoreDts = mediaSource.IgnoreDts;
if (state.ReadInputAtNativeFramerate || if (state.ReadInputAtNativeFramerate ||
mediaSource.Protocol == MediaProtocol.File && string.Equals(mediaSource.Container, "wtv", StringComparison.OrdinalIgnoreCase)) mediaSource.Protocol == MediaProtocol.File && string.Equals(mediaSource.Container, "wtv", StringComparison.OrdinalIgnoreCase))

View file

@ -39,6 +39,16 @@ namespace MediaBrowser.Controller.MediaEncoding
public bool ReadInputAtNativeFramerate { get; set; } public bool ReadInputAtNativeFramerate { get; set; }
public bool IgnoreDts
{
get { return MediaSource.IgnoreDts; }
}
public bool IgnoreIndex
{
get { return MediaSource.IgnoreIndex; }
}
public string OutputContainer { get; set; } public string OutputContainer { get; set; }
public string OutputVideoSync public string OutputVideoSync

View file

@ -12,7 +12,9 @@ namespace MediaBrowser.Model.Dlna
new ResolutionConfiguration(426, 320000), new ResolutionConfiguration(426, 320000),
new ResolutionConfiguration(640, 400000), new ResolutionConfiguration(640, 400000),
new ResolutionConfiguration(720, 950000), new ResolutionConfiguration(720, 950000),
new ResolutionConfiguration(1280, 2500000) new ResolutionConfiguration(1280, 2500000),
new ResolutionConfiguration(1920, 4000000),
new ResolutionConfiguration(3840, 35000000)
}; };
public static ResolutionOptions Normalize(int? inputBitrate, public static ResolutionOptions Normalize(int? inputBitrate,
@ -35,19 +37,15 @@ namespace MediaBrowser.Model.Dlna
} }
} }
foreach (var config in Configurations) var resolutionConfig = GetResolutionConfiguration(outputBitrate);
if (resolutionConfig != null)
{ {
if (outputBitrate <= config.MaxBitrate) var originvalValue = maxWidth;
maxWidth = Math.Min(resolutionConfig.MaxWidth, maxWidth ?? resolutionConfig.MaxWidth);
if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value)
{ {
var originvalValue = maxWidth; maxHeight = null;
maxWidth = Math.Min(config.MaxWidth, maxWidth ?? config.MaxWidth);
if (!originvalValue.HasValue || originvalValue.Value != maxWidth.Value)
{
maxHeight = null;
}
break;
} }
} }
@ -58,6 +56,19 @@ namespace MediaBrowser.Model.Dlna
}; };
} }
private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate)
{
foreach (var config in Configurations)
{
if (outputBitrate <= config.MaxBitrate)
{
return config;
}
}
return null;
}
private static double GetVideoBitrateScaleFactor(string codec) private static double GetVideoBitrateScaleFactor(string codec)
{ {
if (StringHelper.EqualsIgnoreCase(codec, "h265") || if (StringHelper.EqualsIgnoreCase(codec, "h265") ||

View file

@ -29,6 +29,8 @@ namespace MediaBrowser.Model.Dto
public string ETag { get; set; } public string ETag { get; set; }
public long? RunTimeTicks { get; set; } public long? RunTimeTicks { get; set; }
public bool ReadAtNativeFramerate { get; set; } public bool ReadAtNativeFramerate { get; set; }
public bool IgnoreDts { get; set; }
public bool IgnoreIndex { get; set; }
public bool SupportsTranscoding { get; set; } public bool SupportsTranscoding { get; set; }
public bool SupportsDirectStream { get; set; } public bool SupportsDirectStream { get; set; }
public bool SupportsDirectPlay { get; set; } public bool SupportsDirectPlay { get; set; }

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.698</version> <version>3.0.699</version>
<title>Emby.Common</title> <title>Emby.Common</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View file

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.698</version> <version>3.0.699</version>
<title>Emby.Server.Core</title> <title>Emby.Server.Core</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Emby Server.</description> <description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.696" /> <dependency id="MediaBrowser.Common" version="3.0.699" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>