diff --git a/limelight-common/Config.c b/limelight-common/Config.c index 1e41b37..9f7ae3f 100644 --- a/limelight-common/Config.c +++ b/limelight-common/Config.c @@ -2,7 +2,7 @@ #include "ByteBuffer.h" -const int UNKNOWN_CONFIG [] = { +static const int UNKNOWN_CONFIG[] = { 70151, 68291329, 1280, @@ -92,7 +92,7 @@ const int UNKNOWN_CONFIG [] = { (int) 0xFE000000 }; -const int CONFIG_SIZE = sizeof(UNKNOWN_CONFIG) + (8 * 4) + 3; +static const int CONFIG_SIZE = sizeof(UNKNOWN_CONFIG) +(8 * 4) + 3; int getConfigDataSize(PSTREAM_CONFIGURATION streamConfig) { return CONFIG_SIZE; diff --git a/limelight-common/Connection.c b/limelight-common/Connection.c index e393944..e7d91a1 100644 --- a/limelight-common/Connection.c +++ b/limelight-common/Connection.c @@ -9,7 +9,7 @@ #define STAGE_CONTROL_STREAM_START 5 #define STAGE_VIDEO_STREAM_START 6 -int stage = STAGE_NONE; +static int stage = STAGE_NONE; void LiStopConnection(void) { if (stage == STAGE_VIDEO_STREAM_START) { diff --git a/limelight-common/ControlStream.c b/limelight-common/ControlStream.c index 7952e4c..d490e95 100644 --- a/limelight-common/ControlStream.c +++ b/limelight-common/ControlStream.c @@ -7,28 +7,28 @@ typedef struct _NVCTL_PACKET_HEADER { unsigned short payloadLength; } NVCTL_PACKET_HEADER, *PNVCTL_PACKET_HEADER; -IP_ADDRESS host; -SOCKET ctlSock = INVALID_SOCKET; -STREAM_CONFIGURATION streamConfig; -PLT_THREAD heartbeatThread; -PLT_THREAD jitterThread; -PLT_THREAD resyncThread; -PLT_EVENT resyncEvent; +static IP_ADDRESS host; +static SOCKET ctlSock = INVALID_SOCKET; +static STREAM_CONFIGURATION streamConfig; +static PLT_THREAD heartbeatThread; +static PLT_THREAD jitterThread; +static PLT_THREAD resyncThread; +static PLT_EVENT resyncEvent; -const short PTYPE_KEEPALIVE = 0x13ff; -const short PPAYLEN_KEEPALIVE = 0x0000; +static const short PTYPE_KEEPALIVE = 0x13ff; +static const short PPAYLEN_KEEPALIVE = 0x0000; -const short PTYPE_HEARTBEAT = 0x1401; -const short PPAYLEN_HEARTBEAT = 0x0000; +static const short PTYPE_HEARTBEAT = 0x1401; +static const short PPAYLEN_HEARTBEAT = 0x0000; -const short PTYPE_1405 = 0x1405; -const short PPAYLEN_1405 = 0x0000; +static const short PTYPE_1405 = 0x1405; +static const short PPAYLEN_1405 = 0x0000; -const short PTYPE_RESYNC = 0x1404; -const short PPAYLEN_RESYNC = 16; +static const short PTYPE_RESYNC = 0x1404; +static const short PPAYLEN_RESYNC = 16; -const short PTYPE_JITTER = 0x140c; -const short PPAYLEN_JITTER = 0x10; +static const short PTYPE_JITTER = 0x140c; +static const short PPAYLEN_JITTER = 0x10; int initializeControlStream(IP_ADDRESS addr, PSTREAM_CONFIGURATION streamConfigPtr) { memcpy(&streamConfig, streamConfigPtr, sizeof(*streamConfigPtr)); diff --git a/limelight-common/Handshake.c b/limelight-common/Handshake.c index d9d5d0c..cbddb79 100644 --- a/limelight-common/Handshake.c +++ b/limelight-common/Handshake.c @@ -2,28 +2,28 @@ #include "PlatformSockets.h" #include "PlatformThreads.h" -const char HELLO [] = { +static const char HELLO [] = { 0x07, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x03, 0x01, 0x00, 0x00 }; -const char PACKET2 [] = { +static const char PACKET2 [] = { 0x01, 0x03, 0x02, 0x00, 0x08, 0x00 }; -const char PACKET3 [] = { +static const char PACKET3 [] = { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -const char PACKET4 [] = { +static const char PACKET4 [] = { 0x01, 0x01, 0x00, 0x0 }; -SOCKET sock = INVALID_SOCKET; +static SOCKET sock = INVALID_SOCKET; static int waitAndDiscardResponse(SOCKET sock) { char temp[256]; diff --git a/limelight-common/VideoDepacketizer.c b/limelight-common/VideoDepacketizer.c index ee1d9b6..1a4d045 100644 --- a/limelight-common/VideoDepacketizer.c +++ b/limelight-common/VideoDepacketizer.c @@ -3,13 +3,13 @@ #include "LinkedBlockingQueue.h" #include "Video.h" -PLENTRY nalChainHead; -int nalChainDataLength; -int decodingAvc; +static PLENTRY nalChainHead; +static int nalChainDataLength; +static int decodingAvc; -LINKED_BLOCKING_QUEUE decodeUnitQueue; +static LINKED_BLOCKING_QUEUE decodeUnitQueue; -unsigned short lastSequenceNumber; +static unsigned short lastSequenceNumber; typedef struct _BUFFER_DESC { char* data; diff --git a/limelight-common/VideoStream.c b/limelight-common/VideoStream.c index 0ff4741..a6ff661 100644 --- a/limelight-common/VideoStream.c +++ b/limelight-common/VideoStream.c @@ -5,19 +5,22 @@ #define FIRST_FRAME_MAX 1500 -DECODER_RENDERER_CALLBACKS callbacks; -STREAM_CONFIGURATION configuration; -IP_ADDRESS remoteHost; +#define RTP_PORT 47998 +#define FIRST_FRAME_PORT 47996 -SOCKET rtpSocket = INVALID_SOCKET; -SOCKET firstFrameSocket = INVALID_SOCKET; +static DECODER_RENDERER_CALLBACKS callbacks; +static STREAM_CONFIGURATION configuration; +static IP_ADDRESS remoteHost; -LINKED_BLOCKING_QUEUE packetQueue; +static SOCKET rtpSocket = INVALID_SOCKET; +static SOCKET firstFrameSocket = INVALID_SOCKET; -PLT_THREAD udpPingThread; -PLT_THREAD receiveThread; -PLT_THREAD depacketizerThread; -PLT_THREAD decoderThread; +static LINKED_BLOCKING_QUEUE packetQueue; + +static PLT_THREAD udpPingThread; +static PLT_THREAD receiveThread; +static PLT_THREAD depacketizerThread; +static PLT_THREAD decoderThread; void initializeVideoStream(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, PDECODER_RENDERER_CALLBACKS drCallbacks) { memcpy(&callbacks, drCallbacks, sizeof(callbacks)); @@ -51,7 +54,7 @@ static void UdpPingThreadProc(void *context) { memset(&saddr, 0, sizeof(saddr)); saddr.sin_family = AF_INET; - saddr.sin_port = htons(47998); + saddr.sin_port = htons(RTP_PORT); memcpy(&saddr.sin_addr, &remoteHost, sizeof(remoteHost)); while (!PltIsThreadInterrupted(&udpPingThread)) { @@ -137,7 +140,7 @@ int readFirstFrame(void) { int err; int offset = 0; - firstFrameSocket = connectTcpSocket(remoteHost, 47996); + firstFrameSocket = connectTcpSocket(remoteHost, FIRST_FRAME_PORT); if (firstFrameSocket == INVALID_SOCKET) { return LastSocketError(); } @@ -195,7 +198,7 @@ int startVideoStream(void* rendererContext, int drFlags) { callbacks.setup(configuration.width, configuration.height, 60, rendererContext, drFlags); - rtpSocket = bindUdpSocket(47998); + rtpSocket = bindUdpSocket(RTP_PORT); err = PltCreateThread(UdpPingThreadProc, NULL, &udpPingThread); if (err != 0) {