You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Increased debug output precision. Fixed rounding bug on timeline when finding a clips actual frame number. Fixed bug with a clips JSON properties output.
This commit is contained in:
@@ -101,12 +101,12 @@ namespace openshot
|
||||
void AppendDebugItem(Json::Value debug_item);
|
||||
|
||||
/// Append debug information as JSON
|
||||
void AppendDebugMethod(string method_name, string arg1_name, int arg1_value,
|
||||
string arg2_name, int arg2_value,
|
||||
string arg3_name, int arg3_value,
|
||||
string arg4_name, int arg4_value,
|
||||
string arg5_name, int arg5_value,
|
||||
string arg6_name, int arg6_value);
|
||||
void AppendDebugMethod(string method_name, string arg1_name, float arg1_value,
|
||||
string arg2_name, float arg2_value,
|
||||
string arg3_name, float arg3_value,
|
||||
string arg4_name, float arg4_value,
|
||||
string arg5_name, float arg5_value,
|
||||
string arg6_name, float arg6_value);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -91,12 +91,12 @@ namespace openshot
|
||||
void AppendDebugItem(Json::Value debug_item);
|
||||
|
||||
/// Append debug information as JSON
|
||||
void AppendDebugMethod(string method_name, string arg1_name, int arg1_value,
|
||||
string arg2_name, int arg2_value,
|
||||
string arg3_name, int arg3_value,
|
||||
string arg4_name, int arg4_value,
|
||||
string arg5_name, int arg5_value,
|
||||
string arg6_name, int arg6_value);
|
||||
void AppendDebugMethod(string method_name, string arg1_name, float arg1_value,
|
||||
string arg2_name, float arg2_value,
|
||||
string arg3_name, float arg3_value,
|
||||
string arg4_name, float arg4_value,
|
||||
string arg5_name, float arg5_value,
|
||||
string arg6_name, float arg6_value);
|
||||
|
||||
public:
|
||||
/// Constructor for WriterBase class, many things are initialized here
|
||||
|
||||
@@ -533,7 +533,7 @@ string Clip::PropertiesJSON(int requested_frame) {
|
||||
// Generate JSON properties list
|
||||
Json::Value root;
|
||||
root["id"] = add_property_json("ID", 0.0, "string", Id(), false, 0, -1, -1, CONSTANT, -1, true);
|
||||
root["position"] = add_property_json("Position", Position(), "int", "", false, 0, 0, 1000 * 60 * 30, CONSTANT, -1, false);
|
||||
root["position"] = add_property_json("Position", Position(), "float", "", false, 0, 0, 1000 * 60 * 30, CONSTANT, -1, false);
|
||||
root["layer"] = add_property_json("Layer", Layer(), "int", "", false, 0, 0, 1000, CONSTANT, -1, false);
|
||||
root["start"] = add_property_json("Start", Start(), "float", "", false, 0, 0, 1000 * 60 * 30, CONSTANT, -1, false);
|
||||
root["end"] = add_property_json("End", End(), "float", "", false, 0, 0, 1000 * 60 * 30, CONSTANT, -1, false);
|
||||
@@ -583,7 +583,7 @@ Json::Value Clip::add_property_json(string name, float value, string type, strin
|
||||
prop["name"] = name;
|
||||
prop["value"] = value;
|
||||
prop["memo"] = memo;
|
||||
prop["type"] = value;
|
||||
prop["type"] = type;
|
||||
prop["min"] = min_value;
|
||||
prop["max"] = max_value;
|
||||
prop["keyframe"] = contains_point;
|
||||
|
||||
@@ -78,12 +78,12 @@ void ReaderBase::AppendDebugItem(Json::Value debug_item)
|
||||
}
|
||||
|
||||
// Append debug information as JSON
|
||||
void ReaderBase::AppendDebugMethod(string method_name, string arg1_name, int arg1_value,
|
||||
string arg2_name, int arg2_value,
|
||||
string arg3_name, int arg3_value,
|
||||
string arg4_name, int arg4_value,
|
||||
string arg5_name, int arg5_value,
|
||||
string arg6_name, int arg6_value)
|
||||
void ReaderBase::AppendDebugMethod(string method_name, string arg1_name, float arg1_value,
|
||||
string arg2_name, float arg2_value,
|
||||
string arg3_name, float arg3_value,
|
||||
string arg4_name, float arg4_value,
|
||||
string arg5_name, float arg5_value,
|
||||
string arg6_name, float arg6_value)
|
||||
{
|
||||
if (!debug)
|
||||
// Don't do anything
|
||||
@@ -93,6 +93,7 @@ void ReaderBase::AppendDebugMethod(string method_name, string arg1_name, int arg
|
||||
debug_item["method"] = method_name;
|
||||
|
||||
// Output to standard output
|
||||
cout << fixed << setprecision(4);
|
||||
cout << "Debug: Method: " << method_name << " (";
|
||||
|
||||
// Add attributes to method JSON
|
||||
|
||||
@@ -574,19 +574,22 @@ tr1::shared_ptr<Frame> Timeline::GetFrame(int requested_frame) throw(ReaderClose
|
||||
Clip *clip = (*clip_itr);
|
||||
|
||||
// Does clip intersect the current requested time
|
||||
float clip_duration = clip->End() - clip->Start();
|
||||
bool does_clip_intersect = (clip->Position() <= requested_time && clip->Position() + clip_duration >= requested_time);
|
||||
bool does_clip_intersect = (clip->Position() <= requested_time && clip->Position() + clip->Duration() >= requested_time);
|
||||
|
||||
// Debug output
|
||||
#pragma omp critical (debug_output)
|
||||
AppendDebugMethod("Timeline::GetFrame (Does clip intersect)", "frame_number", frame_number, "requested_time", requested_time, "clip->Position()", clip->Position(), "clip_duration", clip_duration, "does_clip_intersect", does_clip_intersect, "", -1);
|
||||
AppendDebugMethod("Timeline::GetFrame (Does clip intersect)", "frame_number", frame_number, "requested_time", requested_time, "clip->Position()", clip->Position(), "clip->Duration()", clip->Duration(), "does_clip_intersect", does_clip_intersect, "", -1);
|
||||
|
||||
// Clip is visible
|
||||
if (does_clip_intersect)
|
||||
{
|
||||
// Determine the frame needed for this clip (based on the position on the timeline)
|
||||
float time_diff = (requested_time - clip->Position()) + clip->Start();
|
||||
int clip_frame_number = round(time_diff * info.fps.ToFloat()) + 1;
|
||||
int clip_frame_number = (time_diff * info.fps.ToFloat()) + 1;
|
||||
|
||||
// Debug output
|
||||
#pragma omp critical (debug_output)
|
||||
AppendDebugMethod("Timeline::GetFrame (Calculate clip's frame #)", "time_diff", time_diff, "requested_time", requested_time, "clip->Position()", clip->Position(), "clip->Start()", clip->Start(), "info.fps.ToFloat()", info.fps.ToFloat(), "clip_frame_number", clip_frame_number);
|
||||
|
||||
// Add clip's frame as layer
|
||||
add_layer(new_frame, clip, clip_frame_number, frame_number);
|
||||
|
||||
@@ -77,12 +77,12 @@ void WriterBase::AppendDebugItem(Json::Value debug_item)
|
||||
}
|
||||
|
||||
// Append debug information as JSON
|
||||
void WriterBase::AppendDebugMethod(string method_name, string arg1_name, int arg1_value,
|
||||
string arg2_name, int arg2_value,
|
||||
string arg3_name, int arg3_value,
|
||||
string arg4_name, int arg4_value,
|
||||
string arg5_name, int arg5_value,
|
||||
string arg6_name, int arg6_value)
|
||||
void WriterBase::AppendDebugMethod(string method_name, string arg1_name, float arg1_value,
|
||||
string arg2_name, float arg2_value,
|
||||
string arg3_name, float arg3_value,
|
||||
string arg4_name, float arg4_value,
|
||||
string arg5_name, float arg5_value,
|
||||
string arg6_name, float arg6_value)
|
||||
{
|
||||
if (!debug)
|
||||
// Don't do anything
|
||||
@@ -92,6 +92,7 @@ void WriterBase::AppendDebugMethod(string method_name, string arg1_name, int arg
|
||||
debug_item["method"] = method_name;
|
||||
|
||||
// Output to standard output
|
||||
cout << fixed << setprecision(4);
|
||||
cout << "Debug: Method: " << method_name << " (";
|
||||
|
||||
// Add attributes to method JSON
|
||||
|
||||
Reference in New Issue
Block a user