[vlc-devel] commit: Use our endianism macros ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 28 19:50:03 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 28 20:47:32 2009 +0200| [dd4e4a5e2f5b61e183adcc992eae262b39f717f9] | committer: Rémi Denis-Courmont 

Use our endianism macros

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

 modules/stream_out/rtpfmt.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/modules/stream_out/rtpfmt.c b/modules/stream_out/rtpfmt.c
index 16719c8..680f745 100644
--- a/modules/stream_out/rtpfmt.c
+++ b/modules/stream_out/rtpfmt.c
@@ -55,11 +55,9 @@ int rtp_packetize_mpa( sout_stream_id_t *id,
         /* rtp common header */
         rtp_packetize_common( id, out, (i == i_count - 1)?1:0, in->i_pts );
         /* mbz set to 0 */
-        out->p_buffer[12] = 0;
-        out->p_buffer[13] = 0;
+        SetWBE( out->p_buffer + 12, 0 );
         /* fragment offset in the current frame */
-        out->p_buffer[14] = ( (i*i_max) >> 8 )&0xff;
-        out->p_buffer[15] = ( (i*i_max)      )&0xff;
+        SetWBE( out->p_buffer + 14, i * i_max );
         memcpy( &out->p_buffer[16], p_data, i_payload );
 
         out->i_buffer   = 16 + i_payload;
@@ -145,6 +143,7 @@ int rtp_packetize_mpv( sout_stream_id_t *id, block_t *in )
     {
         int           i_payload = __MIN( i_max, i_data );
         block_t *out = block_Alloc( 16 + i_payload );
+        /* MBZ:5 T:1 TR:10 AN:1 N:1 S:1 B:1 E:1 P:3 FBV:1 BFC:3 FFV:1 FFC:3 */
         uint32_t      h = ( i_temporal_ref << 16 )|
                           ( b_sequence_start << 13 )|
                           ( b_start_slice << 12 )|
@@ -156,11 +155,7 @@ int rtp_packetize_mpv( sout_stream_id_t *id, block_t *in )
         rtp_packetize_common( id, out, (i == i_count - 1)?1:0,
                               in->i_pts > 0 ? in->i_pts : in->i_dts );
 
-        /* MBZ:5 T:1 TR:10 AN:1 N:1 S:1 B:1 E:1 P:3 FBV:1 BFC:3 FFV:1 FFC:3 */
-        out->p_buffer[12] = ( h >> 24 )&0xff;
-        out->p_buffer[13] = ( h >> 16 )&0xff;
-        out->p_buffer[14] = ( h >>  8 )&0xff;
-        out->p_buffer[15] = ( h       )&0xff;
+        SetDWBE( out->p_buffer + 12, h );
 
         memcpy( &out->p_buffer[16], p_data, i_payload );
 
@@ -320,8 +315,7 @@ int rtp_packetize_mp4a( sout_stream_id_t *id, block_t *in )
         out->p_buffer[12] = 0;
         out->p_buffer[13] = 2*8;
         /* for each AU length 13 bits + idx 3bits, */
-        out->p_buffer[14] = ( in->i_buffer >> 5 )&0xff;
-        out->p_buffer[15] = ( (in->i_buffer&0xff)<<3 )|0;
+        SetWBE( out->p_buffer + 14, (in->i_buffer << 3) | 0 );
 
         memcpy( &out->p_buffer[16], p_data, i_payload );
 
@@ -384,8 +378,7 @@ int rtp_packetize_h263( sout_stream_id_t *id, block_t *in )
                               in->i_pts > 0 ? in->i_pts : in->i_dts );
 
         /* h263 header */
-        out->p_buffer[12] = ( h >>  8 )&0xff;
-        out->p_buffer[13] = ( h       )&0xff;
+        SetWBE( out->p_buffer + 12, h );
         memcpy( &out->p_buffer[RTP_H263_PAYLOAD_START], p_data, i_payload );
 
         out->i_buffer = RTP_H263_PAYLOAD_START + i_payload;




More information about the vlc-devel mailing list