You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Merge pull request #396 from ferdnyc/json-parsing
Behind-the-scenes code tidying for Json data handling
This commit is contained in:
@@ -110,9 +110,9 @@ namespace openshot {
|
||||
|
||||
/// Get and Set JSON methods
|
||||
virtual std::string Json() = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
|
||||
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
|
||||
virtual void SetJson(const std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() = 0; ///< Generate Json::Value for this object
|
||||
virtual void SetJsonValue(const Json::Value root) = 0; ///< Load Json::Value into this object
|
||||
virtual ~CacheBase() = default;
|
||||
|
||||
};
|
||||
|
||||
@@ -129,9 +129,9 @@ namespace openshot {
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -111,9 +111,9 @@ namespace openshot {
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -157,10 +157,10 @@ namespace openshot
|
||||
std::string Name() { return "ChunkReader"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open the reader. This is required before you can access frames or data from the reader.
|
||||
void Open();
|
||||
|
||||
@@ -187,18 +187,18 @@ namespace openshot {
|
||||
openshot::ReaderBase* Reader();
|
||||
|
||||
/// Override End() method
|
||||
float End(); ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
|
||||
float End() const; ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
|
||||
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Get all properties for a specific frame (perfect for a UI to display the current state
|
||||
/// of all properties at any time)
|
||||
std::string PropertiesJSON(int64_t requested_frame);
|
||||
std::string PropertiesJSON(int64_t requested_frame) const override;
|
||||
|
||||
/// @brief Remove an effect from the clip
|
||||
/// @param effect Remove an effect from the clip.
|
||||
|
||||
@@ -56,10 +56,10 @@ namespace openshot {
|
||||
std::string previous_properties; ///< This string contains the previous JSON properties
|
||||
|
||||
/// Generate JSON for a property
|
||||
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame);
|
||||
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, const Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame) const;
|
||||
|
||||
/// Generate JSON choice for a property (dropdown properties)
|
||||
Json::Value add_property_choice_json(std::string name, int value, int selected_value);
|
||||
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -73,12 +73,12 @@ namespace openshot {
|
||||
bool operator>= ( ClipBase& a) { return (Position() >= a.Position()); }
|
||||
|
||||
/// Get basic properties
|
||||
std::string Id() { return id; } ///< Get the Id of this clip object
|
||||
float Position() { return position; } ///< Get position on timeline (in seconds)
|
||||
int Layer() { return layer; } ///< Get layer of clip on timeline (lower number is covered by higher numbers)
|
||||
float Start() { return start; } ///< Get start position (in seconds) of clip (trim start of video)
|
||||
float End() { return end; } ///< Get end position (in seconds) of clip (trim end of video)
|
||||
float Duration() { return end - start; } ///< Get the length of this clip (in seconds)
|
||||
std::string Id() const { return id; } ///< Get the Id of this clip object
|
||||
float Position() const { return position; } ///< Get position on timeline (in seconds)
|
||||
int Layer() const { return layer; } ///< Get layer of clip on timeline (lower number is covered by higher numbers)
|
||||
float Start() const { return start; } ///< Get start position (in seconds) of clip (trim start of video)
|
||||
float End() const { return end; } ///< Get end position (in seconds) of clip (trim end of video)
|
||||
float Duration() const { return end - start; } ///< Get the length of this clip (in seconds)
|
||||
|
||||
/// Set basic properties
|
||||
void Id(std::string value) { id = value; } ///> Set the Id of this clip object
|
||||
@@ -88,14 +88,14 @@ namespace openshot {
|
||||
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
|
||||
|
||||
/// Get and Set JSON methods
|
||||
virtual std::string Json() = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
|
||||
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
|
||||
virtual std::string Json() const = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(const std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() const = 0; ///< Generate Json::Value for this object
|
||||
virtual void SetJsonValue(const Json::Value root) = 0; ///< Load Json::Value into this object
|
||||
|
||||
/// Get all properties for a specific frame (perfect for a UI to display the current state
|
||||
/// of all properties at any time)
|
||||
virtual std::string PropertiesJSON(int64_t requested_frame) = 0;
|
||||
virtual std::string PropertiesJSON(int64_t requested_frame) const = 0;
|
||||
|
||||
virtual ~ClipBase() = default;
|
||||
};
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace openshot {
|
||||
static long GetDistance(long R1, long G1, long B1, long R2, long G2, long B2);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ namespace openshot {
|
||||
Coordinate(double x, double y);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -118,10 +118,10 @@ namespace openshot
|
||||
std::string Name() { return "DecklinkReader"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open device and video stream - which is called by the constructor automatically
|
||||
void Open();
|
||||
|
||||
@@ -87,10 +87,10 @@ namespace openshot
|
||||
std::string Name() { return "DummyReader"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open File - which is called by the constructor automatically
|
||||
void Open();
|
||||
|
||||
@@ -94,14 +94,14 @@ namespace openshot
|
||||
void InitEffectInfo();
|
||||
|
||||
/// Get and Set JSON methods
|
||||
virtual std::string Json() = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
|
||||
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
|
||||
Json::Value JsonInfo(); ///< Generate JSON object of meta data / info
|
||||
virtual std::string Json() const = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(const std::string value) = 0; ///< Load JSON string into this object
|
||||
virtual Json::Value JsonValue() const = 0; ///< Generate Json::Value for this object
|
||||
virtual void SetJsonValue(const Json::Value root) = 0; ///< Load Json::Value into this object
|
||||
Json::Value JsonInfo() const; ///< Generate JSON object of meta data / info
|
||||
|
||||
/// Get the order that this effect should be executed.
|
||||
int Order() { return order; }
|
||||
int Order() const { return order; }
|
||||
|
||||
/// Set the order that this effect should be executed.
|
||||
void Order(int new_order) { order = new_order; }
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace openshot
|
||||
|
||||
/// JSON methods
|
||||
static std::string Json(); ///< Generate JSON string of this object
|
||||
static Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
static Json::Value JsonValue(); ///< Generate Json::Value for this object
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -264,10 +264,10 @@ namespace openshot {
|
||||
std::string Name() { return "FFmpegReader"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open File - which is called by the constructor automatically
|
||||
void Open();
|
||||
|
||||
@@ -199,10 +199,10 @@ namespace openshot
|
||||
std::string Name() { return "FrameMapper"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open the internal reader
|
||||
void Open();
|
||||
|
||||
@@ -106,10 +106,10 @@ namespace openshot
|
||||
std::string Name() { return "ImageReader"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open File - which is called by the constructor automatically
|
||||
void Open();
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
#ifndef OPENSHOT_JSON_H
|
||||
#define OPENSHOT_JSON_H
|
||||
|
||||
#include <string>
|
||||
#include "json/json.h"
|
||||
#include "Exceptions.h"
|
||||
|
||||
namespace openshot {
|
||||
const Json::Value stringToJson(const std::string value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -133,9 +133,9 @@ namespace openshot {
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::JsonValue for this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Remove a point by matching a coordinate
|
||||
void RemovePoint(Point p);
|
||||
|
||||
@@ -119,10 +119,10 @@ namespace openshot
|
||||
void Initialize_RightHandle(float x, float y);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -90,10 +90,10 @@ namespace openshot
|
||||
Profile(std::string path);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const; ///< Generate JSON string of this object
|
||||
Json::Value JsonValue() const; ///< Generate Json::Value for this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -131,10 +131,10 @@ namespace openshot
|
||||
std::string Name() { return "QtHtmlReader"; };
|
||||
|
||||
/// Get and Set JSON methods
|
||||
std::string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
void SetJson(const std::string value); ///< Load JSON string into this object
|
||||
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
|
||||
void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object
|
||||
|
||||
/// Open Reader - which is called by the constructor automatically
|
||||
void Open();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user