31 #include "../include/Profiles.h"
40 bool read_file =
false;
57 QFile inputFile(
path.c_str());
58 if (inputFile.open(QIODevice::ReadOnly))
60 QTextStream in(&inputFile);
63 QString line = in.readLine();
65 if (line.length() <= 0)
69 QStringList parts = line.split(
"=" );
70 std::string setting = parts[0].toStdString();
71 std::string value = parts[1].toStdString();
75 if (setting ==
"description")
77 else if (setting ==
"frame_rate_num") {
78 std::stringstream(value) >> value_int;
81 else if (setting ==
"frame_rate_den") {
82 std::stringstream(value) >> value_int;
85 else if (setting ==
"width") {
86 std::stringstream(value) >> value_int;
89 else if (setting ==
"height") {
90 std::stringstream(value) >> value_int;
93 else if (setting ==
"progressive") {
94 std::stringstream(value) >> value_int;
97 else if (setting ==
"sample_aspect_num") {
98 std::stringstream(value) >> value_int;
101 else if (setting ==
"sample_aspect_den") {
102 std::stringstream(value) >> value_int;
105 else if (setting ==
"display_aspect_num") {
106 std::stringstream(value) >> value_int;
109 else if (setting ==
"display_aspect_den") {
110 std::stringstream(value) >> value_int;
113 else if (setting ==
"colorspace") {
114 std::stringstream(value) >> value_int;
123 catch (
const std::exception& e)
126 throw InvalidFile(
"Profile could not be found or loaded (or is invalid).",
path);
132 throw InvalidFile(
"Profile could not be found or loaded (or is invalid).",
path);
150 root[
"fps"] = Json::Value(Json::objectValue);
153 root[
"pixel_ratio"] = Json::Value(Json::objectValue);
156 root[
"display_ratio"] = Json::Value(Json::objectValue);
175 catch (
const std::exception& e)
178 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
185 if (!root[
"height"].isNull())
187 if (!root[
"width"].isNull())
189 if (!root[
"pixel_format"].isNull())
191 if (!root[
"fps"].isNull()) {
195 if (!root[
"pixel_ratio"].isNull()) {
199 if (!root[
"display_ratio"].isNull()) {
203 if (!root[
"interlaced_frame"].isNull())