OpenShot Library | libopenshot
0.2.5
|
Go to the documentation of this file.
31 #include "../include/ClipBase.h"
42 root[
"layer"] =
Layer();
43 root[
"start"] =
Start();
55 if (!root[
"id"].isNull())
56 Id(root[
"id"].asString());
57 if (!root[
"position"].isNull())
58 Position(root[
"position"].asDouble());
59 if (!root[
"layer"].isNull())
60 Layer(root[
"layer"].asInt());
61 if (!root[
"start"].isNull())
62 Start(root[
"start"].asDouble());
63 if (!root[
"end"].isNull())
64 End(root[
"end"].asDouble());
68 Json::Value
ClipBase::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 {
71 const Point requested_point(requested_frame, requested_frame);
74 Json::Value prop = Json::Value(Json::objectValue);
76 prop[
"value"] = value;
79 prop[
"min"] = min_value;
80 prop[
"max"] = max_value;
82 prop[
"keyframe"] = keyframe->
Contains(requested_point);
83 prop[
"points"] = int(keyframe->
GetCount());
86 prop[
"closest_point_x"] = closest_point.
co.
X;
90 prop[
"keyframe"] =
false;
93 prop[
"closest_point_x"] = -1;
94 prop[
"previous_point_x"] = -1;
97 prop[
"readonly"] = readonly;
98 prop[
"choices"] = Json::Value(Json::arrayValue);
107 Json::Value new_choice = Json::Value(Json::objectValue);
108 new_choice[
"name"] = name;
109 new_choice[
"value"] = value;
110 new_choice[
"selected"] = (value == selected_value);
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 for a property.
InterpolationType interpolation
This is the interpolation mode.
This namespace is the default namespace for all code in the openshot library.
Coordinate co
This is the primary coordinate.
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const
Generate JSON choice for a property (dropdown properties)
float End() const
Get end position (in seconds) of clip (trim end of video)
bool Contains(Point p) const
Does this keyframe contain a specific point.
int Layer() const
Get layer of clip on timeline (lower number is covered by higher numbers)
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
std::string Id() const
Get basic properties.
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
float Duration() const
Get the length of this clip (in seconds)
Point GetClosestPoint(Point p) const
Get current point (or closest point to the right) from the X coordinate (i.e. the frame number)
int64_t GetCount() const
Get the number of points (i.e. # of points)
@ CONSTANT
Constant curves jump from their previous position to a new one (with no interpolation).
float Position() const
Get position on timeline (in seconds)
Point GetPreviousPoint(Point p) const
Get previous point (.
float Start() const
Get start position (in seconds) of clip (trim start of video)
A Point is the basic building block of a key-frame curve.
double X
The X value of the coordinate (usually representing the frame #)