<div dir="ltr"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px;color:rgb(0,0,0)">Hi,</span><br><div class="gmail_quote">
<div dir="ltr"><span style><font color="#000000">
<br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">I am using ffmpeg 2.0 to read audio files from (Visual) C++ code. I had a hard time finding how to achieve this but it now works smartly for WAV files. However, for MP3 files, I am unable to read all samples: when opening the mp3 file in a mp3 editor (like Audicity), it reports me a number of samples available. Now, if I read the file from ffmpeg, I cannot read as many samples as reported.</span><br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">I could isolate the problem in a very simple sample program (source below). This code:</span><br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">- computes the number of samples expected (via frequency and file size attributes), this is always (tested 3 different files) the same value as the one reported by Audicity.</span><br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">- does a while loop to read all samples incrementing a counter. This gives the actual number of samples "readable".</span><br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">If given a WAV file as parameter, the two computed values are the same.</span><br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">If given a MP3 file as parameter, we read less samples than expected (difference is between 0 and packet.size). As if last packet reading failed....</span><br>
</font></span><div><span style="line-height:18.200000762939453px;font-size:13px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif"><font color="#000000"><br>
</font></span></div><div><span style><font color="#000000"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">If somebody can help, this would be greatly appreciated!</span><br style="margin:0px;padding:0px;font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">
<br>Thanks in advance,</font></span></div><div><span style><font color="#000000"><br style="margin:0px;padding:0px"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">Jean</span></font></span><span style="color:rgb(51,51,51);font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px;background-color:rgb(225,235,242)"><br>
</span></div><div><span style><font color="#000000"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px"><br>
</span></font></span></div><div><span style><font color="#000000"><span style="font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px">PS: I posted the <a href="http://ffmpeg.gusari.org/viewtopic.php?f=16&t=1008&p=2373#p2367" target="_blank">question on the forum</a> but were recommended to use this list...</span></font></span></div>
<div><span style="color:rgb(51,51,51);font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px;background-color:rgb(225,235,242)"><br></span></div>
<div><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">extern "C" {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">#include "libavformat/avformat.h"</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">}</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">#include <iostream></span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">#include <sstream></span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">void check_size( char* filename )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">{</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> av_register_all();</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> </span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> AVFormatContext* container = avformat_alloc_context();</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> int stream_id = 0;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> if ( avformat_open_input(&container,filename,NULL,NULL) < 0 ||</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> av_find_stream_info(container) < 0 ||</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> (stream_id = av_find_best_stream(container, AVMEDIA_TYPE_AUDIO, -1, -1, NULL, 0)) < 0 )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> std::cout << "Unable to open file \"" << filename << "\"" << std::endl;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> else</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> av_dump_format(container,0,filename,false);</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> </span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> AVCodecContext *ctx = container->streams[stream_id]->codec;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> AVCodec *codec = avcodec_find_decoder(ctx->codec_id);</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> if ( codec == NULL || avcodec_open2( ctx, codec, NULL ) < 0 )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> std::cout << "Codec cannot be found or inited" << std::endl;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> else</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> // this code works for both wav and mp3</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> double sample_rate = ctx->sample_rate;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> int64_t durationUS = container->duration;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> double periodUS = AV_TIME_BASE / sample_rate;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> // this gives the theoretical number of samples</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> // it's consitent with the number of samples displayed by Audicity audio file editor</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> int64_t numberOfSamplesExpected = static_cast<int>( durationUS / periodUS );</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> // let's read and see how many samples we can get!</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> AVPacket packet;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> av_init_packet( &packet );</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> packet.pos = 0;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> packet.data = NULL;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> packet.size = 0;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> AVFrame *frame = avcodec_alloc_frame();</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> </span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> int64_t samplesFound = 0;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> int frameFinished = 0;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> while ( av_read_frame( container, &packet ) >= 0 )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> if ( packet.stream_index == stream_id )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> if ( avcodec_decode_audio4( ctx, frame, &frameFinished, &packet ) >= 0 )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> samplesFound += frame->nb_samples;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> avcodec_free_frame( &frame );</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> if ( samplesFound == numberOfSamplesExpected )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> std::cout << "OK, found all " << samplesFound << " sample(s)" << std::endl;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> else</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> std::cout << "FAILED, only got " << samplesFound << " sample(s), out of " << numberOfSamplesExpected << std::endl;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> std::cout << (numberOfSamplesExpected-samplesFound) << " samples could not be extracted!" << std::endl;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> av_close_input_file(container);</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">}</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">int main(int argc, char **argv)</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">{</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> if ( argc == 2 )</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> check_size(argv[1]);</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> return 0;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> else</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> {</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> printf("usage: %s input_file\n",</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> argv[0]);</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> return 1;</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px"> }</span><br style="margin:0px;padding:0px;color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.199999809265137px">}</span><span style="color:rgb(51,51,51);font-family:'Lucida Grande','Trebuchet MS',Verdana,Helvetica,Arial,sans-serif;font-size:13px;line-height:18.200000762939453px;background-color:rgb(225,235,242)"><br>
</span></div></div>
</div><br></div>