aboutsummaryrefslogtreecommitdiff
path: root/visualization/renderer/main.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-01 01:31:45 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-05-01 01:31:45 +0800
commit893bec26cd1bc83fd85bb7dfdfd6225d9f6ee5b5 (patch)
tree3b7e7a4f772c8f8de93d61b549599b22902e83fc /visualization/renderer/main.cpp
parentbd165c0254b9095bb9e5ea54def56b6404033ebe (diff)
downloadQMidiPlayer-893bec26cd1bc83fd85bb7dfdfd6225d9f6ee5b5.tar.xz
Visualization renderer now understands command line arguments.
Fixed wrong tick calculation in render mode. Fixed most of the hangs and crashes associated with the renderer. Do not write pixel data in the visualization thread.
Diffstat (limited to 'visualization/renderer/main.cpp')
-rw-r--r--visualization/renderer/main.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/visualization/renderer/main.cpp b/visualization/renderer/main.cpp
index ec4dd1d..cca8a12 100644
--- a/visualization/renderer/main.cpp
+++ b/visualization/renderer/main.cpp
@@ -2,17 +2,32 @@
#include <QCommandLineParser>
#include "qmpvisrendercore.hpp"
+#include "qmpsettingsro.hpp"
int main(int argc,char **argv)
{
QCoreApplication::setApplicationName("qmpvisrender");
+ QCoreApplication::setApplicationVersion("0.0.0");
QCoreApplication a(argc,argv);
QCommandLineParser clp;
clp.setApplicationDescription("Renderer a visualization of a midi file.");
clp.addHelpOption();
- clp.parse(a.arguments());
- qmpVisRenderCore core;
- core.loadVisualizationLibrary();
+ clp.addVersionOption();
+ clp.addOption({{"f","output-file"},"File name of the output file.","filename","output.mp4"});
+ clp.addOption({"ffmpeg-args","Custom output option arguments for ffmpeg.","args","-vf vflip -pix_fmt yuv420p -c:v libx264 -preset slow -crf 22"});
+ clp.addOption({"ffmpeg-pre-args","Custom arguments passed to ffmpeg before input arguments.","args",""});
+ clp.addOption({"ffmpeg-exec","Specify the path to the ffmpeg executable.","exec","ffmpeg"});
+ 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.addPositionalArgument("file","MIDI file to render");
+ clp.process(a.arguments());
+ qmpVisRenderCore core(&clp);
+ if(clp.positionalArguments().empty())
+ clp.showHelp(1);
+ if(!core.loadVisualizationLibrary())
+ return 1;
+ core.loadSettings();
if(clp.positionalArguments().size())
core.setMIDIFile(clp.positionalArguments().front().toStdString().c_str());
core.startRender();