[FFmpeg-devel] [PATCH 2/2] avformat/rpl: Support files containing Replay IMA ADPCM audio

Cameron Cawley ccawley2011 at gmail.com
Thu Jun 27 22:56:02 EEST 2019


---
 libavformat/rpl.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index dbbcd13b41..b4859320f4 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -121,6 +121,7 @@ static int rpl_read_header(AVFormatContext *s)
     int error = 0;
     const char *endptr;
     char audio_type[RPL_LINE_LENGTH];
+    char audio_codec[RPL_LINE_LENGTH];
 
     uint32_t i;
 
@@ -189,7 +190,9 @@ static int rpl_read_header(AVFormatContext *s)
 
     // ARMovie supports multiple audio tracks; I don't have any
     // samples, though. This code will ignore additional tracks.
-    audio_format = read_line_and_int(pb, &error);  // audio format ID
+    error |= read_line(pb, line, sizeof(line));
+    audio_format = read_int(line, &endptr, &error);  // audio format ID
+    strcpy(audio_codec, endptr);
     if (audio_format) {
         ast = avformat_new_stream(s, NULL);
         if (!ast)
@@ -229,6 +232,14 @@ static int rpl_read_header(AVFormatContext *s)
                         break;
                     }
                 }
+                break;
+            case 2:
+                if (av_strcasecmp(audio_codec," adpcm") == 0) {
+                    ast->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_ACORN;
+                } else {
+                    avpriv_report_missing_feature(s, "Audio format %"PRId32" (%s)",
+                                                  audio_format, audio_codec);
+                }
                 // There are some other formats listed as legal per the spec;
                 // samples needed.
                 break;
-- 
2.11.0



More information about the ffmpeg-devel mailing list