[vlc-commits] Use vlc function for host to network conversions

Denis Charmet git at videolan.org
Mon Feb 24 23:41:09 CET 2014


vlc | branch: master | Denis Charmet <typx at dinauz.org> | Mon Feb 24 23:40:02 2014 +0100| [9b2058c6ca785aa9cc9233749221bbf359a97a39] | committer: Denis Charmet

Use vlc function for host to network conversions

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b2058c6ca785aa9cc9233749221bbf359a97a39
---

 modules/access_output/http.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/modules/access_output/http.c b/modules/access_output/http.c
index f217679..4fbcf22 100644
--- a/modules/access_output/http.c
+++ b/modules/access_output/http.c
@@ -30,7 +30,6 @@
 # include "config.h"
 #endif
 
-#include <arpa/inet.h>
 #include <stdint.h>
 
 #include <vlc_common.h>
@@ -377,9 +376,9 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
             {
                 struct metacube2_block_header hdr;
                 memcpy( hdr.sync, METACUBE2_SYNC, sizeof( METACUBE2_SYNC ) );
-                hdr.size = htonl( p_sys->i_header_size );
-                hdr.flags = htons( METACUBE_FLAGS_HEADER );
-                hdr.csum = htons( metacube2_compute_crc( &hdr ) );
+                hdr.size = hton32( p_sys->i_header_size );
+                hdr.flags = hton16( METACUBE_FLAGS_HEADER );
+                hdr.csum = hton16( metacube2_compute_crc( &hdr ) );
 
                 int i_header_size = p_sys->i_header_size + sizeof( hdr );
                 uint8_t *p_hdr_block = xmalloc( i_header_size );
@@ -411,13 +410,13 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
             /* prepend Metacube header */
             struct metacube2_block_header hdr;
             memcpy( hdr.sync, METACUBE2_SYNC, sizeof( METACUBE2_SYNC ) );
-            hdr.size = htonl( p_buffer->i_buffer );
-            hdr.flags = htons( 0 );
+            hdr.size = hton32( p_buffer->i_buffer );
+            hdr.flags = hton16( 0 );
             if( p_buffer->i_flags & BLOCK_FLAG_HEADER )
-                hdr.flags |= htons( METACUBE_FLAGS_HEADER );
+                hdr.flags |= hton16( METACUBE_FLAGS_HEADER );
             if( p_sys->b_has_keyframes && !( p_buffer->i_flags & BLOCK_FLAG_TYPE_I ) )
-                hdr.flags |= htons( METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START );
-            hdr.csum = htons( metacube2_compute_crc( &hdr ) );
+                hdr.flags |= hton16( METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START );
+            hdr.csum = hton16( metacube2_compute_crc( &hdr ) );
 
             p_buffer = block_Realloc( p_buffer, sizeof( hdr ), p_buffer->i_buffer );
             if( p_buffer == NULL ) {



More information about the vlc-commits mailing list