From: Niklesh <niklesh.lalw...@iitb.ac.in> Signed-off-by: Niklesh <niklesh.lalw...@iitb.ac.in> --- libavcodec/movtextdec.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-)
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index a5d995d..ad1d324 100644 --- a/libavcodec/movtextdec.c +++ b/libavcodec/movtextdec.c @@ -32,19 +32,19 @@ #define STYLE_FLAG_UNDERLINE 4 static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, - int **style_start, int **style_end, - int **style_flags, int style_entries) + size_t *style_start, size_t *style_end, + size_t *style_flags, int style_entries) { int i = 0; int style_pos = 0; while (text < text_end) { for (i = 0; i < style_entries; i++) { - if (*style_flags[i] && style_pos == *style_start[i]) { - if (*style_flags[i] & STYLE_FLAG_BOLD) + if (style_flags[i] && style_pos == style_start[i]) { + if (style_flags[i] & STYLE_FLAG_BOLD) av_bprintf(buf, "{\\b1}"); - if (*style_flags[i] & STYLE_FLAG_ITALIC) + if (style_flags[i] & STYLE_FLAG_ITALIC) av_bprintf(buf, "{\\i1}"); - if (*style_flags[i] & STYLE_FLAG_UNDERLINE) + if (style_flags[i] & STYLE_FLAG_UNDERLINE) av_bprintf(buf, "{\\u1}"); } } @@ -61,12 +61,12 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, } for (i = 0; i < style_entries; i++) { - if (*style_flags[i] && style_pos == *style_end[i]) { - if (*style_flags[i] & STYLE_FLAG_BOLD) + if (style_flags[i] && style_pos == style_end[i]) { + if (style_flags[i] & STYLE_FLAG_BOLD) av_bprintf(buf, "{\\b0}"); - if (*style_flags[i] & STYLE_FLAG_ITALIC) + if (style_flags[i] & STYLE_FLAG_ITALIC) av_bprintf(buf, "{\\i0}"); - if (*style_flags[i] & STYLE_FLAG_UNDERLINE) + if (style_flags[i] & STYLE_FLAG_UNDERLINE) av_bprintf(buf, "{\\u0}"); } } @@ -95,17 +95,15 @@ static int mov_text_decode_frame(AVCodecContext *avctx, AVBPrint buf; char *ptr = avpkt->data; char *end; - //char *ptr_temp; int text_length, style_entries; uint32_t tsmb_type; uint64_t tsmb_size; - int **style_start = {0,}; - int **style_end = {0,}; - int **style_flags = {0,}; + size_t *style_start = { 0, }; + size_t *style_end = { 0, }; + size_t *style_flags = { 0, }; const uint8_t *tsmb; int index, i; - int *flag; - int *style_pos; + int flag, style_pos; if (!ptr || avpkt->size < 2) return AVERROR_INVALIDDATA; @@ -157,22 +155,19 @@ static int mov_text_decode_frame(AVCodecContext *avctx, tsmb += 2; for(i = 0; i < style_entries; i++) { - style_pos = av_malloc(4); - *style_pos = AV_RB16(tsmb); + style_pos = AV_RB16(tsmb); index = i; - av_dynarray_add(&style_start, &index, style_pos); + av_dynarray_add(&style_start, &index, (void*)(size_t)style_pos); tsmb += 2; - style_pos = av_malloc(4); - *style_pos = AV_RB16(tsmb); + style_pos = AV_RB16(tsmb); index = i; - av_dynarray_add(&style_end, &index, style_pos); + av_dynarray_add(&style_end, &index, (void*)(size_t)style_pos); tsmb += 2; // fontID = AV_RB16(tsmb); tsmb += 2; - flag = av_malloc(4); - *flag = AV_RB8(tsmb); + flag = AV_RB8(tsmb); index = i; - av_dynarray_add(&style_flags, &index, flag); + av_dynarray_add(&style_flags, &index, (void*)(size_t)flag); //fontsize = AV_RB8(tsmb); tsmb += 2; // text-color-rgba -- 1.9.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel