lavc/ccaption_dec: extract capture_screen() for future use
unlike reap_screen(), capture_screen() can be used to populate buffer without touching the timestamps. this is useful for upcoming commits which implement a real time caption stream.
This commit is contained in:
		
							parent
							
								
									e521a32af2
								
							
						
					
					
						commit
						080de371d8
					
				@ -274,12 +274,11 @@ static void roll_up(CCaptionSubContext *ctx)
 | 
				
			|||||||
    UNSET_FLAG(screen->row_used, ctx->cursor_row);
 | 
					    UNSET_FLAG(screen->row_used, ctx->cursor_row);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int reap_screen(CCaptionSubContext *ctx, int64_t pts)
 | 
					static int capture_screen(CCaptionSubContext *ctx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
    int ret = 0;
 | 
					    int ret = 0;
 | 
				
			||||||
    struct Screen *screen = ctx->screen + ctx->active_screen;
 | 
					    struct Screen *screen = ctx->screen + ctx->active_screen;
 | 
				
			||||||
    ctx->start_time = ctx->startv_time;
 | 
					 | 
				
			||||||
    av_bprint_clear(&ctx->buffer);
 | 
					    av_bprint_clear(&ctx->buffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; screen->row_used && i < SCREEN_ROWS; i++)
 | 
					    for (i = 0; screen->row_used && i < SCREEN_ROWS; i++)
 | 
				
			||||||
@ -304,9 +303,15 @@ static int reap_screen(CCaptionSubContext *ctx, int64_t pts)
 | 
				
			|||||||
        ctx->buffer.str[ctx->buffer.len] = 0;
 | 
					        ctx->buffer.str[ctx->buffer.len] = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ctx->buffer_changed = 1;
 | 
					    ctx->buffer_changed = 1;
 | 
				
			||||||
 | 
					    return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int reap_screen(CCaptionSubContext *ctx, int64_t pts)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ctx->start_time = ctx->startv_time;
 | 
				
			||||||
    ctx->startv_time = pts;
 | 
					    ctx->startv_time = pts;
 | 
				
			||||||
    ctx->end_time = pts;
 | 
					    ctx->end_time = pts;
 | 
				
			||||||
    return ret;
 | 
					    return capture_screen(ctx);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void handle_textattr(CCaptionSubContext *ctx, uint8_t hi, uint8_t lo)
 | 
					static void handle_textattr(CCaptionSubContext *ctx, uint8_t hi, uint8_t lo)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user