aboutsummaryrefslogtreecommitdiff
path: root/visualization
diff options
context:
space:
mode:
Diffstat (limited to 'visualization')
-rw-r--r--visualization/renderer/main.cpp5
-rw-r--r--visualization/renderer/qmpsettingsro.cpp52
-rw-r--r--visualization/renderer/qmpsettingsro.hpp1
-rw-r--r--visualization/renderer/qmpvisrendercore.cpp5
4 files changed, 61 insertions, 2 deletions
diff --git a/visualization/renderer/main.cpp b/visualization/renderer/main.cpp
index 82e8983..c651c54 100644
--- a/visualization/renderer/main.cpp
+++ b/visualization/renderer/main.cpp
@@ -18,7 +18,7 @@ int main(int argc,char **argv)
"receiver",
"Specify a program and its arguments to process the rendered frames. Supports parameter substitution. See documentation for details.",
"command",
- "ffmpeg -f rawvideo -pixel_format rgba -video_size %wx%h -framerate %r -i pipe: -vf vflip -pix_fmt yuv420p -c:v libx264 -preset slow -crf 22 %o"
+ "ffmpeg %i -vf vflip -pix_fmt yuv420p -c:v libx264 -preset slow -crf 22 %o"
});
clp.addOption({
{"e","receiver-execution"},
@@ -29,10 +29,11 @@ int main(int argc,char **argv)
clp.addOption({{"s","show-window"},"Do not hide the visualization window."});
clp.addOption({{"c","config"},"Load options from the configuration file.","qmprc file"});
clp.addOption({{"o","option"},"Set option for the visualization module.","key-value pair"});
+ clp.addOption({"list-options","Show a list of recognized options and quit."});
clp.addPositionalArgument("file","MIDI file to render");
clp.process(a.arguments());
qmpVisRenderCore core(&clp);
- if(clp.positionalArguments().empty())
+ if(clp.positionalArguments().empty()&&!clp.isSet("list-options"))
clp.showHelp(1);
core.loadSettings();
if(!core.loadVisualizationLibrary())
diff --git a/visualization/renderer/qmpsettingsro.cpp b/visualization/renderer/qmpsettingsro.cpp
index bf8096f..034f073 100644
--- a/visualization/renderer/qmpsettingsro.cpp
+++ b/visualization/renderer/qmpsettingsro.cpp
@@ -1,6 +1,8 @@
#include <QScopedPointer>
#include <QSettings>
+#include <cstdio>
+
#include "qmpsettingsro.hpp"
qmpSettingsRO::qmpSettingsRO()
@@ -172,3 +174,53 @@ void qmpSettingsRO::setopt(std::string key, std::string val)
if(key.find("Visualization/")!=0)
settings.insert("Visualization/"+QString(key.c_str()),QString(val.c_str()));
}
+
+void qmpSettingsRO::listopt()
+{
+ for(auto&k:optionlist)
+ {
+ printf("Option key: %s\n",k.c_str());
+ if(options[k].desc.length())
+ printf("Description: %s\n",options[k].desc.c_str());
+ switch(options[k].type)
+ {
+ case qmpOptionR::ParameterType::parameter_int:
+ printf("Type: int\n");
+ printf("Range: [%d,%d]\n",options[k].minv.toInt(),options[k].maxv.toInt());
+ printf("Default value: %d\n",options[k].defaultval.toInt());
+ break;
+ case qmpOptionR::ParameterType::parameter_uint:
+ printf("Type: uint\n");
+ printf("Range: [%u,%u]\n",options[k].minv.toUInt(),options[k].maxv.toUInt());
+ printf("Default value: %u\n",options[k].defaultval.toUInt());
+ break;
+ case qmpOptionR::ParameterType::parameter_double:
+ printf("Type: double\n");
+ printf("Range: [%.2f,%.2f]\n",options[k].minv.toDouble(),options[k].maxv.toDouble());
+ printf("Default value: %.f2\n",options[k].defaultval.toDouble());
+ break;
+ case qmpOptionR::ParameterType::parameter_bool:
+ printf("Type: bool\n");
+ printf("Default value: %s\n",options[k].defaultval.toBool()?"true":"false");
+ break;
+ case qmpOptionR::ParameterType::parameter_str:
+ printf("Type: str\n");
+ printf("Default value: %s\n",options[k].defaultval.toString().toStdString().c_str());
+ break;
+ case qmpOptionR::ParameterType::parameter_url:
+ printf("Type: url\n");
+ printf("Default value: %s\n",options[k].defaultval.toString().toStdString().c_str());
+ break;
+ case qmpOptionR::ParameterType::parameter_enum:
+ printf("Type: enum\n");
+ printf("Possible values: ");
+ for(size_t i=0;i<options[k].enumlist.size();++i)
+ printf("%s%s",options[k].enumlist[i].c_str(),i==options[k].enumlist.size()-1?"\n":", ");
+ printf("Default value: %s\n",options[k].enumlist[options[k].defaultval.toInt()].c_str());
+ break;
+ default:
+ printf("Type: unknown\n");
+ }
+ puts("");
+ }
+}
diff --git a/visualization/renderer/qmpsettingsro.hpp b/visualization/renderer/qmpsettingsro.hpp
index 5c5361d..c5dd8af 100644
--- a/visualization/renderer/qmpsettingsro.hpp
+++ b/visualization/renderer/qmpsettingsro.hpp
@@ -65,6 +65,7 @@ public:
void load(const char* path);
void setopt(std::string key,std::string val);
+ void listopt();
private:
std::map<std::string,qmpOptionR> options;
std::vector<std::string> optionlist;
diff --git a/visualization/renderer/qmpvisrendercore.cpp b/visualization/renderer/qmpvisrendercore.cpp
index 304d061..f8044f5 100644
--- a/visualization/renderer/qmpvisrendercore.cpp
+++ b/visualization/renderer/qmpvisrendercore.cpp
@@ -39,6 +39,11 @@ bool qmpVisRenderCore::loadVisualizationLibrary()
switchmode(&qmpVisRenderCore::framefunc,!clp->isSet("show-window"));
vp->init();
resetcb(nullptr,nullptr);
+ if(clp->isSet("list-options"))
+ {
+ msettings->listopt();
+ exit(0);
+ }
return true;
}