[vlc-devel] commit: Fixed (partially) parsing of E-AC3 not using 1536 samples per frame . (Laurent Aimar )

git version control git at videolan.org
Wed May 6 00:23:24 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed May  6 00:10:55 2009 +0200| [36def77907889ae0bf382376925df0a6c0058c90] | committer: Laurent Aimar 

Fixed (partially) parsing of E-AC3 not using 1536 samples per frame.

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

 modules/codec/a52.c |    8 ++++----
 modules/codec/a52.h |    4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/codec/a52.c b/modules/codec/a52.c
index 21dd406..474a1d0 100644
--- a/modules/codec/a52.c
+++ b/modules/codec/a52.c
@@ -359,7 +359,7 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer )
     p_dec->fmt_out.audio.i_channels = p_sys->frame.i_channels;
     if( p_dec->fmt_out.audio.i_bytes_per_frame < p_sys->frame.i_size )
         p_dec->fmt_out.audio.i_bytes_per_frame = p_sys->frame.i_size;
-    p_dec->fmt_out.audio.i_frame_length = A52_FRAME_NB;
+    p_dec->fmt_out.audio.i_frame_length = p_sys->frame.i_samples;
 
     p_dec->fmt_out.audio.i_original_channels = p_sys->frame.i_channels_conf;
     p_dec->fmt_out.audio.i_physical_channels =
@@ -391,11 +391,11 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
     decoder_sys_t *p_sys = p_dec->p_sys;
     aout_buffer_t *p_buf;
 
-    p_buf = decoder_NewAudioBuffer( p_dec, A52_FRAME_NB  );
+    p_buf = decoder_NewAudioBuffer( p_dec, p_sys->frame.i_samples );
     if( p_buf == NULL ) return NULL;
 
     p_buf->start_date = aout_DateGet( &p_sys->end_date );
-    p_buf->end_date = aout_DateIncrement( &p_sys->end_date, A52_FRAME_NB );
+    p_buf->end_date = aout_DateIncrement( &p_sys->end_date, p_sys->frame.i_samples );
 
     return p_buf;
 }
@@ -414,7 +414,7 @@ static block_t *GetSoutBuffer( decoder_t *p_dec )
     p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date );
 
     p_block->i_length =
-        aout_DateIncrement( &p_sys->end_date, A52_FRAME_NB ) - p_block->i_pts;
+        aout_DateIncrement( &p_sys->end_date, p_sys->frame.i_samples ) - p_block->i_pts;
 
     return p_block;
 }
diff --git a/modules/codec/a52.h b/modules/codec/a52.h
index 824ef10..204be33 100644
--- a/modules/codec/a52.h
+++ b/modules/codec/a52.h
@@ -54,6 +54,7 @@ typedef struct
     unsigned int i_bitrate;
 
     unsigned int i_size;
+    unsigned int i_samples;
 
 } vlc_a52_header_t;
 
@@ -122,6 +123,8 @@ static inline int vlc_a52_header_ParseAc3( vlc_a52_header_t *p_header,
     default:
         return VLC_EGENERIC;
     }
+    p_header->i_samples = 6*256;
+
     p_header->b_eac3 = false;
     return VLC_SUCCESS;
 }
@@ -170,6 +173,7 @@ static inline int vlc_a52_header_ParseEac3( vlc_a52_header_t *p_header,
     p_header->i_channels      = p_acmod[i_acmod].i_count + i_lfeon;
     p_header->i_channels_conf = p_acmod[i_acmod].i_configuration | ( i_lfeon ? AOUT_CHAN_LFE : 0);
     p_header->i_bitrate = 8 * p_header->i_size * (p_header->i_rate) / (i_numblkscod * 256);
+    p_header->i_samples = i_numblkscod * 256;
 
     p_header->b_eac3 = true;
     return VLC_SUCCESS;




More information about the vlc-devel mailing list