Share decoder live sources and bound web playback startup
This commit is contained in:
@@ -30,6 +30,8 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
{
|
||||
private readonly ILogger<LiveTvService> _logger;
|
||||
private int _liveStreams;
|
||||
private readonly LiveStreamProbe _streamProbe;
|
||||
private readonly LiveStreamRelay _streamRelay;
|
||||
|
||||
private string tvBouquetSRef;
|
||||
private List<ChannelInfo> tvChannelInfos = new List<ChannelInfo>();
|
||||
@@ -40,10 +42,12 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
|
||||
public static LiveTvService Instance { get; private set; }
|
||||
|
||||
public LiveTvService(ILogger<LiveTvService> logger, IHttpClientFactory httpClientFactory, InternetEpg internetEpg)
|
||||
public LiveTvService(ILogger<LiveTvService> logger, IHttpClientFactory httpClientFactory, InternetEpg internetEpg, LiveStreamProbe streamProbe, LiveStreamRelay streamRelay)
|
||||
{
|
||||
_logger = logger;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_streamProbe = streamProbe;
|
||||
_streamRelay = streamRelay;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
@@ -1167,34 +1171,20 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
trancodingUrl = "?bitrate=1000000?width=1280?height=720?vcodec=h264?aspectratio=2?interlaced=0.mp4";
|
||||
}
|
||||
|
||||
_liveStreams++;
|
||||
var streamUrl = string.Format("{0}/{1}{2}", baseUrl, channelOid, trancodingUrl);
|
||||
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetChannelStream url: {0}", streamUrl));
|
||||
streamUrl = _streamRelay.Register(streamUrl);
|
||||
var streams = await _streamProbe.Get(streamUrl, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return new MediaSourceInfo
|
||||
{
|
||||
Id = _liveStreams.ToString(CultureInfo.InvariantCulture),
|
||||
Id = Interlocked.Increment(ref _liveStreams).ToString(CultureInfo.InvariantCulture),
|
||||
Path = streamUrl,
|
||||
Protocol = MediaProtocol.Http,
|
||||
MediaStreams = new List<MediaStream>
|
||||
{
|
||||
new MediaStream
|
||||
{
|
||||
Type = MediaStreamType.Video,
|
||||
// Set the index to -1 because we don't know the exact index of the video stream within the container
|
||||
Index = -1,
|
||||
|
||||
// Set to true if unknown to enable deinterlacing
|
||||
IsInterlaced = true
|
||||
|
||||
},
|
||||
new MediaStream
|
||||
{
|
||||
Type = MediaStreamType.Audio,
|
||||
// Set the index to -1 because we don't know the exact index of the audio stream within the container
|
||||
Index = -1
|
||||
}
|
||||
}
|
||||
Container = Plugin.Instance.Configuration.TranscodedStream ? "mpegts" : "ts",
|
||||
IsInfiniteStream = true,
|
||||
SupportsProbing = false,
|
||||
SupportsDirectPlay = false,
|
||||
MediaStreams = streams
|
||||
};
|
||||
throw new ResourceNotFoundException(string.Format("Could not stream channel {0}", channelOid));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user