diff options
author | Michael Smith <msmith@xiph.org> | 2008-11-20 22:56:58 +0000 |
---|---|---|
committer | Michael Smith <msmith@xiph.org> | 2008-11-20 22:56:58 +0000 |
commit | 9b372f1bbd3c1e0994811354fe500f1da0ea938b (patch) | |
tree | 234e1d6693faee2fd82deee21245f0937b4319f1 /gst/udp/gstudpnetutils.c | |
parent | 380b64d670d1a8a9a5075d3a235f57f10d0f41fa (diff) |
gst/udp/: Fix multiudpsink on OSX by passing the specific length of the socket, refactor that into a function shared ...
Original commit message from CVS:
* gst/udp/gstmultiudpsink.c:
* gst/udp/gstudpnetutils.c:
* gst/udp/gstudpnetutils.h:
* gst/udp/gstudpsrc.c:
Fix multiudpsink on OSX by passing the specific length of the socket,
refactor that into a function shared with the same thing in udpsrc.
Diffstat (limited to 'gst/udp/gstudpnetutils.c')
-rw-r--r-- | gst/udp/gstudpnetutils.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gst/udp/gstudpnetutils.c b/gst/udp/gstudpnetutils.c index b3fa8870..07c80448 100644 --- a/gst/udp/gstudpnetutils.c +++ b/gst/udp/gstudpnetutils.c @@ -60,6 +60,23 @@ gst_udp_net_utils_win32_wsa_startup (GstObject * obj) #endif int +gst_udp_get_sockaddr_length (struct sockaddr_storage *addr) +{ + /* MacOS is picky about passing precisely the correct length, + * so we calculate it here for the given socket type. + */ + switch (addr->ss_family) { + case AF_INET: + return sizeof (struct sockaddr_in); + case AF_INET6: + return sizeof (struct sockaddr_in6); + default: + /* don't know, Screw MacOS and use the full length */ + return sizeof (*addr); + } +} + +int gst_udp_get_addr (const char *hostname, int port, struct sockaddr_storage *addr) { struct addrinfo hints, *res, *nres; |