From bc1f9bfb4316d6de9083ec53810eea9dcc08dda0 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 1 Jan 2020 07:07:45 -0500 Subject: [PATCH] ncvisual: free up image alloc #241 --- src/lib/libav.c | 6 ++++-- src/view/view.cpp | 3 --- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/libav.c b/src/lib/libav.c index b92fe164a..3a2857bff 100644 --- a/src/lib/libav.c +++ b/src/lib/libav.c @@ -19,7 +19,7 @@ void ncvisual_destroy(ncvisual* ncv){ avcodec_close(ncv->codecctx); avcodec_free_context(&ncv->codecctx); av_frame_free(&ncv->frame); - // av_frame_free(&ncv->oframe); FIXME + // av_frame_unref(ncv->oframe); FIXME avcodec_parameters_free(&ncv->cparams); sws_freeContext(ncv->swsctx); av_packet_free(&ncv->packet); @@ -95,7 +95,7 @@ AVFrame* ncvisual_decode(ncvisual* nc, int* averr){ break; } if(unref){ - // fprintf(stderr, "stream index %d != %d\n", nc->packet->stream_index, nc->stream_index); +//fprintf(stderr, "stream index %d != %d\n", nc->packet->stream_index, nc->stream_index); av_packet_unref(nc->packet); } if((*averr = av_read_frame(nc->fmtctx, nc->packet)) < 0){ @@ -370,6 +370,8 @@ int ncvisual_render(const ncvisual* ncv, int begy, int begx, int leny, int lenx) } } } + av_freep(&ncv->oframe->data[0]); + //av_frame_unref(ncv->oframe); return 0; } diff --git a/src/view/view.cpp b/src/view/view.cpp index 7c79c48f6..ee0daac1e 100644 --- a/src/view/view.cpp +++ b/src/view/view.cpp @@ -47,9 +47,6 @@ int perframe(struct notcurses* nc, struct ncvisual* ncv, void* vframecount){ ns -= s * NANOSECS_IN_SEC; ncplane_printf_aligned(stdn, 0, NCALIGN_RIGHT, "%02ld:%02ld:%02ld.%04ld", h, m, s, ns / 1000000); - if(ncvisual_render(ncv, 0, 0, 0, 0)){ - return -1; - } if(notcurses_render(nc)){ return -1; }