Merge pull request #1901 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-06-30 17:30:41 -04:00 committed by GitHub
commit a83f0487e0
5 changed files with 27 additions and 19 deletions

View File

@ -292,9 +292,9 @@ namespace MediaBrowser.Api.Playback
return "h264_qsv";
}
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "libnvenc", StringComparison.OrdinalIgnoreCase))
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase))
{
return "libnvenc";
return "h264_nvenc";
}
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase))
{
@ -338,8 +338,8 @@ namespace MediaBrowser.Api.Playback
}
// h264 (libnvenc)
else if (string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
// h264 (h264_nvenc)
else if (string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
{
param = "-preset high-performance";
}
@ -412,9 +412,9 @@ namespace MediaBrowser.Api.Playback
if (!string.IsNullOrEmpty(state.VideoRequest.Level))
{
// h264_qsv and libnvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
// h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
{
switch (state.VideoRequest.Level)
{
@ -458,7 +458,7 @@ namespace MediaBrowser.Api.Playback
if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) &&
!string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) &&
!string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
!string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
{
param = "-pix_fmt yuv420p " + param;
}
@ -1645,7 +1645,8 @@ namespace MediaBrowser.Api.Playback
var state = new StreamState(MediaSourceManager, Logger)
{
Request = request,
RequestedUrl = url
RequestedUrl = url,
UserAgent = Request.UserAgent
};
//if ((Request.UserAgent ?? string.Empty).IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 ||

View File

@ -74,10 +74,16 @@ namespace MediaBrowser.Api.Playback
get
{
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
var userAgent = UserAgent ?? string.Empty;
if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1)
{
return 10;
}
return 6;
}
return 3;
}
}
@ -99,6 +105,7 @@ namespace MediaBrowser.Api.Playback
public string OutputVideoSync = "-1";
public List<string> SupportedAudioCodecs { get; set; }
public string UserAgent { get; set; }
public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger)
{

View File

@ -607,10 +607,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
// h264 (libnvenc)
else if (string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
// h264 (h264_nvenc)
else if (string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
{
param = "-preset high-performance";
param = "-preset llhq";
}
// webm
@ -683,9 +683,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (!string.IsNullOrEmpty(levelString))
{
// h264_qsv and libnvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
// h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
{
switch (levelString)
{
@ -729,7 +729,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) &&
!string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) &&
!string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
!string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
{
param = "-pix_fmt yuv420p " + param;
}

View File

@ -85,7 +85,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
"libopus",
//"libvorbis",
"srt",
"libnvenc",
"h264_nvenc",
"h264_qsv"
};

View File

@ -562,9 +562,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
return "h264_qsv";
}
if (string.Equals(options.HardwareAccelerationType, "libnvenc", StringComparison.OrdinalIgnoreCase))
if (string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase))
{
return "libnvenc";
return "h264_nvenc";
}
if (string.Equals(options.HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase))
{