ncvisual_set_data: handle incoming data equivalent to existing data

pull/1626/head
nick black 3 years ago
parent 584f394071
commit 9a5b719627
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -30,8 +30,10 @@ typedef struct ncvisual {
static inline void static inline void
ncvisual_set_data(ncvisual* ncv, void* data, bool owned){ ncvisual_set_data(ncvisual* ncv, void* data, bool owned){
if(ncv->owndata){ if(ncv->owndata){
if(data != ncv->data){
free(ncv->data); free(ncv->data);
} }
}
ncv->data = (uint32_t*)data; ncv->data = (uint32_t*)data;
ncv->owndata = owned; ncv->owndata = owned;
} }

@ -244,10 +244,13 @@ int ffmpeg_resize(ncvisual* n, int rows, int cols){
n->rowstride = sframe->linesize[0]; n->rowstride = sframe->linesize[0];
n->pixy = rows; n->pixy = rows;
n->pixx = cols; n->pixx = cols;
if((uint32_t*)sframe->data[0] != n->data){
//fprintf(stderr, "SETTING UP RESIZE %p\n", n->data);
ncvisual_set_data(n, sframe->data[0], false); ncvisual_set_data(n, sframe->data[0], false);
if(n->details->frame){ if(n->details->frame){
av_freep(&n->details->frame); av_freep(&n->details->frame);
} }
}
n->details->frame = sframe; n->details->frame = sframe;
//fprintf(stderr, "SIZE SCALED: %d %d (%u)\n", nc->details->frame->height, nc->details->frame->width, nc->details->frame->linesize[0]); //fprintf(stderr, "SIZE SCALED: %d %d (%u)\n", nc->details->frame->height, nc->details->frame->width, nc->details->frame->linesize[0]);

Loading…
Cancel
Save