초기 커밋.
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Inno.Communication.TCP
|
||||
{
|
||||
public class TcpClientConnector : IDisposable
|
||||
{
|
||||
private TcpClient _client;
|
||||
private NetworkStream _stream;
|
||||
|
||||
public bool IsConnected => _client != null && _client.Connected;
|
||||
|
||||
public async Task ConnectAsync(string host, int port, int timeout, CancellationToken token)
|
||||
{
|
||||
_client = new TcpClient();
|
||||
var connectTask = _client.ConnectAsync(host, port);
|
||||
if (await Task.WhenAny(connectTask, Task.Delay(timeout, token)) == connectTask)
|
||||
{
|
||||
await connectTask;
|
||||
try
|
||||
{
|
||||
_stream = _client.GetStream();
|
||||
}
|
||||
catch
|
||||
{
|
||||
_client.Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_client.Dispose();
|
||||
throw new TimeoutException();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task WriteAsync(byte[] data, CancellationToken token)
|
||||
{
|
||||
if (_stream == null) throw new InvalidOperationException("Not connected");
|
||||
await _stream.WriteAsync(data, 0, data.Length, token);
|
||||
}
|
||||
|
||||
public async Task WriteAsync(string message, Encoding encoding, CancellationToken token)
|
||||
{
|
||||
if (_stream == null) throw new InvalidOperationException("Not connected");
|
||||
byte[] data = encoding.GetBytes(message);
|
||||
await WriteAsync(data, token);
|
||||
}
|
||||
|
||||
public async Task<int> ReadAsync(byte[] buffer, CancellationToken token)
|
||||
{
|
||||
if (_stream == null) throw new InvalidOperationException("Not connected");
|
||||
return await _stream.ReadAsync(buffer, 0, buffer.Length, token);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_stream?.Dispose();
|
||||
_client?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Inno.Communication.TCP
|
||||
{
|
||||
public class TcpConnectionItem
|
||||
{
|
||||
public string Host { get; set; }
|
||||
public int Port { get; set; }
|
||||
public TcpConnectionItem(string host, int port) { Host = host; Port = port; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Inno.Rtsp.RawFramesDecoding.DecodedFrames.Video
|
||||
{
|
||||
public interface IDecodedVideoFrame
|
||||
{
|
||||
}
|
||||
}
|
||||
23
Inno.Common.Stubs/Inno/Rtsp/RtspPlayer.cs
Normal file
23
Inno.Common.Stubs/Inno/Rtsp/RtspPlayer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using RtspModule;
|
||||
using Inno.Rtsp.RawFramesDecoding.DecodedFrames.Video;
|
||||
|
||||
namespace Inno.Rtsp
|
||||
{
|
||||
public class RtspPlayer : IDisposable
|
||||
{
|
||||
public event EventHandler<IDecodedVideoFrame> RtspFrameReceived;
|
||||
public event EventHandler<string> ConnectionChanged;
|
||||
|
||||
public void Init(RtspConnectionParameter param) { }
|
||||
public void StartRtspStreaming() { }
|
||||
public void StopRtspStreaming() { }
|
||||
public void ChangeAddress(RtspConnectionParameter param) { }
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
|
||||
namespace Inno.Rtsp.RawFramesReceiving
|
||||
{
|
||||
public class RawFramesSource { }
|
||||
}
|
||||
7
Inno.Common.Stubs/Inno/Wpf/EncodingCodeDefines.cs
Normal file
7
Inno.Common.Stubs/Inno/Wpf/EncodingCodeDefines.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Inno.Wpf
|
||||
{
|
||||
public static class EncodingCodeDefines
|
||||
{
|
||||
public const int CODE_EUC_KR = 51949;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user