[FFmpeg-cvslog] lavf/brstm: handle a BFSTM endianness oddity

Rodger Combs git at videolan.org
Sun Jun 21 13:18:01 CEST 2015


ffmpeg | branch: master | Rodger Combs <rodger.combs at gmail.com> | Sat Jun 20 05:01:26 2015 -0500| [d2ce10093e374709c5ea660d9b26f05043f1a6cd] | committer: Paul B Mahol

lavf/brstm: handle a BFSTM endianness oddity

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2ce10093e374709c5ea660d9b26f05043f1a6cd
---

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

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index 0014b48..45bdb72 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -296,7 +296,17 @@ static int read_header(AVFormatContext *s)
                     ret = AVERROR(ENOMEM);
                     goto fail;
                 }
-                avio_read(s->pb, b->adpc, asize);
+                if (bfstm && codec != AV_CODEC_ID_ADPCM_THP_LE) {
+                    // Big-endian BFSTMs have little-endian SEEK tables
+                    // for some strange reason.
+                    int i;
+                    for (i = 0; i < asize; i += 2) {
+                        b->adpc[i+1] = avio_r8(s->pb);
+                        b->adpc[i]   = avio_r8(s->pb);
+                    }
+                } else {
+                    avio_read(s->pb, b->adpc, asize);
+                }
                 avio_skip(s->pb, size - asize);
             }
             break;



More information about the ffmpeg-cvslog mailing list