Skip to content

Commit fd98f31

Browse files
committed
R Refactoring
1 parent 1b0b130 commit fd98f31

6 files changed

Lines changed: 257 additions & 246 deletions

File tree

src/RTSPClientApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
client.NewAudioStream += (sender, e) => Console.WriteLine(e.ToString());
1414
client.ReceivedAudioData += (sender, e) => Console.Write("+");
1515

16-
client.Connect(rtspUri, RTSPClient.RTP_TRANSPORT.TCP, userName, password);
16+
client.Connect(rtspUri, RTSPClient.RtpTransport.TCP, userName, password);
1717

1818
Console.WriteLine("Press any key to exit");
1919
while (!Console.KeyAvailable)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace SharpRTSPClient
6+
{
7+
public class AACStreamConfigurationData : IStreamConfigurationData
8+
{
9+
public AACStreamConfigurationData()
10+
{ }
11+
12+
public AACStreamConfigurationData(int objectType, int frequencyIndex, int samplingFrequency, int channelConfiguration)
13+
{
14+
ObjectType = objectType;
15+
FrequencyIndex = frequencyIndex;
16+
SamplingFrequency = samplingFrequency;
17+
ChannelConfiguration = channelConfiguration;
18+
}
19+
20+
public int ObjectType { get; set; }
21+
public int FrequencyIndex { get; set; }
22+
public int SamplingFrequency { get; set; }
23+
public int ChannelConfiguration { get; set; }
24+
}
25+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System.Collections.Generic;
2+
3+
namespace SharpRTSPClient
4+
{
5+
public class H264StreamConfigurationData : IVideoStreamConfigurationData
6+
{
7+
public byte[] SPS { get; set; }
8+
public byte[] PPS { get; set; }
9+
10+
public H264StreamConfigurationData()
11+
{ }
12+
13+
public H264StreamConfigurationData(byte[] sps, byte[] pps)
14+
{
15+
SPS = sps;
16+
PPS = pps;
17+
}
18+
19+
public override string ToString()
20+
{
21+
return $"SPS: {Utilities.ToHexString(SPS)}\r\nPPS: {Utilities.ToHexString(PPS)}";
22+
}
23+
24+
public IEnumerable<byte[]> GetNALUs()
25+
{
26+
return new byte[][] { SPS, PPS };
27+
}
28+
}
29+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Collections.Generic;
2+
3+
namespace SharpRTSPClient
4+
{
5+
public class H265StreamConfigurationData : IVideoStreamConfigurationData
6+
{
7+
public byte[] VPS { get; set; }
8+
public byte[] SPS { get; set; }
9+
public byte[] PPS { get; set; }
10+
11+
public H265StreamConfigurationData()
12+
{ }
13+
14+
public H265StreamConfigurationData(byte[] vps, byte[] sps, byte[] pps)
15+
{
16+
VPS = vps;
17+
SPS = sps;
18+
PPS = pps;
19+
}
20+
21+
public override string ToString()
22+
{
23+
return $"VPS: {Utilities.ToHexString(VPS)}\r\nSPS: {Utilities.ToHexString(SPS)}\r\nPPS: {Utilities.ToHexString(PPS)}";
24+
}
25+
26+
public IEnumerable<byte[]> GetNALUs()
27+
{
28+
return new byte[][] { VPS, SPS, PPS };
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)