From bb0618f6083bb7dc8f5f7de7a65e2b8aa50f629b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 8 Aug 2016 18:15:37 -0400 Subject: [PATCH 1/4] fixes #2041 - Error when altering and saving user settings --- .../Serialization/XmlSerializer.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs b/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs index 756741e0da..77f65b0c7a 100644 --- a/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs +++ b/MediaBrowser.Common.Implementations/Serialization/XmlSerializer.cs @@ -1,6 +1,7 @@ using MediaBrowser.Model.Serialization; using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.IO; using System.Xml; using CommonIO; @@ -24,13 +25,22 @@ namespace MediaBrowser.Common.Implementations.Serialization // Need to cache these // http://dotnetcodebox.blogspot.com/2013/01/xmlserializer-class-may-result-in.html - private readonly ConcurrentDictionary _serializers = - new ConcurrentDictionary(); + private readonly Dictionary _serializers = + new Dictionary(); private System.Xml.Serialization.XmlSerializer GetSerializer(Type type) { var key = type.FullName; - return _serializers.GetOrAdd(key, k => new System.Xml.Serialization.XmlSerializer(type)); + lock (_serializers) + { + System.Xml.Serialization.XmlSerializer serializer; + if (!_serializers.TryGetValue(key, out serializer)) + { + serializer = new System.Xml.Serialization.XmlSerializer(type); + _serializers[key] = serializer; + } + return serializer; + } } /// From cbb6a9495db893211bced8f9c8ca845f91f2bc02 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 9 Aug 2016 01:08:21 -0400 Subject: [PATCH 2/4] exclude people from dynamic images --- .../UserViews/DynamicImageProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs index ea4da19b20..3c75c8a487 100644 --- a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs @@ -72,7 +72,7 @@ namespace MediaBrowser.Server.Implementations.UserViews User = view.UserId.HasValue ? _userManager.GetUserById(view.UserId.Value) : null, CollapseBoxSetItems = false, Recursive = recursive, - ExcludeItemTypes = new[] { "UserView", "CollectionFolder" } + ExcludeItemTypes = new[] { "UserView", "CollectionFolder", "Person" }, }).ConfigureAwait(false); From 112d5d63481f2002a08d5532072cee84df01116b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 9 Aug 2016 01:08:36 -0400 Subject: [PATCH 3/4] try to detect 3d type --- MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs | 6 ++++++ MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index f37e223ded..9e9bc0780e 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -168,6 +168,12 @@ namespace MediaBrowser.MediaEncoding.Probing } ExtractTimestamp(info); + + var stereoMode = GetDictionaryValue(tags, "stereo_mode"); + if (string.Equals(stereoMode, "left_right", StringComparison.OrdinalIgnoreCase)) + { + info.Video3DFormat = Video3DFormat.FullSideBySide; + } } return info; diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index e1ab61cbbe..c208235356 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -231,6 +231,8 @@ namespace MediaBrowser.Providers.MediaInfo video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle); video.Timestamp = mediaInfo.Timestamp; + video.Video3DFormat = video.Video3DFormat ?? mediaInfo.Video3DFormat; + await _itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken).ConfigureAwait(false); if (options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || From e52759786ff626d930ff3aa7375546d8efb5b975 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 9 Aug 2016 01:10:17 -0400 Subject: [PATCH 4/4] fix layout quirks --- MediaBrowser.Api/ApiEntryPoint.cs | 11 ++- .../BaseProgressiveStreamingService.cs | 68 +++++++++---------- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 1a7f4a2b12..bb9d2b8645 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -63,6 +63,15 @@ namespace MediaBrowser.Api Instance = this; _sessionManager.PlaybackProgress += _sessionManager_PlaybackProgress; + _sessionManager.PlaybackStart += _sessionManager_PlaybackStart; + } + + private void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e) + { + if (!string.IsNullOrWhiteSpace(e.PlaySessionId)) + { + PingTranscodingJob(e.PlaySessionId, e.IsPaused); + } } void _sessionManager_PlaybackProgress(object sender, PlaybackProgressEventArgs e) @@ -401,7 +410,7 @@ namespace MediaBrowser.Api } } - Logger.Debug("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId); + Logger.Info("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId); KillTranscodingJob(job, true, path => true); } diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index 4649499c46..d6dea0fe52 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -165,40 +165,40 @@ namespace MediaBrowser.Api.Playback.Progressive } } - // Not static but transcode cache file exists - if (isTranscodeCached) - { - var contentType = state.GetMimeType(outputPath); - - try - { - if (transcodingJob != null) - { - ApiEntryPoint.Instance.OnTranscodeBeginRequest(transcodingJob); - } - - return await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions - { - ResponseHeaders = responseHeaders, - ContentType = contentType, - IsHeadRequest = isHeadRequest, - Path = outputPath, - FileShare = FileShare.ReadWrite, - OnComplete = () => - { - if (transcodingJob != null) - { - ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob); - } - } - - }).ConfigureAwait(false); - } - finally - { - state.Dispose(); - } - } + //// Not static but transcode cache file exists + //if (isTranscodeCached && state.VideoRequest == null) + //{ + // var contentType = state.GetMimeType(outputPath); + + // try + // { + // if (transcodingJob != null) + // { + // ApiEntryPoint.Instance.OnTranscodeBeginRequest(transcodingJob); + // } + + // return await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions + // { + // ResponseHeaders = responseHeaders, + // ContentType = contentType, + // IsHeadRequest = isHeadRequest, + // Path = outputPath, + // FileShare = FileShare.ReadWrite, + // OnComplete = () => + // { + // if (transcodingJob != null) + // { + // ApiEntryPoint.Instance.OnTranscodeEndRequest(transcodingJob); + // } + // } + + // }).ConfigureAwait(false); + // } + // finally + // { + // state.Dispose(); + // } + //} // Need to start ffmpeg try