From 1f63a30ee788764524a839358a8318c9de9aeef4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Mar 2017 14:05:44 -0500 Subject: [PATCH 1/3] update mjpeg stream detection --- .../MediaEncoding/EncodingHelper.cs | 5 ---- .../Probing/ProbeResultNormalizer.cs | 29 +++++++++++++++++-- MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 1 + MediaBrowser.Model/Net/MimeTypes.cs | 3 ++ 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 21a3494c56..80b9cc1543 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1190,11 +1190,6 @@ namespace MediaBrowser.Controller.MediaEncoding } } - if (type == MediaStreamType.Video) - { - streams = streams.Where(i => !string.Equals(i.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)).ToList(); - } - if (returnFirstIfNoIndex && type == MediaStreamType.Audio) { return streams.FirstOrDefault(i => i.Channels.HasValue && i.Channels.Value > 0) ?? diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 256c38597d..7927ddb6a1 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -558,13 +558,36 @@ namespace MediaBrowser.MediaEncoding.Probing ? MediaStreamType.EmbeddedImage : MediaStreamType.Video; + stream.AverageFrameRate = GetFrameRate(streamInfo.avg_frame_rate); + stream.RealFrameRate = GetFrameRate(streamInfo.r_frame_rate); + + if (isAudio || string.Equals(stream.Codec, "gif", StringComparison.OrdinalIgnoreCase) || + string.Equals(stream.Codec, "png", StringComparison.OrdinalIgnoreCase)) + { + stream.Type = MediaStreamType.EmbeddedImage; + } + else if (string.Equals(stream.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)) + { + // How to differentiate between video and embedded image? + // The only difference I've seen thus far is presence of codec tag, also embedded images have high (unusual) framerates + if (!string.IsNullOrWhiteSpace(stream.CodecTag)) + { + stream.Type = MediaStreamType.Video; + } + else + { + stream.Type = MediaStreamType.EmbeddedImage; + } + } + else + { + stream.Type = MediaStreamType.Video; + } + stream.Width = streamInfo.width; stream.Height = streamInfo.height; stream.AspectRatio = GetAspectRatio(streamInfo); - stream.AverageFrameRate = GetFrameRate(streamInfo.avg_frame_rate); - stream.RealFrameRate = GetFrameRate(streamInfo.r_frame_rate); - if (streamInfo.bits_per_sample > 0) { stream.BitDepth = streamInfo.bits_per_sample; diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index e2c6b0503a..79a484a467 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -36,6 +36,7 @@ namespace MediaBrowser.Model.LiveTv MediaLocationsCreated = new string[] { }; RecordingEncodingFormat = "mp4"; RecordingPostProcessorArguments = "\"{path}\""; + EnableRecordingEncoding = true; } } diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index 902253e806..790f8a8f61 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -322,6 +322,9 @@ namespace MediaBrowser.Model.Net throw new ArgumentNullException("mimeType"); } + // handle text/html; charset=UTF-8 + mimeType = mimeType.Split(';')[0]; + string result; if (ExtensionLookup.TryGetValue(mimeType, out result)) { From 7b467689589b0144c6957b46e35259f62ec13417 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Mar 2017 01:48:07 -0500 Subject: [PATCH 2/3] fix chapter images being stretched --- Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 654777b3c0..618cd1d453 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1596,6 +1596,7 @@ namespace Emby.Server.Implementations.LiveTv IsFolder = false, IsVirtualItem = false, Limit = query.Limit, + StartIndex = query.StartIndex, SortBy = new[] { ItemSortBy.DateCreated }, SortOrder = SortOrder.Descending, EnableTotalRecordCount = query.EnableTotalRecordCount, From 9383378e8150b3242c96f2dac6e77b1dc4568e6e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Mar 2017 02:01:53 -0500 Subject: [PATCH 3/3] fix playaccess property --- Emby.Server.Implementations/Dto/DtoService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index e0df65b8eb..147abd171a 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Dto } } - if (!(item is LiveTvProgram) || fields.Contains(ItemFields.PlayAccess)) + //if (!(item is LiveTvProgram) || fields.Contains(ItemFields.PlayAccess)) { dto.PlayAccess = item.GetPlayAccess(user); }