Commit 790c5845 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

S/PDIF: use SetWBE/SetWLE

parent 812905a6
...@@ -96,16 +96,14 @@ static block_t *DoWork( filter_t * p_filter, block_t *p_in_buf ) ...@@ -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 ); vlc_memcpy( p_out, p_sync_be, 6 );
p_out[4] = p_in[5] & 0x7; /* bsmod */ p_out[4] = p_in[5] & 0x7; /* bsmod */
p_out[6] = (i_frame_size >> 4) & 0xff; SetWBE( p_out + 6, i_frame_size << 4 );
p_out[7] = (i_frame_size << 4) & 0xff;
vlc_memcpy( &p_out[8], p_in, i_frame_size * 2 ); vlc_memcpy( &p_out[8], p_in, i_frame_size * 2 );
} }
else else
{ {
vlc_memcpy( p_out, p_sync_le, 6 ); vlc_memcpy( p_out, p_sync_le, 6 );
p_out[5] = p_in[5] & 0x7; /* bsmod */ p_out[5] = p_in[5] & 0x7; /* bsmod */
p_out[6] = (i_frame_size << 4) & 0xff; SetWLE( p_out + 6, i_frame_size << 4 );
p_out[7] = (i_frame_size >> 4) & 0xff;
swab( p_in, &p_out[8], i_frame_size * 2 ); swab( p_in, &p_out[8], i_frame_size * 2 );
} }
vlc_memset( p_out + 8 + i_frame_size * 2, 0, vlc_memset( p_out + 8 + i_frame_size * 2, 0,
......
...@@ -173,15 +173,13 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf ) ...@@ -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 ); vlc_memcpy( p_out, p_sync_be, 6 );
p_out[5] = i_ac5_spdif_type; p_out[5] = i_ac5_spdif_type;
p_out[6] = (( i_length ) >> 5 ) & 0xFF; SetWBE( p_out + 6, i_length << 3 );
p_out[7] = ( i_length << 3 ) & 0xFF;
} }
else else
{ {
vlc_memcpy( p_out, p_sync_le, 6 ); vlc_memcpy( p_out, p_sync_le, 6 );
p_out[4] = i_ac5_spdif_type; p_out[4] = i_ac5_spdif_type;
p_out[6] = ( i_length << 3 ) & 0xFF; SetWLE( p_out + 6, i_length << 3 );
p_out[7] = (( i_length ) >> 5 ) & 0xFF;
} }
if( ( (p_in[0] == 0x1F || p_in[0] == 0x7F) && p_filter->fmt_out.audio.i_format == VLC_CODEC_SPDIFL ) || if( ( (p_in[0] == 0x1F || p_in[0] == 0x7F) && p_filter->fmt_out.audio.i_format == VLC_CODEC_SPDIFL ) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment