From a6b630e9b6d873d97c91322608ce4ac5fb9bed78 Mon Sep 17 00:00:00 2001 From: Anshul Maheshwari Date: Sun, 3 May 2015 18:37:40 +0530 Subject: avcodec/ccaption_dec: correcting line breaks in cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anshul Maheshwari Reviewed-by: Clément Bœsch Signed-off-by: Michael Niedermayer --- libavcodec/ccaption_dec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libavcodec/ccaption_dec.c') diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c index da43ca6b33..264d21cf8b 100644 --- a/libavcodec/ccaption_dec.c +++ b/libavcodec/ccaption_dec.c @@ -338,6 +338,10 @@ static int reap_screen(CCaptionSubContext *ctx, int64_t pts) } } + if(screen->row_used && ctx->buffer.len >= 2 ) { + ctx->buffer.len -= 2; + ctx->buffer.str[ctx->buffer.len] = 0; + } ctx->startv_time = pts; ctx->end_time = pts; return ret; @@ -550,7 +554,7 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp int start_time = av_rescale_q(ctx->start_time, avctx->time_base, (AVRational){ 1, 100 }); int end_time = av_rescale_q(ctx->end_time, avctx->time_base, (AVRational){ 1, 100 }); av_dlog(ctx, "cdp writing data (%s)\n",ctx->buffer.str); - ret = ff_ass_add_rect(sub, ctx->buffer.str, start_time, end_time - start_time , 0); + ret = ff_ass_add_rect_bprint(sub, &ctx->buffer, start_time, end_time - start_time); if (ret < 0) return ret; sub->pts = av_rescale_q(ctx->start_time, avctx->time_base, AV_TIME_BASE_Q); -- cgit v1.2.3