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