From 8d22a55dec7f9c1b81ddc00390cdd4cad7293624 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 20 Nov 2021 16:44:19 -0500 Subject: [PATCH] [ffmpeg] memset AVFrame in details_seed() --- src/media/ffmpeg.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/media/ffmpeg.c b/src/media/ffmpeg.c index 45a92c4c9..a6f7823f5 100644 --- a/src/media/ffmpeg.c +++ b/src/media/ffmpeg.c @@ -149,7 +149,7 @@ subtitle_plane_from_text(ncplane* parent, const char* text){ return n; } -static uint32_t palette[256]; +static uint32_t palette[NCPALETTESIZE]; struct ncplane* ffmpeg_subtitle(ncplane* parent, const ncvisual* ncv){ for(unsigned i = 0 ; i < ncv->details->subtitle.num_rects ; ++i){ @@ -178,8 +178,8 @@ struct ncplane* ffmpeg_subtitle(ncplane* parent, const ncvisual* ncv){ continue; } struct ncvisual* v = ncvisual_from_palidx(rect->data[0], rect->h, - rect->w, rect->w, 256, 1, - palette); + rect->w, rect->w, + NCPALETTESIZE, 1, palette); if(v == NULL){ return NULL; } @@ -651,14 +651,8 @@ int ffmpeg_blit(ncvisual* ncv, int rows, int cols, ncplane* n, } void ffmpeg_details_seed(ncvisual* ncv){ - ncv->details->frame->data[0] = NULL; - ncv->details->frame->data[1] = NULL; - ncv->details->frame->data[2] = NULL; - ncv->details->frame->data[3] = NULL; + memset(ncv->details->frame, 0, sizeof(*ncv->details->frame)); ncv->details->frame->linesize[0] = ncv->rowstride; - ncv->details->frame->linesize[1] = 0; - ncv->details->frame->linesize[2] = 0; - ncv->details->frame->linesize[3] = 0; ncv->details->frame->width = ncv->pixx; ncv->details->frame->height = ncv->pixy; ncv->details->frame->format = AV_PIX_FMT_RGBA;