summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinstall_dependencies_linux.sh9
-rw-r--r--rotord/src/graph.h38
-rw-r--r--rotord/src/nodes_audio_analysis.cpp2
-rw-r--r--rotord/src/nodes_drawing.h7
-rw-r--r--rotord/src/rotor.h1
5 files changed, 52 insertions, 5 deletions
diff --git a/install_dependencies_linux.sh b/install_dependencies_linux.sh
index b9ca61f..c9fdfbf 100755
--- a/install_dependencies_linux.sh
+++ b/install_dependencies_linux.sh
@@ -69,4 +69,11 @@ sudo apt-get -y install libjsoncpp0 libjsoncpp-dev
sudo mkdir /usr/lib/vamp
sudo cp qm-vamp-plugins-1.7-amd64-linux/* /usr/lib/vamp
-sudo apt-get install librsvg2-2 librsvg2-dev
+git clone https://github.com/bbcrd/bbc-vamp-plugins.git
+cd bbc-vamp-plugins
+make -f Makefile.linux
+sudo mv bbc-vamp-plugins.so bbc-vamp-plugins.cat bbc-vamp-plugins.n3 /usr/local/lib/vamp/
+cd ..
+sudo rm -r bbc-vamp-plugins
+
+sudo apt-get -y install librsvg2-2 librsvg2-dev
diff --git a/rotord/src/graph.h b/rotord/src/graph.h
index 6f2ee79..2f8843d 100644
--- a/rotord/src/graph.h
+++ b/rotord/src/graph.h
@@ -97,6 +97,43 @@ namespace Rotor {
class Thumbnailer{
public:
bool make(const string &inputfilename,int w,int h,const string &outputfilename) {
+ Poco::StringTokenizer t1(inputfilename,".");
+ if (t1.count()>1) {
+ if (t1[t1.count()-1]=="svg"){
+ cerr<<"found an svg"<<endl;
+ RsvgHandle * rsvg=rsvg_handle_new_from_file(inputfilename.c_str(),nullptr);
+ if (rsvg) {
+ RsvgDimensionData dims;
+ rsvg_handle_get_dimensions(rsvg,&dims);
+ cerr<<"Rotor: SVG loaded "<<inputfilename<<" , "<<dims.width<<"x"<<dims.height<<endl;
+ cv::Mat cp=cv::Mat(h,w,CV_8UC4);
+ cv::Mat co=cv::Mat(h,w,CV_8UC3);
+ cairo_surface_t * cs = cairo_image_surface_create_for_data (cp.data,
+ CAIRO_FORMAT_RGB24,
+ w,
+ h,
+ w*4);
+ cairo_t * cr = cairo_create (cs);
+ cairo_translate(cr, w/2, h/2);
+ cairo_scale(cr, ((float)w)/640.0f,((float)w)/640.0f);
+ cairo_translate(cr, -w/2, -h/2);
+ cairo_translate(cr, w/2-(dims.width/2), h/2-(dims.height/2));
+ rsvg_handle_render_cairo(rsvg,cr);
+ cv::cvtColor(cp,co,CV_RGBA2BGR,3);
+ cv::imwrite(outputfilename.c_str(),co);
+ cairo_destroy(cr);
+ cairo_surface_destroy(cs);
+ rsvg_handle_close(rsvg,nullptr);
+ g_object_unref(rsvg);
+ return true;
+ }
+ else {
+ cerr<<"Rotor: SVG failed to load "<<inputfilename<<endl;
+ return false;
+ }
+ }
+ }
+ //if not svg feed to FFMS2
if (player.open(inputfilename)){
if (player.fetch_frame(w,h,player.get_number_frames()/4)) {
Image i;
@@ -105,7 +142,6 @@ namespace Rotor {
cvtColor(i.rgb,cp,CV_RGB2BGR);
cv::imwrite(outputfilename.c_str(),cp);
return true;
-
}
}
return false;
diff --git a/rotord/src/nodes_audio_analysis.cpp b/rotord/src/nodes_audio_analysis.cpp
index 5318bb1..a2a9c63 100644
--- a/rotord/src/nodes_audio_analysis.cpp
+++ b/rotord/src/nodes_audio_analysis.cpp
@@ -122,7 +122,6 @@ namespace Rotor{
cerr<<analysers["segmenter"].features.size()<<" segments"<<endl;
cerr<<analysers["tempo"].features.size()<<" tempo features"<<endl;
cerr<<analysers["intensity"].features.size()<<" intensity features"<<endl;
- auto g=++analysers["segmenter"].features.begin();
int i=0;
float min_tempo=9999999.0f;
float min_intensity=9999999.0f;
@@ -131,6 +130,7 @@ namespace Rotor{
vector<float> tempos;
vector<float> intensities;
vector<float> times;
+ auto g=++analysers["segmenter"].features.begin();
for (auto f=analysers["segmenter"].features.begin();g!=analysers["segmenter"].features.end();f++,g++,i++){
cerr<<"segment "<<i<<": "<<f->first<<" to "<<g->first<<endl;
times.push_back(f->first);
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h
index b26841e..1bd6375 100644
--- a/rotord/src/nodes_drawing.h
+++ b/rotord/src/nodes_drawing.h
@@ -3,7 +3,6 @@
#include "rotor.h"
#include <cairo.h>
-#include <rsvg.h>
namespace Rotor {
class Draw_node: public Image_node {
@@ -217,6 +216,7 @@ namespace Rotor {
};
class Svg: public Draw_node {
public:
+ //rsvg should be cleanup?
Svg(){
title="SVG";
description="Draws svg files";
@@ -238,7 +238,10 @@ namespace Rotor {
}
else cerr<<"Rotor: SVG failed to load "<<attributes["filename"]->value<<endl;
};
- ~Svg(){};
+ ~Svg(){
+ rsvg_handle_close(rsvg,nullptr);
+ g_object_unref(rsvg);
+ };
Svg* clone(map<string,string> &_settings) { return new Svg(_settings);};
void vector_output(cairo_t * cr,const Frame_spec &frame){
//to make it resolution independent
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index f179efd..50ae266 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -75,6 +75,7 @@ Requirements
#include <iostream>
#include <json/json.h>
+#include <rsvg.h>
#include "Poco/Net/HTTPResponse.h"
#include "Poco/Logger.h"