[Libav-user] Swscale bad dst image pointers

Dorian Green doriangreen97 at gmail.com
Wed Nov 20 08:19:22 EET 2019


Hello, can someone enlighten me as to why this gives error -22 "invalid
argument" which results in bad dst image pointers?

------------------------------------------------------

AVFrame * frame = av_frame_alloc();
If (!frame){

std::cout << "frame failed to initialize" << std::endl;

}

Int size =
av_image_get_buffer_size(pCodecContext->pix_fmt,pCodecContext->width,pCodecContext->height,0);

auto picture_src = (uint8_t*)av_malloc(sizeof(uint8_t) * size);

av_image_fill_arrays(frame->data,frame->linesize,picture_src,
pCodecContext->pix_fmt,pCodecContext->width,pCodecContext->height,0);

img_convert_ctx = sws_getContext(pCodecContext->width,pCodecContext->height,
pCodecContext->pix_fmt,pCodecContext->width,pCodecContext->height,AV_PIX_FMT_RGB24,
SWS_BICUBIC, nullptr, nullptr, nullptr);

sws_scale(img_convert_ctx, frame->data,frame->linesize,0,
pCodecContext->height,frame->data,frame->linesize);

----------------------------------------------------
What is it that i'm not understanding?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20191120/f381654f/attachment.html>


More information about the Libav-user mailing list