@ -112,47 +112,48 @@ static unsigned int get_aiff_header(AVFormatContext *s, int size,
codec - > sample_rate = sample_rate ;
codec - > sample_rate = sample_rate ;
size - = 18 ;
size - = 18 ;
/* Got an AIFF-C? */
/* get codec id for AIFF-C */
if ( version = = AIFF_C_VERSION1 ) {
if ( version = = AIFF_C_VERSION1 ) {
codec - > codec_tag = avio_rl32 ( pb ) ;
codec - > codec_tag = avio_rl32 ( pb ) ;
codec - > codec_id = ff_codec_get_id ( ff_codec_aiff_tags , codec - > codec_tag ) ;
codec - > codec_id = ff_codec_get_id ( ff_codec_aiff_tags , codec - > codec_tag ) ;
size - = 4 ;
}
if ( version ! = AIFF_C_VERSION1 | | codec - > codec_id = = CODEC_ID_PCM_S16BE ) {
codec - > codec_id = aiff_codec_get_id ( codec - > bits_per_coded_sample ) ;
codec - > bits_per_coded_sample = av_get_bits_per_sample ( codec - > codec_id ) ;
aiff - > block_duration = 1 ;
} else {
switch ( codec - > codec_id ) {
switch ( codec - > codec_id ) {
case CODEC_ID_PCM_S16BE :
case CODEC_ID_PCM_F32BE :
codec - > codec_id = aiff_codec_get_id ( codec - > bits_per_coded_sample ) ;
case CODEC_ID_PCM_F64BE :
codec - > bits_per_coded_sample = av_get_bits_per_sample ( codec - > codec_id ) ;
case CODEC_ID_PCM_S16LE :
case CODEC_ID_PCM_ALAW :
case CODEC_ID_PCM_MULAW :
aiff - > block_duration = 1 ;
aiff - > block_duration = 1 ;
break ;
break ;
case CODEC_ID_ADPCM_IMA_QT :
case CODEC_ID_ADPCM_IMA_QT :
codec - > block_align = 34 * codec - > channels ;
codec - > block_align = 34 * codec - > channels ;
aiff - > block_duration = 64 ;
break ;
break ;
case CODEC_ID_MACE3 :
case CODEC_ID_MACE3 :
codec - > block_align = 2 * codec - > channels ;
codec - > block_align = 2 * codec - > channels ;
aiff - > block_duration = 6 ;
break ;
break ;
case CODEC_ID_MACE6 :
case CODEC_ID_MACE6 :
codec - > block_align = 1 * codec - > channels ;
codec - > block_align = 1 * codec - > channels ;
aiff - > block_duration = 6 ;
break ;
break ;
case CODEC_ID_GSM :
case CODEC_ID_GSM :
codec - > block_align = 33 ;
codec - > block_align = 33 ;
aiff - > block_duration = 160 ;
break ;
break ;
case CODEC_ID_QCELP :
case CODEC_ID_QCELP :
codec - > block_align = 35 ;
codec - > block_align = 35 ;
aiff - > block_duration = 160 ;
break ;
break ;
default :
default :
aiff - > block_duration = 1 ;
aiff - > block_duration = 1 ;
break ;
break ;
}
}
size - = 4 ;
if ( codec - > block_align > 0 )
} else {
aiff - > block_duration = av_get_audio_frame_duration ( codec ,
/* Need the codec type */
codec - > block_align ) ;
codec - > codec_id = aiff_codec_get_id ( codec - > bits_per_coded_sample ) ;
codec - > bits_per_coded_sample = av_get_bits_per_sample ( codec - > codec_id ) ;
aiff - > block_duration = 1 ;
}
}
/* Block align needs to be computed in all cases, as the definition
/* Block align needs to be computed in all cases, as the definition
@ -160,8 +161,10 @@ static unsigned int get_aiff_header(AVFormatContext *s, int size,
if ( ! codec - > block_align )
if ( ! codec - > block_align )
codec - > block_align = ( codec - > bits_per_coded_sample * codec - > channels ) > > 3 ;
codec - > block_align = ( codec - > bits_per_coded_sample * codec - > channels ) > > 3 ;
codec - > bit_rate = codec - > sample_rate * ( codec - > block_align < < 3 ) /
if ( aiff - > block_duration ) {
aiff - > block_duration ;
codec - > bit_rate = codec - > sample_rate * ( codec - > block_align < < 3 ) /
aiff - > block_duration ;
}
/* Chunk is over */
/* Chunk is over */
if ( size )
if ( size )