Index: libs/libmythhdhomerun/libmythhdhomerun.pro
===================================================================
--- libs/libmythhdhomerun/libmythhdhomerun.pro	(revision 20658)
+++ libs/libmythhdhomerun/libmythhdhomerun.pro	(working copy)
@@ -9,6 +9,8 @@
 target.path = $${LIBDIR}
 INSTALLS = target
 
+mingw:LIBS += -lws2_32 -liphlpapi -lpthread
+
 QMAKE_CLEAN += $(TARGET) $(TARGETA) $(TARGETD) $(TARGET0) $(TARGET1) $(TARGET2)
 
 HEADERS += hdhomerun_channelscan.h  hdhomerun_debug.h     hdhomerun_discover.h
Index: libs/libmythhdhomerun/hdhomerun_os.h
===================================================================
--- libs/libmythhdhomerun/hdhomerun_os.h	(revision 20658)
+++ libs/libmythhdhomerun/hdhomerun_os.h	(working copy)
@@ -23,10 +23,12 @@
 
 #if defined(__WINDOWS__)
 #define _WINSOCKAPI_
+// MinGW lacks wspiapi, so remove dependency by setting minimum WINVER to WinXP
+#define WINVER 0x0501
 #include <windows.h>
 #include <winsock2.h>
 #include <ws2tcpip.h>
-#include <wspiapi.h>
+//#include <wspiapi.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -78,6 +80,7 @@
 #endif
 
 typedef int bool_t;
+/* Use MinGW includes instead of these...
 typedef signed __int8 int8_t;
 typedef signed __int16 int16_t;
 typedef signed __int32 int32_t;
@@ -88,12 +91,17 @@
 typedef unsigned __int64 uint64_t;
 typedef HANDLE pthread_t;
 typedef HANDLE pthread_mutex_t;
+*/
+#include <stdint.h>
+#include <pthread.h>
 
+// Avoid #define conflicts by limiting scope to non-c++
+#ifndef __cplusplus
 #define socklen_t int
 #define close closesocket
 #define sock_getlasterror WSAGetLastError()
 #define sock_getlasterror_socktimeout (WSAGetLastError() == WSAETIMEDOUT)
-#define va_copy(x, y) x = y
+//#define va_copy(x, y) x = y
 #define atoll _atoi64
 #define strdup _strdup
 #define strcasecmp _stricmp
@@ -104,6 +112,7 @@
 #define sleep(sec) Sleep((sec)*1000)
 #define THREAD_FUNC_PREFIX DWORD WINAPI
 #define SIGPIPE SIGABRT
+#endif
 
 static inline uint64_t getcurrenttime(void)
 {
@@ -118,6 +127,7 @@
 	return setsockopt(s, level, optname, (char *)&t, sizeof(t));
 }
 
+/* MythTV uses pthreads lib instead of these...
 static inline int pthread_create(pthread_t *tid, void *attr, LPTHREAD_START_ROUTINE start, void *arg)
 {
 	*tid = CreateThread(NULL, 0, start, arg, 0, NULL);
@@ -154,6 +164,7 @@
 {
 	ReleaseMutex(*mutex);
 }
+*/
 
 #else /* !defined(__WINDOWS__) */
 
Index: libs/libmythtv/hdhrchannel.cpp
===================================================================
--- libs/libmythtv/hdhrchannel.cpp	(revision 20658)
+++ libs/libmythtv/hdhrchannel.cpp	(working copy)
@@ -7,10 +7,12 @@
 // C includes
 #include <unistd.h>
 #include <sys/types.h>
+#ifndef USING_MINGW
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#endif
 #include <sys/time.h>
 #include <fcntl.h>
 
@@ -44,7 +46,12 @@
 
     /* Otherwise, is it a valid IP address? */
     struct in_addr address;
+#ifdef USING_MINGW
+    address.s_addr = inet_addr(device.toLatin1().data());
+    if ((address.s_addr != INADDR_NONE) && (address.s_addr != INADDR_ANY))
+#else
     if (inet_aton(device.toLatin1().constData(), &address))
+#endif
     {
 	_device_ip = ntohl(address.s_addr);
 	return;
Index: libs/libmythtv/hdhrrecorder.cpp
===================================================================
--- libs/libmythtv/hdhrrecorder.cpp	(revision 20658)
+++ libs/libmythtv/hdhrrecorder.cpp	(working copy)
@@ -9,10 +9,12 @@
 #include <pthread.h>
 #include <unistd.h>
 #include <sys/types.h>
+#ifndef USING_MINGW
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+#endif
 #include <sys/time.h>
 #include <fcntl.h>
 
Index: libs/libmythtv/hdhrsignalmonitor.cpp
===================================================================
--- libs/libmythtv/hdhrsignalmonitor.cpp	(revision 20658)
+++ libs/libmythtv/hdhrsignalmonitor.cpp	(working copy)
@@ -7,7 +7,9 @@
 #include <pthread.h>
 #include <fcntl.h>
 #include <unistd.h>
+#ifndef USING_MINGW
 #include <sys/select.h>
+#endif
 
 #include "mythcontext.h"
 #include "mythdbcon.h"
Index: libs/libmythtv/libmythtv.pro
===================================================================
--- libs/libmythtv/libmythtv.pro	(revision 20658)
+++ libs/libmythtv/libmythtv.pro	(working copy)
@@ -581,6 +581,7 @@
     SOURCES += videoout_d3d.cpp
 
     LIBS += -lpthread
+    LIBS += -lws2_32
 }
 
 # install headers required by mytharchive
