1414
1515namespace SharpRTSPClient
1616{
17+ public enum RTPTransport
18+ {
19+ UDP ,
20+ TCP ,
21+ MULTICAST
22+ }
23+
24+ public enum MediaRequest
25+ {
26+ VIDEO_ONLY ,
27+ AUDIO_ONLY ,
28+ VIDEO_AND_AUDIO
29+ }
30+
1731 /// <summary>
1832 /// RTSP client.
1933 /// </summary>
@@ -40,28 +54,14 @@ public class RTSPClient : IDisposable
4054
4155 public bool AutoPlay { get ; set ; } = true ;
4256
43- public enum RtpTransport
44- {
45- UDP ,
46- TCP ,
47- MULTICAST
48- } ;
49-
50- public enum MediaRequest
51- {
52- VIDEO_ONLY ,
53- AUDIO_ONLY ,
54- VIDEO_AND_AUDIO
55- } ;
56-
5757 private enum RtspStatus { WaitingToConnect , Connecting , ConnectFailed , Connected } ;
5858
5959 private IRtspTransport _rtspSocket ; // RTSP connection
6060 private RtspStatus _rtspSocketStatus = RtspStatus . WaitingToConnect ;
6161
6262 // this wraps around a the RTSP tcpSocket stream
6363 private RtspListener _rtspClient ;
64- private RtpTransport _rtpTransport = RtpTransport . UDP ; // Mode, either RTP over UDP or RTP over TCP using the RTSP socket
64+ private RTPTransport _rtpTransport = RTPTransport . UDP ; // Mode, either RTP over UDP or RTP over TCP using the RTSP socket
6565
6666 private IRtpTransport _videoRtpTransport ;
6767 private IRtpTransport _audioRtpTransport ;
@@ -131,12 +131,12 @@ public RTSPClient(ILoggerFactory loggerFactory)
131131 /// Connect.
132132 /// </summary>
133133 /// <param name="url">URL to connect to.</param>
134- /// <param name="rtpTransport">Type of the RTP transport <see cref="RtpTransport "/>.</param>
134+ /// <param name="rtpTransport">Type of the RTP transport <see cref="RTPTransport "/>.</param>
135135 /// <param name="username">User name.</param>
136136 /// <param name="password">Password.</param>
137137 /// <param name="mediaRequest">Media request type <see cref="MediaRequest>."/></param>
138138 /// <param name="playbackSession">Playback session.</param>
139- public void Connect ( string url , RtpTransport rtpTransport , string username = null , string password = null , MediaRequest mediaRequest = MediaRequest . VIDEO_AND_AUDIO , bool playbackSession = false )
139+ public void Connect ( string url , RTPTransport rtpTransport , string username = null , string password = null , MediaRequest mediaRequest = MediaRequest . VIDEO_AND_AUDIO , bool playbackSession = false )
140140 {
141141 RtspUtils . RegisterUri ( ) ;
142142
@@ -213,14 +213,14 @@ public void Connect(string url, RtpTransport rtpTransport, string username = nul
213213 // If the RTP transport is MULTICAST, we have to wait for the SETUP message to get the Multicast Address from the RTSP server
214214 this . _rtpTransport = rtpTransport ;
215215
216- if ( rtpTransport == RtpTransport . UDP )
216+ if ( rtpTransport == RTPTransport . UDP )
217217 {
218218 // give a range of 500 pairs (1000 addresses) to try incase some address are in use
219219 _videoRtpTransport = new UDPSocket ( 50000 , 51000 ) ;
220220 _audioRtpTransport = new UDPSocket ( 50000 , 51000 ) ;
221221 }
222222
223- if ( rtpTransport == RtpTransport . TCP )
223+ if ( rtpTransport == RTPTransport . TCP )
224224 {
225225 int nextFreeRtpChannel = 0 ;
226226 _videoRtpTransport = new RtpTcpTransport ( _rtspClient )
@@ -1118,14 +1118,14 @@ private RtspTransport CalculateTransport(IRtpTransport transport)
11181118 {
11191119 // Server interleaves the RTP packets over the RTSP connection
11201120 // Example for TCP mode (RTP over RTSP) Transport: RTP/AVP/TCP;interleaved=0-1
1121- case RtpTransport . TCP :
1121+ case RTPTransport . TCP :
11221122 return new RtspTransport ( )
11231123 {
11241124 LowerTransport = RtspTransport . LowerTransportType . TCP ,
11251125 // Eg Channel 0 for RTP video data. Channel 1 for RTCP status reports
11261126 Interleaved = ( transport as RtpTcpTransport ) ? . Channels ?? throw new ApplicationException ( "TCP transport asked and no tcp channel allocated" ) ,
11271127 } ;
1128- case RtpTransport . UDP :
1128+ case RTPTransport . UDP :
11291129 return new RtspTransport ( )
11301130 {
11311131 LowerTransport = RtspTransport . LowerTransportType . UDP ,
@@ -1135,7 +1135,7 @@ private RtspTransport CalculateTransport(IRtpTransport transport)
11351135 // Server sends the RTP packets to a Pair of UDP ports (one for data, one for rtcp control messages)
11361136 // using Multicast Address and Ports that are in the reply to the SETUP message
11371137 // Example for MULTICAST mode Transport: RTP/AVP;multicast
1138- case RtpTransport . MULTICAST :
1138+ case RTPTransport . MULTICAST :
11391139 return new RtspTransport ( )
11401140 {
11411141 LowerTransport = RtspTransport . LowerTransportType . UDP ,
@@ -1222,11 +1222,6 @@ public override string ToString()
12221222 public interface IStreamConfigurationData
12231223 { }
12241224
1225- public interface IVideoStreamConfigurationData : IStreamConfigurationData
1226- {
1227- IEnumerable < byte [ ] > GetNALUs ( ) ;
1228- }
1229-
12301225 public class SimpleDataEventArgs : EventArgs
12311226 {
12321227 public SimpleDataEventArgs ( IEnumerable < ReadOnlyMemory < byte > > data , DateTime timeStamp )
0 commit comments