Skip to content

Commit

Permalink
Merge branch 'develop' into add-features
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Mar 2, 2020
2 parents 7ab18fd + 8b78ddf commit 600e884
Show file tree
Hide file tree
Showing 89 changed files with 850 additions and 1,249 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -40,8 +40,8 @@ For more information, please visit <http://www.openshot.org/>.
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")

################ PROJECT VERSION ####################
set(PROJECT_VERSION_FULL "0.2.4-dev1")
set(PROJECT_SO_VERSION 18)
set(PROJECT_VERSION_FULL "0.2.5-dev1")
set(PROJECT_SO_VERSION 19)

# Remove the dash and anything following, to get the #.#.# version for project()
STRING(REGEX REPLACE "\-.*$" "" VERSION_NUM "${PROJECT_VERSION_FULL}")
Expand Down
33 changes: 27 additions & 6 deletions cmake/Modules/CodeCoverage.cmake
Expand Up @@ -59,6 +59,13 @@
# 2019-12-19, FeRD (Frank Dana)
# - Rename Lcov outputs, make filtered file canonical, fix cleanup for targets
#
# 2020-01-19, Bob Apthorpe
# - Added gfortran support
#
# 2020-02-17, FeRD (Frank Dana)
# - Make all add_custom_target()s VERBATIM to auto-escape wildcard characters
# in EXCLUDEs, and remove manual escaping from gcovr targets
#
# USAGE:
#
# 1. Copy this file into your cmake modules path.
Expand Down Expand Up @@ -122,12 +129,22 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
endif()
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang")
# Do nothing; exit conditional without error if true
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
# Do nothing; exit conditional without error if true
else()
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
endif()
endif()

set(COVERAGE_COMPILER_FLAGS "-g -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")

set(CMAKE_Fortran_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
FORCE )
set(CMAKE_CXX_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C++ compiler during coverage builds."
Expand All @@ -145,6 +162,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
mark_as_advanced(
CMAKE_Fortran_FLAGS_COVERAGE
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
Expand All @@ -154,7 +172,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"

if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
link_libraries(gcov)
endif()

Expand Down Expand Up @@ -242,6 +260,7 @@ function(setup_target_for_coverage_lcov)

WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)

Expand Down Expand Up @@ -304,9 +323,8 @@ function(setup_target_for_coverage_gcovr_xml)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE_REPLACED}")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()

add_custom_target(${Coverage_NAME}
Expand All @@ -321,6 +339,7 @@ function(setup_target_for_coverage_gcovr_xml)
BYPRODUCTS ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce Cobertura code coverage report."
)

Expand Down Expand Up @@ -376,9 +395,8 @@ function(setup_target_for_coverage_gcovr_html)
# Combine excludes to several -e arguments
set(GCOVR_EXCLUDE_ARGS "")
foreach(EXCLUDE ${GCOVR_EXCLUDES})
string(REPLACE "*" "\\*" EXCLUDE_REPLACED ${EXCLUDE})
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE_REPLACED}")
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
endforeach()

add_custom_target(${Coverage_NAME}
Expand All @@ -393,9 +411,11 @@ function(setup_target_for_coverage_gcovr_html)
-r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR}
-o ${Coverage_NAME}/index.html

BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME} # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
VERBATIM # Protect arguments to commands
COMMENT "Running gcovr to produce HTML code coverage report."
)

Expand All @@ -410,5 +430,6 @@ endfunction() # setup_target_for_coverage_gcovr_html
function(append_coverage_compiler_flags)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
endfunction() # append_coverage_compiler_flags
6 changes: 3 additions & 3 deletions include/CacheBase.h
Expand Up @@ -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;

};
Expand Down
6 changes: 3 additions & 3 deletions include/CacheDisk.h
Expand Up @@ -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
};

}
Expand Down
6 changes: 3 additions & 3 deletions include/CacheMemory.h
Expand Up @@ -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
};

}
Expand Down
8 changes: 4 additions & 4 deletions include/ChunkReader.h
Expand Up @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions include/Clip.h
Expand Up @@ -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.
Expand Down
26 changes: 13 additions & 13 deletions include/ClipBase.h
Expand Up @@ -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:

Expand All @@ -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
Expand All @@ -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;
};
Expand Down
8 changes: 4 additions & 4 deletions include/Color.h
Expand Up @@ -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
};


Expand Down
8 changes: 4 additions & 4 deletions include/Coordinate.h
Expand Up @@ -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
};

}
Expand Down
8 changes: 4 additions & 4 deletions include/DecklinkReader.h
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions include/DummyReader.h
Expand Up @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions include/EffectBase.h
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion include/EffectInfo.h
Expand Up @@ -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

};

Expand Down
12 changes: 6 additions & 6 deletions include/FFmpegReader.h
Expand Up @@ -76,11 +76,11 @@ namespace openshot {
*
* @code
* // Create a reader for a video
* FFmpegReader r("MyAwesomeVideo.webm");
* openshot::FFmpegReader r("MyAwesomeVideo.webm");
* r.Open(); // Open the reader
*
* // Get frame number 1 from the video
* std::shared_ptr<Frame> f = r.GetFrame(1);
* std::shared_ptr<openshot::Frame> f = r.GetFrame(1);
*
* // Now that we have an openshot::Frame object, lets have some fun!
* f->Display(); // Display the frame on the screen
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 600e884

Please sign in to comment.