2021-05-20 21:28:18 +02:00
|
|
|
#nullable disable
|
|
|
|
|
2019-11-01 18:38:54 +01:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 20:54:44 +01:00
|
|
|
using System;
|
2019-02-28 23:22:57 +01:00
|
|
|
using System.Globalization;
|
2021-09-10 09:29:14 +02:00
|
|
|
using System.IO;
|
2018-09-12 19:26:21 +02:00
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using MediaBrowser.Controller.Library;
|
2019-01-13 20:21:32 +01:00
|
|
|
using MediaBrowser.Model.Dto;
|
2018-09-12 19:26:21 +02:00
|
|
|
|
|
|
|
namespace Emby.Server.Implementations.Library
|
|
|
|
{
|
2023-12-05 20:26:35 +01:00
|
|
|
public sealed class ExclusiveLiveStream : ILiveStream
|
2018-09-12 19:26:21 +02:00
|
|
|
{
|
2020-07-20 11:01:37 +02:00
|
|
|
private readonly Func<Task> _closeFn;
|
|
|
|
|
|
|
|
public ExclusiveLiveStream(MediaSourceInfo mediaSource, Func<Task> closeFn)
|
|
|
|
{
|
|
|
|
MediaSource = mediaSource;
|
|
|
|
EnableStreamSharing = false;
|
|
|
|
_closeFn = closeFn;
|
|
|
|
ConsumerCount = 1;
|
|
|
|
UniqueId = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
|
|
|
|
}
|
|
|
|
|
2018-09-12 19:26:21 +02:00
|
|
|
public int ConsumerCount { get; set; }
|
2020-06-15 23:43:52 +02:00
|
|
|
|
2018-09-12 19:26:21 +02:00
|
|
|
public string OriginalStreamId { get; set; }
|
|
|
|
|
|
|
|
public string TunerHostId => null;
|
|
|
|
|
|
|
|
public bool EnableStreamSharing { get; set; }
|
2020-06-15 23:43:52 +02:00
|
|
|
|
2018-09-12 19:26:21 +02:00
|
|
|
public MediaSourceInfo MediaSource { get; set; }
|
|
|
|
|
2020-07-20 11:01:37 +02:00
|
|
|
public string UniqueId { get; }
|
2018-09-12 19:26:21 +02:00
|
|
|
|
|
|
|
public Task Close()
|
|
|
|
{
|
|
|
|
return _closeFn();
|
|
|
|
}
|
|
|
|
|
2021-09-10 09:56:48 +02:00
|
|
|
public Stream GetStream()
|
2021-09-10 09:29:14 +02:00
|
|
|
{
|
|
|
|
throw new NotSupportedException();
|
|
|
|
}
|
|
|
|
|
2018-09-12 19:26:21 +02:00
|
|
|
public Task Open(CancellationToken openCancellationToken)
|
|
|
|
{
|
|
|
|
return Task.CompletedTask;
|
|
|
|
}
|
2023-12-05 20:26:35 +01:00
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
}
|
2018-09-12 19:26:21 +02:00
|
|
|
}
|
|
|
|
}
|