diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-09-12 14:28:32 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-09-12 14:28:32 +0100 |
| commit | fd2cdacf49b101658de7e0a624c84897a398e62e (patch) | |
| tree | 6ced81a91b56e20182d5dff77a1e09cffb2a0e29 /rotord/src/graph.h | |
| parent | 119dbdb43b859b529112d49dbeb3e05831372f68 (diff) | |
thumbnail function
Diffstat (limited to 'rotord/src/graph.h')
| -rw-r--r-- | rotord/src/graph.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/rotord/src/graph.h b/rotord/src/graph.h index b2132b9..6ade53e 100644 --- a/rotord/src/graph.h +++ b/rotord/src/graph.h @@ -1,6 +1,8 @@ #ifndef GRAPH_H #define GRAPH_H +#include "Poco/StringTokenizer.h" + #include "rotor.h" #include "nodes_audio_analysis.h" @@ -31,7 +33,7 @@ namespace Rotor { for (auto n: nodes) { delete n.second; } - nodes.clear(); + nodes.clear(); } string uid; //every version of a graph has a UUID, no particular need to actually read its data(?) //?? is it faster than using strings?? @@ -64,5 +66,22 @@ namespace Rotor { int outW,outH; }; + class Thumbnailer{ + public: + bool make(const string &inputfilename,int w,int h,const string &outputfilename) { + if (player.open(inputfilename)){ + if (player.fetchFrame(w,h,player.getNumberOfFrames()/4)) { + Image i; + i.setup_fromRGB(w,h,player.frame->Data[0],player.frame->Linesize[0]-(w*3)); + cv::imwrite(outputfilename.c_str(),i.rgb); + return true; + + } + } + return false; + } + private: + libav::ffms2_decoder player; + }; } #endif |
