Changeset 55f1d3272f61f46068e58c41690111e879082188
- Timestamp:
- 06/22/08 18:07:34
(2 months ago)
- Author:
- Antoine Cellerier <dionoea@videolan.org>
- git-committer:
- Antoine Cellerier <dionoea@videolan.org> 1214150854 +0200
- git-parent:
[4c8296b58b24175921b37f99dfa7bda5e08f6cdb]
- git-author:
- Antoine Cellerier <dionoea@videolan.org> 1214150625 +0200
- Message:
Set i_bitspersample to correct value when changing an audio codec. (Not
sure if I didn't miss some spots where that was missing). Thanks to
Kevin DuBois? for finding the bug. (This should fix some audio
transcoding crashes)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rfbb8255 |
r55f1d32 |
|
| 366 | 366 | |
|---|
| 367 | 367 | VLC_EXPORT( unsigned int, aout_FormatNbChannels, ( const audio_sample_format_t * p_format ) ); |
|---|
| | 368 | VLC_EXPORT( unsigned int, aout_BitsPerSample, ( vlc_fourcc_t i_format ) ); |
|---|
| 368 | 369 | VLC_EXPORT( void, aout_FormatPrepare, ( audio_sample_format_t * p_format ) ); |
|---|
| 369 | 370 | VLC_EXPORT( void, aout_FormatPrint, ( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format ) ); |
|---|
| r3561b9b |
r55f1d32 |
|
| 439 | 439 | p_filter->fmt_out.i_codec = VLC_FOURCC('f','l','3','2'); |
|---|
| 440 | 440 | #endif |
|---|
| | 441 | p_filter->fmt_out.audio.i_bitspersample = |
|---|
| | 442 | aout_BitsPerSample( p_filter->fmt_out.i_codec ); |
|---|
| 441 | 443 | |
|---|
| 442 | 444 | /* Allocate the memory needed to store the module's structure */ |
|---|
| r3561b9b |
r55f1d32 |
|
| 397 | 397 | p_filter->fmt_out.audio.i_format = |
|---|
| 398 | 398 | p_filter->fmt_out.i_codec = VLC_FOURCC('f','l','3','2'); |
|---|
| | 399 | p_filter->fmt_out.audio.i_bitspersample = |
|---|
| | 400 | aout_BitsPerSample( p_filter->fmt_out.i_codec ); |
|---|
| 399 | 401 | |
|---|
| 400 | 402 | /* Allocate the memory needed to store the module's structure */ |
|---|
| r3561b9b |
r55f1d32 |
|
| 336 | 336 | p_filter->fmt_out.i_codec = VLC_FOURCC('f','i','3','2'); |
|---|
| 337 | 337 | p_filter->fmt_out.audio.i_format = p_filter->fmt_out.i_codec; |
|---|
| | 338 | p_filter->fmt_out.audio.i_bitspersample = |
|---|
| | 339 | aout_BitsPerSample( p_filter->fmt_out.i_codec ); |
|---|
| 338 | 340 | |
|---|
| 339 | 341 | p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate; |
|---|
| rd666030 |
r55f1d32 |
|
| 110 | 110 | |
|---|
| 111 | 111 | /***************************************************************************** |
|---|
| 112 | | * aout_FormatPrepare : compute the number of bytes per frame & frame length |
|---|
| 113 | | *****************************************************************************/ |
|---|
| 114 | | void aout_FormatPrepare( audio_sample_format_t * p_format ) |
|---|
| 115 | | { |
|---|
| 116 | | int i_result; |
|---|
| 117 | | |
|---|
| 118 | | switch ( p_format->i_format ) |
|---|
| | 112 | * aout_BitsPerSample : get the number of bits per sample |
|---|
| | 113 | *****************************************************************************/ |
|---|
| | 114 | unsigned int aout_BitsPerSample( vlc_fourcc_t i_format ) |
|---|
| | 115 | { |
|---|
| | 116 | switch( i_format ) |
|---|
| 119 | 117 | { |
|---|
| 120 | 118 | case VLC_FOURCC('u','8',' ',' '): |
|---|
| 121 | 119 | case VLC_FOURCC('s','8',' ',' '): |
|---|
| 122 | | i_result = 1; |
|---|
| 123 | | break; |
|---|
| | 120 | return 8; |
|---|
| 124 | 121 | |
|---|
| 125 | 122 | case VLC_FOURCC('u','1','6','l'): |
|---|
| … | … | |
| 127 | 124 | case VLC_FOURCC('u','1','6','b'): |
|---|
| 128 | 125 | case VLC_FOURCC('s','1','6','b'): |
|---|
| 129 | | i_result = 2; |
|---|
| 130 | | break; |
|---|
| | 126 | return 16; |
|---|
| 131 | 127 | |
|---|
| 132 | 128 | case VLC_FOURCC('u','2','4','l'): |
|---|
| … | … | |
| 134 | 130 | case VLC_FOURCC('u','2','4','b'): |
|---|
| 135 | 131 | case VLC_FOURCC('s','2','4','b'): |
|---|
| 136 | | i_result = 3; |
|---|
| 137 | | break; |
|---|
| | 132 | return 24; |
|---|
| 138 | 133 | |
|---|
| 139 | 134 | case VLC_FOURCC('f','l','3','2'): |
|---|
| 140 | 135 | case VLC_FOURCC('f','i','3','2'): |
|---|
| 141 | | i_result = 4; |
|---|
| 142 | | break; |
|---|
| 143 | | |
|---|
| 144 | | case VLC_FOURCC('s','p','d','i'): |
|---|
| 145 | | case VLC_FOURCC('s','p','d','b'): /* Big endian spdif output */ |
|---|
| 146 | | case VLC_FOURCC('a','5','2',' '): |
|---|
| 147 | | case VLC_FOURCC('d','t','s',' '): |
|---|
| 148 | | case VLC_FOURCC('m','p','g','a'): |
|---|
| 149 | | case VLC_FOURCC('m','p','g','3'): |
|---|
| | 136 | return 32; |
|---|
| | 137 | |
|---|
| | 138 | case VLC_FOURCC('f','l','6','4'): |
|---|
| | 139 | return 64; |
|---|
| | 140 | |
|---|
| 150 | 141 | default: |
|---|
| 151 | 142 | /* For these formats the caller has to indicate the parameters |
|---|
| 152 | 143 | * by hand. */ |
|---|
| 153 | | return; |
|---|
| 154 | | } |
|---|
| 155 | | |
|---|
| 156 | | p_format->i_bytes_per_frame = i_result * aout_FormatNbChannels( p_format ); |
|---|
| 157 | | p_format->i_frame_length = 1; |
|---|
| | 144 | return 0; |
|---|
| | 145 | } |
|---|
| | 146 | } |
|---|
| | 147 | |
|---|
| | 148 | /***************************************************************************** |
|---|
| | 149 | * aout_FormatPrepare : compute the number of bytes per frame & frame length |
|---|
| | 150 | *****************************************************************************/ |
|---|
| | 151 | void aout_FormatPrepare( audio_sample_format_t * p_format ) |
|---|
| | 152 | { |
|---|
| | 153 | p_format->i_bitspersample = aout_BitsPerSample( p_format->i_format ); |
|---|
| | 154 | if( p_format->i_bitspersample > 0 ) |
|---|
| | 155 | { |
|---|
| | 156 | p_format->i_bytes_per_frame = ( p_format->i_bitspersample / 8 ) |
|---|
| | 157 | * aout_FormatNbChannels( p_format ); |
|---|
| | 158 | p_format->i_frame_length = 1; |
|---|
| | 159 | } |
|---|
| 158 | 160 | } |
|---|
| 159 | 161 | |
|---|