|
|
@ -201,7 +201,7 @@ force_rgba(ncvisual* n){
|
|
|
|
av_freep(&n->details->frame);
|
|
|
|
av_freep(&n->details->frame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ncvisual_set_data(n, sframe->data[0], false);
|
|
|
|
ncvisual_set_data(n, sframe->data[0], true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
n->details->frame = sframe;
|
|
|
|
n->details->frame = sframe;
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -494,7 +494,8 @@ ffmpeg_resize_internal(const ncvisual* ncv, int rows, int* stride, int cols,
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//fprintf(stderr, "INFRAME DAA: %p SDATA: %p FDATA: %p to %d/%d\n", inframe->data[0], sframe->data[0], ncv->details->frame->data[0], sframe->height, sframe->width);
|
|
|
|
//fprintf(stderr, "INFRAME DAA: %p SDATA: %p FDATA: %p to %d/%d\n", inframe->data[0], sframe->data[0], ncv->details->frame->data[0], sframe->height, sframe->width);
|
|
|
|
int height = sws_scale(ncv->details->swsctx, (const uint8_t* const*)inframe->data,
|
|
|
|
const uint8_t* data[4] = { (uint8_t*)ncv->data, };
|
|
|
|
|
|
|
|
int height = sws_scale(ncv->details->swsctx, data,
|
|
|
|
inframe->linesize, 0, srcleny, dptrs, dlinesizes);
|
|
|
|
inframe->linesize, 0, srcleny, dptrs, dlinesizes);
|
|
|
|
if(height < 0){
|
|
|
|
if(height < 0){
|
|
|
|
//fprintf(stderr, "Error applying scaling (%d X %d)\n", inframe->height, inframe->width);
|
|
|
|
//fprintf(stderr, "Error applying scaling (%d X %d)\n", inframe->height, inframe->width);
|
|
|
@ -517,29 +518,15 @@ int ffmpeg_resize(ncvisual* n, int rows, int cols){
|
|
|
|
if(data == NULL){
|
|
|
|
if(data == NULL){
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
AVFrame* sframe = av_frame_alloc();
|
|
|
|
AVFrame* inf = n->details->frame;
|
|
|
|
if(sframe == NULL){
|
|
|
|
//fprintf(stderr, "WHN NCV: %d/%d %p\n", inf->width, inf->height, n->data);
|
|
|
|
//fprintf(stderr, "Couldn't allocate output frame for scaled frame\n");
|
|
|
|
inf->width = cols;
|
|
|
|
return -1;
|
|
|
|
inf->height = rows;
|
|
|
|
}
|
|
|
|
inf->linesize[0] = stride;
|
|
|
|
const AVFrame* inf = n->details->frame;
|
|
|
|
n->rowstride = stride;
|
|
|
|
//fprintf(stderr, "WHN NCV: %d/%d\n", inf->width, inf->height);
|
|
|
|
|
|
|
|
memcpy(sframe, inf, sizeof(*inf));
|
|
|
|
|
|
|
|
sframe->format = AV_PIX_FMT_RGBA;
|
|
|
|
|
|
|
|
sframe->width = cols;
|
|
|
|
|
|
|
|
sframe->height = rows;
|
|
|
|
|
|
|
|
memset(sframe->data, 0, sizeof(sframe->data));
|
|
|
|
|
|
|
|
sframe->data[0] = data;
|
|
|
|
|
|
|
|
memset(sframe->linesize, 0, sizeof(sframe->linesize));
|
|
|
|
|
|
|
|
sframe->linesize[0] = stride;
|
|
|
|
|
|
|
|
n->rowstride = sframe->linesize[0];
|
|
|
|
|
|
|
|
n->pixy = rows;
|
|
|
|
n->pixy = rows;
|
|
|
|
n->pixx = cols;
|
|
|
|
n->pixx = cols;
|
|
|
|
if(n->owndata){
|
|
|
|
ncvisual_set_data(n, data, true);
|
|
|
|
av_frame_unref(n->details->frame);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ncvisual_set_data(n, sframe->data[0], false);
|
|
|
|
|
|
|
|
n->details->frame = sframe;
|
|
|
|
|
|
|
|
//fprintf(stderr, "SIZE SCALED: %d %d (%u)\n", n->details->frame->height, n->details->frame->width, n->details->frame->linesize[0]);
|
|
|
|
//fprintf(stderr, "SIZE SCALED: %d %d (%u)\n", n->details->frame->height, n->details->frame->width, n->details->frame->linesize[0]);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -568,8 +555,12 @@ int ffmpeg_blit(ncvisual* ncv, int rows, int cols, ncplane* n,
|
|
|
|
void ffmpeg_details_seed(ncvisual* ncv){
|
|
|
|
void ffmpeg_details_seed(ncvisual* ncv){
|
|
|
|
ncv->details->frame->data[0] = NULL;
|
|
|
|
ncv->details->frame->data[0] = NULL;
|
|
|
|
ncv->details->frame->data[1] = NULL;
|
|
|
|
ncv->details->frame->data[1] = NULL;
|
|
|
|
|
|
|
|
ncv->details->frame->data[2] = NULL;
|
|
|
|
|
|
|
|
ncv->details->frame->data[3] = NULL;
|
|
|
|
ncv->details->frame->linesize[0] = ncv->rowstride;
|
|
|
|
ncv->details->frame->linesize[0] = ncv->rowstride;
|
|
|
|
ncv->details->frame->linesize[1] = 0;
|
|
|
|
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->width = ncv->pixx;
|
|
|
|
ncv->details->frame->height = ncv->pixy;
|
|
|
|
ncv->details->frame->height = ncv->pixy;
|
|
|
|
ncv->details->frame->format = AV_PIX_FMT_RGBA;
|
|
|
|
ncv->details->frame->format = AV_PIX_FMT_RGBA;
|
|
|
|