From e91f569c154e571f52ea6a86fc3920700c317a56 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 3 Jun 2017 03:36:32 -0400 Subject: update live tv startup --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 54a361ff7e..82d18a3738 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1604,7 +1604,7 @@ namespace MediaBrowser.Controller.MediaEncoding } // Only do this for video files due to sometimes unpredictable codec names coming from BDInfo - if (state.RunTimeTicks.HasValue && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) + if (state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) { foreach (var stream in state.MediaSource.MediaStreams) { -- cgit v1.2.3 From 820b4873fb669b5a273817d68f3fbfc216b6610e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 4 Jun 2017 16:28:27 -0400 Subject: move methods to base class --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 1 - MediaBrowser.Api/Playback/StreamState.cs | 242 ------------------- .../MediaEncoding/EncodingJobInfo.cs | 267 ++++++++++++++++++++- MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs | 242 ------------------- .../Encoder/EncodingJobFactory.cs | 1 - MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 7 +- 6 files changed, 267 insertions(+), 493 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 3ffa26450f..bbee361995 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -783,7 +783,6 @@ namespace MediaBrowser.Api.Playback state.OutputContainer = (container ?? string.Empty).TrimStart('.'); state.OutputAudioBitrate = EncodingHelper.GetAudioBitrateParam(state.Request, state.AudioStream); - state.OutputAudioSampleRate = request.AudioSampleRate; state.OutputAudioCodec = state.Request.AudioCodec; diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index 1daca9e33c..2cf7d81af7 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -250,248 +250,6 @@ namespace MediaBrowser.Api.Playback public DeviceProfile DeviceProfile { get; set; } - public int? TotalOutputBitrate - { - get - { - return (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0); - } - } - - public int? OutputWidth - { - get - { - if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue) - { - var size = new ImageSize - { - Width = VideoStream.Width.Value, - Height = VideoStream.Height.Value - }; - - var newSize = DrawingUtils.Resize(size, - VideoRequest.Width, - VideoRequest.Height, - VideoRequest.MaxWidth, - VideoRequest.MaxHeight); - - return Convert.ToInt32(newSize.Width); - } - - if (VideoRequest == null) - { - return null; - } - - return VideoRequest.MaxWidth ?? VideoRequest.Width; - } - } - - public int? OutputHeight - { - get - { - if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue) - { - var size = new ImageSize - { - Width = VideoStream.Width.Value, - Height = VideoStream.Height.Value - }; - - var newSize = DrawingUtils.Resize(size, - VideoRequest.Width, - VideoRequest.Height, - VideoRequest.MaxWidth, - VideoRequest.MaxHeight); - - return Convert.ToInt32(newSize.Height); - } - - if (VideoRequest == null) - { - return null; - } - - return VideoRequest.MaxHeight ?? VideoRequest.Height; - } - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public int? TargetVideoBitDepth - { - get - { - var stream = VideoStream; - return stream == null || !Request.Static ? null : stream.BitDepth; - } - } - - /// - /// Gets the target reference frames. - /// - /// The target reference frames. - public int? TargetRefFrames - { - get - { - var stream = VideoStream; - return stream == null || !Request.Static ? null : stream.RefFrames; - } - } - - public int? TargetVideoStreamCount - { - get - { - if (Request.Static) - { - return GetMediaStreamCount(MediaStreamType.Video, int.MaxValue); - } - return GetMediaStreamCount(MediaStreamType.Video, 1); - } - } - - public int? TargetAudioStreamCount - { - get - { - if (Request.Static) - { - return GetMediaStreamCount(MediaStreamType.Audio, int.MaxValue); - } - return GetMediaStreamCount(MediaStreamType.Audio, 1); - } - } - - public bool? IsTargetAnamorphic - { - get - { - if (Request.Static) - { - return VideoStream == null ? null : VideoStream.IsAnamorphic; - } - - return false; - } - } - - public bool? IsTargetInterlaced - { - get - { - if (Request.Static) - { - return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced; - } - - if (DeInterlace) - { - return false; - } - - return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced; - } - } - - private int? GetMediaStreamCount(MediaStreamType type, int limit) - { - var count = MediaSource.GetStreamCount(type); - - if (count.HasValue) - { - count = Math.Min(count.Value, limit); - } - - return count; - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public float? TargetFramerate - { - get - { - var stream = VideoStream; - var requestedFramerate = VideoRequest.MaxFramerate ?? VideoRequest.Framerate; - - return requestedFramerate.HasValue && !Request.Static - ? requestedFramerate - : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate; - } - } - - public TransportStreamTimestamp TargetTimestamp - { - get - { - var defaultValue = string.Equals(OutputContainer, "m2ts", StringComparison.OrdinalIgnoreCase) ? - TransportStreamTimestamp.Valid : - TransportStreamTimestamp.None; - - return !Request.Static - ? defaultValue - : InputTimestamp; - } - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public int? TargetPacketLength - { - get - { - var stream = VideoStream; - return !Request.Static - ? null - : stream == null ? null : stream.PacketLength; - } - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public string TargetVideoProfile - { - get - { - var stream = VideoStream; - return !string.IsNullOrEmpty(VideoRequest.Profile) && !Request.Static - ? VideoRequest.Profile - : stream == null ? null : stream.Profile; - } - } - - public string TargetVideoCodecTag - { - get - { - var stream = VideoStream; - return !Request.Static - ? null - : stream == null ? null : stream.CodecTag; - } - } - - public bool? IsTargetAVC - { - get - { - if (Request.Static) - { - return VideoStream == null ? null : VideoStream.IsAVC; - } - - return true; - } - } - public TranscodingJob TranscodingJob; public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate) { diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs index 9b89e8f5aa..57c81ddf76 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs @@ -8,6 +8,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Drawing; namespace MediaBrowser.Controller.MediaEncoding { @@ -134,7 +135,6 @@ namespace MediaBrowser.Controller.MediaEncoding public int? OutputAudioBitrate; public int? OutputAudioChannels; - public int? OutputAudioSampleRate; public bool DeInterlace { get; set; } public bool IsVideoRequest { get; set; } public TranscodingJobType TranscodingType { get; set; } @@ -173,6 +173,97 @@ namespace MediaBrowser.Controller.MediaEncoding return false; } + public int? TotalOutputBitrate + { + get + { + return (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0); + } + } + + public int? OutputWidth + { + get + { + if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue) + { + var size = new ImageSize + { + Width = VideoStream.Width.Value, + Height = VideoStream.Height.Value + }; + + var newSize = DrawingUtils.Resize(size, + BaseRequest.Width, + BaseRequest.Height, + BaseRequest.MaxWidth, + BaseRequest.MaxHeight); + + return Convert.ToInt32(newSize.Width); + } + + if (!IsVideoRequest) + { + return null; + } + + return BaseRequest.MaxWidth ?? BaseRequest.Width; + } + } + + public int? OutputHeight + { + get + { + if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue) + { + var size = new ImageSize + { + Width = VideoStream.Width.Value, + Height = VideoStream.Height.Value + }; + + var newSize = DrawingUtils.Resize(size, + BaseRequest.Width, + BaseRequest.Height, + BaseRequest.MaxWidth, + BaseRequest.MaxHeight); + + return Convert.ToInt32(newSize.Height); + } + + if (!IsVideoRequest) + { + return null; + } + + return BaseRequest.MaxHeight ?? BaseRequest.Height; + } + } + + public int? OutputAudioSampleRate + { + get + { + if (BaseRequest.Static || string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase)) + { + if (AudioStream != null) + { + return AudioStream.SampleRate; + } + } + + else if (BaseRequest.AudioSampleRate.HasValue) + { + // Don't exceed what the encoder supports + // Seeing issues of attempting to encode to 88200 + return Math.Min(44100, BaseRequest.AudioSampleRate.Value); + } + + return null; + } + } + /// /// Predicts the audio sample rate that will be in the output stream /// @@ -189,6 +280,180 @@ namespace MediaBrowser.Controller.MediaEncoding } } + /// + /// Predicts the audio sample rate that will be in the output stream + /// + public int? TargetVideoBitDepth + { + get + { + var stream = VideoStream; + return stream == null || !BaseRequest.Static ? null : stream.BitDepth; + } + } + + /// + /// Gets the target reference frames. + /// + /// The target reference frames. + public int? TargetRefFrames + { + get + { + var stream = VideoStream; + return stream == null || !BaseRequest.Static ? null : stream.RefFrames; + } + } + + /// + /// Predicts the audio sample rate that will be in the output stream + /// + public float? TargetFramerate + { + get + { + var stream = VideoStream; + var requestedFramerate = BaseRequest.MaxFramerate ?? BaseRequest.Framerate; + + return requestedFramerate.HasValue && !BaseRequest.Static + ? requestedFramerate + : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate; + } + } + + public TransportStreamTimestamp TargetTimestamp + { + get + { + var defaultValue = string.Equals(OutputContainer, "m2ts", StringComparison.OrdinalIgnoreCase) ? + TransportStreamTimestamp.Valid : + TransportStreamTimestamp.None; + + return !BaseRequest.Static + ? defaultValue + : InputTimestamp; + } + } + + /// + /// Predicts the audio sample rate that will be in the output stream + /// + public int? TargetPacketLength + { + get + { + var stream = VideoStream; + return !BaseRequest.Static + ? null + : stream == null ? null : stream.PacketLength; + } + } + + /// + /// Predicts the audio sample rate that will be in the output stream + /// + public string TargetVideoProfile + { + get + { + var stream = VideoStream; + return !string.IsNullOrEmpty(BaseRequest.Profile) && !BaseRequest.Static + ? BaseRequest.Profile + : stream == null ? null : stream.Profile; + } + } + + public string TargetVideoCodecTag + { + get + { + var stream = VideoStream; + return !BaseRequest.Static + ? null + : stream == null ? null : stream.CodecTag; + } + } + + public bool? IsTargetAnamorphic + { + get + { + if (BaseRequest.Static) + { + return VideoStream == null ? null : VideoStream.IsAnamorphic; + } + + return false; + } + } + + public bool? IsTargetInterlaced + { + get + { + if (BaseRequest.Static) + { + return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced; + } + + if (DeInterlace) + { + return false; + } + + return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced; + } + } + + public bool? IsTargetAVC + { + get + { + if (BaseRequest.Static) + { + return VideoStream == null ? null : VideoStream.IsAVC; + } + + return false; + } + } + + public int? TargetVideoStreamCount + { + get + { + if (BaseRequest.Static) + { + return GetMediaStreamCount(MediaStreamType.Video, int.MaxValue); + } + return GetMediaStreamCount(MediaStreamType.Video, 1); + } + } + + public int? TargetAudioStreamCount + { + get + { + if (BaseRequest.Static) + { + return GetMediaStreamCount(MediaStreamType.Audio, int.MaxValue); + } + return GetMediaStreamCount(MediaStreamType.Audio, 1); + } + } + + private int? GetMediaStreamCount(MediaStreamType type, int limit) + { + var count = MediaSource.GetStreamCount(type); + + if (count.HasValue) + { + count = Math.Min(count.Value, limit); + } + + return count; + } + protected void DisposeIsoMount() { if (IsoMount != null) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs index 97623c44b7..d53701feb3 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs @@ -150,248 +150,6 @@ namespace MediaBrowser.MediaEncoding.Encoder } } - public int? TotalOutputBitrate - { - get - { - return (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0); - } - } - - public int? OutputWidth - { - get - { - if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue) - { - var size = new ImageSize - { - Width = VideoStream.Width.Value, - Height = VideoStream.Height.Value - }; - - var newSize = DrawingUtils.Resize(size, - Options.Width, - Options.Height, - Options.MaxWidth, - Options.MaxHeight); - - return Convert.ToInt32(newSize.Width); - } - - if (!IsVideoRequest) - { - return null; - } - - return Options.MaxWidth ?? Options.Width; - } - } - - public int? OutputHeight - { - get - { - if (VideoStream != null && VideoStream.Width.HasValue && VideoStream.Height.HasValue) - { - var size = new ImageSize - { - Width = VideoStream.Width.Value, - Height = VideoStream.Height.Value - }; - - var newSize = DrawingUtils.Resize(size, - Options.Width, - Options.Height, - Options.MaxWidth, - Options.MaxHeight); - - return Convert.ToInt32(newSize.Height); - } - - if (!IsVideoRequest) - { - return null; - } - - return Options.MaxHeight ?? Options.Height; - } - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public int? TargetVideoBitDepth - { - get - { - var stream = VideoStream; - return stream == null || !Options.Static ? null : stream.BitDepth; - } - } - - /// - /// Gets the target reference frames. - /// - /// The target reference frames. - public int? TargetRefFrames - { - get - { - var stream = VideoStream; - return stream == null || !Options.Static ? null : stream.RefFrames; - } - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public float? TargetFramerate - { - get - { - var stream = VideoStream; - var requestedFramerate = Options.MaxFramerate ?? Options.Framerate; - - return requestedFramerate.HasValue && !Options.Static - ? requestedFramerate - : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate; - } - } - - public TransportStreamTimestamp TargetTimestamp - { - get - { - var defaultValue = string.Equals(OutputContainer, "m2ts", StringComparison.OrdinalIgnoreCase) ? - TransportStreamTimestamp.Valid : - TransportStreamTimestamp.None; - - return !Options.Static - ? defaultValue - : InputTimestamp; - } - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public int? TargetPacketLength - { - get - { - var stream = VideoStream; - return !Options.Static - ? null - : stream == null ? null : stream.PacketLength; - } - } - - /// - /// Predicts the audio sample rate that will be in the output stream - /// - public string TargetVideoProfile - { - get - { - var stream = VideoStream; - return !string.IsNullOrEmpty(Options.Profile) && !Options.Static - ? Options.Profile - : stream == null ? null : stream.Profile; - } - } - - public string TargetVideoCodecTag - { - get - { - var stream = VideoStream; - return !Options.Static - ? null - : stream == null ? null : stream.CodecTag; - } - } - - public bool? IsTargetAnamorphic - { - get - { - if (Options.Static) - { - return VideoStream == null ? null : VideoStream.IsAnamorphic; - } - - return false; - } - } - - public bool? IsTargetInterlaced - { - get - { - if (Options.Static) - { - return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced; - } - - if (DeInterlace) - { - return false; - } - - return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced; - } - } - - public bool? IsTargetAVC - { - get - { - if (Options.Static) - { - return VideoStream == null ? null : VideoStream.IsAVC; - } - - return false; - } - } - - public int? TargetVideoStreamCount - { - get - { - if (Options.Static) - { - return GetMediaStreamCount(MediaStreamType.Video, int.MaxValue); - } - return GetMediaStreamCount(MediaStreamType.Video, 1); - } - } - - public int? TargetAudioStreamCount - { - get - { - if (Options.Static) - { - return GetMediaStreamCount(MediaStreamType.Audio, int.MaxValue); - } - return GetMediaStreamCount(MediaStreamType.Audio, 1); - } - } - - private int? GetMediaStreamCount(MediaStreamType type, int limit) - { - var count = MediaSource.GetStreamCount(type); - - if (count.HasValue) - { - count = Math.Min(count.Value, limit); - } - - return count; - } - public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate) { var ticks = transcodingPosition.HasValue ? transcodingPosition.Value.Ticks : (long?)null; diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs index c74a8ce37a..ba5f625f50 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs @@ -105,7 +105,6 @@ namespace MediaBrowser.MediaEncoding.Encoder //state.OutputContainer = (container ?? string.Empty).TrimStart('.'); state.OutputAudioBitrate = encodingHelper.GetAudioBitrateParam(state.Options, state.AudioStream); - state.OutputAudioSampleRate = request.AudioSampleRate; state.OutputAudioCodec = state.Options.AudioCodec; diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 280b01ee22..faf5b06677 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -80,11 +80,6 @@ namespace MediaBrowser.MediaEncoding.Encoder int defaultImageExtractionTimeoutMs, bool enableEncoderFontFile, IEnvironmentInfo environmentInfo) { - if (jsonSerializer == null) - { - throw new ArgumentNullException("jsonSerializer"); - } - _logger = logger; _jsonSerializer = jsonSerializer; ConfigurationManager = configurationManager; @@ -330,7 +325,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } var newPaths = GetEncoderPaths(appPath); - if (string.IsNullOrWhiteSpace(newPaths.Item1) || string.IsNullOrWhiteSpace(newPaths.Item2)) + if (string.IsNullOrWhiteSpace(newPaths.Item1) || string.IsNullOrWhiteSpace(newPaths.Item2) || IsSystemInstalledPath(appPath)) { newPaths = TestForInstalledVersions(); } -- cgit v1.2.3 From 282dce7f1060bcaa49ba54f7cf91cd6a7cf3c3a4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 9 Jun 2017 15:26:54 -0400 Subject: normalize session object --- .../Activity/ActivityLogEntryPoint.cs | 4 +- .../Notifications/Notifications.cs | 5 +- .../Session/SessionManager.cs | 200 ++++++--------------- MediaBrowser.Api/Session/SessionsService.cs | 23 +-- .../Entities/InternalItemsQuery.cs | 2 + .../Library/PlaybackProgressEventArgs.cs | 4 +- .../MediaEncoding/EncodingHelper.cs | 2 +- MediaBrowser.Controller/Session/ISessionManager.cs | 4 +- MediaBrowser.Controller/Session/SessionInfo.cs | 6 +- MediaBrowser.Model/Entities/BaseItemInfo.cs | 178 ------------------ MediaBrowser.Model/MediaBrowser.Model.csproj | 1 - MediaBrowser.Model/Session/PlaybackProgressInfo.cs | 6 +- MediaBrowser.Model/Session/PlaybackStopInfo.cs | 4 +- MediaBrowser.Model/Session/SessionInfoDto.cs | 6 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 16 files changed, 79 insertions(+), 372 deletions(-) delete mode 100644 MediaBrowser.Model/Entities/BaseItemInfo.cs (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs index d3b2ef7ef7..567f139fd8 100644 --- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs +++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs @@ -123,7 +123,7 @@ namespace Emby.Server.Implementations.Activity return; } - if (item.IsThemeMedia) + if (e.Item != null && e.Item.IsThemeMedia) { // Don't report theme song or local trailer playback return; @@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.Activity return; } - if (item.IsThemeMedia) + if (e.Item != null && e.Item.IsThemeMedia) { // Don't report theme song or local trailer playback return; diff --git a/Emby.Server.Implementations/Notifications/Notifications.cs b/Emby.Server.Implementations/Notifications/Notifications.cs index 8f24dfe1a3..f95b3f701a 100644 --- a/Emby.Server.Implementations/Notifications/Notifications.cs +++ b/Emby.Server.Implementations/Notifications/Notifications.cs @@ -23,6 +23,7 @@ using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Model.Threading; +using MediaBrowser.Model.Dto; namespace Emby.Server.Implementations.Notifications { @@ -260,7 +261,7 @@ namespace Emby.Server.Implementations.Notifications var item = e.MediaInfo; - if ( item.IsThemeMedia) + if (e.Item != null && e.Item.IsThemeMedia) { // Don't report theme song or local trailer playback return; @@ -430,7 +431,7 @@ namespace Emby.Server.Implementations.Notifications return name; } - public static string GetItemName(BaseItemInfo item) + public static string GetItemName(BaseItemDto item) { var name = item.Name; diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 42cd5d1b1e..a5582ddc55 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -338,7 +338,7 @@ namespace Emby.Server.Implementations.Session } } - info.Item = GetItemInfo(libraryItem, libraryItem, mediaSource); + info.Item = GetItemInfo(libraryItem, mediaSource); info.Item.RunTimeTicks = runtimeTicks; } @@ -813,7 +813,7 @@ namespace Emby.Server.Implementations.Session mediaSource = await GetMediaSource(hasMediaSources, info.MediaSourceId, info.LiveStreamId).ConfigureAwait(false); } - info.Item = GetItemInfo(libraryItem, libraryItem, mediaSource); + info.Item = GetItemInfo(libraryItem, mediaSource); } else { @@ -1637,165 +1637,65 @@ namespace Emby.Server.Implementations.Session return dto; } + private DtoOptions _itemInfoDtoOptions; + /// /// Converts a BaseItem to a BaseItemInfo /// - /// The item. - /// The chapter owner. - /// The media source. - /// BaseItemInfo. - /// item - private BaseItemInfo GetItemInfo(BaseItem item, BaseItem chapterOwner, MediaSourceInfo mediaSource) + private BaseItemDto GetItemInfo(BaseItem item, MediaSourceInfo mediaSource) { if (item == null) { throw new ArgumentNullException("item"); } - var info = new BaseItemInfo - { - Id = GetDtoId(item), - Name = item.Name, - MediaType = item.MediaType, - Type = item.GetClientTypeName(), - RunTimeTicks = item.RunTimeTicks, - IndexNumber = item.IndexNumber, - ParentIndexNumber = item.ParentIndexNumber, - PremiereDate = item.PremiereDate, - ProductionYear = item.ProductionYear, - IsThemeMedia = item.IsThemeMedia - }; - - info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary); - if (info.PrimaryImageTag != null) - { - info.PrimaryImageItemId = GetDtoId(item); - } - - var episode = item as Episode; - if (episode != null) - { - info.IndexNumberEnd = episode.IndexNumberEnd; - } - - var hasSeries = item as IHasSeries; - if (hasSeries != null) - { - info.SeriesName = hasSeries.SeriesName; - } - - var recording = item as ILiveTvRecording; - if (recording != null) - { - if (recording.IsSeries) - { - info.Name = recording.EpisodeTitle; - info.SeriesName = recording.Name; - - if (string.IsNullOrWhiteSpace(info.Name)) - { - info.Name = recording.Name; - } - } - } - - var audio = item as Audio; - if (audio != null) - { - info.Album = audio.Album; - info.Artists = audio.Artists; - - if (info.PrimaryImageTag == null) - { - var album = audio.AlbumEntity; - - if (album != null && album.HasImage(ImageType.Primary)) - { - info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary); - if (info.PrimaryImageTag != null) - { - info.PrimaryImageItemId = GetDtoId(album); - } - } - } - } - - var musicVideo = item as MusicVideo; - if (musicVideo != null) - { - info.Album = musicVideo.Album; - info.Artists = musicVideo.Artists.ToList(); - } - - var backropItem = item.HasImage(ImageType.Backdrop) ? item : null; - var thumbItem = item.HasImage(ImageType.Thumb) ? item : null; - var logoItem = item.HasImage(ImageType.Logo) ? item : null; - - if (thumbItem == null) - { - if (episode != null) - { - var series = episode.Series; - - if (series != null && series.HasImage(ImageType.Thumb)) - { - thumbItem = series; - } - } - } + var dtoOptions = _itemInfoDtoOptions; - if (backropItem == null) + if (_itemInfoDtoOptions == null) { - if (episode != null) + dtoOptions = new DtoOptions { - var series = episode.Series; - - if (series != null && series.HasImage(ImageType.Backdrop)) - { - backropItem = series; - } - } - } - - if (backropItem == null) - { - backropItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Backdrop)); - } - - if (thumbItem == null) - { - thumbItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Thumb)); - } - - if (logoItem == null) - { - logoItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Logo)); - } - - if (thumbItem != null) - { - info.ThumbImageTag = GetImageCacheTag(thumbItem, ImageType.Thumb); - info.ThumbItemId = GetDtoId(thumbItem); - } - - if (backropItem != null) - { - info.BackdropImageTag = GetImageCacheTag(backropItem, ImageType.Backdrop); - info.BackdropItemId = GetDtoId(backropItem); - } - - if (logoItem != null) - { - info.LogoImageTag = GetImageCacheTag(logoItem, ImageType.Logo); - info.LogoItemId = GetDtoId(logoItem); - } - - if (chapterOwner != null) - { - info.ChapterImagesItemId = chapterOwner.Id.ToString("N"); - - info.Chapters = _dtoService.GetChapterInfoDtos(chapterOwner).ToList(); - } + AddProgramRecordingInfo = false + }; + + dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo); + dtoOptions.Fields.Remove(ItemFields.SyncInfo); + dtoOptions.Fields.Remove(ItemFields.CanDelete); + dtoOptions.Fields.Remove(ItemFields.CanDownload); + dtoOptions.Fields.Remove(ItemFields.ChildCount); + dtoOptions.Fields.Remove(ItemFields.CustomRating); + dtoOptions.Fields.Remove(ItemFields.DateLastMediaAdded); + dtoOptions.Fields.Remove(ItemFields.DateLastRefreshed); + dtoOptions.Fields.Remove(ItemFields.DateLastSaved); + dtoOptions.Fields.Remove(ItemFields.DisplayMediaType); + dtoOptions.Fields.Remove(ItemFields.DisplayPreferencesId); + dtoOptions.Fields.Remove(ItemFields.Etag); + dtoOptions.Fields.Remove(ItemFields.ExternalEtag); + dtoOptions.Fields.Remove(ItemFields.IndexOptions); + dtoOptions.Fields.Remove(ItemFields.InheritedParentalRatingValue); + dtoOptions.Fields.Remove(ItemFields.ItemCounts); + dtoOptions.Fields.Remove(ItemFields.Keywords); + dtoOptions.Fields.Remove(ItemFields.MediaSourceCount); + dtoOptions.Fields.Remove(ItemFields.MediaStreams); + dtoOptions.Fields.Remove(ItemFields.MediaSources); + dtoOptions.Fields.Remove(ItemFields.People); + dtoOptions.Fields.Remove(ItemFields.PlayAccess); + dtoOptions.Fields.Remove(ItemFields.People); + dtoOptions.Fields.Remove(ItemFields.ProductionLocations); + dtoOptions.Fields.Remove(ItemFields.RecursiveItemCount); + dtoOptions.Fields.Remove(ItemFields.RemoteTrailers); + dtoOptions.Fields.Remove(ItemFields.SeasonUserData); + dtoOptions.Fields.Remove(ItemFields.SeriesGenres); + dtoOptions.Fields.Remove(ItemFields.Settings); + dtoOptions.Fields.Remove(ItemFields.SortName); + dtoOptions.Fields.Remove(ItemFields.Tags); + dtoOptions.Fields.Remove(ItemFields.ThemeSongIds); + dtoOptions.Fields.Remove(ItemFields.ThemeVideoIds); + + _itemInfoDtoOptions = dtoOptions; + } + + var info = _dtoService.GetBaseItemDto(item, dtoOptions); if (mediaSource != null) { @@ -1837,7 +1737,7 @@ namespace Emby.Server.Implementations.Session //ReportNowViewingItem(sessionId, info); } - public void ReportNowViewingItem(string sessionId, BaseItemInfo item) + public void ReportNowViewingItem(string sessionId, BaseItemDto item) { //var session = GetSession(sessionId); diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index a424412684..358d09c182 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -98,7 +98,7 @@ namespace MediaBrowser.Api.Session [Route("/Sessions/{Id}/Playing/{Command}", "POST", Summary = "Issues a playstate command to a client")] [Authenticated] - public class SendPlaystateCommand : IReturnVoid + public class SendPlaystateCommand : PlaystateRequest, IReturnVoid { /// /// Gets or sets the id. @@ -106,19 +106,6 @@ namespace MediaBrowser.Api.Session /// The id. [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public string Id { get; set; } - - /// - /// Gets or sets the position to seek to - /// - [ApiMember(Name = "SeekPositionTicks", Description = "The position to seek to.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] - public long? SeekPositionTicks { get; set; } - - /// - /// Gets or sets the play command. - /// - /// The play command. - [ApiMember(Name = "Command", Description = "The command to send - stop, pause, unpause, nexttrack, previoustrack, seek, fullscreen.", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public PlaystateCommand Command { get; set; } } [Route("/Sessions/{Id}/System/{Command}", "POST", Summary = "Issues a system command to a client")] @@ -414,13 +401,7 @@ namespace MediaBrowser.Api.Session public void Post(SendPlaystateCommand request) { - var command = new PlaystateRequest - { - Command = request.Command, - SeekPositionTicks = request.SeekPositionTicks - }; - - var task = _sessionManager.SendPlaystateCommand(GetSession(_sessionContext).Result.Id, request.Id, command, CancellationToken.None); + var task = _sessionManager.SendPlaystateCommand(GetSession(_sessionContext).Result.Id, request.Id, request, CancellationToken.None); Task.WaitAll(task); } diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index f3caac492c..4d96c082fb 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -149,6 +149,7 @@ namespace MediaBrowser.Controller.Entities public string[] PresetViews { get; set; } public TrailerType[] TrailerTypes { get; set; } + public SourceType[] SourceTypes { get; set; } public DayOfWeek[] AirDays { get; set; } public SeriesStatus[] SeriesStatuses { get; set; } @@ -214,6 +215,7 @@ namespace MediaBrowser.Controller.Entities ExcludeInheritedTags = new string[] { }; PresetViews = new string[] { }; TrailerTypes = new TrailerType[] { }; + SourceTypes = new SourceType[] { }; AirDays = new DayOfWeek[] { }; SeriesStatuses = new SeriesStatus[] { }; OrderBy = new List>(); diff --git a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs index 0644719b64..9f98182ba3 100644 --- a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs +++ b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs @@ -1,5 +1,5 @@ using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Dto; using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Library public List Users { get; set; } public long? PlaybackPositionTicks { get; set; } public BaseItem Item { get; set; } - public BaseItemInfo MediaInfo { get; set; } + public BaseItemDto MediaInfo { get; set; } public string MediaSourceId { get; set; } public bool IsPaused { get; set; } public bool IsAutomated { get; set; } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 82d18a3738..f790bb1a17 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1604,7 +1604,7 @@ namespace MediaBrowser.Controller.MediaEncoding } // Only do this for video files due to sometimes unpredictable codec names coming from BDInfo - if (state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) + if (state.VideoType == VideoType.VideoFile && state.RunTimeTicks.HasValue && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) { foreach (var stream in state.MediaSource.MediaStreams) { diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs index 956d4cc95f..8d77e07479 100644 --- a/MediaBrowser.Controller/Session/ISessionManager.cs +++ b/MediaBrowser.Controller/Session/ISessionManager.cs @@ -1,7 +1,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Security; -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.Events; using MediaBrowser.Model.Session; using MediaBrowser.Model.Users; @@ -249,7 +249,7 @@ namespace MediaBrowser.Controller.Session /// /// The session identifier. /// The item. - void ReportNowViewingItem(string sessionId, BaseItemInfo item); + void ReportNowViewingItem(string sessionId, BaseItemDto item); /// /// Authenticates the new session. diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 5cef56d1cd..f590d9aec1 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.Session; using System; using System.Collections.Generic; @@ -100,13 +100,13 @@ namespace MediaBrowser.Controller.Session /// Gets or sets the name of the now viewing item. /// /// The name of the now viewing item. - public BaseItemInfo NowViewingItem { get; set; } + public BaseItemDto NowViewingItem { get; set; } /// /// Gets or sets the now playing item. /// /// The now playing item. - public BaseItemInfo NowPlayingItem { get; set; } + public BaseItemDto NowPlayingItem { get; set; } public BaseItem FullNowPlayingItem { get; set; } diff --git a/MediaBrowser.Model/Entities/BaseItemInfo.cs b/MediaBrowser.Model/Entities/BaseItemInfo.cs deleted file mode 100644 index db6c4b3fa7..0000000000 --- a/MediaBrowser.Model/Entities/BaseItemInfo.cs +++ /dev/null @@ -1,178 +0,0 @@ -using MediaBrowser.Model.Dto; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using MediaBrowser.Model.Serialization; - -namespace MediaBrowser.Model.Entities -{ - /// - /// This is a stub class containing only basic information about an item - /// - [DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")] - public class BaseItemInfo - { - /// - /// Gets or sets the name. - /// - /// The name. - public string Name { get; set; } - - /// - /// Gets or sets the id. - /// - /// The id. - public string Id { get; set; } - - /// - /// Gets or sets the type. - /// - /// The type. - public string Type { get; set; } - - /// - /// Gets or sets the type of the media. - /// - /// The type of the media. - public string MediaType { get; set; } - - /// - /// Gets or sets the run time ticks. - /// - /// The run time ticks. - public long? RunTimeTicks { get; set; } - - /// - /// Gets or sets the primary image tag. - /// - /// The primary image tag. - public string PrimaryImageTag { get; set; } - - /// - /// Gets or sets the primary image item identifier. - /// - /// The primary image item identifier. - public string PrimaryImageItemId { get; set; } - - /// - /// Gets or sets the logo image tag. - /// - /// The logo image tag. - public string LogoImageTag { get; set; } - - /// - /// Gets or sets the logo item identifier. - /// - /// The logo item identifier. - public string LogoItemId { get; set; } - - /// - /// Gets or sets the thumb image tag. - /// - /// The thumb image tag. - public string ThumbImageTag { get; set; } - - /// - /// Gets or sets the thumb item identifier. - /// - /// The thumb item identifier. - public string ThumbItemId { get; set; } - - /// - /// Gets or sets the thumb image tag. - /// - /// The thumb image tag. - public string BackdropImageTag { get; set; } - - /// - /// Gets or sets the thumb item identifier. - /// - /// The thumb item identifier. - public string BackdropItemId { get; set; } - - /// - /// Gets or sets the premiere date. - /// - /// The premiere date. - public DateTime? PremiereDate { get; set; } - - /// - /// Gets or sets the production year. - /// - /// The production year. - public int? ProductionYear { get; set; } - - /// - /// Gets or sets the index number. - /// - /// The index number. - public int? IndexNumber { get; set; } - - /// - /// Gets or sets the index number end. - /// - /// The index number end. - public int? IndexNumberEnd { get; set; } - - /// - /// Gets or sets the parent index number. - /// - /// The parent index number. - public int? ParentIndexNumber { get; set; } - - /// - /// Gets or sets the name of the series. - /// - /// The name of the series. - public string SeriesName { get; set; } - - /// - /// Gets or sets the album. - /// - /// The album. - public string Album { get; set; } - - public bool IsThemeMedia { get; set; } - - /// - /// Gets or sets the artists. - /// - /// The artists. - public List Artists { get; set; } - - /// - /// Gets or sets the media streams. - /// - /// The media streams. - public List MediaStreams { get; set; } - - /// - /// Gets or sets the chapter images item identifier. - /// - /// The chapter images item identifier. - public string ChapterImagesItemId { get; set; } - - /// - /// Gets or sets the chapters. - /// - /// The chapters. - public List Chapters { get; set; } - - /// - /// Gets a value indicating whether this instance has primary image. - /// - /// true if this instance has primary image; otherwise, false. - [IgnoreDataMember] - public bool HasPrimaryImage - { - get { return PrimaryImageTag != null; } - } - - public BaseItemInfo() - { - Artists = new List(); - MediaStreams = new List(); - Chapters = new List(); - } - } -} diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 354fd38ead..e6cc58868b 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -322,7 +322,6 @@ - diff --git a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs index fff4ee8e0d..5f81f7269a 100644 --- a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Model.Session { @@ -17,7 +17,7 @@ namespace MediaBrowser.Model.Session /// Gets or sets the item. /// /// The item. - public BaseItemInfo Item { get; set; } + public BaseItemDto Item { get; set; } /// /// Gets or sets the item identifier. @@ -67,6 +67,8 @@ namespace MediaBrowser.Model.Session /// The position ticks. public long? PositionTicks { get; set; } + public long? playbackStartTimeTicks { get; set; } + /// /// Gets or sets the volume level. /// diff --git a/MediaBrowser.Model/Session/PlaybackStopInfo.cs b/MediaBrowser.Model/Session/PlaybackStopInfo.cs index 74347f8943..160ef3554a 100644 --- a/MediaBrowser.Model/Session/PlaybackStopInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackStopInfo.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Dto; namespace MediaBrowser.Model.Session { @@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Session /// Gets or sets the item. /// /// The item. - public BaseItemInfo Item { get; set; } + public BaseItemDto Item { get; set; } /// /// Gets or sets the item identifier. /// diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs index 0909d255ae..b21a089aab 100644 --- a/MediaBrowser.Model/Session/SessionInfoDto.cs +++ b/MediaBrowser.Model/Session/SessionInfoDto.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Dto; using System; using System.Collections.Generic; using System.Diagnostics; @@ -72,7 +72,7 @@ namespace MediaBrowser.Model.Session /// Gets or sets the now viewing item. /// /// The now viewing item. - public BaseItemInfo NowViewingItem { get; set; } + public BaseItemDto NowViewingItem { get; set; } /// /// Gets or sets the name of the device. @@ -84,7 +84,7 @@ namespace MediaBrowser.Model.Session /// Gets or sets the now playing item. /// /// The now playing item. - public BaseItemInfo NowPlayingItem { get; set; } + public BaseItemDto NowPlayingItem { get; set; } /// /// Gets or sets the device id. diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 0b988ddabb..90663b500a 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.702 + 3.0.703 Emby.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 18128c7b18..e5cb120d33 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.702 + 3.0.703 Emby.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + -- cgit v1.2.3 From 2c54390c38e6ecd061645713c5f690e3f9b3ccf2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 10 Jun 2017 14:24:53 -0400 Subject: enable h264_cuvid decoder --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 14 ++++++++++++++ MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index f790bb1a17..c348ffda72 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1806,6 +1806,20 @@ namespace MediaBrowser.Controller.MediaEncoding break; } } + + else if (string.Equals(encodingOptions.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase)) + { + switch (state.MediaSource.VideoStream.Codec.ToLower()) + { + case "avc": + case "h264": + if (_mediaEncoder.SupportsDecoder("h264_cuvid")) + { + return "-c:v h264_cuvid "; + } + break; + } + } } // leave blank so ffmpeg will decide diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 27f66835f5..43e463902d 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -90,7 +90,8 @@ namespace MediaBrowser.MediaEncoding.Encoder "h264_qsv", "hevc_qsv", "mpeg2_qsv", - "vc1_qsv" + "vc1_qsv", + "h264_cuvid" }; foreach (var codec in required) -- cgit v1.2.3