[FFmpeg-devel] [PATCH 3/6] libavcodec/ccaption_dec: implement "erase non displayed memory"

Aman Gupta ffmpeg at tmm1.net
Wed Jan 6 00:35:05 CET 2016


From: Aman Gupta <aman at tmm1.net>

---
 libavcodec/ccaption_dec.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index c5aace7..6f1e70d 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -395,12 +395,9 @@ static void handle_pac(CCaptionSubContext *ctx, uint8_t hi, uint8_t lo)
     }
 }
 
-/**
- * @param pts it is required to set end time
- */
-static void handle_edm(CCaptionSubContext *ctx, int64_t pts)
+static void handle_erase(CCaptionSubContext *ctx, int64_t pts, int n_screen)
 {
-    struct Screen *screen = ctx->screen + ctx->active_screen;
+    struct Screen *screen = ctx->screen + n_screen;
 
     reap_screen(ctx, pts);
     screen->row_used = 0;
@@ -408,7 +405,7 @@ static void handle_edm(CCaptionSubContext *ctx, int64_t pts)
 
 static void handle_eoc(CCaptionSubContext *ctx, int64_t pts)
 {
-    handle_edm(ctx,pts);
+    handle_erase(ctx, pts, ctx->active_screen);
     ctx->active_screen = !ctx->active_screen;
     ctx->cursor_column = 0;
 }
@@ -489,7 +486,7 @@ static void process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, uint
             break;
         case 0x2c:
             /* erase display memory */
-            handle_edm(ctx, pts);
+            handle_erase(ctx, pts, ctx->active_screen);
             break;
         case 0x2d:
             /* carriage return */
@@ -498,6 +495,10 @@ static void process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, uint
             roll_up(ctx);
             ctx->cursor_column = 0;
             break;
+        case 0x2e:
+            /* erase non displayed memory */
+            handle_erase(ctx, pts, !ctx->active_screen);
+            break;
         case 0x2f:
             /* end of caption */
             ff_dlog(ctx, "handle_eoc\n");
-- 
2.5.3



More information about the ffmpeg-devel mailing list