On 20/11/19 03:19, Dorian Green wrote:
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);
You might want to set the alignment to 1, just in case.
sws_scale(img_convert_ctx,
frame->data,frame->linesize,0,pCodecContext->height,frame->data,frame->linesize);
----------------------------------------------------
What is it that i'm not understanding?
You are using sws_scale to decode to the same pointers it is reading
from. That's more likely your problem.
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".