<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">El 16/04/2018 a las 22:11, YIRAN LI
escribió:<br>
</div>
<blockquote type="cite"
cite="mid:CAN16yyO5m0A=yBrYLx6axyABtFPF=JPO87++mV2WeUxzZgiSAw@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-family:georgia,serif"><br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2018-04-16 12:07 GMT+10:00 YIRAN LI <span
dir="ltr"><<a href="mailto:mrfun.china@gmail.com"
target="_blank" moz-do-not-send="true">mrfun.china@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:georgia,serif">Hi guys,</div>
<div style="font-family:georgia,serif"><br>
</div>
<div style="font-family:georgia,serif">I know if I
call av_new_packet then the data buffer created will
be padded and aligned.</div>
<div style="font-family:georgia,serif"><br>
</div>
<div style="font-family:georgia,serif"><br>
</div>
<div style="font-family:georgia,serif">But how if I only
use ffmpeg to do the muxing?</div>
<div style="font-family:georgia,serif"><br>
</div>
<div style="font-family:georgia,serif"><br>
</div>
<div style="font-family:georgia,serif">Say if I get a
buffer with size n. My code looks like this.</div>
<div style="font-family:georgia,serif"><br>
</div>
<div style="font-family:georgia,serif"><br>
</div>
<div style="font-family:georgia,serif">
<div> AVPacket pkt;</div>
<div> ZeroMemory(&pkt, sizeof(pkt));</div>
<div> pkt.stream_index = myindex;</div>
<div> pkt.pts = myPTS;</div>
<div> pkt.data = myPtr; (points to a buffer
allocated in my program)</div>
<div> pkt.size = mySize;</div>
<div> av_write_frame(pFormatCtx, &pkt)</div>
<div><br>
</div>
<div><br>
</div>
<div>Is above code OK? or do I need to allocate
pkt.data with padding + alignment and copy my data
into it?</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div class="gmail_default" style="font-family:georgia,serif">Hi,
Can anyone help on this?</div>
<div class="gmail_default" style="font-family:georgia,serif"><br>
</div>
<div class="gmail_default" style="font-family:georgia,serif">Thanks</div>
</div>
<br>
</div>
</div>
</blockquote>
AFAIK, you need to allocate with alignment taken into account.
av_malloc (in libavutil/mem.h) and similar should be of help.<br>
<br>
<pre class="moz-signature" cols="72">--
Gonzalo Garramuño</pre>
</body>
</html>