<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 20/11/19 03:19, Dorian Green wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CABo2n72S54aZHGZdzLamjhCkjdW6ZMvSt8sgApqzLTY5Z0bpig@mail.gmail.com">
<div dir="auto">Hello, can someone enlighten me as to why this
gives error -22 "invalid argument" which results in bad dst
image pointers?
<div dir="auto"><br>
</div>
<div dir="auto">------------------------------------------------------<br>
<div dir="auto"><br>
</div>
<div dir="auto">AVFrame * frame = av_frame_alloc();</div>
<div dir="auto">If (!frame){</div>
<div dir="auto"><br>
</div>
<div dir="auto">std::cout << "frame failed to
initialize" << std::endl;</div>
<div dir="auto"><br>
</div>
<div dir="auto">}</div>
<div dir="auto"><br>
</div>
<div dir="auto">Int size =
av_image_get_buffer_size(pCodecContext->pix_fmt,pCodecContext->width,pCodecContext->height,0);</div>
<div dir="auto"><br>
</div>
<div dir="auto">auto picture_src =
(uint8_t*)av_malloc(sizeof(uint8_t) * size);</div>
<div dir="auto"><br>
</div>
<div dir="auto">av_image_fill_arrays(frame->data,frame->linesize,picture_src,<span
style="font-family:sans-serif">pCodecContext->pix_fmt,</span><span
style="font-family:sans-serif">pCodecContext->width,</span><span
style="font-family:sans-serif">pCodecContext->height,0);</span></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
</div>
</div>
</blockquote>
You might want to set the alignment to 1, just in case.<br>
<blockquote type="cite"
cite="mid:CABo2n72S54aZHGZdzLamjhCkjdW6ZMvSt8sgApqzLTY5Z0bpig@mail.gmail.com">
<div dir="auto">
<div dir="auto"><br>
<div dir="auto"><font face="sans-serif">sws_scale(img_convert_ctx,
frame->data,frame->linesize,0,</font><span
style="font-family:sans-serif">pCodecContext->height,frame->data,frame->linesize);</span></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">----------------------------------------------------</font></div>
<div dir="auto"><font face="sans-serif">What is it that i'm
not understanding?</font></div>
</div>
</div>
</blockquote>
<br>
You are using sws_scale to decode to the same pointers it is reading
from. That's more likely your problem.<br>
<br>
</body>
</html>