[FFmpeg-devel] [PATCH 2/2] electronic arts: support rare samples containing adpcm_ea_r1 audio
Peter Ross
pross at xvid.org
Sat Nov 10 00:27:36 CET 2012
Fixes ticket #1549.
---
Revised patch with av_log_ask_for_sample.
The return value of 0 is used in electronicarts header processing to flag an
invalid stream. From the comments:
/*
* Process PT/GSTR sound header
* return 1 if success, 0 if invalid format, otherwise AVERROR_xxx
*/
static int process_audio_header_elements(AVFormatContext *s)
libavformat/electronicarts.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 0847a3a..82bc0e2 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -189,7 +189,16 @@ static int process_audio_header_elements(AVFormatContext *s)
}
switch (revision2) {
case 8: ea->audio_codec = AV_CODEC_ID_PCM_S16LE_PLANAR; break;
- case 10: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R2; break;
+ case 10:
+ switch (revision) {
+ case -1:
+ case 2: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R1; break;
+ case 3: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R2; break;
+ default:
+ av_log_ask_for_sample(s, "unsupported stream type; revision=%i, revision2=%i\n", revision, revision2);
+ return 0;
+ }
+ break;
case 16: ea->audio_codec = AV_CODEC_ID_MP3; break;
case -1: break;
default:
--
1.7.10.4
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121110/b66afe41/attachment.asc>
More information about the ffmpeg-devel
mailing list