1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Scheduler functions
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef PLUGINPREHOOKH
#define PLUGINPREHOOKH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "Plugin.h"
//---------------------------------------------------------------------------
namespace MediaConch {
//***************************************************************************
// Class Plugin
//***************************************************************************
class PluginPreHook : public Plugin
{
public:
PluginPreHook();
virtual ~PluginPreHook();
PluginPreHook(const PluginPreHook& p);
struct Output
{
Output() : create_file(true), analyze(true) {}
Output(const Output* o)
{
if (!o || o == this)
return;
name = o->name;
output_file = o->output_file;
outputDir = o->outputDir;
outputExt = o->outputExt;
for (size_t i = 0; i < o->outputParams.size(); ++i)
outputParams.push_back(o->outputParams[i]);
create_file = o->create_file;
analyze = o->analyze;
}
// Set at run-time
std::string output_file;
// Set by the configuration
std::string name;
std::string outputDir;
std::string outputExt;
std::vector<std::string> outputParams;
bool create_file;
bool analyze;
};
virtual int load_plugin(const std::map<std::string, Container::Value>& obj, std::string& error);
virtual int run(std::string& error);
void set_input_file(const std::string& file) { input_file = file; }
void get_outputs(std::vector<Output*>& files);
bool is_creating_files();
bool need_analyze();
protected:
// Set at run-time
std::string input_file;
// Set by the configuration
std::string bin;
std::string formatting;
std::vector<std::string> inputParams;
std::vector<std::string> params;
std::vector<Output*> outputs;
void create_output_file_name(Output* o);
Output *get_output_from_name(const std::string& str, size_t start, std::string& err);
static const std::string output_params_str;
static const std::string output_file_str;
private:
PluginPreHook &operator=(const PluginPreHook&);
};
}
#endif // !PLUGINPREHOOKH
|