Changeset f94dbb3eaeef0ca764fe9cd029da79cab45be7ca
- Timestamp:
- 11/20/06 06:09:23
(2 years ago)
- Author:
- Benjamin Pracht <bigben@videolan.org>
- git-committer:
- Benjamin Pracht <bigben@videolan.org> 1163999363 +0000
- git-parent:
[6a42724746cf15ac038540451a04f62bca3b5629]
- git-author:
- Benjamin Pracht <bigben@videolan.org> 1163999363 +0000
- Message:
* Quick fix when transcoding and resampling mono audio tracks.
* The transcode module should be reviewed: all the the fields in p
_enc->fmt_in are not set, it seems
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf485214 |
rf94dbb3 |
|
| 42 | 42 | static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *, |
|---|
| 43 | 43 | aout_buffer_t * ); |
|---|
| | 44 | static void DoWork_inner( aout_instance_t *, aout_filter_t *, aout_buffer_t *, |
|---|
| | 45 | aout_buffer_t *, int ); |
|---|
| 44 | 46 | |
|---|
| 45 | 47 | static int OpenFilter ( vlc_object_t * ); |
|---|
| … | … | |
| 103 | 105 | } |
|---|
| 104 | 106 | p_sys->p_prev_sample = malloc( |
|---|
| 105 | | aout_FormatNbChannels( &p_filter->input ) * sizeof(int32_t) ); |
|---|
| | 107 | p_filter->input.i_channels * sizeof(int32_t) ); |
|---|
| 106 | 108 | if( p_sys->p_prev_sample == NULL ) |
|---|
| 107 | 109 | { |
|---|
| … | … | |
| 109 | 111 | return VLC_ENOMEM; |
|---|
| 110 | 112 | } |
|---|
| | 113 | |
|---|
| | 114 | memset( p_sys->p_prev_sample, 0, aout_FormatNbChannels( &p_filter->input ) * sizeof(int32_t) ); |
|---|
| 111 | 115 | |
|---|
| 112 | 116 | p_filter->pf_do_work = DoWork; |
|---|
| … | … | |
| 136 | 140 | static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, |
|---|
| 137 | 141 | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) |
|---|
| | 142 | { |
|---|
| | 143 | DoWork_inner( p_aout, p_filter, p_in_buf, p_out_buf, p_aout->mixer.mixer.i_rate ); |
|---|
| | 144 | } |
|---|
| | 145 | |
|---|
| | 146 | static void DoWork_inner( aout_instance_t * p_aout, aout_filter_t * p_filter, |
|---|
| | 147 | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf, |
|---|
| | 148 | int i_output_rate ) |
|---|
| 138 | 149 | { |
|---|
| 139 | 150 | filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys; |
|---|
| … | … | |
| 144 | 155 | float *p_prev_sample = (float *)p_sys->p_prev_sample; |
|---|
| 145 | 156 | |
|---|
| 146 | | int i_nb_channels = aout_FormatNbChannels( &p_filter->input ); |
|---|
| | 157 | int i_nb_channels = p_filter->input.i_channels; |
|---|
| 147 | 158 | int i_in_nb = p_in_buf->i_nb_samples; |
|---|
| 148 | 159 | int i_chan, i_in, i_out = 0; |
|---|
| 149 | 160 | |
|---|
| | 161 | |
|---|
| 150 | 162 | /* Check if we really need to run the resampler */ |
|---|
| 151 | | if( p_aout->mixer.mixer.i_rate == p_filter->input.i_rate ) |
|---|
| | 163 | //if( p_aout->mixer.mixer.i_rate == p_filter->input.i_rate ) |
|---|
| | 164 | if( i_output_rate == p_filter->input.i_rate ) |
|---|
| 152 | 165 | { |
|---|
| 153 | 166 | if( p_filter->b_continuity && |
|---|
| … | … | |
| 287 | 300 | } |
|---|
| 288 | 301 | |
|---|
| | 302 | memset( p_sys->p_prev_sample, 0, p_filter->fmt_in.audio.i_channels * sizeof(int32_t) ); |
|---|
| | 303 | |
|---|
| 289 | 304 | p_filter->pf_audio_filter = Resample; |
|---|
| 290 | 305 | |
|---|
| … | … | |
| 361 | 376 | out_buf.i_nb_samples = p_out->i_samples; |
|---|
| 362 | 377 | |
|---|
| 363 | | DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf ); |
|---|
| | 378 | DoWork_inner( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf, |
|---|
| | 379 | p_filter->fmt_out.audio.i_rate ); |
|---|
| 364 | 380 | |
|---|
| 365 | 381 | p_block->pf_release( p_block ); |
|---|