diff options
| -rw-r--r-- | rotord/Makefile | 6 | ||||
| -rw-r--r-- | rotord/ValgrindOut.xml | 51 | ||||
| -rwxr-xr-x | rotord/rotor.cpp | 16 | ||||
| -rwxr-xr-x | rotord/rotor.h | 20 | ||||
| -rw-r--r-- | rotord/vampHost.cpp | 18 |
5 files changed, 33 insertions, 78 deletions
diff --git a/rotord/Makefile b/rotord/Makefile index d153562..6a7f48b 100644 --- a/rotord/Makefile +++ b/rotord/Makefile @@ -1,10 +1,12 @@ # The pre-processor and compiler options. -MY_CFLAGS = -fpermissive -std=c++11 -Wno-error +MY_CFLAGS = -fpermissive -std=c++11 -Wno-error # -I ../ffmpeg # The linker options. -MY_LIBS = -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lavcodec -lavutil -lavformat -lavfilter -lavdevice +MY_LIBS = -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lavcodec -lavformat -lavfilter -lavdevice -lavutil +#MY_LIBS = ../libavcodec/ffmpeg/libavcodec/libavcodec.a ../libavcodec/ffmpeg/libavutil/libavutil.a ../libavcodec/ffmpeg/libavformat/libavformat.a ../libavcodec/ffmpeg/libavfilter/libavfilter.a ../libavcodec/ffmpeg/libavdevice/libavdevice.a -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk +#GAH! HARD! # The pre-processor options used by the cpp (man cpp for more). CPPFLAGS = -Wall diff --git a/rotord/ValgrindOut.xml b/rotord/ValgrindOut.xml deleted file mode 100644 index f0b4b6d..0000000 --- a/rotord/ValgrindOut.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0"?> - -<valgrindoutput> - -<protocolversion>4</protocolversion> -<protocoltool>memcheck</protocoltool> - -<preamble> - <line>Memcheck, a memory error detector</line> - <line>Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.</line> - <line>Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info</line> - <line>Command: rotord </line> -</preamble> - -<pid>21214</pid> -<ppid>18095</ppid> -<tool>memcheck</tool> - -<args> - <vargv> - <exe>/usr/bin/valgrind.bin</exe> - <arg>--suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp</arg> - <arg>--leak-check=yes</arg> - <arg>--xml=yes</arg> - <arg>--xml-file=ValgrindOut.xml</arg> - </vargv> - <argv> - <exe>rotord</exe> - <arg></arg> - </argv> -</args> - -<status> - <state>RUNNING</state> - <time>00:00:00:00.048 </time> -</status> - - -<status> - <state>FINISHED</state> - <time>00:00:02:38.523 </time> -</status> - -<errorcounts> -</errorcounts> - -<suppcounts> -</suppcounts> - -</valgrindoutput> - diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 2da6a8b..e0c91dd 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -256,7 +256,7 @@ Command_response Render_context::session_command(const std::vector<std::string>& if (state==IDLE) { output_filename=command[3]; if (command.size()>3) { - output_framerate=ofToFloat(command[4]); +// output_framerate=ofToFloat(command[4]); } add_queue(RENDER); response.status=HTTPResponse::HTTP_OK; @@ -378,7 +378,7 @@ bool Render_context::load_audio(const string &filename,vector<Base_audio_process { // Try to decode the packet into a frame int frameFinished = 0; - //int bytes = + //int bytes = avcodec_decode_audio4(codecContext, frame, &frameFinished, &packet); // Some frames rely on multiple packets, so we have to make sure the frame is finished before @@ -635,7 +635,7 @@ bool Video_output::render(const float duration, const float framerate,const stri uint8_t *outbuf, *picture_buf; cerr << "Rotor: rendering " << output_filename << " , " << duration << " seconds at " << framerate << " frames per second" << endl; - + /* find the mpeg1 video encoder */ codec = avcodec_find_encoder(AV_CODEC_ID_H264); if (!codec) { @@ -650,14 +650,15 @@ bool Video_output::render(const float duration, const float framerate,const stri c->bit_rate = 400000; /* resolution must be a multiple of two */ c->width = 640; - c->height = 250; + c->height = 480; /* frames per second */ c->time_base= (AVRational){1,25}; c->gop_size = 10; /* emit one intra frame every ten frames */ c->max_b_frames=1; c->pix_fmt = PIX_FMT_YUV420P; //AV_PIX_FMT_RGB24 - AVDictionary *options; + AVDictionary *options; //= NULL; causes a forward declaration error!? + options=NULL; /* open it */ if (avcodec_open2(c, codec, &options) < 0) { @@ -685,7 +686,7 @@ bool Video_output::render(const float duration, const float framerate,const stri picture->linesize[2] = c->width / 2; /* encode 1 second of video */ - for(i=0;i<25;i++) { + for(i=0;i<250;i++) { fflush(stdout); /* prepare a dummy image */ /* Y */ @@ -728,10 +729,11 @@ bool Video_output::render(const float duration, const float framerate,const stri free(picture_buf); free(outbuf); + avcodec_close(c); av_free(c); av_free(picture); printf("\n"); return true; -}
\ No newline at end of file +} diff --git a/rotord/rotor.h b/rotord/rotor.h index 4bba577..9f0c2e3 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -73,15 +73,17 @@ using Poco::Net::HTTPResponse; extern "C" { - #include "libavcodec/avcodec.h" - #include "libavformat/avformat.h" - #include "libavutil/opt.h" - #include "libavutil/channel_layout.h" - #include "libavutil/common.h" - #include "libavutil/imgutils.h" - #include "libavutil/mathematics.h" - #include "libavutil/samplefmt.h" - + #include <libavcodec/avcodec.h> + #include <libavformat/avformat.h> + #include <libavutil/opt.h> + #include <libavutil/channel_layout.h> + #include <libavutil/common.h> + #include <libavutil/imgutils.h> + #include <libavutil/mathematics.h> + #include <libavutil/samplefmt.h> + + #include <libavutil/dict.h> + //#include <libavutil/dict.c> stops the compiler error but causes a linker error. does libavcodec need to be statically linked? #include <libavutil/imgutils.h> #include <libavutil/samplefmt.h> //#include <libavutil/timestamp.h> diff --git a/rotord/vampHost.cpp b/rotord/vampHost.cpp index 2713e38..56d57db 100644 --- a/rotord/vampHost.cpp +++ b/rotord/vampHost.cpp @@ -714,14 +714,14 @@ bool vampHost::Analyser::init(const string &soname,const string &id,const int &_ in_block=0; blocks_processed=0; currentStep=0; - + featureNo=1; return true; } void vampHost::Analyser::process_frame(uint8_t *data,int samples_in_frame){ int sample=0; - + //process the whole frame which may be f>1<f blocks //when the frame is finished leave the partial block for the next frame while(sample<samples_in_frame) { @@ -739,24 +739,24 @@ void vampHost::Analyser::process_frame(uint8_t *data,int samples_in_frame){ if (in_block==blockSize) { //block is ready to be processed //cerr<<plugin->getIdentifier()<<" processed block "<<blocks_processed<<endl; - + //I /think/ that the vamp plugin keeps processing through the plugbuf until it encounters 0s rt = RealTime::frame2RealTime(currentStep * stepSize, rate); - + Plugin::FeatureSet feat=plugin->process(plugbuf, rt); - + for (unsigned int i = 0; i < feat[outputNo].size(); ++i) { features[((float)feat[outputNo][i].timestamp.sec)+(((float)feat[outputNo][i].timestamp.nsec)*.000000001)]=featureNo; featureNo++; } - + //shunt it down for (int i=0;i<blockSize-stepSize;i++){ for (int j=0;j<channels;j++){ plugbuf[j][i]=plugbuf[j][i+stepSize]; } } - + in_block-=stepSize; currentStep++; } @@ -773,9 +773,9 @@ void vampHost::Analyser::cleanup(){ } rt = RealTime::frame2RealTime(currentStep * stepSize, rate); - + Plugin::FeatureSet feat=plugin->process(plugbuf, rt); - + for (unsigned int i = 0; i < feat[outputNo].size(); ++i) { features[((float)feat[outputNo][i].timestamp.sec)+(((float)feat[outputNo][i].timestamp.nsec)*.000000001)]=featureNo; featureNo++; |
