aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Server.Implementations/Library/MediaSourceManager.cs35
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs32
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs2
-rw-r--r--MediaBrowser.Controller/Library/IMediaSourceManager.cs9
4 files changed, 44 insertions, 34 deletions
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index 96fad9bca..68eccf311 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -11,14 +11,15 @@ using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
-using EasyCaching.Core.Configurations;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions.Json;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
@@ -37,6 +38,7 @@ namespace Emby.Server.Implementations.Library
// Do not use a pipe here because Roku http requests to the server will fail, without any explicit error message.
private const char LiveStreamIdDelimeter = '_';
+ private readonly IServerApplicationHost _appHost;
private readonly IItemRepository _itemRepo;
private readonly IUserManager _userManager;
private readonly ILibraryManager _libraryManager;
@@ -55,6 +57,7 @@ namespace Emby.Server.Implementations.Library
private IMediaSourceProvider[] _providers;
public MediaSourceManager(
+ IServerApplicationHost appHost,
IItemRepository itemRepo,
IApplicationPaths applicationPaths,
ILocalizationManager localizationManager,
@@ -66,6 +69,7 @@ namespace Emby.Server.Implementations.Library
IMediaEncoder mediaEncoder,
IDirectoryService directoryService)
{
+ _appHost = appHost;
_itemRepo = itemRepo;
_userManager = userManager;
_libraryManager = libraryManager;
@@ -799,6 +803,35 @@ namespace Emby.Server.Implementations.Library
return result.Item1;
}
+ public async Task<List<MediaSourceInfo>> GetRecordingStreamMediaSources(ActiveRecordingInfo info, CancellationToken cancellationToken)
+ {
+ var stream = new MediaSourceInfo
+ {
+ EncoderPath = _appHost.GetApiUrlForLocalAccess() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
+ EncoderProtocol = MediaProtocol.Http,
+ Path = info.Path,
+ Protocol = MediaProtocol.File,
+ Id = info.Id,
+ SupportsDirectPlay = false,
+ SupportsDirectStream = true,
+ SupportsTranscoding = true,
+ IsInfiniteStream = true,
+ RequiresOpening = false,
+ RequiresClosing = false,
+ BufferMs = 0,
+ IgnoreDts = true,
+ IgnoreIndex = true
+ };
+
+ await new LiveStreamHelper(_mediaEncoder, _logger, _appPaths)
+ .AddMediaInfoWithProbe(stream, false, false, cancellationToken).ConfigureAwait(false);
+
+ return new List<MediaSourceInfo>
+ {
+ stream
+ };
+ }
+
public async Task CloseLiveStream(string id)
{
ArgumentException.ThrowIfNullOrEmpty(id);
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index abe3ff349..e2e0dfb2b 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -47,7 +47,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private const int TunerDiscoveryDurationMs = 3000;
- private readonly IServerApplicationHost _appHost;
private readonly ILogger<EmbyTV> _logger;
private readonly IHttpClientFactory _httpClientFactory;
private readonly IServerConfigurationManager _config;
@@ -76,7 +75,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private bool _disposed;
public EmbyTV(
- IServerApplicationHost appHost,
IStreamHelper streamHelper,
IMediaSourceManager mediaSourceManager,
ILogger<EmbyTV> logger,
@@ -91,7 +89,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
Current = this;
- _appHost = appHost;
_logger = logger;
_httpClientFactory = httpClientFactory;
_config = config;
@@ -1021,35 +1018,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
throw new NotImplementedException();
}
- public async Task<List<MediaSourceInfo>> GetRecordingStreamMediaSources(ActiveRecordingInfo info, CancellationToken cancellationToken)
- {
- var stream = new MediaSourceInfo
- {
- EncoderPath = _appHost.GetApiUrlForLocalAccess() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
- EncoderProtocol = MediaProtocol.Http,
- Path = info.Path,
- Protocol = MediaProtocol.File,
- Id = info.Id,
- SupportsDirectPlay = false,
- SupportsDirectStream = true,
- SupportsTranscoding = true,
- IsInfiniteStream = true,
- RequiresOpening = false,
- RequiresClosing = false,
- BufferMs = 0,
- IgnoreDts = true,
- IgnoreIndex = true
- };
-
- await new LiveStreamHelper(_mediaEncoder, _logger, _config.CommonApplicationPaths)
- .AddMediaInfoWithProbe(stream, false, false, cancellationToken).ConfigureAwait(false);
-
- return new List<MediaSourceInfo>
- {
- stream
- };
- }
-
public Task CloseLiveStream(string id, CancellationToken cancellationToken)
{
return Task.CompletedTask;
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
index 6a92fc599..a5a1a4a4c 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
@@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.LiveTv
{
if (activeRecordingInfo is not null)
{
- sources = await EmbyTV.EmbyTV.Current.GetRecordingStreamMediaSources(activeRecordingInfo, cancellationToken)
+ sources = await _mediaSourceManager.GetRecordingStreamMediaSources(activeRecordingInfo, cancellationToken)
.ConfigureAwait(false);
}
else
diff --git a/MediaBrowser.Controller/Library/IMediaSourceManager.cs b/MediaBrowser.Controller/Library/IMediaSourceManager.cs
index f1758a9d8..bace703ad 100644
--- a/MediaBrowser.Controller/Library/IMediaSourceManager.cs
+++ b/MediaBrowser.Controller/Library/IMediaSourceManager.cs
@@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
@@ -117,6 +118,14 @@ namespace MediaBrowser.Controller.Library
public ILiveStream GetLiveStreamInfoByUniqueId(string uniqueId);
/// <summary>
+ /// Gets the media sources for an active recording.
+ /// </summary>
+ /// <param name="info">The <see cref="ActiveRecordingInfo"/>.</param>
+ /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
+ /// <returns>A task containing the <see cref="MediaSourceInfo"/>'s for the recording.</returns>
+ Task<List<MediaSourceInfo>> GetRecordingStreamMediaSources(ActiveRecordingInfo info, CancellationToken cancellationToken);
+
+ /// <summary>
/// Closes the media source.
/// </summary>
/// <param name="id">The live stream identifier.</param>