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); return GetAvailableEncoder("h264_omx", defaultEncoder);
} }
if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(encodingOptions.VaapiDevice)) if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(encodingOptions.VaapiDevice))
{
if (IsVaapiSupported(state))
{ {
return GetAvailableEncoder("h264_vaapi", defaultEncoder); return GetAvailableEncoder("h264_vaapi", defaultEncoder);
} }
} }
}
return 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) private string GetAvailableEncoder(string preferredEncoder, string defaultEncoder)
{ {
if (MediaEncoder.SupportsEncoder(preferredEncoder)) if (MediaEncoder.SupportsEncoder(preferredEncoder))

View File

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

View File

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

View File

@ -587,14 +587,33 @@ namespace MediaBrowser.MediaEncoding.Encoder
return GetAvailableEncoder(mediaEncoder, "h264_omx", defaultEncoder); return GetAvailableEncoder(mediaEncoder, "h264_omx", defaultEncoder);
} }
if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(options.VaapiDevice)) if (string.Equals(hwType, "vaapi", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(options.VaapiDevice))
{
if (IsVaapiSupported(state))
{ {
return GetAvailableEncoder(mediaEncoder, "h264_vaapi", defaultEncoder); return GetAvailableEncoder(mediaEncoder, "h264_vaapi", defaultEncoder);
} }
} }
}
return 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) internal static bool CanStreamCopyVideo(EncodingJobOptions request, MediaStream videoStream)
{ {
if (videoStream.IsInterlaced) if (videoStream.IsInterlaced)

View File

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

View File

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

View File

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

View File

@ -1947,7 +1947,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
} }
else 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 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); await AddMediaInfo(stream, isAudio, cancellationToken).ConfigureAwait(false);
} }

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.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.664</version> <version>3.0.665</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <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> <description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <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="NLog" version="4.3.8" />
<dependency id="SimpleInjector" version="3.2.2" /> <dependency id="SimpleInjector" version="3.2.2" />
</dependencies> </dependencies>

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.664</version> <version>3.0.665</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.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.664</version> <version>3.0.665</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.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.664" /> <dependency id="MediaBrowser.Common" version="3.0.665" />
<dependency id="Interfaces.IO" version="1.0.0.5" /> <dependency id="Interfaces.IO" version="1.0.0.5" />
</dependencies> </dependencies>
</metadata> </metadata>