[vlc-commits] packetizer: a52: simplify, fix audio stuffing
Thomas Guillem
git at videolan.org
Wed Apr 11 13:19:42 CEST 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Apr 11 08:42:45 2018 +0200| [19676efa36d8aeaf8d7b75ac30d155d21226ed57] | committer: Thomas Guillem
packetizer: a52: simplify, fix audio stuffing
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=19676efa36d8aeaf8d7b75ac30d155d21226ed57
---
modules/packetizer/a52.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/modules/packetizer/a52.c b/modules/packetizer/a52.c
index 07d33c2cdb..f9972a7649 100644
--- a/modules/packetizer/a52.c
+++ b/modules/packetizer/a52.c
@@ -61,7 +61,6 @@ struct decoder_sys_t
int i_state;
block_bytestream_t bytestream;
- size_t i_next_offset;
/*
* Common properties
@@ -227,13 +226,13 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
break;
}
- p_sys->i_input_size = p_sys->i_next_offset = p_sys->frame.i_size;
+ p_sys->i_input_size = p_sys->frame.i_size;
p_sys->i_state = STATE_NEXT_SYNC;
/* fallthrough */
case STATE_NEXT_SYNC:
/* Check if next expected frame contains the sync word */
- if( block_PeekOffsetBytes( &p_sys->bytestream, p_sys->i_next_offset,
+ if( block_PeekOffsetBytes( &p_sys->bytestream, p_sys->i_input_size,
p_header, VLC_A52_HEADER_SIZE )
!= VLC_SUCCESS )
{
@@ -246,11 +245,11 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
- if( p_header[0] == 0 )
+ if( p_header[0] == 0 || p_header[1] == 0 )
{
/* A52 wav files and audio CD's use stuffing */
- p_sys->i_next_offset++;
- continue;
+ p_sys->i_state = STATE_GET_DATA;
+ break;
}
if( p_header[0] != 0x0b || p_header[1] != 0x77 )
@@ -262,16 +261,11 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
break;
}
- if( p_sys->i_next_offset == p_sys->i_input_size )
- {
- vlc_a52_header_t a52;
- if( !vlc_a52_header_Parse( &a52, p_header, VLC_A52_HEADER_SIZE )
- && a52.b_eac3 && a52.eac3.strmtyp == EAC3_STRMTYP_DEPENDENT )
- {
- p_sys->i_input_size += a52.i_size;
- p_sys->i_next_offset = p_sys->i_input_size;
- }
- }
+ vlc_a52_header_t a52;
+ if( !vlc_a52_header_Parse( &a52, p_header, VLC_A52_HEADER_SIZE )
+ && a52.b_eac3 && a52.eac3.strmtyp == EAC3_STRMTYP_DEPENDENT )
+ p_sys->i_input_size += a52.i_size;
+
p_sys->i_state = STATE_GET_DATA;
break;
More information about the vlc-commits
mailing list