New parameter -d to disable parallelism
This commit is contained in:
parent
7ef166e2bd
commit
4e5521c564
@ -11,6 +11,7 @@ class Configuration
|
|||||||
std::list<std::string> input;
|
std::list<std::string> input;
|
||||||
std::string output;
|
std::string output;
|
||||||
std::string codec;
|
std::string codec;
|
||||||
|
int para;
|
||||||
void add_filter(std::string param);
|
void add_filter(std::string param);
|
||||||
inline std::list<std::pair<std::string, std::vector<int> > > filters_get();
|
inline std::list<std::pair<std::string, std::vector<int> > > filters_get();
|
||||||
private:
|
private:
|
||||||
|
@ -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")
|
("input-file,i", po::value<std::vector<std::string>>(), "file to treat")
|
||||||
("output,o", po::value<std::string>(), "output file")
|
("output,o", po::value<std::string>(), "output file")
|
||||||
("codec,c", po::value<std::string>(), "output codec")
|
("codec,c", po::value<std::string>(), "output codec")
|
||||||
|
("disable,d", "disable parallelism")
|
||||||
;
|
;
|
||||||
|
|
||||||
// Handle ./prpa file.avi instead of ./prpa --input-file=file.avi
|
// 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
|
else
|
||||||
conf.codec = "MP42";
|
conf.codec = "MP42";
|
||||||
|
|
||||||
|
if (vm.count("disable"))
|
||||||
|
conf.para = 1;
|
||||||
|
else
|
||||||
|
conf.para = -1;
|
||||||
|
|
||||||
std::vector<std::string> vs;
|
std::vector<std::string> vs;
|
||||||
if (vm.count("input-file"))
|
if (vm.count("input-file"))
|
||||||
{
|
{
|
||||||
@ -82,12 +88,13 @@ bool parse_cli(Configuration& conf, int argc, char** argv)
|
|||||||
|
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
tbb::task_scheduler_init init;
|
|
||||||
Configuration conf = Configuration();
|
Configuration conf = Configuration();
|
||||||
|
|
||||||
if (!parse_cli(conf, argc, argv))
|
if (!parse_cli(conf, argc, argv))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
tbb::task_scheduler_init init(conf.para);
|
||||||
|
|
||||||
std::list<VideoReader> input_vr = std::list<VideoReader>();
|
std::list<VideoReader> input_vr = std::list<VideoReader>();
|
||||||
for (auto it = conf.input.begin(); it != conf.input.end(); ++it)
|
for (auto it = conf.input.begin(); it != conf.input.end(); ++it)
|
||||||
input_vr.push_back(VideoReader(*it));
|
input_vr.push_back(VideoReader(*it));
|
||||||
|
Reference in New Issue
Block a user