New parameter -d to disable parallelism

This commit is contained in:
Némunaire 2012-07-16 09:32:30 +02:00
parent 7ef166e2bd
commit 4e5521c564
2 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,7 @@ class Configuration
std::list<std::string> input;
std::string output;
std::string codec;
int para;
void add_filter(std::string param);
inline std::list<std::pair<std::string, std::vector<int> > > filters_get();
private:

View File

@ -22,6 +22,7 @@ bool parse_cli(Configuration& conf, int argc, char** argv)
("input-file,i", po::value<std::vector<std::string>>(), "file to treat")
("output,o", po::value<std::string>(), "output file")
("codec,c", po::value<std::string>(), "output codec")
("disable,d", "disable parallelism")
;
// Handle ./prpa file.avi instead of ./prpa --input-file=file.avi
@ -62,6 +63,11 @@ bool parse_cli(Configuration& conf, int argc, char** argv)
else
conf.codec = "MP42";
if (vm.count("disable"))
conf.para = 1;
else
conf.para = -1;
std::vector<std::string> vs;
if (vm.count("input-file"))
{
@ -82,12 +88,13 @@ bool parse_cli(Configuration& conf, int argc, char** argv)
int main (int argc, char** argv)
{
tbb::task_scheduler_init init;
Configuration conf = Configuration();
if (!parse_cli(conf, argc, argv))
return 1;
tbb::task_scheduler_init init(conf.para);
std::list<VideoReader> input_vr = std::list<VideoReader>();
for (auto it = conf.input.begin(); it != conf.input.end(); ++it)
input_vr.push_back(VideoReader(*it));