aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/aiffdec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-03-21 14:48:35 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-03-22 11:45:46 -0400
commitb38b7cc39232b545086f69583967e696fee44ab8 (patch)
tree09d89c6b852a27da91ff58bfb8c8f794f028e5d1 /libavformat/aiffdec.c
parent2c07c1804831fa0ae6d494a63fdd10facfd6074b (diff)
downloadffmpeg-b38b7cc39232b545086f69583967e696fee44ab8.tar.gz
aiffdec: factor out handling of integer PCM for AIFF-C and plain AIFF
Diffstat (limited to 'libavformat/aiffdec.c')
-rw-r--r--libavformat/aiffdec.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index a48d946880..70ce017488 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -110,17 +110,19 @@ static unsigned int get_aiff_header(AVFormatContext *s, int size,
codec->sample_rate = sample_rate;
size -= 18;
- /* Got an AIFF-C? */
+ /* get codec id for AIFF-C */
if (version == AIFF_C_VERSION1) {
codec->codec_tag = avio_rl32(pb);
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) {
- case 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;
- break;
case CODEC_ID_ADPCM_IMA_QT:
codec->block_align = 34*codec->channels;
break;
@@ -139,16 +141,9 @@ static unsigned int get_aiff_header(AVFormatContext *s, int size,
default:
break;
}
- size -= 4;
-
if (codec->block_align > 0)
aiff->block_duration = av_get_audio_frame_duration(codec,
codec->block_align);
- } else {
- /* Need the codec type */
- 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