<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Hi, this is a function taken from an ffmpeg example</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">How can I fill the frame with my data buffer (<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">uchar</span>*<span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">data</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">Length)?</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">***************************************</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800080;">AVFrame</span><span style=" color:#c0c0c0;"> </span>*<span style=" color:#092e64;">frame</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>OutputStreamAudio.pAVFrameTemp;</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack'; color:#808000;">int</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#092e64;">j</span><span style=" font-family:'Hack';">,</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#092e64;">i</span><span style=" font-family:'Hack';">,</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#092e64;">v</span><span style=" font-family:'Hack';">;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack'; color:#800080;">int16_t</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">*</span><span style=" font-family:'Hack'; color:#092e64;">q</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">(</span><span style=" font-family:'Hack'; color:#800080;">int16_t</span><span style=" font-family:'Hack';">*)</span><span style=" font-family:'Hack'; color:#092e64;">frame</span><span style=" font-family:'Hack';">-></span><span style=" font-family:'Hack'; color:#800000;">data</span><span style=" font-family:'Hack';">[</span><span style=" font-family:'Hack'; color:#000080;">0</span><span style=" font-family:'Hack';">];</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack'; color:#008000;">/*</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">check</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">if</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">we</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">want</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">to</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">generate</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">more</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">frames</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#008000;">*/</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack'; color:#808000;">if</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">(av_compare_ts(OutputStreamAudio.next_pts,</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">OutputStreamAudio.pAVCodecContext->time_base,</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">STREAM_DURATION,</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">(AVRational){</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#000080;">1</span><span style=" font-family:'Hack';">,</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#000080;">1</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">})</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">>=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#000080;">0</span><span style=" font-family:'Hack';">)</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#808000;">return</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#000080;">NULL</span><span style=" font-family:'Hack';">;</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack'; color:#808000;">for</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">(</span><span style=" font-family:'Hack'; color:#092e64;">j</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#000080;">0</span><span style=" font-family:'Hack';">;</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#092e64;">j</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';"><</span><span style=" font-family:'Hack'; color:#092e64;">frame</span><span style=" font-family:'Hack';">-></span><span style=" font-family:'Hack'; color:#800000;">nb_samples</span><span style=" font-family:'Hack';">;</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#092e64;">j</span><span style=" font-family:'Hack';">++)</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">{</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">        </span><span style=" font-family:'Hack';">v</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">(</span><span style=" font-family:'Hack'; color:#808000;">int</span><span style=" font-family:'Hack';">)(sin(OutputStreamAudio.t)</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">*</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#000080;">10000</span><span style=" font-family:'Hack';">);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">        </span><span style=" font-family:'Hack'; color:#808000;">for</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">(i</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#000080;">0</span><span style=" font-family:'Hack';">;</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">i</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';"><</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">OutputStreamAudio.pAVCodecContext->channels;</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">i++)</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">*q++</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">v;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">        </span><span style=" font-family:'Hack';">OutputStreamAudio.t</span><span style=" font-family:'Hack'; color:#c0c0c0;">     </span><span style=" font-family:'Hack';">+=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">OutputStreamAudio.tincr;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">        </span><span style=" font-family:'Hack';">OutputStreamAudio.tincr</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">+=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">OutputStreamAudio.tincr2;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack';">}</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack';">frame->pts</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">OutputStreamAudio.next_pts;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack';">OutputStreamAudio.next_pts</span><span style=" font-family:'Hack'; color:#c0c0c0;">  </span><span style=" font-family:'Hack';">+=</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack';">frame->nb_samples;</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Hack'; color:#c0c0c0;">    </span><span style=" font-family:'Hack'; color:#808000;">return</span><span style=" font-family:'Hack'; color:#c0c0c0;"> </span><span style=" font-family:'Hack'; color:#092e64;">frame</span><span style=" font-family:'Hack';">;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">***************************************</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Regards</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br />-- </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">+39.347.4070897</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.labcsp.com"><span style=" text-decoration: underline; color:#2980b9;">http://www.labcsp.com</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.denisgottardello.it"><span style=" text-decoration: underline; color:#2980b9;">http://www.denisgottardello.it</span></a></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">GMT+1</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Skype: mrdebug</p></body></html>