|
|
|
@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
await tcpClient.ConnectAsync(remoteAddress, HdHomerunManager.HdHomeRunPort).ConfigureAwait(false);
|
|
|
|
|
localAddress = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address;
|
|
|
|
|
localAddress = ((IPEndPoint)tcpClient.Client.LocalEndPoint).Address;
|
|
|
|
|
tcpClient.Close();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
@ -80,6 +80,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localAddress.IsIPv4MappedToIPv6) {
|
|
|
|
|
localAddress = localAddress.MapToIPv4();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var udpClient = new UdpClient(localPort, AddressFamily.InterNetwork);
|
|
|
|
|
var hdHomerunManager = new HdHomerunManager();
|
|
|
|
|
|
|
|
|
@ -110,12 +114,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|
|
|
|
|
|
|
|
|
var taskCompletionSource = new TaskCompletionSource<bool>();
|
|
|
|
|
|
|
|
|
|
await StartStreaming(
|
|
|
|
|
_ = StartStreaming(
|
|
|
|
|
udpClient,
|
|
|
|
|
hdHomerunManager,
|
|
|
|
|
remoteAddress,
|
|
|
|
|
taskCompletionSource,
|
|
|
|
|
LiveStreamCancellationTokenSource.Token).ConfigureAwait(false);
|
|
|
|
|
LiveStreamCancellationTokenSource.Token);
|
|
|
|
|
|
|
|
|
|
// OpenedMediaSource.Protocol = MediaProtocol.File;
|
|
|
|
|
// OpenedMediaSource.Path = tempFile;
|
|
|
|
@ -136,9 +140,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|
|
|
|
return TempFilePath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Task StartStreaming(UdpClient udpClient, HdHomerunManager hdHomerunManager, IPAddress remoteAddress, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
return Task.Run(async () =>
|
|
|
|
|
private async Task StartStreaming(UdpClient udpClient, HdHomerunManager hdHomerunManager, IPAddress remoteAddress, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
using (udpClient)
|
|
|
|
|
using (hdHomerunManager)
|
|
|
|
@ -162,7 +164,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task CopyTo(UdpClient udpClient, string file, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
|
|
|
|