diff --git a/README.html b/README.html
index c8cc5f7..021ad66 100644
--- a/README.html
+++ b/README.html
@@ -461,9 +461,7 @@ compiler)
Limitations: “sudo make install” does not work (due to
lack of “sudo” equivalent on this platform); GStreamer sound was so far
only confirmed to work with the DirectSound audiosink option
-“-as directsoundsink”. The identification of the “true” MAC
-address of the UxPlay server is not yet implemented on Windows, so a
-random MAC address is used.
+“-as directsoundsink”.
Download and install Bonjour SDK for Windows
v3.0 from the official Apple site
#include
-#include
+#include
+#include
#else
#include
#include
@@ -288,10 +289,40 @@ static int parse_hw_addr (std::string str, std::vector &hw_addr) {
static std::string find_mac () {
/* finds the MAC address of a network interface *
- * in a Linux, *BSD or macOS system. */
+ * in a Windows, Linux, *BSD or macOS system. */
std::string mac = "";
+ char str[3];
#ifdef _WIN32
- /* for now, don't find true MAC address if compiled for Windows */
+ ULONG buflen = sizeof(IP_ADAPTER_ADDRESSES);
+ PIP_ADAPTER_ADDRESSES addresses = (IP_ADAPTER_ADDRESSES*) malloc(buflen);
+ if (addresses == NULL) {
+ return mac;
+ }
+ if (GetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &buflen) == ERROR_BUFFER_OVERFLOW) {
+ free(addresses);
+ addresses = (IP_ADAPTER_ADDRESSES*) malloc(buflen);
+ if (addresses == NULL) {
+ return mac;
+ }
+ }
+ if (GetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &buflen) == NO_ERROR) {
+ for (PIP_ADAPTER_ADDRESSES address = addresses; address != NULL; address = address->Next) {
+ if (address->PhysicalAddressLength != 6 /* MAC has 6 octets */
+ || (address->IfType != 6 && address->IfType != 71) /* Ethernet or Wireless interface */
+ || address->OperStatus != 1) { /* interface is up */
+ continue;
+ }
+ mac.erase();
+ for (int i = 0; i < 6; i++) {
+ sprintf(str,"%02x", int(address->PhysicalAddress[i]));
+ mac = mac + str;
+ if (i < 5) mac = mac + ":";
+ }
+ break;
+ }
+ }
+ free(addresses);
+ return mac;
#else
struct ifaddrs *ifap, *ifaptr;
int non_null_octets = 0;
@@ -315,7 +346,6 @@ static std::string find_mac () {
#endif
if (non_null_octets) {
mac.erase();
- char str[3];
for (int i = 0; i < 6 ; i++) {
sprintf(str,"%02x", octet[i]);
mac = mac + str;
@@ -759,6 +789,12 @@ int main (int argc, char *argv[]) {
use_audio = false;
}
+#ifdef _WIN32 /* don't buffer stdout in WIN32 when debug_log = false */
+ if (!debug_log) {
+ setbuf(stdout, NULL);
+ }
+#endif
+
#if __APPLE__
/* force use of -nc option on macOS */
LOGI("macOS detected: use -nc option as workaround for GStreamer problem");