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
|
/* 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.
*/
//---------------------------------------------------------------------------
#ifdef __BORLANDC__
#pragma hdrstop
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "IMSC1.h"
#include "IMSC1/IMSC1Plugin.h"
#include <fstream>
#include <algorithm>
//---------------------------------------------------------------------------
namespace MediaConch {
//***************************************************************************
// Constructor/Destructor
//***************************************************************************
//---------------------------------------------------------------------------
IMSC1::IMSC1()
{
type = MediaConchLib::PLUGIN_FORMAT;
report_kind = MediaConchLib::report_MediaImsc1Validation;
}
//---------------------------------------------------------------------------
IMSC1::~IMSC1()
{
}
//---------------------------------------------------------------------------
IMSC1::IMSC1(const IMSC1& p): PluginFormat(p)
{
}
//---------------------------------------------------------------------------
int IMSC1::load_plugin(const std::map<std::string, Container::Value>& obj, std::string& error)
{
if (obj.find("format") == obj.end() || obj.at("format").type != Container::Value::CONTAINER_TYPE_STRING)
{
error += "Field 'format' is not present\n";
return -1;
}
format = obj.at("format").s;
return 0;
}
//---------------------------------------------------------------------------
int IMSC1::run(std::string& error)
{
bool pass = false;
std::string message;
std::string schema_dir;
if (create_report_dir("TTMLTemp", "TTMLSchemaDir", schema_dir) < 0)
{
error = "Unable to create temporary directory.";
return -1;
}
IMSC1Plugin plugin(schema_dir);
if (plugin.validate_ttml_file(filename, pass, message, error))
{
delete_report_dir(schema_dir);
return -1;
}
if (plugin.create_report(report, filename, pass, message, error))
{
delete_report_dir(schema_dir);
return -1;
}
delete_report_dir(schema_dir);
return 0;
}
}
|