diff options
author | Peter Ross <pross@xvid.org> | 2008-08-18 12:39:57 +0000 |
---|---|---|
committer | Peter Ross <pross@xvid.org> | 2008-08-18 12:39:57 +0000 |
commit | fc7ed9a6f60860fb19c54ae2482a0588ca8054f6 (patch) | |
tree | 11d938515f7c670107ea3d051d7b44e32b0880dc /libavformat/electronicarts.c | |
parent | 97ceb75218742b410ddb6f74d955a80a96162117 (diff) | |
download | ffmpeg-fc7ed9a6f60860fb19c54ae2482a0588ca8054f6.tar.gz |
Support Electronic Arts files containing MP3 audio.
Originally committed as revision 14824 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/electronicarts.c')
-rw-r--r-- | libavformat/electronicarts.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 7bc42805db..2e627792c3 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -185,6 +185,7 @@ static int process_audio_header_elements(AVFormatContext *s) switch (revision2) { case 8: ea->audio_codec = CODEC_ID_PCM_S16LE_PLANAR; break; case 10: ea->audio_codec = CODEC_ID_ADPCM_EA_R2; break; + case 16: ea->audio_codec = CODEC_ID_MP3; break; case -1: break; default: av_log(s, AV_LOG_ERROR, "unsupported stream type; revision2=%i\n", revision2); @@ -430,6 +431,7 @@ static int ea_read_packet(AVFormatContext *s, int packet_read = 0; unsigned int chunk_type, chunk_size; int key = 0; + int num_samples; while (!packet_read) { chunk_type = get_le32(pb); @@ -448,8 +450,10 @@ static int ea_read_packet(AVFormatContext *s, if (!ea->audio_codec) { url_fskip(pb, chunk_size); break; - } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR) { - url_fskip(pb, 12); /* planar header */ + } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || + ea->audio_codec == CODEC_ID_MP3) { + num_samples = get_le32(pb); + url_fskip(pb, 8); chunk_size -= 12; } ret = av_get_packet(pb, pkt, chunk_size); @@ -468,6 +472,10 @@ static int ea_read_packet(AVFormatContext *s, ea->audio_frame_counter += ((chunk_size - 12) * 2) / ea->num_channels; break; + case CODEC_ID_PCM_S16LE_PLANAR: + case CODEC_ID_MP3: + ea->audio_frame_counter += num_samples; + break; default: ea->audio_frame_counter += chunk_size / (ea->bytes * ea->num_channels); |