The Free Software Media System - Server Backend & API
assume interlaced for external plugins
Luke Pulverenti4941aa4d14f2
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 1ec5dd1d58..fe114d224e 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -1163,7 +1163,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV};var isAudio = false;- await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false);+ await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, false, cancellationToken).ConfigureAwait(false);return new List<MediaSourceInfo>{diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.csindex 0313e6fdec..2ee6869f68 100644--- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs+++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs@@ -6,6 +6,7 @@ using System.Threading.Tasks;using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Model.Dlna;using MediaBrowser.Model.Dto;+using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;namespace Emby.Server.Implementations.LiveTv@@ -21,7 +22,7 @@ namespace Emby.Server.Implementations.LiveTv_logger = logger;}- public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, CancellationToken cancellationToken)+ public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, bool assumeInterlaced, CancellationToken cancellationToken){var originalRuntime = mediaSource.RunTimeTicks;@@ -95,6 +96,17 @@ namespace Emby.Server.Implementations.LiveTvvideoStream.IsAVC = null;}+ if (assumeInterlaced)+ {+ foreach (var mediaStream in mediaSource.MediaStreams)+ {+ if (mediaStream.Type == MediaStreamType.Video)+ {+ mediaStream.IsInterlaced = true;+ }+ }+ }+// Try to estimate thismediaSource.InferTotalBitrate(true);}diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.csindex 613a30b1da..e30280967f 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs@@ -246,9 +246,9 @@ namespace Emby.Server.Implementations.LiveTvreturn info.Item1;}- public async Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken)+ public Task<Tuple<MediaSourceInfo, IDirectStreamProvider, bool>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken){- return await GetLiveStream(id, mediaSourceId, true, cancellationToken).ConfigureAwait(false);+ return GetLiveStream(id, mediaSourceId, true, cancellationToken);}private string GetItemExternalId(BaseItem item)@@ -308,7 +308,7 @@ namespace Emby.Server.Implementations.LiveTvreturn _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));}- private async Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetLiveStream(string id, string mediaSourceId, bool isChannel, CancellationToken cancellationToken)+ private async Task<Tuple<MediaSourceInfo, IDirectStreamProvider, bool>> GetLiveStream(string id, string mediaSourceId, bool isChannel, CancellationToken cancellationToken){if (string.Equals(id, mediaSourceId, StringComparison.OrdinalIgnoreCase)){@@ -319,6 +319,7 @@ namespace Emby.Server.Implementations.LiveTvbool isVideo;ILiveTvService service;IDirectStreamProvider directStreamProvider = null;+ var assumeInterlaced = false;if (isChannel){@@ -367,7 +368,12 @@ namespace Emby.Server.Implementations.LiveTvNormalize(info, service, isVideo);- return new Tuple<MediaSourceInfo, IDirectStreamProvider>(info, directStreamProvider);+ if (!(service is EmbyTV.EmbyTV))+ {+ assumeInterlaced = true;+ }++ return new Tuple<MediaSourceInfo, IDirectStreamProvider, bool>(info, directStreamProvider, assumeInterlaced);}private void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo)diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.csindex 747e0fdd31..e25e284849 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs@@ -126,12 +126,14 @@ namespace Emby.Server.Implementations.LiveTvvar keys = openToken.Split(new[] { StreamIdDelimeter }, 3);var mediaSourceId = keys.Length >= 3 ? keys[2] : null;IDirectStreamProvider directStreamProvider = null;+ var assumeInterlaced = false;if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase)){var info = await _liveTvManager.GetChannelStream(keys[1], mediaSourceId, cancellationToken).ConfigureAwait(false);stream = info.Item1;directStreamProvider = info.Item2;+ assumeInterlaced = info.Item3;}else{@@ -146,7 +148,7 @@ namespace Emby.Server.Implementations.LiveTv}else{- await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false);+ await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, assumeInterlaced, cancellationToken).ConfigureAwait(false);}}catch (Exception ex)diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.csindex 08e4956adc..a908d2d3fb 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs@@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.LiveTv/// <param name="mediaSourceId">The media source identifier.</param>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task{StreamResponseInfo}.</returns>- Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken);+ Task<Tuple<MediaSourceInfo, IDirectStreamProvider, bool>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken);/// <summary>/// Gets the program.