diff --git a/limelight-common/Connection.c b/limelight-common/Connection.c
index e7655e8..45d1161 100644
--- a/limelight-common/Connection.c
+++ b/limelight-common/Connection.c
@@ -7,7 +7,7 @@ static CONNECTION_LISTENER_CALLBACKS ListenerCallbacks;
static const char* stageNames[STAGE_MAX] = {
"none",
"platform initialization",
- "handshake",
+ "RTSP handshake",
"control stream initialization",
"video stream initialization",
"audio stream initialization",
@@ -71,9 +71,9 @@ void LiStopConnection(void) {
stage--;
Limelog("done\n");
}
- if (stage == STAGE_HANDSHAKE) {
- Limelog("Terminating handshake...");
- terminateHandshake();
+ if (stage == STAGE_RTSP_HANDSHAKE) {
+ Limelog("Terminating RTSP handshake...");
+ terminateRtspHandshake();
stage--;
Limelog("done\n");
}
@@ -112,17 +112,17 @@ int LiStartConnection(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, PCONN
ListenerCallbacks.stageComplete(STAGE_PLATFORM_INIT);
Limelog("done\n");
- Limelog("Starting handshake...");
- ListenerCallbacks.stageStarting(STAGE_HANDSHAKE);
- err = performHandshake(host);
+ Limelog("Starting RTSP handshake...");
+ ListenerCallbacks.stageStarting(STAGE_RTSP_HANDSHAKE);
+ err = performRtspHandshake(host, streamConfig);
if (err != 0) {
Limelog("failed: %d\n", err);
- ListenerCallbacks.stageFailed(STAGE_HANDSHAKE, err);
+ ListenerCallbacks.stageFailed(STAGE_RTSP_HANDSHAKE, err);
goto Cleanup;
}
stage++;
- LC_ASSERT(stage == STAGE_HANDSHAKE);
- ListenerCallbacks.stageComplete(STAGE_HANDSHAKE);
+ LC_ASSERT(stage == STAGE_RTSP_HANDSHAKE);
+ ListenerCallbacks.stageComplete(STAGE_RTSP_HANDSHAKE);
Limelog("done\n");
Limelog("Initializing control stream...");
diff --git a/limelight-common/Limelight-internal.h b/limelight-common/Limelight-internal.h
index b58dfef..28d536b 100644
--- a/limelight-common/Limelight-internal.h
+++ b/limelight-common/Limelight-internal.h
@@ -17,6 +17,9 @@ void connectionDetectedFrameLoss(int startFrame, int endFrame);
void connectionReceivedFrame(int frameIndex);
void connectionLostPackets(int lastReceivedPacket, int nextReceivedPacket);
+int performRtspHandshake(IP_ADDRESS addr, PSTREAM_CONFIGURATION streamConfigPtr);
+void terminateRtspHandshake(void);
+
void initializeVideoDepacketizer(int pktSize);
void destroyVideoDepacketizer(void);
void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length);
diff --git a/limelight-common/Limelight.h b/limelight-common/Limelight.h
index b549057..d162cc5 100644
--- a/limelight-common/Limelight.h
+++ b/limelight-common/Limelight.h
@@ -55,7 +55,7 @@ typedef struct _AUDIO_RENDERER_CALLBACKS {
// Use LiGetStageName() for stable stage names
#define STAGE_NONE 0
#define STAGE_PLATFORM_INIT 1
-#define STAGE_HANDSHAKE 2
+#define STAGE_RTSP_HANDSHAKE 2
#define STAGE_CONTROL_STREAM_INIT 3
#define STAGE_VIDEO_STREAM_INIT 4
#define STAGE_AUDIO_STREAM_INIT 5
diff --git a/limelight-common/RtspConnection.c b/limelight-common/RtspConnection.c
new file mode 100644
index 0000000..7dcc300
--- /dev/null
+++ b/limelight-common/RtspConnection.c
@@ -0,0 +1,63 @@
+#include "Limelight-internal.h"
+
+static SOCKET sock = INVALID_SOCKET;
+
+#define RTSP_MAX_RESP_SIZE 1024
+
+// FIXME defs
+static void* transactRtspMessage(IP_ADDRESS addr, void* message) {
+ int err;
+ char responseBuffer[RTSP_MAX_RESP_SIZE];
+ int offset;
+ void* responseMsg = NULL;
+
+ sock = connectTcpSocket(addr, 48010);
+ if (sock == INVALID_SOCKET) {
+ return NULL;
+ }
+ enableNoDelay(sock);
+
+ char* serializedMessage = NULL; // FIXME
+ int messageLen = 0; // FIXME
+
+ // Send our message
+ err = send(sock, serializedMessage, messageLen, 0);
+ if (err == SOCKET_ERROR) {
+ goto Exit;
+ }
+
+ // Read the response until the server closes the connection
+ offset = 0;
+ for (;;) {
+ err = recv(sock, &responseBuffer[offset], RTSP_MAX_RESP_SIZE - offset, 0);
+ if (err <= 0) {
+ // Done reading
+ break;
+ }
+ offset += err;
+
+ // Warn if the RTSP message is too big
+ if (offset == RTSP_MAX_RESP_SIZE) {
+ Limelog("RTSP message too long");
+ goto Exit;
+ }
+ }
+
+ responseMsg = NULL; // FIXME
+
+Exit:
+ closesocket(sock);
+ sock = INVALID_SOCKET;
+ return responseMsg;
+}
+
+void terminateRtspHandshake(void) {
+ if (sock != INVALID_SOCKET) {
+ closesocket(sock);
+ sock = INVALID_SOCKET;
+ }
+}
+
+int performRtspHandshake(IP_ADDRESS addr, PSTREAM_CONFIGURATION streamConfigPtr) {
+ return 0;
+}
\ No newline at end of file
diff --git a/limelight-common/limelight-common.vcxproj b/limelight-common/limelight-common.vcxproj
index bcc43a2..d4eae93 100644
--- a/limelight-common/limelight-common.vcxproj
+++ b/limelight-common/limelight-common.vcxproj
@@ -135,6 +135,7 @@
+
diff --git a/limelight-common/limelight-common.vcxproj.filters b/limelight-common/limelight-common.vcxproj.filters
index 90f998a..bbb4231 100644
--- a/limelight-common/limelight-common.vcxproj.filters
+++ b/limelight-common/limelight-common.vcxproj.filters
@@ -48,6 +48,9 @@
Source Files
+
+ Source Files
+