<div dir="ltr">Hi everyone,<br><br>Not sure I will be using this list correctly. Pardon me if I'm not (first time I try it).<br><br>I'm working on a program to simply read a mp3 file. For some reason (optimization), I want to read the file by blocks (possibly non consecutive and I often move forward and backward). But I am unable to safely navigate through the file, I try to call av_seek_frame, but then, extracted data are incorrect.<br>
<br>I could isolate the problem in a very basic sample program. This program opens a file, reads the audio stream (saves it to a vector of doubles), then calls av_seek_frame to move back to the beginning of the file and finally try to read it a second time (saving it to a new vector of doubles). The resulting two vectors of double are slighlty different.....<br>
<br>If anyone sees what's wrong, this would help!!!<br><br>Thanks<br><br>Jean<br><br>Here is the program:<div><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#include "libavutil/samplefmt.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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#include <libswresample/swresample.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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#include <libavutil/opt.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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">}</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#include <fstream></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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">#include <vector></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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">AVFormatContext* container = 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">AVCodecContext *ctx = 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">int audio_stream = 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">bool open_audio_stream( char* file )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">{</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> bool bRes = 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> </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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> AVCodec *codec = 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( avformat_open_input(&container,file,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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> (audio_stream = 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> (ctx = container->streams[audio_stream]->codec) == 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> (codec = avcodec_find_decoder(ctx->codec_id)) == 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::cout << "Failed to open audio stream" << 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> return 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> return true;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">}</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">bool read_audio_stream( std::vector<std::vector<double>>& extracted )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">{</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> bool bRes = 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> extracted.resize( ctx->channels ); // prepare 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> // read to read the file!</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> int tempdatabuffer_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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> double* tempdatabuffer = 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> </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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> struct SwrContext *swr_ctx;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> swr_ctx = swr_alloc();</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( swr_ctx )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> // prepare object used for data conversion</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_int(swr_ctx, "in_channel_count", ctx->channels, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_int(swr_ctx, "in_channel_layout", ctx->channel_layout, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_int(swr_ctx, "in_sample_rate", ctx->sample_rate, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", ctx->sample_fmt, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_int(swr_ctx, "out_channel_layout", ctx->channel_layout, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_int(swr_ctx, "out_channel_count", ctx->channels, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_int(swr_ctx, "out_sample_rate", ctx->sample_rate, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_DBL, 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( swr_init(swr_ctx) >= 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> int tempdatabuffer_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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> double* tempdatabuffer = 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> bRes = true;</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> int sample = 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> packet.stream_index == audio_stream )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( frame->nb_samples*ctx->channels > tempdatabuffer_size )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> // update temp buffer, it's actually too small!!</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> tempdatabuffer_size = frame->nb_samples*ctx->channels;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( tempdatabuffer )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> delete [] tempdatabuffer;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> tempdatabuffer = new double[tempdatabuffer_size];</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( swr_convert(swr_ctx, (uint8_t **)&tempdatabuffer, tempdatabuffer_size, (const uint8_t **)&(frame->data[0]), 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> for ( sample = 0; sample != frame->nb_samples; ++sample )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> for ( int chan = 0; chan != ctx->channels; ++chan )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> extracted[chan].push_back( tempdatabuffer[sample*ctx->channels + chan] );</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( tempdatabuffer ) delete [] tempdatabuffer;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> swr_free(&swr_ctx);</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> return bRes;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">}</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">{</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( open_audio_stream( 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::vector<std::vector<double>> first_read;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::vector<std::vector<double>> second_read;</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( read_audio_stream( first_read ) )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> // rewind!</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> av_seek_frame( container, audio_stream, 0, AVSEEK_FLAG_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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( read_audio_stream( second_read ) )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( first_read.size() == second_read.size() )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::cout << "Comparing " << first_read.size() << " channels" << 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> for ( unsigned int chan = 0; chan != first_read.size(); ++chan )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( first_read[chan].size() == second_read[chan].size() )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::cout << "Comparing " << first_read[chan].size() << " samples for channel " << chan << 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> for ( unsigned int sample = 0; sample != first_read[chan].size(); ++sample )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> if ( first_read[chan][sample] != second_read[chan][sample] )</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::cout << "Different data found for sample " << sample << " of channel " << chan << 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::cout << "Results are equivalent!!!" << 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::cout << "Did not find the same number of samples" << 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> std::cout << "Did not find the same number of channels" << 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<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.203125px"><span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> {</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> printf("usage: %s 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> 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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px"> }</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.203125px">
<span style="color:rgb(46,139,87);font-family:Monaco,'Andale Mono','Courier New',Courier,mono;font-size:12px;line-height:15.203125px">}</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.1875px;background-color:rgb(225,235,242)"><br>
</span></div></div>