Changeset bf48c33dbb564a5ede1581ab9bcb2db9213fba2f
- Timestamp:
- 04/06/07 21:39:55
(1 year ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1180985995 +0000
- git-parent:
[1fc3e360df0a8f4f169f2e258e52a0c98282178c]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1180985995 +0000
- Message:
Added a b_discontinuity to aout_buffer_t for non-pcm streams.
Set aout_buffer_t.b_discontinuity in mpeg audio packetizer.
Silent first 3 frames on discontinuity in mad decoder.
(close #590)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rfbf4c80 |
rbf48c33 |
|
| 145 | 145 | unsigned int i_nb_samples; |
|---|
| 146 | 146 | mtime_t start_date, end_date; |
|---|
| | 147 | vlc_bool_t b_discontinuity; /* Set on discontinuity (for non pcm stream) */ |
|---|
| 147 | 148 | |
|---|
| 148 | 149 | struct aout_buffer_t * p_next; |
|---|
| … | … | |
| 156 | 157 | }; |
|---|
| 157 | 158 | |
|---|
| 158 | | #define aout_BufferFree( p_buffer ) \ |
|---|
| | 159 | #define aout_BufferFree( p_buffer ) do { \ |
|---|
| 159 | 160 | if( p_buffer != NULL && (p_buffer)->i_alloc_type == AOUT_ALLOC_HEAP ) \ |
|---|
| 160 | 161 | { \ |
|---|
| 161 | 162 | free( p_buffer ); \ |
|---|
| 162 | 163 | } \ |
|---|
| 163 | | p_buffer = NULL; |
|---|
| | 164 | p_buffer = NULL; } while(0) |
|---|
| 164 | 165 | |
|---|
| 165 | 166 | /* Size of a frame for S/PDIF output. */ |
|---|
| r7b0773e |
rbf48c33 |
|
| 55 | 55 | { |
|---|
| 56 | 56 | struct mad_stream mad_stream; |
|---|
| 57 | | struct mad_frame mad_frame; |
|---|
| 58 | | struct mad_synth mad_synth; |
|---|
| | 57 | struct mad_frame mad_frame; |
|---|
| | 58 | struct mad_synth mad_synth; |
|---|
| | 59 | |
|---|
| | 60 | int i_reject_count; |
|---|
| 59 | 61 | }; |
|---|
| 60 | 62 | |
|---|
| … | … | |
| 110 | 112 | mad_synth_init( &p_sys->mad_synth ); |
|---|
| 111 | 113 | mad_stream_options( &p_sys->mad_stream, MAD_OPTION_IGNORECRC ); |
|---|
| | 114 | p_sys->i_reject_count = 0; |
|---|
| 112 | 115 | |
|---|
| 113 | 116 | p_filter->pf_do_work = DoWork; |
|---|
| … | … | |
| 136 | 139 | msg_Dbg( p_aout, "libmad error: %s", |
|---|
| 137 | 140 | mad_stream_errorstr( &p_sys->mad_stream ) ); |
|---|
| | 141 | p_sys->i_reject_count = 3; |
|---|
| | 142 | } |
|---|
| | 143 | else if( p_in_buf->b_discontinuity ) |
|---|
| | 144 | { |
|---|
| | 145 | p_sys->i_reject_count = 3; |
|---|
| | 146 | } |
|---|
| | 147 | |
|---|
| | 148 | if( p_sys->i_reject_count > 0 ) |
|---|
| | 149 | { |
|---|
| 138 | 150 | if( p_filter->output.i_format == VLC_FOURCC('f','l','3','2') ) |
|---|
| 139 | 151 | { |
|---|
| … | … | |
| 149 | 161 | memset( p_out_buf->p_buffer, 0, p_out_buf->i_nb_bytes ); |
|---|
| 150 | 162 | } |
|---|
| | 163 | p_sys->i_reject_count--; |
|---|
| 151 | 164 | return; |
|---|
| 152 | 165 | } |
|---|
| | 166 | |
|---|
| 153 | 167 | |
|---|
| 154 | 168 | mad_synth_frame( &p_sys->mad_synth, &p_sys->mad_frame ); |
|---|
| rab1b0eb |
rbf48c33 |
|
| 61 | 61 | unsigned int i_rate, i_max_frame_size, i_frame_length; |
|---|
| 62 | 62 | unsigned int i_layer, i_bit_rate; |
|---|
| | 63 | |
|---|
| | 64 | vlc_bool_t b_discontinuity; |
|---|
| 63 | 65 | }; |
|---|
| 64 | 66 | |
|---|
| … | … | |
| 153 | 155 | aout_DateSet( &p_sys->end_date, 0 ); |
|---|
| 154 | 156 | p_sys->bytestream = block_BytestreamInit( p_dec ); |
|---|
| | 157 | p_sys->b_discontinuity = VLC_FALSE; |
|---|
| 155 | 158 | |
|---|
| 156 | 159 | /* Set output properties */ |
|---|
| … | … | |
| 206 | 209 | // aout_DateSet( &p_sys->end_date, 0 ); |
|---|
| 207 | 210 | block_Release( *pp_block ); |
|---|
| | 211 | p_sys->b_discontinuity = VLC_TRUE; |
|---|
| 208 | 212 | return NULL; |
|---|
| 209 | 213 | } |
|---|
| … | … | |
| 282 | 286 | block_SkipByte( &p_sys->bytestream ); |
|---|
| 283 | 287 | p_sys->i_state = STATE_NOSYNC; |
|---|
| | 288 | p_sys->b_discontinuity = VLC_TRUE; |
|---|
| 284 | 289 | break; |
|---|
| 285 | 290 | } |
|---|
| … | … | |
| 356 | 361 | block_SkipByte( &p_sys->bytestream ); |
|---|
| 357 | 362 | p_sys->i_state = STATE_NOSYNC; |
|---|
| | 363 | p_sys->b_discontinuity = VLC_TRUE; |
|---|
| 358 | 364 | break; |
|---|
| 359 | 365 | } |
|---|
| … | … | |
| 531 | 537 | p_buf->end_date = |
|---|
| 532 | 538 | aout_DateIncrement( &p_sys->end_date, p_sys->i_frame_length ); |
|---|
| | 539 | p_buf->b_discontinuity = p_sys->b_discontinuity; |
|---|
| | 540 | p_sys->b_discontinuity = VLC_FALSE; |
|---|
| 533 | 541 | |
|---|
| 534 | 542 | /* Hack for libmad filter */ |
|---|
| rd3fe7f2 |
rbf48c33 |
|
| 60 | 60 | (p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer) \ |
|---|
| 61 | 61 | + sizeof(aout_buffer_t); \ |
|---|
| | 62 | (p_new_buffer)->b_discontinuity = VLC_FALSE; \ |
|---|
| 62 | 63 | if ( (p_previous_buffer) != NULL ) \ |
|---|
| 63 | 64 | { \ |
|---|