Merge pull request #2249 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-10-20 14:04:17 -04:00 committed by GitHub
commit f6afe90acd
12 changed files with 61 additions and 14 deletions

View File

@ -316,14 +316,33 @@ namespace MediaBrowser.Api.Playback
return GetAvailableEncoder("h264_omx", defaultEncoder);
}
if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(encodingOptions.VaapiDevice))
{
if (IsVaapiSupported(state))
{
return GetAvailableEncoder("h264_vaapi", defaultEncoder);
}
}
}
return defaultEncoder;
}
private bool IsVaapiSupported(StreamState state)
{
var videoStream = state.VideoStream;
if (videoStream != null)
{
// vaapi will throw an error with this input
// [vaapi @ 0x7faed8000960] No VAAPI support for codec mpeg4 profile -99.
if (string.Equals(videoStream.Codec, "mpeg4", StringComparison.OrdinalIgnoreCase) && videoStream.Level == -99)
{
return false;
}
}
return true;
}
private string GetAvailableEncoder(string preferredEncoder, string defaultEncoder)
{
if (MediaEncoder.SupportsEncoder(preferredEncoder))

View File

@ -886,7 +886,7 @@ namespace MediaBrowser.Api.Playback.Hls
var mapArgs = state.IsOutputVideo ? GetMapArgs(state) : string.Empty;
var enableSplittingOnNonKeyFrames = state.VideoRequest.EnableSplittingOnNonKeyFrames && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase);
enableSplittingOnNonKeyFrames = false;
// TODO: check libavformat version for 57 50.100 and use -hls_flags split_by_time
var hlsProtocolSupportsSplittingByTime = false;

View File

@ -125,7 +125,7 @@ namespace MediaBrowser.Api.Playback
SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate,
request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex,
request.SubtitleStreamIndex, request.PlaySessionId, request.UserId);
request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId);
}
else
{
@ -167,7 +167,7 @@ namespace MediaBrowser.Api.Playback
{
var mediaSourceId = request.MediaSourceId;
SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.UserId);
SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId);
}
return ToOptimizedResult(info);
@ -230,13 +230,14 @@ namespace MediaBrowser.Api.Playback
string mediaSourceId,
int? audioStreamIndex,
int? subtitleStreamIndex,
int? maxAudioChannels,
string userId)
{
var item = _libraryManager.GetItemById(itemId);
foreach (var mediaSource in result.MediaSources)
{
SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, result.PlaySessionId, userId);
SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId);
}
SortMediaSources(result, maxBitrate);
@ -251,6 +252,7 @@ namespace MediaBrowser.Api.Playback
string mediaSourceId,
int? audioStreamIndex,
int? subtitleStreamIndex,
int? maxAudioChannels,
string playSessionId,
string userId)
{
@ -262,7 +264,8 @@ namespace MediaBrowser.Api.Playback
Context = EncodingContext.Streaming,
DeviceId = auth.DeviceId,
ItemId = item.Id.ToString("N"),
Profile = profile
Profile = profile,
MaxAudioChannels = maxAudioChannels
};
if (string.Equals(mediaSourceId, mediaSource.Id, StringComparison.OrdinalIgnoreCase))

View File

@ -587,14 +587,33 @@ namespace MediaBrowser.MediaEncoding.Encoder
return GetAvailableEncoder(mediaEncoder, "h264_omx", defaultEncoder);
}
if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(options.VaapiDevice))
{
if (IsVaapiSupported(state))
{
return GetAvailableEncoder(mediaEncoder, "h264_vaapi", defaultEncoder);
}
}
}
return defaultEncoder;
}
private static bool IsVaapiSupported(EncodingJob state)
{
var videoStream = state.VideoStream;
if (videoStream != null)
{
// vaapi will throw an error with this input
// [vaapi @ 0x7faed8000960] No VAAPI support for codec mpeg4 profile -99.
if (string.Equals(videoStream.Codec, "mpeg4", StringComparison.OrdinalIgnoreCase) && videoStream.Level == -99)
{
return false;
}
}
return true;
}
internal static bool CanStreamCopyVideo(EncodingJobOptions request, MediaStream videoStream)
{
if (videoStream.IsInterlaced)

View File

@ -31,6 +31,7 @@ namespace MediaBrowser.Model.Dto
public bool RequiresOpening { get; set; }
public string OpenToken { get; set; }
public bool RequiresClosing { get; set; }
public bool SupportsProbing { get; set; }
public string LiveStreamId { get; set; }
public int? BufferMs { get; set; }
@ -63,6 +64,7 @@ namespace MediaBrowser.Model.Dto
SupportsTranscoding = true;
SupportsDirectStream = true;
SupportsDirectPlay = true;
SupportsProbing = true;
}
public int? DefaultAudioStreamIndex { get; set; }

View File

@ -11,6 +11,7 @@ namespace MediaBrowser.Model.MediaInfo
public long? StartTimeTicks { get; set; }
public int? AudioStreamIndex { get; set; }
public int? SubtitleStreamIndex { get; set; }
public int? MaxAudioChannels { get; set; }
public string ItemId { get; set; }
public DeviceProfile DeviceProfile { get; set; }
@ -24,6 +25,7 @@ namespace MediaBrowser.Model.MediaInfo
MaxStreamingBitrate = options.MaxBitrate;
ItemId = options.ItemId;
DeviceProfile = options.Profile;
MaxAudioChannels = options.MaxAudioChannels;
VideoOptions videoOptions = options as VideoOptions;
if (videoOptions != null)

View File

@ -16,6 +16,8 @@ namespace MediaBrowser.Model.MediaInfo
public int? SubtitleStreamIndex { get; set; }
public int? MaxAudioChannels { get; set; }
public string MediaSourceId { get; set; }
public string LiveStreamId { get; set; }

View File

@ -1947,7 +1947,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}
else
{
timers = timers.Where(i => !(i.Item1.Status == RecordingStatus.New));
timers = timers.Where(i => i.Item1.Status != RecordingStatus.New);
}
}

View File

@ -140,7 +140,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
try
{
if (stream.MediaStreams.Any(i => i.Index != -1))
if (!stream.SupportsProbing || stream.MediaStreams.Any(i => i.Index != -1))
{
await AddMediaInfo(stream, isAudio, cancellationToken).ConfigureAwait(false);
}

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.664</version>
<version>3.0.665</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Emby 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.664" />
<dependency id="MediaBrowser.Common" version="3.0.665" />
<dependency id="NLog" version="4.3.8" />
<dependency id="SimpleInjector" version="3.2.2" />
</dependencies>

View File

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

View File

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