Merge branch 'develop' into json-parsing

This commit is contained in:
Frank Dana
2020-01-20 15:25:40 -05:00
committed by GitHub
35 changed files with 966 additions and 344 deletions

View File

@@ -46,7 +46,7 @@ mac-builder:
- export LIBOPENSHOT_AUDIO_DIR=$CI_PROJECT_DIR/build/install-x64
- mkdir -p build; cd build;
- mkdir -p install-x64/python;
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/build/install-x64" -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc48/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/local/opt/gcc48/bin/gcc-4.8 -DCMAKE_PREFIX_PATH=/usr/local/qt5/5.5/clang_64 -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6.dylib -DPython_FRAMEWORKS=/Library/Frameworks/Python.framework/ -D"CMAKE_BUILD_TYPE:STRING=Debug" -D"CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" -D"CMAKE_OSX_DEPLOYMENT_TARGET=10.9" -D"CMAKE_INSTALL_RPATH_USE_LINK_PATH=1" -D"ENABLE_RUBY=0" ../
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/build/install-x64" -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc48/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/local/opt/gcc48/bin/gcc-4.8 -DCMAKE_PREFIX_PATH=/usr/local/qt5/5.5/clang_64 -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6.dylib -DPython_FRAMEWORKS=/Library/Frameworks/Python.framework/ -D"CMAKE_BUILD_TYPE:STRING=Release" -D"CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" -D"CMAKE_OSX_DEPLOYMENT_TARGET=10.9" -D"CMAKE_INSTALL_RPATH_USE_LINK_PATH=1" -D"ENABLE_RUBY=0" ../
- make
- make install
- mv install-x64/lib/python3.6/site-packages/*openshot* install-x64/python

View File

@@ -18,6 +18,7 @@ addons:
- qtmultimedia5-dev
- doxygen
- graphviz
- curl
packages: &ff_common # Common set of FFmpeg packages
- *p_common
- libfdk-aac-dev
@@ -32,26 +33,13 @@ addons:
- libswresample-dev
matrix:
# The FFmpeg4 PPA is currently down as a protest
allow_failures:
- env: BUILD_VERSION=ffmpeg4
include:
- name: "FFmpeg 2 GCC (Ubuntu 16.04 Xenial)"
env: BUILD_VERSION=ffmpeg2
os: linux
dist: xenial
addons:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.10.0-xenial'
packages:
- *ff_common
- name: "FFmpeg 3 GCC (Ubuntu 18.04 Bionic)"
env: BUILD_VERSION=ffmpeg3
- name: "Coverage (Ubuntu 18.04 Bionic)"
env:
- BUILD_VERSION=coverage_ffmpeg3
- CMAKE_EXTRA_ARGS="-DENABLE_COVERAGE=1"
- TEST_TARGET=coverage
os: linux
dist: bionic
addons:
@@ -62,9 +50,14 @@ matrix:
packages:
- *ff_common
- qt5-default
- lcov
- binutils-common # For c++filt
- name: "FFmpeg 4 GCC (Ubuntu 18.04 Bionic)"
env: BUILD_VERSION=ffmpeg4
env:
- BUILD_VERSION=ffmpeg4
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET=test
os: linux
dist: bionic
addons:
@@ -76,6 +69,7 @@ matrix:
packages:
- *ff_common
- qt5-default
- libjsoncpp-dev
- libavcodec58
- libavformat58
- libavdevice58
@@ -86,8 +80,28 @@ matrix:
- libavresample4
- libswresample3
- name: "FFmpeg 3 GCC (Ubuntu 18.04 Bionic)"
env:
- BUILD_VERSION=ffmpeg3
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET=test
os: linux
dist: bionic
addons:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.12.3-bionic'
packages:
- *ff_common
- qt5-default
- libjsoncpp-dev
- name: "FFmpeg 3 Clang (Ubuntu 18.04 Bionic)"
env: BUILD_VERSION=ffmpeg3
env:
- BUILD_VERSION=clang_ffmpeg3
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET=test
os: linux
dist: bionic
compiler: clang
@@ -101,9 +115,28 @@ matrix:
- qt5-default
- libomp-dev
- name: "FFmpeg 2 GCC (Ubuntu 16.04 Xenial)"
env:
- BUILD_VERSION=ffmpeg2
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET="os_test"
os: linux
dist: xenial
addons:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.10.0-xenial'
packages:
- *ff_common
script:
- mkdir -p build; cd build;
- cmake -DCMAKE_BUILD_TYPE:STRING="Debug" ../
- cmake -DCMAKE_BUILD_TYPE:STRING="Debug" ${CMAKE_EXTRA_ARGS} ../
- make VERBOSE=1
- make os_test
- make ${TEST_TARGET}
- make install DESTDIR="$BUILD_VERSION"
- cd ..
after_success:
- if [ "x$TEST_TARGET" = "xcoverage" ]; then bash <(curl -s https://codecov.io/bash) -f build/coverage.info || echo "Codecov did not collect coverage reports"; fi

View File

@@ -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.3-dev1")
set(PROJECT_SO_VERSION 17)
set(PROJECT_VERSION_FULL "0.2.4-dev1")
set(PROJECT_SO_VERSION 18)
# Remove the dash and anything following, to get the #.#.# version for project()
STRING(REGEX REPLACE "\-.*$" "" VERSION_NUM "${PROJECT_VERSION_FULL}")
@@ -73,7 +73,9 @@ include(FeatureSummary)
# Optional build settings for libopenshot
option(USE_SYSTEM_JSONCPP "Use system installed JsonCpp, if found" ON)
option(DISABLE_BUNDLED_JSONCPP "Don't fall back to bundled JsonCpp" OFF)
option(DISABLE_TESTS "Don't build unit tests" OFF)
option(ENABLE_IWYU "Enable 'Include What You Use' scanner (CMake 3.3+)" OFF)
option(ENABLE_COVERAGE "Enable coverage reporting" OFF)
########## Configure Version.h header ##############
configure_file(include/OpenShotVersion.h.in include/OpenShotVersion.h @ONLY)
@@ -94,6 +96,22 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include)
############## Code Coverage #########################
if (DISABLE_TESTS AND ENABLE_COVERAGE)
message(WARNING "ENABLE_COVERAGE requires tests, overriding DISABLE_TESTS")
set(DISABLE_TESTS OFF CACHE BOOL "Don't build unit tests" FORCE)
endif()
if (ENABLE_COVERAGE)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
message(STATUS "Coverage enabled, setting build type to Debug")
endif()
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
endif()
add_feature_info("Coverage" ENABLE_COVERAGE "analyze test coverage and generate report")
############## PROCESS src/ DIRECTORIES ##############
add_subdirectory(src)
@@ -121,6 +139,16 @@ if(NOT DISABLE_TESTS)
add_subdirectory(tests)
endif()
############## COVERAGE REPORTING #################
if (ENABLE_COVERAGE)
setup_target_for_coverage_lcov(
NAME coverage
LCOV_ARGS "--no-external"
EXECUTABLE openshot-test
DEPENDENCIES openshot-test)
message("Generate coverage report with 'make coverage'")
endif()
########### PRINT FEATURE SUMMARY ##############
feature_summary(WHAT ALL
INCLUDE_QUIET_PACKAGES

View File

@@ -0,0 +1,414 @@
# Copyright (c) 2012 - 2017, Lars Bilke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# CHANGES:
#
# 2012-01-31, Lars Bilke
# - Enable Code Coverage
#
# 2013-09-17, Joakim Söderberg
# - Added support for Clang.
# - Some additional usage instructions.
#
# 2016-02-03, Lars Bilke
# - Refactored functions to use named parameters
#
# 2017-06-02, Lars Bilke
# - Merged with modified version from github.com/ufz/ogs
#
# 2019-05-06, Anatolii Kurotych
# - Remove unnecessary --coverage flag
#
# 2019-12-13, FeRD (Frank Dana)
# - Deprecate COVERAGE_LCOVR_EXCLUDES and COVERAGE_GCOVR_EXCLUDES lists in favor
# of tool-agnostic COVERAGE_EXCLUDES variable, or EXCLUDE setup arguments.
# - CMake 3.4+: All excludes can be specified relative to BASE_DIRECTORY
# - All setup functions: accept BASE_DIRECTORY, EXCLUDE list
# - Set lcov basedir with -b argument
# - Add automatic --demangle-cpp in lcovr, if 'c++filt' is available (can be
# overridden with NO_DEMANGLE option in setup_target_for_coverage_lcovr().)
# - Delete output dir, .info file on 'make clean'
# - Remove Python detection, since version mismatches will break gcovr
# - Minor cleanup (lowercase function names, update examples...)
#
# 2019-12-19, FeRD (Frank Dana)
# - Rename Lcov outputs, make filtered file canonical, fix cleanup for targets
#
# USAGE:
#
# 1. Copy this file into your cmake modules path.
#
# 2. Add the following line to your CMakeLists.txt:
# include(CodeCoverage)
#
# 3. Append necessary compiler flags:
# append_coverage_compiler_flags()
#
# 3.a (OPTIONAL) Set appropriate optimization flags, e.g. -O0, -O1 or -Og
#
# 4. If you need to exclude additional directories from the report, specify them
# using full paths in the COVERAGE_EXCLUDES variable before calling
# setup_target_for_coverage_*().
# Example:
# set(COVERAGE_EXCLUDES
# '${PROJECT_SOURCE_DIR}/src/dir1/*'
# '/path/to/my/src/dir2/*')
# Or, use the EXCLUDE argument to setup_target_for_coverage_*().
# Example:
# setup_target_for_coverage_lcov(
# NAME coverage
# EXECUTABLE testrunner
# EXCLUDE "${PROJECT_SOURCE_DIR}/src/dir1/*" "/path/to/my/src/dir2/*")
#
# 4.a NOTE: With CMake 3.4+, COVERAGE_EXCLUDES or EXCLUDE can also be set
# relative to the BASE_DIRECTORY (default: PROJECT_SOURCE_DIR)
# Example:
# set(COVERAGE_EXCLUDES "dir1/*")
# setup_target_for_coverage_gcovr_html(
# NAME coverage
# EXECUTABLE testrunner
# BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src"
# EXCLUDE "dir2/*")
#
# 5. Use the functions described below to create a custom make target which
# runs your test executable and produces a code coverage report.
#
# 6. Build a Debug build:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
#
include(CMakeParseArguments)
# Check prereqs
find_program( GCOV_PATH gcov )
find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl)
find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat )
find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
find_program( CPPFILT_PATH NAMES c++filt )
if(NOT GCOV_PATH)
message(FATAL_ERROR "gcov not found! Aborting...")
endif() # NOT GCOV_PATH
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3)
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...")
endif()
set(COVERAGE_COMPILER_FLAGS "-g -fprofile-arcs -ftest-coverage"
CACHE INTERNAL "")
set(CMAKE_CXX_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE )
set(CMAKE_C_FLAGS_COVERAGE
${COVERAGE_COMPILER_FLAGS}
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE )
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE )
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
mark_as_advanced(
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
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")
link_libraries(gcov)
endif()
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# setup_target_for_coverage_lcov(
# NAME testrunner_coverage # New target name
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES testrunner # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# NO_DEMANGLE # Don't demangle C++ symbols
# # even if c++filt is found
# )
function(setup_target_for_coverage_lcov)
set(options NO_DEMANGLE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT LCOV_PATH)
message(FATAL_ERROR "lcov not found! Aborting...")
endif() # NOT LCOV_PATH
if(NOT GENHTML_PATH)
message(FATAL_ERROR "genhtml not found! Aborting...")
endif() # NOT GENHTML_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(LCOV_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_LCOV_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND LCOV_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES LCOV_EXCLUDES)
# Conditional arguments
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
endif()
# Setup target
add_custom_target(${Coverage_NAME}
# Cleanup lcov
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory . -b ${BASEDIR} --zerocounters
# Create baseline to make sure untouched files show up in the report
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -b ${BASEDIR} -o ${Coverage_NAME}.base
# Run tests
COMMAND ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . -b ${BASEDIR} --capture --output-file ${Coverage_NAME}.capture
# add baseline counters
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base -a ${Coverage_NAME}.capture --output-file ${Coverage_NAME}.total
# filter collected data to final coverage report
COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove ${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file ${Coverage_NAME}.info
# Generate HTML output
COMMAND ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o ${Coverage_NAME} ${Coverage_NAME}.info
# Set output files as GENERATED (will be removed on 'make clean')
BYPRODUCTS
${Coverage_NAME}.base
${Coverage_NAME}.capture
${Coverage_NAME}.total
${Coverage_NAME}.info
${Coverage_NAME} # report directory
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Show where to find the lcov info report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
endfunction() # setup_target_for_coverage_lcov
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# setup_target_for_coverage_gcovr_xml(
# NAME ctest_coverage # New target name
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES executable_target # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# )
function(setup_target_for_coverage_gcovr_xml)
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# 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}")
endforeach()
add_custom_target(${Coverage_NAME}
# Run tests
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Running gcovr
COMMAND ${GCOVR_PATH} --xml
-r ${BASEDIR} ${GCOVR_EXCLUDE_ARGS}
--object-directory=${PROJECT_BINARY_DIR}
-o ${Coverage_NAME}.xml
BYPRODUCTS ${Coverage_NAME}.xml
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${Coverage_DEPENDENCIES}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml."
)
endfunction() # setup_target_for_coverage_gcovr_xml
# Defines a target for running and collection code coverage information
# Builds dependencies, runs the given executable and outputs reports.
# NOTE! The executable should always have a ZERO as exit code otherwise
# the coverage generation will not complete.
#
# setup_target_for_coverage_gcovr_html(
# NAME ctest_coverage # New target name
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
# DEPENDENCIES executable_target # Dependencies to build first
# BASE_DIRECTORY "../" # Base directory for report
# # (defaults to PROJECT_SOURCE_DIR)
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
# # to BASE_DIRECTORY, with CMake 3.4+)
# )
function(setup_target_for_coverage_gcovr_html)
set(options NONE)
set(oneValueArgs BASE_DIRECTORY NAME)
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT GCOVR_PATH)
message(FATAL_ERROR "gcovr not found! Aborting...")
endif() # NOT GCOVR_PATH
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
if(${Coverage_BASE_DIRECTORY})
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
else()
set(BASEDIR ${PROJECT_SOURCE_DIR})
endif()
# Collect excludes (CMake 3.4+: Also compute absolute paths)
set(GCOVR_EXCLUDES "")
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
if(CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
endif()
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
endforeach()
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
# 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}")
endforeach()
add_custom_target(${Coverage_NAME}
# Run tests
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
# Create folder
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME}
# Running gcovr
COMMAND ${GCOVR_PATH} --html --html-details
-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}
COMMENT "Running gcovr to produce HTML code coverage report."
)
# Show info where to find the report
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
COMMAND ;
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
)
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)
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
endfunction() # append_coverage_compiler_flags

View File

@@ -1,28 +1,115 @@
# - Try to find RESVG
# Once done this will define
# RESVG_FOUND - System has RESVG
# RESVG_INCLUDE_DIRS - The RESVG include directories
# RESVG_LIBRARIES - The libraries needed to use RESVG
find_path ( RESVG_INCLUDE_DIR ResvgQt.h
PATHS ${RESVGDIR}/include/resvg
$ENV{RESVGDIR}/include/resvg
$ENV{RESVGDIR}/include
/usr/include/resvg
/usr/include
/usr/local/include/resvg
/usr/local/include )
# vim: ts=2 sw=2
#[=======================================================================[.rst:
FindRESVG
---------
Try to find the shared-library build of resvg, the Rust SVG library
find_library ( RESVG_LIBRARY NAMES resvg
PATHS /usr/lib
/usr/local/lib
$ENV{RESVGDIR}
$ENV{RESVGDIR}/lib )
IMPORTED targets
^^^^^^^^^^^^^^^^
set ( RESVG_LIBRARIES ${RESVG_LIBRARY} )
set ( RESVG_INCLUDE_DIRS ${RESVG_INCLUDE_DIR} )
This module defines :prop_tgt:`IMPORTED` target ``RESVG::resvg`` when
the library and headers are found.
include ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set RESVG_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args ( RESVG "Could NOT find RESVG, using Qt SVG parsing instead" RESVG_LIBRARY RESVG_INCLUDE_DIR )
mark_as_advanced( RESVG_LIBRARY RESVG_INCLUDE_DIR )
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
::
RESVG_FOUND - Library and header files found
RESVG_INCLUDE_DIRS - Include directory path
RESVG_LIBRARIES - Link path to the library
RESVG_DEFINITIONS - Compiler switches (currently unused)
Backwards compatibility
^^^^^^^^^^^^^^^^^^^^^^^
For compatibility with previous versions of this module, uppercase names
for FFmpeg and for all components are also recognized, and all-uppercase
versions of the cache variables are also created.
Control variables
^^^^^^^^^^^^^^^^^
The following variables can be used to provide path hints to the module:
RESVGDIR - Set in the calling CMakeLists.txt or on the command line
ENV{RESVGDIR} - An environment variable in the cmake process context
Copyright (c) 2020, FeRD (Frank Dana) <ferdnyc@gmail.com>
#]=======================================================================]
include(FindPackageHandleStandardArgs)
# CMake 3.4+ only: Convert relative paths to absolute
if(DEFINED RESVGDIR AND CMAKE_VERSION VERSION_GREATER 3.4)
get_filename_component(RESVGDIR "${RESVGDIR}" ABSOLUTE
BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
find_path(RESVG_INCLUDE_DIRS
ResvgQt.h
PATHS
${RESVGDIR}
${RESVGDIR}/include
$ENV{RESVGDIR}
$ENV{RESVGDIR}/include
/usr/include
/usr/local/include
PATH_SUFFIXES
resvg
capi/include
resvg/capi/include
)
find_library(RESVG_LIBRARIES
NAMES resvg
PATHS
${RESVGDIR}
${RESVGDIR}/lib
$ENV{RESVGDIR}
$ENV{RESVGDIR}/lib
/usr/lib
/usr/local/lib
PATH_SUFFIXES
resvg
target/release
resvg/target/release
)
if (RESVG_INCLUDE_DIRS AND RESVG_LIBRARIES)
set(RESVG_FOUND TRUE)
endif()
set(RESVG_LIBRARIES ${RESVG_LIBRARIES} CACHE STRING "The Resvg library link path")
set(RESVG_INCLUDE_DIRS ${RESVG_INCLUDE_DIRS} CACHE STRING "The Resvg include directories")
set(RESVG_DEFINITIONS "" CACHE STRING "The Resvg CFLAGS")
mark_as_advanced(RESVG_LIBRARIES RESVG_INCLUDE_DIRS RESVG_DEFINITIONS)
# Give a nice error message if some of the required vars are missing.
find_package_handle_standard_args(RESVG
"Could NOT find RESVG, using Qt SVG parsing instead"
RESVG_LIBRARIES RESVG_INCLUDE_DIRS )
# Export target
if(RESVG_FOUND AND NOT TARGET RESVG::resvg)
message(STATUS "Creating IMPORTED target RESVG::resvg")
if (WIN32)
# Windows mis-links SHARED library targets
add_library(RESVG::resvg UNKNOWN IMPORTED)
else()
# Linux needs SHARED to link because libresvg has no SONAME
add_library(RESVG::resvg SHARED IMPORTED)
set_property(TARGET RESVG::resvg APPEND PROPERTY
IMPORTED_NO_SONAME TRUE)
endif()
set_property(TARGET RESVG::resvg APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${RESVG_INCLUDE_DIRS}")
set_property(TARGET RESVG::resvg APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS "${RESVG_DEFINITIONS}")
set_property(TARGET RESVG::resvg APPEND PROPERTY
IMPORTED_LOCATION "${RESVG_LIBRARIES}")
endif()

15
codecov.yml Normal file
View File

@@ -0,0 +1,15 @@
codecov:
branch: default
coverage:
status:
project:
default:
base: pr # Only post a status to pull requests
informational: true # Don't block PRs based on coverage stats (yet?)
ignore:
- "/src/examples"
- "/src/Qt/demo"
- "/thirdparty"
- "/doc"
- "/cmake"
- "/*.md"

View File

@@ -31,14 +31,6 @@
#ifndef OPENSHOT_AUDIOBUFFERSOURCE_H
#define OPENSHOT_AUDIOBUFFERSOURCE_H
/// Do not include the juce unittest headers, because it collides with unittest++
#define __JUCE_UNITTEST_JUCEHEADER__
#ifndef _NDEBUG
/// Define NO debug for JUCE on mac os
#define _NDEBUG
#endif
#include <iomanip>
#include "JuceHeader.h"

View File

@@ -31,14 +31,6 @@
#ifndef OPENSHOT_AUDIOREADERSOURCE_H
#define OPENSHOT_AUDIOREADERSOURCE_H
/// Do not include the juce unittest headers, because it collides with unittest++
#define __JUCE_UNITTEST_JUCEHEADER__
#ifndef _NDEBUG
/// Define NO debug for JUCE on mac os
#define _NDEBUG
#endif
#include <iomanip>
#include "ReaderBase.h"
#include "JuceHeader.h"

View File

@@ -31,16 +31,6 @@
#ifndef OPENSHOT_RESAMPLER_H
#define OPENSHOT_RESAMPLER_H
/// Do not include the juce unittest headers, because it collides with unittest++
#ifndef __JUCE_UNITTEST_JUCEHEADER__
#define __JUCE_UNITTEST_JUCEHEADER__
#endif
#ifndef _NDEBUG
// Define NO debug for JUCE on mac os
#define _NDEBUG
#endif
#include "AudioBufferSource.h"
#include "Exceptions.h"
#include "JuceHeader.h"

View File

@@ -31,11 +31,6 @@
#ifndef OPENSHOT_CLIP_H
#define OPENSHOT_CLIP_H
/// Do not include the juce unittest headers, because it collides with unittest++
#ifndef __JUCE_UNITTEST_JUCEHEADER__
#define __JUCE_UNITTEST_JUCEHEADER__
#endif
#include <memory>
#include <string>
#include <QtGui/QImage>

View File

@@ -31,11 +31,6 @@
#ifndef OPENSHOT_CLIPBASE_H
#define OPENSHOT_CLIPBASE_H
/// Do not include the juce unittest headers, because it collides with unittest++
#ifndef __JUCE_UNITTEST_JUCEHEADER__
#define __JUCE_UNITTEST_JUCEHEADER__
#endif
#include <memory>
#include <sstream>
#include "Exceptions.h"

View File

@@ -50,7 +50,6 @@ namespace openshot
struct EffectInfoStruct
{
std::string class_name; ///< The class name of the effect
std::string short_name; ///< A short name of the effect, commonly used for icon names, etc...
std::string name; ///< The name of the effect
std::string description; ///< The description of this effect and what it does
bool has_video; ///< Determines if this effect manipulates the image of a frame

View File

@@ -31,15 +31,6 @@
#ifndef OPENSHOT_FRAME_H
#define OPENSHOT_FRAME_H
/// Do not include the juce unittest headers, because it collides with unittest++
#ifndef __JUCE_UNITTEST_JUCEHEADER__
#define __JUCE_UNITTEST_JUCEHEADER__
#endif
#ifndef _NDEBUG
// Define NO debug for JUCE on mac os
#define _NDEBUG
#endif
#include <iomanip>
#include <sstream>
#include <queue>

View File

@@ -43,7 +43,7 @@ AudioBufferSource::~AudioBufferSource()
{
// forget the AudioSampleBuffer. It still exists; we just don't know about it.
buffer = NULL;
};
}
// Get the next block of audio samples
void AudioBufferSource::getNextAudioBlock (const juce::AudioSourceChannelInfo& info)

View File

@@ -51,7 +51,7 @@ AudioReaderSource::~AudioReaderSource()
// Clear and delete the buffer
delete buffer;
buffer = NULL;
};
}
// Get more samples from the reader
void AudioReaderSource::GetMoreSamplesFromReader()

View File

@@ -79,7 +79,7 @@ ENDIF (ImageMagick_FOUND)
################# LIBOPENSHOT-AUDIO ###################
# Find JUCE-based openshot Audio libraries
FIND_PACKAGE(OpenShotAudio 0.1.8 REQUIRED)
FIND_PACKAGE(OpenShotAudio 0.1.9 REQUIRED)
# Include Juce headers (needed for compile)
include_directories(${LIBOPENSHOT_AUDIO_INCLUDE_DIRS})
@@ -100,20 +100,6 @@ IF (ENABLE_BLACKMAGIC)
ENDIF (BLACKMAGIC_FOUND)
ENDIF (ENABLE_BLACKMAGIC)
################### RESVG #####################
# Find resvg library (used for rendering svg files)
FIND_PACKAGE(RESVG)
# Include resvg headers (optional SVG library)
if (RESVG_FOUND)
include_directories(${RESVG_INCLUDE_DIRS})
# define a global var (used in the C++)
add_definitions( -DUSE_RESVG=1 )
SET(CMAKE_SWIG_FLAGS "-DUSE_RESVG=1")
endif(RESVG_FOUND)
############### PROFILING #################
#set(PROFILER "/usr/lib/libprofiler.so.0.3.2")
#set(PROFILER "/usr/lib/libtcmalloc.so.4")
@@ -358,6 +344,26 @@ if (TARGET cppzmq)
target_link_libraries(openshot PUBLIC cppzmq)
endif()
################### RESVG #####################
# Migrate some legacy variable names
if(DEFINED RESVGDIR AND NOT DEFINED RESVG_ROOT)
set(RESVG_ROOT ${RESVGDIR})
endif()
if(DEFINED ENV{RESVGDIR} AND NOT DEFINED RESVG_ROOT)
set(RESVG_ROOT $ENV{RESVGDIR})
endif()
# Find resvg library (used for rendering svg files)
FIND_PACKAGE(RESVG)
# Include resvg headers (optional SVG library)
if (TARGET RESVG::resvg)
#include_directories(${RESVG_INCLUDE_DIRS})
target_link_libraries(openshot PUBLIC RESVG::resvg)
target_compile_definitions(openshot PUBLIC "-DUSE_RESVG=1")
set(CMAKE_SWIG_FLAGS "-DUSE_RESVG=1")
endif()
############### LINK LIBRARY #################
# Link remaining dependency libraries
@@ -369,10 +375,6 @@ if(ImageMagick_FOUND)
target_link_libraries(openshot PUBLIC ${ImageMagick_LIBRARIES})
endif()
if(RESVG_FOUND)
target_link_libraries(openshot PUBLIC ${RESVG_LIBRARIES})
endif()
if(BLACKMAGIC_FOUND)
target_link_libraries(openshot PUBLIC ${BLACKMAGIC_LIBRARY_DIR})
endif()

View File

@@ -37,13 +37,13 @@ using namespace openshot;
CacheBase::CacheBase() : max_bytes(0) {
// Init the critical section
cacheCriticalSection = new CriticalSection();
};
}
// Constructor that sets the max frames to cache
CacheBase::CacheBase(int64_t max_bytes) : max_bytes(max_bytes) {
// Init the critical section
cacheCriticalSection = new CriticalSection();
};
}
// Set maximum bytes to a different amount based on a ReaderInfo struct
void CacheBase::SetMaxBytesFromInfo(int64_t number_of_frames, int width, int height, int sample_rate, int channels)

View File

@@ -47,7 +47,7 @@ CacheDisk::CacheDisk(std::string cache_path, std::string format, float quality,
// Init path directory
InitPath(cache_path);
};
}
// Constructor that sets the max bytes to cache
CacheDisk::CacheDisk(std::string cache_path, std::string format, float quality, float scale, int64_t max_bytes) : CacheBase(max_bytes) {
@@ -62,7 +62,7 @@ CacheDisk::CacheDisk(std::string cache_path, std::string format, float quality,
// Init path directory
InitPath(cache_path);
};
}
// Initialize cache directory
void CacheDisk::InitPath(std::string cache_path) {
@@ -103,13 +103,11 @@ void CacheDisk::CalculateRanges() {
// Increment range version
range_version++;
std::vector<int64_t>::iterator itr_ordered;
int64_t starting_frame = *ordered_frame_numbers.begin();
int64_t ending_frame = *ordered_frame_numbers.begin();
int64_t ending_frame = starting_frame;
// Loop through all known frames (in sequential order)
for (itr_ordered = ordered_frame_numbers.begin(); itr_ordered != ordered_frame_numbers.end(); ++itr_ordered) {
int64_t frame_number = *itr_ordered;
for (const auto frame_number : ordered_frame_numbers) {
if (frame_number - ending_frame > 1) {
// End of range detected
Json::Value range;

View File

@@ -39,7 +39,7 @@ CacheMemory::CacheMemory() : CacheBase(0) {
cache_type = "CacheMemory";
range_version = 0;
needs_range_processing = false;
};
}
// Constructor that sets the max bytes to cache
CacheMemory::CacheMemory(int64_t max_bytes) : CacheBase(max_bytes) {
@@ -47,7 +47,7 @@ CacheMemory::CacheMemory(int64_t max_bytes) : CacheBase(max_bytes) {
cache_type = "CacheMemory";
range_version = 0;
needs_range_processing = false;
};
}
// Default destructor
CacheMemory::~CacheMemory()

View File

@@ -782,11 +782,8 @@ Json::Value Clip::JsonValue() const {
root["effects"] = Json::Value(Json::arrayValue);
// loop through effects
std::list<EffectBase*>::const_iterator effect_itr;
for (effect_itr=effects.begin(); effect_itr != effects.end(); ++effect_itr)
for (auto existing_effect : effects)
{
// Get clip object from the iterator
EffectBase *existing_effect = (*effect_itr);
root["effects"].append(existing_effect->JsonValue());
}
@@ -893,10 +890,7 @@ void Clip::SetJsonValue(const Json::Value root) {
effects.clear();
// loop through effects
for (int x = 0; x < root["effects"].size(); x++) {
// Get each effect
Json::Value existing_effect = root["effects"][x];
for (const auto existing_effect : root["effects"]) {
// Create Effect
EffectBase *e = NULL;
@@ -1013,12 +1007,8 @@ void Clip::RemoveEffect(EffectBase* effect)
std::shared_ptr<Frame> Clip::apply_effects(std::shared_ptr<Frame> frame)
{
// Find Effects at this position and layer
std::list<EffectBase*>::iterator effect_itr;
for (effect_itr=effects.begin(); effect_itr != effects.end(); ++effect_itr)
for (auto effect : effects)
{
// Get clip object from the iterator
EffectBase *effect = (*effect_itr);
// Apply the effect to this frame
frame = effect->GetFrame(frame, frame->number);

Some files were not shown because too many files have changed in this diff Show More