mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-17 17:05:50 +00:00
Platform code cleanup
This commit is contained in:
parent
601dd55d7c
commit
f8df5030e1
@ -93,8 +93,7 @@ void LiStopConnection(void) {
|
||||
}
|
||||
if (stage == STAGE_PLATFORM_INIT) {
|
||||
Limelog("Cleaning up platform...");
|
||||
cleanupPlatformSockets();
|
||||
cleanupPlatformThreads();
|
||||
cleanupPlatform();
|
||||
stage--;
|
||||
Limelog("done\n");
|
||||
}
|
||||
@ -139,13 +138,7 @@ int LiStartConnection(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, PCONN
|
||||
|
||||
Limelog("Initializing platform...");
|
||||
listenerCallbacks.stageStarting(STAGE_PLATFORM_INIT);
|
||||
err = initializePlatformSockets();
|
||||
if (err != 0) {
|
||||
Limelog("failed: %d\n", err);
|
||||
listenerCallbacks.stageFailed(STAGE_PLATFORM_INIT, err);
|
||||
goto Cleanup;
|
||||
}
|
||||
err = initializePlatformThreads();
|
||||
err = initializePlatform();
|
||||
if (err != 0) {
|
||||
Limelog("failed: %d\n", err);
|
||||
listenerCallbacks.stageFailed(STAGE_PLATFORM_INIT, err);
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "PlatformThreads.h"
|
||||
#include "Platform.h"
|
||||
|
||||
int initializePlatformSockets(void);
|
||||
void cleanupPlatformSockets(void);
|
||||
|
||||
#if defined(LC_WINDOWS_PHONE) || defined(LC_WINDOWS)
|
||||
CHAR DbgBuf[512];
|
||||
#endif
|
||||
@ -307,7 +310,14 @@ int PltWaitForEvent(PLT_EVENT *event) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int initializePlatformThreads(void) {
|
||||
int initializePlatform(void) {
|
||||
int err;
|
||||
|
||||
err = initializePlatformSockets();
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
|
||||
return PltCreateMutex(&thread_list_lock);
|
||||
#else
|
||||
@ -315,7 +325,9 @@ int initializePlatformThreads(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void cleanupPlatformThreads(void) {
|
||||
void cleanupPlatform(void) {
|
||||
cleanupPlatformSockets();
|
||||
|
||||
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
|
||||
LC_ASSERT(pending_thread_head == NULL);
|
||||
LC_ASSERT(thread_head == NULL);
|
@ -46,3 +46,6 @@ extern PLATFORM_CALLBACKS platformCallbacks;
|
||||
#else
|
||||
#define LC_ASSERT(x)
|
||||
#endif
|
||||
|
||||
int initializePlatform(void);
|
||||
void cleanupPlatform(void);
|
@ -33,5 +33,3 @@ typedef ssize_t SOCK_RET;
|
||||
SOCKET connectTcpSocket(IP_ADDRESS dstaddr, unsigned short port);
|
||||
SOCKET bindUdpSocket(void);
|
||||
int enableNoDelay(SOCKET s);
|
||||
int initializePlatformSockets(void);
|
||||
void cleanupPlatformSockets(void);
|
@ -35,9 +35,6 @@ typedef struct _PLT_EVENT {
|
||||
#error Unsupported platform
|
||||
#endif
|
||||
|
||||
int initializePlatformThreads(void);
|
||||
void cleanupPlatformThreads(void);
|
||||
|
||||
int PltCreateMutex(PLT_MUTEX *mutex);
|
||||
void PltDeleteMutex(PLT_MUTEX *mutex);
|
||||
void PltLockMutex(PLT_MUTEX *mutex);
|
||||
|
@ -141,7 +141,7 @@
|
||||
<ClCompile Include="OpenAES\oaes_base64.c" />
|
||||
<ClCompile Include="OpenAES\oaes_lib.c" />
|
||||
<ClCompile Include="PlatformSockets.c" />
|
||||
<ClCompile Include="PlatformThreads.c" />
|
||||
<ClCompile Include="Platform.c" />
|
||||
<ClCompile Include="RtspConnection.c" />
|
||||
<ClCompile Include="RtspParser.c" />
|
||||
<ClCompile Include="SdpGenerator.c" />
|
||||
|
@ -33,9 +33,6 @@
|
||||
<ClCompile Include="PlatformSockets.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PlatformThreads.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VideoDepacketizer.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -66,6 +63,9 @@
|
||||
<ClCompile Include="FakeCallbacks.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Platform.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ByteBuffer.h">
|
||||
|
Loading…
x
Reference in New Issue
Block a user