diff options
author | Anshul Maheshwari <er.anshul.maheshwari@gmail.com> | 2015-05-03 16:07:40 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-04 00:38:57 +0300 |
commit | a6b630e9b6d873d97c91322608ce4ac5fb9bed78 (patch) | |
tree | 083640d8fe863eff913b554c44ec972f2b0a9e63 /libavcodec/ccaption_dec.c | |
parent | f9e802018e5455bb3fee32626da295bf5b040bf8 (diff) |
avcodec/ccaption_dec: correcting line breaks in cc
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ccaption_dec.c')
-rw-r--r-- | libavcodec/ccaption_dec.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |