gst/: Use GLib versions of htonl, htons, ntohl and ntohs in order to avoid problems on win32 (#529707).

Original commit message from CVS:
* gst/rtp/gstasteriskh263.c: (gst_asteriskh263_chain):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_add_internal):
* gst/udp/gstudpsrc.c: (gst_udpsrc_start):
Use GLib versions of htonl, htons, ntohl and ntohs in order
to avoid problems on win32 (#529707).
This commit is contained in:
Tim-Philipp Müller 2008-04-25 13:31:48 +00:00
parent 883d93df58
commit 327741a21a
4 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2008-04-25 Tim-Philipp Müller <tim at centricular dot net>
* gst/rtp/gstasteriskh263.c: (gst_asteriskh263_chain):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_add_internal):
* gst/udp/gstudpsrc.c: (gst_udpsrc_start):
Use GLib versions of htonl, htons, ntohl and ntohs in order
to avoid problems on win32 (#529707).
2008-04-25 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Jesús Corrius <jesus at softcatala org>

View file

@ -204,8 +204,8 @@ gst_asteriskh263_chain (GstPad * pad, GstBuffer * buf)
samples = timestamp - asteriskh263->lastts;
asteriskh263->lastts = timestamp;
GST_ASTERISKH263_HEADER_TIMESTAMP (outbuf) = htonl (samples);
GST_ASTERISKH263_HEADER_LENGTH (outbuf) = htons (asterisk_len);
GST_ASTERISKH263_HEADER_TIMESTAMP (outbuf) = g_htonl (samples);
GST_ASTERISKH263_HEADER_LENGTH (outbuf) = g_htons (asterisk_len);
/* copy the data into place */
memcpy (GST_BUFFER_DATA (outbuf) + GST_ASTERISKH263_HEADER_LEN, payload,

View file

@ -626,7 +626,7 @@ gst_multiudpsink_add_internal (GstMultiUDPSink * sink, const gchar * host,
memset (&client->theiraddr, 0, sizeof (client->theiraddr));
memset (&client->multi_addr, 0, sizeof (client->multi_addr));
client->theiraddr.sin_family = AF_INET; /* host byte order */
client->theiraddr.sin_port = htons (port); /* short, network byte order */
client->theiraddr.sin_port = g_htons (port); /* short, network byte order */
g_get_current_time (&now);
client->connect_time = GST_TIMEVAL_TO_TIME (now);
@ -634,7 +634,7 @@ gst_multiudpsink_add_internal (GstMultiUDPSink * sink, const gchar * host,
/* if its an IP address */
if (inet_aton (host, &addr)) {
/* check if its a multicast address */
if ((ntohl (addr.s_addr) & 0xf0000000) == 0xe0000000) {
if ((g_ntohl (addr.s_addr) & 0xf0000000) == 0xe0000000) {
GST_DEBUG_OBJECT (sink, "multicast address detected");
client->multi_addr.imr_multiaddr.s_addr = addr.s_addr;
client->multi_addr.imr_interface.s_addr = INADDR_ANY;

View file

@ -691,7 +691,7 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
memset (&src->myaddr, 0, sizeof (src->myaddr));
src->myaddr.sin_family = AF_INET; /* host byte order */
src->myaddr.sin_port = htons (src->port); /* short, network byte order */
src->myaddr.sin_port = g_htons (src->port); /* short, network byte order */
if (src->multi_addr.imr_multiaddr.s_addr)
src->myaddr.sin_addr.s_addr = src->multi_addr.imr_multiaddr.s_addr;
@ -751,7 +751,7 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
sizeof (bc_val))) < 0)
goto no_broadcast;
port = ntohs (my_addr.sin_port);
port = g_ntohs (my_addr.sin_port);
GST_DEBUG_OBJECT (src, "bound, on port %d", port);
if (port != src->port) {
src->port = port;
@ -759,7 +759,7 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
g_object_notify (G_OBJECT (src), "port");
}
src->myaddr.sin_port = htons (src->port + 1);
src->myaddr.sin_port = g_htons (src->port + 1);
if ((src->fdset = gst_poll_new (TRUE)) == NULL)
goto no_fdset;