udpsrc: Move #includes around to a) work around broken glibc header and b) Windows
authorSebastian Dröge <sebastian@centricular.com>
Tue, 28 Jun 2016 12:08:04 +0000 (15:08 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 28 Jun 2016 12:08:04 +0000 (15:08 +0300)
gst/udp/gstudpsrc.c

index 7714391..e646878 100644 (file)
 #include "config.h"
 #endif
 
-/* Needed to get struct in6_pktinfo */
+/* Needed to get struct in6_pktinfo.
+ * Also all these have to be before glib.h is included as
+ * otherwise struct in6_pktinfo is not defined completely
+ * due to broken glibc headers */
 #define _GNU_SOURCE
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
-#ifndef G_OS_WIN32
-#include <netinet/in.h>
-#endif
 
 #include <string.h>
 #include "gstudpsrc.h"
 
 #include <gio/gnetworking.h>
 
+/* Required for other parts of in_pktinfo / in6_pktinfo but only
+ * on non-Windows and can be included after glib.h */
+#ifndef G_OS_WIN32
+#include <netinet/ip.h>
+#endif
+
 /* Control messages for getting the destination address */
 #ifdef IP_PKTINFO
 GType gst_ip_pktinfo_message_get_type (void);