[FFmpeg-devel] [PATCH 4/4] ansi: erase screen on first frame

Peter Ross pross at xvid.org
Sat Sep 1 07:21:01 CEST 2012


---

 libavcodec/ansi.c   |    5 +++++
 tests/ref/fate/ansi |    6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 6afd17c..3572500 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -58,6 +58,7 @@ typedef struct {
     int attributes;       /**< attribute flags */
     int fg;               /**< foreground color */
     int bg;               /**< background color */
+    int first_frame;
 
     /* ansi parser state machine */
     enum {
@@ -353,6 +354,10 @@ static int decode_frame(AVCodecContext *avctx,
     s->frame.pict_type           = AV_PICTURE_TYPE_I;
     s->frame.palette_has_changed = 1;
     set_palette((uint32_t *)s->frame.data[1]);
+    if (!s->first_frame) {
+        erase_screen(avctx);
+        s->first_frame = 1;
+    }
 
     while(buf < buf_end) {
         switch(s->state) {
diff --git a/tests/ref/fate/ansi b/tests/ref/fate/ansi
index 6000105..78e853f 100644
--- a/tests/ref/fate/ansi
+++ b/tests/ref/fate/ansi
@@ -1,7 +1,7 @@
 #tb 0: 1/25
-0,          0,          0,        1,   768000, 0xc4865718
-0,          1,          1,        1,   768000, 0x2c7de258
-0,          2,          2,        1,   768000, 0x0d6b8dc6
+0,          0,          0,        1,   768000, 0x772dd3d0
+0,          1,          1,        1,   768000, 0xd7dab1d1
+0,          2,          2,        1,   768000, 0x0e56f2d3
 0,          3,          3,        1,   768000, 0x11c1fb8e
 0,          4,          4,        1,   768000, 0x72d12da9
 0,          5,          5,        1,   768000, 0x39c7a70d
-- 
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/20120901/807356c7/attachment.asc>


More information about the ffmpeg-devel mailing list