[FFmpeg-devel] [PATCH] sanm.c: codec 37 is a separate stream.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Apr 2 12:08:34 CEST 2016


Fixes playback of
http://samples.mplayerhq.hu/game-formats/la-san/rebelassault2/01P01.SAN

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavcodec/sanm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 2eb7e44..ce3c868 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -283,6 +283,7 @@ typedef struct SANMVideoContext {
     unsigned int rle_buf_size;
 
     int rotate_code;
+    int prev_codec;
 
     long npixels, buf_size;
 
@@ -1129,9 +1130,14 @@ static int process_frame_obj(SANMVideoContext *ctx)
     switch (codec) {
     case 1:
     case 3:
+        // codec 37 operates on a separate "stream", fixes 01P01.SAN
+        if (ctx->prev_codec == 37) memcpy(ctx->frm1, ctx->frm0, ctx->frm0_size);
+        ctx->prev_codec = codec;
         return old_codec1(ctx, top, left, w, h);
         break;
     case 37:
+        if (ctx->prev_codec == 1) FFSWAP(uint16_t*, ctx->frm0, ctx->frm1);
+        ctx->prev_codec = codec;
         return old_codec37(ctx, top, left, w, h);
         break;
     case 47:
-- 
2.7.0



More information about the ffmpeg-devel mailing list