Add static keyword to global variable declarations

This commit is contained in:
Cameron Gutman 2014-02-02 05:05:37 -05:00
parent 31cd93b11b
commit 12a31f8442
6 changed files with 46 additions and 43 deletions

View File

@ -2,7 +2,7 @@
#include "ByteBuffer.h" #include "ByteBuffer.h"
const int UNKNOWN_CONFIG [] = { static const int UNKNOWN_CONFIG[] = {
70151, 70151,
68291329, 68291329,
1280, 1280,
@ -92,7 +92,7 @@ const int UNKNOWN_CONFIG [] = {
(int) 0xFE000000 (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) { int getConfigDataSize(PSTREAM_CONFIGURATION streamConfig) {
return CONFIG_SIZE; return CONFIG_SIZE;

View File

@ -9,7 +9,7 @@
#define STAGE_CONTROL_STREAM_START 5 #define STAGE_CONTROL_STREAM_START 5
#define STAGE_VIDEO_STREAM_START 6 #define STAGE_VIDEO_STREAM_START 6
int stage = STAGE_NONE; static int stage = STAGE_NONE;
void LiStopConnection(void) { void LiStopConnection(void) {
if (stage == STAGE_VIDEO_STREAM_START) { if (stage == STAGE_VIDEO_STREAM_START) {

View File

@ -7,28 +7,28 @@ typedef struct _NVCTL_PACKET_HEADER {
unsigned short payloadLength; unsigned short payloadLength;
} NVCTL_PACKET_HEADER, *PNVCTL_PACKET_HEADER; } NVCTL_PACKET_HEADER, *PNVCTL_PACKET_HEADER;
IP_ADDRESS host; static IP_ADDRESS host;
SOCKET ctlSock = INVALID_SOCKET; static SOCKET ctlSock = INVALID_SOCKET;
STREAM_CONFIGURATION streamConfig; static STREAM_CONFIGURATION streamConfig;
PLT_THREAD heartbeatThread; static PLT_THREAD heartbeatThread;
PLT_THREAD jitterThread; static PLT_THREAD jitterThread;
PLT_THREAD resyncThread; static PLT_THREAD resyncThread;
PLT_EVENT resyncEvent; static PLT_EVENT resyncEvent;
const short PTYPE_KEEPALIVE = 0x13ff; static const short PTYPE_KEEPALIVE = 0x13ff;
const short PPAYLEN_KEEPALIVE = 0x0000; static const short PPAYLEN_KEEPALIVE = 0x0000;
const short PTYPE_HEARTBEAT = 0x1401; static const short PTYPE_HEARTBEAT = 0x1401;
const short PPAYLEN_HEARTBEAT = 0x0000; static const short PPAYLEN_HEARTBEAT = 0x0000;
const short PTYPE_1405 = 0x1405; static const short PTYPE_1405 = 0x1405;
const short PPAYLEN_1405 = 0x0000; static const short PPAYLEN_1405 = 0x0000;
const short PTYPE_RESYNC = 0x1404; static const short PTYPE_RESYNC = 0x1404;
const short PPAYLEN_RESYNC = 16; static const short PPAYLEN_RESYNC = 16;
const short PTYPE_JITTER = 0x140c; static const short PTYPE_JITTER = 0x140c;
const short PPAYLEN_JITTER = 0x10; static const short PPAYLEN_JITTER = 0x10;
int initializeControlStream(IP_ADDRESS addr, PSTREAM_CONFIGURATION streamConfigPtr) { int initializeControlStream(IP_ADDRESS addr, PSTREAM_CONFIGURATION streamConfigPtr) {
memcpy(&streamConfig, streamConfigPtr, sizeof(*streamConfigPtr)); memcpy(&streamConfig, streamConfigPtr, sizeof(*streamConfigPtr));

View File

@ -2,28 +2,28 @@
#include "PlatformSockets.h" #include "PlatformSockets.h"
#include "PlatformThreads.h" #include "PlatformThreads.h"
const char HELLO [] = { static const char HELLO [] = {
0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x61, 0x6e, 0x64, 0x72, 0x61, 0x6e, 0x64, 0x72,
0x6f, 0x69, 0x64, 0x03, 0x6f, 0x69, 0x64, 0x03,
0x01, 0x00, 0x00 0x01, 0x00, 0x00
}; };
const char PACKET2 [] = { static const char PACKET2 [] = {
0x01, 0x03, 0x02, 0x00, 0x01, 0x03, 0x02, 0x00,
0x08, 0x00 0x08, 0x00
}; };
const char PACKET3 [] = { static const char PACKET3 [] = {
0x04, 0x01, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00
}; };
const char PACKET4 [] = { static const char PACKET4 [] = {
0x01, 0x01, 0x00, 0x0 0x01, 0x01, 0x00, 0x0
}; };
SOCKET sock = INVALID_SOCKET; static SOCKET sock = INVALID_SOCKET;
static int waitAndDiscardResponse(SOCKET sock) { static int waitAndDiscardResponse(SOCKET sock) {
char temp[256]; char temp[256];

View File

@ -3,13 +3,13 @@
#include "LinkedBlockingQueue.h" #include "LinkedBlockingQueue.h"
#include "Video.h" #include "Video.h"
PLENTRY nalChainHead; static PLENTRY nalChainHead;
int nalChainDataLength; static int nalChainDataLength;
int decodingAvc; static int decodingAvc;
LINKED_BLOCKING_QUEUE decodeUnitQueue; static LINKED_BLOCKING_QUEUE decodeUnitQueue;
unsigned short lastSequenceNumber; static unsigned short lastSequenceNumber;
typedef struct _BUFFER_DESC { typedef struct _BUFFER_DESC {
char* data; char* data;

View File

@ -5,19 +5,22 @@
#define FIRST_FRAME_MAX 1500 #define FIRST_FRAME_MAX 1500
DECODER_RENDERER_CALLBACKS callbacks; #define RTP_PORT 47998
STREAM_CONFIGURATION configuration; #define FIRST_FRAME_PORT 47996
IP_ADDRESS remoteHost;
SOCKET rtpSocket = INVALID_SOCKET; static DECODER_RENDERER_CALLBACKS callbacks;
SOCKET firstFrameSocket = INVALID_SOCKET; 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; static LINKED_BLOCKING_QUEUE packetQueue;
PLT_THREAD receiveThread;
PLT_THREAD depacketizerThread; static PLT_THREAD udpPingThread;
PLT_THREAD decoderThread; static PLT_THREAD receiveThread;
static PLT_THREAD depacketizerThread;
static PLT_THREAD decoderThread;
void initializeVideoStream(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, PDECODER_RENDERER_CALLBACKS drCallbacks) { void initializeVideoStream(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, PDECODER_RENDERER_CALLBACKS drCallbacks) {
memcpy(&callbacks, drCallbacks, sizeof(callbacks)); memcpy(&callbacks, drCallbacks, sizeof(callbacks));
@ -51,7 +54,7 @@ static void UdpPingThreadProc(void *context) {
memset(&saddr, 0, sizeof(saddr)); memset(&saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET; saddr.sin_family = AF_INET;
saddr.sin_port = htons(47998); saddr.sin_port = htons(RTP_PORT);
memcpy(&saddr.sin_addr, &remoteHost, sizeof(remoteHost)); memcpy(&saddr.sin_addr, &remoteHost, sizeof(remoteHost));
while (!PltIsThreadInterrupted(&udpPingThread)) { while (!PltIsThreadInterrupted(&udpPingThread)) {
@ -137,7 +140,7 @@ int readFirstFrame(void) {
int err; int err;
int offset = 0; int offset = 0;
firstFrameSocket = connectTcpSocket(remoteHost, 47996); firstFrameSocket = connectTcpSocket(remoteHost, FIRST_FRAME_PORT);
if (firstFrameSocket == INVALID_SOCKET) { if (firstFrameSocket == INVALID_SOCKET) {
return LastSocketError(); return LastSocketError();
} }
@ -195,7 +198,7 @@ int startVideoStream(void* rendererContext, int drFlags) {
callbacks.setup(configuration.width, callbacks.setup(configuration.width,
configuration.height, 60, rendererContext, drFlags); configuration.height, 60, rendererContext, drFlags);
rtpSocket = bindUdpSocket(47998); rtpSocket = bindUdpSocket(RTP_PORT);
err = PltCreateThread(UdpPingThreadProc, NULL, &udpPingThread); err = PltCreateThread(UdpPingThreadProc, NULL, &udpPingThread);
if (err != 0) { if (err != 0) {