[vlc-commits] S/PDIF: use SetWBE/SetWLE

Rémi Denis-Courmont git at videolan.org
Thu Apr 28 21:21:29 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Apr 28 22:20:53 2011 +0300| [790c5845afd99d72ba63cd9af403c8086e508a8f] | committer: Rémi Denis-Courmont

S/PDIF: use SetWBE/SetWLE

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

 modules/audio_filter/converter/a52tospdif.c |    6 ++----
 modules/audio_filter/converter/dtstospdif.c |    6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/modules/audio_filter/converter/a52tospdif.c b/modules/audio_filter/converter/a52tospdif.c
index 8ee261c..4fd14ab 100644
--- a/modules/audio_filter/converter/a52tospdif.c
+++ b/modules/audio_filter/converter/a52tospdif.c
@@ -96,16 +96,14 @@ static block_t *DoWork( filter_t * p_filter, block_t *p_in_buf )
     {
         vlc_memcpy( p_out, p_sync_be, 6 );
         p_out[4] = p_in[5] & 0x7; /* bsmod */
-        p_out[6] = (i_frame_size >> 4) & 0xff;
-        p_out[7] = (i_frame_size << 4) & 0xff;
+        SetWBE( p_out + 6, i_frame_size << 4 );
         vlc_memcpy( &p_out[8], p_in, i_frame_size * 2 );
     }
     else
     {
         vlc_memcpy( p_out, p_sync_le, 6 );
         p_out[5] = p_in[5] & 0x7; /* bsmod */
-        p_out[6] = (i_frame_size << 4) & 0xff;
-        p_out[7] = (i_frame_size >> 4) & 0xff;
+        SetWLE( p_out + 6, i_frame_size << 4 );
         swab( p_in, &p_out[8], i_frame_size * 2 );
     }
     vlc_memset( p_out + 8 + i_frame_size * 2, 0,
diff --git a/modules/audio_filter/converter/dtstospdif.c b/modules/audio_filter/converter/dtstospdif.c
index c345e01..19cb432 100644
--- a/modules/audio_filter/converter/dtstospdif.c
+++ b/modules/audio_filter/converter/dtstospdif.c
@@ -173,15 +173,13 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
         {
             vlc_memcpy( p_out, p_sync_be, 6 );
             p_out[5] = i_ac5_spdif_type;
-            p_out[6] = (( i_length ) >> 5 ) & 0xFF;
-            p_out[7] = ( i_length << 3 ) & 0xFF;
+            SetWBE( p_out + 6, i_length << 3 );
         }
         else
         {
             vlc_memcpy( p_out, p_sync_le, 6 );
             p_out[4] = i_ac5_spdif_type;
-            p_out[6] = ( i_length << 3 ) & 0xFF;
-            p_out[7] = (( i_length ) >> 5 ) & 0xFF;
+            SetWLE( p_out + 6, i_length << 3 );
         }
 
         if( ( (p_in[0] == 0x1F || p_in[0] == 0x7F) && p_filter->fmt_out.audio.i_format == VLC_CODEC_SPDIFL ) ||



More information about the vlc-commits mailing list