MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / PropertiesJSON

Method PropertiesJSON

src/Clip.cpp:816–935  ·  view source on GitHub ↗

Get all properties for a specific frame

Source from the content-addressed store, hash-verified

814
815// Get all properties for a specific frame
816std::string Clip::PropertiesJSON(int64_t requested_frame) const {
817
818 // Generate JSON properties list
819 Json::Value root;
820 root["id"] = add_property_json("ID", 0.0, "string", Id(), NULL, -1, -1, true, requested_frame);
821 root["position"] = add_property_json("Position", Position(), "float", "", NULL, 0, 30 * 60 * 60 * 48, false, requested_frame);
822 root["layer"] = add_property_json("Track", Layer(), "int", "", NULL, 0, 20, false, requested_frame);
823 root["start"] = add_property_json("Start", Start(), "float", "", NULL, 0, 30 * 60 * 60 * 48, false, requested_frame);
824 root["end"] = add_property_json("End", End(), "float", "", NULL, 0, 30 * 60 * 60 * 48, false, requested_frame);
825 root["duration"] = add_property_json("Duration", Duration(), "float", "", NULL, 0, 30 * 60 * 60 * 48, true, requested_frame);
826 root["gravity"] = add_property_json("Gravity", gravity, "int", "", NULL, 0, 8, false, requested_frame);
827 root["scale"] = add_property_json("Scale", scale, "int", "", NULL, 0, 3, false, requested_frame);
828 root["display"] = add_property_json("Frame Number", display, "int", "", NULL, 0, 3, false, requested_frame);
829 root["mixing"] = add_property_json("Volume Mixing", mixing, "int", "", NULL, 0, 2, false, requested_frame);
830 root["composite"] = add_property_json("Composite", composite, "int", "", NULL, 0, composite_choices_count - 1, false, requested_frame);
831 root["waveform"] = add_property_json("Waveform", waveform, "int", "", NULL, 0, 1, false, requested_frame);
832 root["parentObjectId"] = add_property_json("Parent", 0.0, "string", parentObjectId, NULL, -1, -1, false, requested_frame);
833
834 // Add gravity choices (dropdown style)
835 root["gravity"]["choices"].append(add_property_choice_json("Top Left", GRAVITY_TOP_LEFT, gravity));
836 root["gravity"]["choices"].append(add_property_choice_json("Top Center", GRAVITY_TOP, gravity));
837 root["gravity"]["choices"].append(add_property_choice_json("Top Right", GRAVITY_TOP_RIGHT, gravity));
838 root["gravity"]["choices"].append(add_property_choice_json("Left", GRAVITY_LEFT, gravity));
839 root["gravity"]["choices"].append(add_property_choice_json("Center", GRAVITY_CENTER, gravity));
840 root["gravity"]["choices"].append(add_property_choice_json("Right", GRAVITY_RIGHT, gravity));
841 root["gravity"]["choices"].append(add_property_choice_json("Bottom Left", GRAVITY_BOTTOM_LEFT, gravity));
842 root["gravity"]["choices"].append(add_property_choice_json("Bottom Center", GRAVITY_BOTTOM, gravity));
843 root["gravity"]["choices"].append(add_property_choice_json("Bottom Right", GRAVITY_BOTTOM_RIGHT, gravity));
844
845 // Add scale choices (dropdown style)
846 root["scale"]["choices"].append(add_property_choice_json("Crop", SCALE_CROP, scale));
847 root["scale"]["choices"].append(add_property_choice_json("Best Fit", SCALE_FIT, scale));
848 root["scale"]["choices"].append(add_property_choice_json("Stretch", SCALE_STRETCH, scale));
849 root["scale"]["choices"].append(add_property_choice_json("None", SCALE_NONE, scale));
850
851 // Add frame number display choices (dropdown style)
852 root["display"]["choices"].append(add_property_choice_json("None", FRAME_DISPLAY_NONE, display));
853 root["display"]["choices"].append(add_property_choice_json("Clip", FRAME_DISPLAY_CLIP, display));
854 root["display"]["choices"].append(add_property_choice_json("Timeline", FRAME_DISPLAY_TIMELINE, display));
855 root["display"]["choices"].append(add_property_choice_json("Both", FRAME_DISPLAY_BOTH, display));
856
857 // Add volume mixing choices (dropdown style)
858 root["mixing"]["choices"].append(add_property_choice_json("None", VOLUME_MIX_NONE, mixing));
859 root["mixing"]["choices"].append(add_property_choice_json("Average", VOLUME_MIX_AVERAGE, mixing));
860 root["mixing"]["choices"].append(add_property_choice_json("Reduce", VOLUME_MIX_REDUCE, mixing));
861
862 // Add composite choices (dropdown style)
863 for (int i = 0; i < composite_choices_count; ++i)
864 root["composite"]["choices"].append(add_property_choice_json(composite_choices[i].name, composite_choices[i].value, composite));
865
866 // Add waveform choices (dropdown style)
867 root["waveform"]["choices"].append(add_property_choice_json("Yes", true, waveform));
868 root["waveform"]["choices"].append(add_property_choice_json("No", false, waveform));
869
870 // Add the parentClipObject's properties
871 if (parentClipObject)
872 {
873 // Convert Clip's frame position to Timeline's frame position

Callers 4

ColorMap.cppFile · 0.45
Clip.cppFile · 0.45
Mask.cppFile · 0.45
EffectMask.cppFile · 0.45

Calls 2

ToDoubleMethod · 0.80
GetValueMethod · 0.80

Tested by

no test coverage detected