#include <sstream>
#include <cmath>
+#include <cstdint>
#include <cinttypes>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <unistd.h>
+#ifdef _WIN32
+# include <WinSock2.h>
+# include <ws2tcpip.h>
+# include <basetsd.h>
+#else
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <arpa/inet.h>
+# include <unistd.h>
+#endif
#include "facial_landmark_detector.h"
#include "math_utils.h"
{
parseConfig(cfgPath);
+#ifdef _WIN32 // WinSock2 should be initialized before using
+ WSADATA wsaData;
+ if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
+ {
+ return;
+ }
+#endif
+
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons(m_cfg.osfPort);
FacialLandmarkDetector::~FacialLandmarkDetector()
{
+#ifdef _WIN32
+ closesocket(m_sock);
+#else
close(m_sock);
+#endif
}
FacialLandmarkDetector::Params FacialLandmarkDetector::getParams(void) const
static const int landmarksOffset = 8 + 4 + 2 * 4 + 2 * 4 + 1 + 4 + 3 * 4 + 3 * 4
+ 4 * 4 + 4 * 68;
- uint8_t buf[packetFrameSize];
- ssize_t recvSize = recv(m_sock, buf, sizeof buf, 0);
+ char buf[packetFrameSize];
+ auto recvSize = recv(m_sock, buf, sizeof buf, 0);
if (recvSize != packetFrameSize) continue;
// Note: This is dependent on endianness, and we would assume that