Merge branch 'develop' into debug-to-stderr

This commit is contained in:
FeRD (Frank Dana)
2020-06-17 08:39:57 -04:00
59 changed files with 1025 additions and 515 deletions

1
.gitignore vendored
View File

@@ -6,4 +6,5 @@
.project
.cproject
/.metadata/
tags
*~

View File

@@ -72,7 +72,6 @@ windows-builder-x64:
- cd build
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR\build\install-x64" -D"PYTHON_MODULE_PATH=python" -D"RUBY_MODULE_PATH=ruby" -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -D"CMAKE_BUILD_TYPE:STRING=Release" ../
- mingw32-make install
- Move-Item -Force -path "install-x64\lib\python3.7\site-packages\*openshot*" -destination "install-x64\python\"
- New-Item -path "install-x64/share/" -Name "$CI_PROJECT_NAME" -Value "CI_PROJECT_NAME:$CI_PROJECT_NAME`nCI_COMMIT_REF_NAME:$CI_COMMIT_REF_NAME`nCI_COMMIT_SHA:$CI_COMMIT_SHA`nCI_JOB_ID:$CI_JOB_ID" -ItemType file -force
- $PREV_GIT_LABEL=(git describe --tags --abbrev=0 '@^')
- git log "$PREV_GIT_LABEL..@" --oneline --pretty=format:"%C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "install-x64/share/$CI_PROJECT_NAME.log"

View File

@@ -1,5 +1,7 @@
language: cpp
compiler: gcc
os: linux
dist: xenial
# This section uses a rather esoteric (and tricky!) feature of YAML,
# &aliases and *anchors, to build package lists out of sublists without
@@ -9,18 +11,12 @@ addons:
apt:
packages: &p_common # Packages common to all Ubuntu builds
- cmake
- swig
- libopenshot-audio-dev
- libmagick++-dev
- libunittest++-dev
- libzmq3-dev
- qtbase5-dev
- qtmultimedia5-dev
- doxygen
- graphviz
- curl
packages: &ff_common # Common set of FFmpeg packages
- *p_common
- libfdk-aac-dev
- libavcodec-dev
- libavformat-dev
@@ -29,12 +25,19 @@ addons:
- libavfilter-dev
- libswscale-dev
- libpostproc-dev
- libavresample-dev
- libswresample-dev
- swig
- doxygen
- graphviz
- curl
jobs:
# The FFmpeg 3.2 backport PPA has gone missing
allow_failures:
- name: "FFmpeg 3.2 GCC (Ubuntu 16.04 Xenial)"
matrix:
include:
- name: "Coverage + FFmpeg 3.4 GCC (Ubuntu 18.04 Bionic)"
env:
- BUILD_VERSION=coverage_ffmpeg34
@@ -46,29 +49,27 @@ matrix:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.12.3-bionic'
packages:
- *ff_common
- *p_common
- qt5-default
- libavresample-dev
- libjsoncpp-dev
- lcov
- binutils-common # For c++filt
- name: "FFmpeg 4 GCC (Ubuntu 18.04 Bionic)"
- name: "FFmpeg 4 GCC (Ubuntu 20.04 Focal)"
env:
- BUILD_VERSION=ffmpeg4
- CMAKE_EXTRA_ARGS=""
- TEST_TARGET=test
os: linux
dist: bionic
dist: focal
addons:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.12.3-bionic'
- sourceline: 'ppa:jonathonf/ffmpeg-4'
packages:
- *ff_common
- *p_common
- qt5-default
- libjsoncpp-dev
- libavcodec58
@@ -78,7 +79,6 @@ matrix:
- libavfilter7
- libswscale5
- libpostproc55
- libavresample4
- libswresample3
- name: "FFmpeg 3.4 Clang (Ubuntu 18.04 Bionic)"
@@ -93,10 +93,10 @@ matrix:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.12.3-bionic'
packages:
- *ff_common
- *p_common
- qt5-default
- libavresample-dev
- libomp-dev
- name: "FFmpeg 3.2 GCC (Ubuntu 16.04 Xenial)"
@@ -110,10 +110,10 @@ matrix:
apt:
sources:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.10.0-xenial'
- sourceline: 'ppa:jon-hedgerows/ffmpeg-backports'
packages:
- *ff_common
- *p_common
- libavresample-dev
- libavcodec57
- libavdevice57
- libavfilter6
@@ -137,7 +137,8 @@ matrix:
- sourceline: 'ppa:openshot.developers/libopenshot-daily'
- sourceline: 'ppa:beineri/opt-qt-5.10.0-xenial'
packages:
- *ff_common
- *p_common
- libavresample-dev
script:
- mkdir -p build; cd build;

View File

@@ -129,6 +129,16 @@ if (ENABLE_COVERAGE)
endif()
add_feature_info("Coverage" ENABLE_COVERAGE "analyze test coverage and generate report")
# Juce requires either DEBUG or NDEBUG to be defined on MacOS.
# -DNDEBUG is set by cmake for all release configs, so add
# -DDEBUG for debug builds. We'll do this for all OSes, even
# though only MacOS requires it.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
# Make sure we've picked some build type, default to debug
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
endif()
############## PROCESS src/ DIRECTORIES ##############
add_subdirectory(src)

View File

@@ -2,90 +2,68 @@
Operating system specific install instructions are located in:
* doc/INSTALL-LINUX.md
* doc/INSTALL-MAC.md
* doc/INSTALL-WINDOWS.md
* [doc/INSTALL-LINUX.md][INSTALL-LINUX]
* [doc/INSTALL-MAC.md][INSTALL-MAC]
* [doc/INSTALL-WINDOWS.md][INSTALL-WINDOWS]
## Getting Started
The best way to get started with libopenshot, is to learn about our build system, obtain all the source code,
install a development IDE and tools, and better understand our dependencies. So, please read through the
following sections, and follow the instructions. And keep in mind, that your computer is likely different
than the one used when writing these instructions. Your file paths and versions of applications might be
The best way to get started with libopenshot, is to learn about our build system, obtain all the source code,
install a development IDE and tools, and better understand our dependencies. So, please read through the
following sections, and follow the instructions. And keep in mind, that your computer is likely different
than the one used when writing these instructions. Your file paths and versions of applications might be
slightly different, so keep an eye out for subtle file path differences in the commands you type.
## Build Tools
CMake is the backbone of our build system. It is a cross-platform build system, which checks for dependencies,
locates header files and libraries, generates makefiles, and supports the cross-platform compiling of
libopenshot and libopenshot-audio. CMake uses an out-of-source build concept, where all temporary build
files, such as makefiles, object files, and even the final binaries, are created outside of the source
code folder, inside a /build/ sub-folder. This prevents the build process from cluttering up the source
code. These instructions have only been tested with the GNU compiler (including MSYS2/MinGW for Windows).
## Dependencies
The following libraries are required to build libopenshot. Instructions on how to install these
dependencies vary for each operating system. Libraries and Executables have been labeled in the
list below to help distinguish between them.
The following libraries are required to build libopenshot.
Instructions on how to install these dependencies vary for each operating system.
Libraries and Executables have been labeled in the list below to help distinguish between them.
* ### FFmpeg (libavformat, libavcodec, libavutil, libavdevice, libavresample, libswscale)
* http://www.ffmpeg.org/ `(Library)`
#### FFmpeg (libavformat, libavcodec, libavutil, libavdevice, libavresample, libswscale)
* http://www.ffmpeg.org/ **(Library)**
* This library is used to decode and encode video, audio, and image files. It is also used to obtain information about media files, such as frame rate, sample rate, aspect ratio, and other common attributes.
* ### ImageMagick++ (libMagick++, libMagickWand, libMagickCore)
* http://www.imagemagick.org/script/magick++.php `(Library)`
#### ImageMagick++ (libMagick++, libMagickWand, libMagickCore)
* http://www.imagemagick.org/script/magick++.php **(Library)**
* This library is **optional**, and used to decode and encode images.
* ### OpenShot Audio Library (libopenshot-audio)
* https://github.com/OpenShot/libopenshot-audio/ `(Library)`
#### OpenShot Audio Library (libopenshot-audio)
* https://github.com/OpenShot/libopenshot-audio/ **(Library)**
* This library is used to mix, resample, host plug-ins, and play audio. It is based on the JUCE project, which is an outstanding audio library used by many different applications
* ### Qt 5 (libqt5)
* http://www.qt.io/qt5/ `(Library)`
#### Qt 5 (libqt5)
* http://www.qt.io/qt5/ **(Library)**
* Qt5 is used to display video, store image data, composite images, apply image effects, and many other utility functions, such as file system manipulation, high resolution timers, etc...
* ### CMake (cmake)
* http://www.cmake.org/ `(Executable)`
* This executable is used to automate the generation of Makefiles, check for dependencies, and is the backbone of libopenshots cross-platform build process.
* ### SWIG (swig)
* http://www.swig.org/ `(Executable)`
* This executable is used to generate the Python and Ruby bindings for libopenshot. It is a simple and powerful wrapper for C++ libraries, and supports many languages.
* ### Python 3 (libpython)
* http://www.python.org/ `(Executable and Library)`
* This library is used by swig to create the Python (version 3+) bindings for libopenshot. This is also the official language used by OpenShot Video Editor (a graphical interface to libopenshot).
* ### Doxygen (doxygen)
* http://www.stack.nl/~dimitri/doxygen/ `(Executable)`
* This executable is used to auto-generate the documentation used by libopenshot.
* ### UnitTest++ (libunittest++)
* https://github.com/unittest-cpp/ `(Library)`
* This library is used to execute unit tests for libopenshot. It contains many macros used to keep our unit testing code very clean and simple.
* ### ZeroMQ (libzmq)
* http://zeromq.org/ `(Library)`
#### ZeroMQ (libzmq)
* http://zeromq.org/ **(Library)**
* This library is used to communicate between libopenshot and other applications (publisher / subscriber). Primarily used to send debug data from libopenshot.
* ### OpenMP (-fopenmp)
* http://openmp.org/wp/ `(Compiler Flag)`
#### OpenMP (`-fopenmp`)
* http://openmp.org/wp/ **(Compiler Flag)**
* If your compiler supports this flag (GCC, Clang, and most other compilers), it provides libopenshot with easy methods of using parallel programming techniques to improve performance and take advantage of multi-core processors.
## CMake Flags (Optional)
There are many different build flags that can be passed to cmake to adjust how libopenshot is compiled. Some of these flags might be required when compiling on certain OSes, just depending on how your build environment is setup. To add a build flag, follow this general syntax: $ cmake -DMAGICKCORE_HDRI_ENABLE=1 -DENABLE_TESTS=1 ../
#### CMake (`cmake`)
* http://www.cmake.org/ **(Executable)**
* This executable is used to automate the generation of Makefiles, check for dependencies, and is the backbone of libopenshots cross-platform build process.
* MAGICKCORE_HDRI_ENABLE (default 0)
* MAGICKCORE_QUANTUM_DEPTH (default 0)
* OPENSHOT_IMAGEMAGICK_COMPATIBILITY (default 0)
* DISABLE_TESTS (default 0)
* CMAKE_PREFIX_PATH (`/location/to/missing/library/`)
* PYTHON_INCLUDE_DIR (`/location/to/python/include/`)
* PYTHON_LIBRARY (`/location/to/python/lib.a`)
* PYTHON_FRAMEWORKS (`/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/`)
* CMAKE_CXX_COMPILER (`/location/to/mingw/g++`)
* CMAKE_C_COMPILER (`/location/to/mingw/gcc`)
#### SWIG (`swig`)
* http://www.swig.org/ **(Executable)**
* This executable is used to generate the Python and Ruby bindings for libopenshot. It is a simple and powerful wrapper for C++ libraries, and supports many languages.
#### Python 3 (libpython)
* http://www.python.org/ **(Executable and Library)**
* This library is used by swig to create the Python (version 3+) bindings for libopenshot. This is also the official language used by OpenShot Video Editor (a graphical interface to libopenshot).
#### Doxygen (doxygen)
* http://www.stack.nl/~dimitri/doxygen/ **(Executable)**
* This executable is used to auto-generate the documentation used by libopenshot.
#### UnitTest++ (libunittest++)
* https://github.com/unittest-cpp/ **(Library)**
* This library is used to execute unit tests for libopenshot. It contains many macros used to keep our unit testing code very clean and simple.
## Obtaining Source Code
@@ -96,30 +74,87 @@ git clone https://github.com/OpenShot/libopenshot.git
git clone https://github.com/OpenShot/libopenshot-audio.git
```
## Folder Structure (libopenshot)
### Folder Structure (libopenshot)
The source code is divided up into the following folders.
* ### build/
* This folder needs to be manually created, and is used by cmake to store the temporary build files, such as makefiles, as well as the final binaries (library and test executables).
#### `build/`
This folder needs to be manually created, and is used by cmake to store the temporary build files, such as makefiles, as well as the final binaries (library and test executables).
* ### cmake/
* This folder contains custom modules not included by default in cmake, used to find dependency libraries and headers and determine if these libraries are installed.
#### `cmake/`
This folder contains custom modules not included by default in cmake.
CMake find modules are used to discover dependency libraries on the system, and to incorporate their headers and object files.
CMake code modules are used to implement build features such as test coverage scanning.
* ### doc/
* This folder contains documentation and related files, such as logos and images required by the doxygen auto-generated documentation.
#### `doc/`
This folder contains documentation and related files.
This includes logos and images required by the doxygen-generated API documentation.
* ### include/
* This folder contains all headers (*.h) used by libopenshot.
#### `include/`
This folder contains all headers (*.h) used by libopenshot.
* ### src/
* This folder contains all source code (*.cpp) used by libopenshot.
#### `src/`
This folder contains all source code (*.cpp) used by libopenshot.
* ### tests/
* This folder contains all unit test code. Each class has its own test file (*.cpp), and uses UnitTest++ macros to keep the test code simple and manageable.
#### `tests/`
This folder contains all unit test code.
Each test file (`<class>_Tests.cpp`) contains the tests for the named class.
We use UnitTest++ macros to keep the test code simple and manageable.
* ### thirdparty/
* This folder contains code not written by the OpenShot team. For example, jsoncpp, an open-source JSON parser.
#### `thirdparty/`
This folder contains code not written by the OpenShot team.
For example, `jsoncpp`, an open-source JSON parser.
## Build Tools
CMake is the backbone of our build system.
It is a cross-platform build system, which checks for dependencies,
locates header files and libraries, and generates a build system in various formats.
We use CMake's Makefile generators to compile libopenshot and libopenshot-audio.
CMake uses an out-of-source build concept.
This means that the build system, all temporary files, and all generated products are kept separate from the source code.
This includes Makefiles, object files, and even the final binaries.
While it is possible to build in-tree, we highly recommend you use a `/build/` sub-folder to compile each library.
This prevents the build process from cluttering up the source
code.
These instructions have only been tested with the GNU compiler suite (including MSYS2/MinGW for Windows), and the Clang compiler (including AppleClang on MacOS).
## CMake Flags (Optional)
There are many different build flags that can be passed to cmake to adjust how libopenshot is compiled. Some of these flags might be required when compiling on certain OSes, just depending on how your build environment is setup.
To add a build flag, follow this general syntax:
```sh
$ cmake -DMAGICKCORE_HDRI_ENABLE=1 -DENABLE_TESTS=1 ..
```
Following are some of the flags you might need to set when generating your build system.
##### Optional behavior:
* `-DENABLE_TESTS=0` (default: `ON`)
* `-DENABLE_COVERAGE=1` (default: `OFF`)
* `-DENABLE_DOCS=0` (default: `ON` if doxygen found)
##### Compiler configuration:
* `-DCMAKE_BUILD_TYPE=Release`, `-DCMAKE_BUILD_TYPE=Debug` (default: `Debug` if unset)
* `-DCMAKE_CXX_FLAGS="-Wall -Wextra"` (default: CMake builtin defaults for build type)
* `-DCMAKE_CXX_COMPILER=/path/to/g++`, `-DCMAKE_CXX_COMPILER=/path/to/clang++`
* `-DCMAKE_C_COMPILER=/path/to/gcc`, `-DCMAKE_CXX_COMPILER=/path/to/clang` (used by CMake for OS probes)
##### Dependency configuration:
* `-DCMAKE_PREFIX_PATH=/extra/path/to/search/for/libraries/`
* `-DUSE_SYSTEM_JSONCPP=0` (default: auto if discovered)
* `-DImageMagick_FOUND=0` (default: auto if discovered)
##### To compile bindings for a specific Python installation:
* `-DPYTHON_INCLUDE_DIR=/location/of/python/includes/`
* `-DPYTHON_LIBRARY=/location/of/libpython*.so`
* `-DPYTHON_FRAMEWORKS=/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/` (MacOS only)
##### Only used when building with ImageMagick enabled:
* `-DMAGICKCORE_HDRI_ENABLE=1` (default `0`)
* `-DMAGICKCORE_QUANTUM_DEPTH=8` (default `16`)
## Linux Build Instructions (libopenshot-audio)
To compile libopenshot-audio, we need to go through a few additional steps to manually build and install it. Launch a terminal and enter:
@@ -148,6 +183,10 @@ make install
For more detailed instructions, please see:
* doc/INSTALL-LINUX.md
* doc/INSTALL-MAC.md
* doc/INSTALL-WINDOWS.md
* [doc/INSTALL-LINUX.md][INSTALL-LINUX]
* [doc/INSTALL-MAC.md][INSTALL-MAC]
* [doc/INSTALL-WINDOWS.md][INSTALL-WINDOWS]
[INSTALL-LINUX]: https://github.com/OpenShot/libopenshot/blob/develop/doc/INSTALL-LINUX.md
[INSTALL-MAC]: https://github.com/OpenShot/libopenshot/blob/develop/doc/INSTALL-MAC.md
[INSTALL-WINDOWS]: https://github.com/OpenShot/libopenshot/blob/develop/doc/INSTALL-WINDOWS.md

View File

@@ -1,64 +0,0 @@
# - Try to find JsonCpp
#
# Once done this will define
# JSONCPP_INCLUDE_DIRS, where to find header, etc.
# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
# JSONCPP_FOUND, If false, do not try to use jsoncpp.
# JSONCPP_INCLUDE_PREFIX, include prefix for jsoncpp
# try to detect using pkg-config, and use as hints later
find_package(PkgConfig)
pkg_check_modules(PC_jsoncpp QUIET jsoncpp)
find_path(
JSONCPP_INCLUDE_DIR
NAMES json/json.h
HINTS ${PC_jsoncpp_INCLUDE_DIRS}
DOC "jsoncpp include dir"
)
find_library(
JSONCPP_LIBRARY
NAMES jsoncpp
HINTS ${PC_jsoncpp_LIBRARY_DIR}
DOC "jsoncpp library"
)
set(JSONCPP_INCLUDE_DIRS ${JSONCPP_INCLUDE_DIR})
set(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
# debug library on windows
# same naming convention as in qt (appending debug library with d)
# boost is using the same "hack" as us with "optimized" and "debug"
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
find_library(
JSONCPP_LIBRARY_DEBUG
NAMES jsoncppd
HINTS ${PC_jsoncpp_LIBDIR} ${PC_jsoncpp_LIBRARY_DIRS}
DOC "jsoncpp debug library"
)
set(JSONCPP_LIBRARIES optimized ${JSONCPP_LIBRARIES} debug ${JSONCPP_LIBRARY_DEBUG})
endif()
# find JSONCPP_INCLUDE_PREFIX
find_path(
JSONCPP_INCLUDE_PREFIX
NAMES json.h
PATH_SUFFIXES jsoncpp/json json
)
if (${JSONCPP_INCLUDE_PREFIX} MATCHES "jsoncpp")
set(JSONCPP_INCLUDE_PREFIX "jsoncpp/json")
else()
set(JSONCPP_INCLUDE_PREFIX "json")
endif()
# handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE
# if all listed variables are TRUE, hide their existence from configuration view
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(jsoncpp DEFAULT_MSG
JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)
mark_as_advanced (JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)

View File

@@ -5,14 +5,16 @@ pkg_check_modules(PC_LIBZMQ QUIET libzmq)
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
find_path(ZeroMQ_INCLUDE_DIR zmq.h
PATHS ${ZeroMQ_DIR}/include
${PC_LIBZMQ_INCLUDE_DIRS})
PATHS
${ZeroMQ_DIR}/include
${PC_LIBZMQ_INCLUDE_DIRS})
find_library(ZeroMQ_LIBRARY
NAMES zmq
PATHS ${ZeroMQ_DIR}/lib
${PC_LIBZMQ_LIBDIR}
${PC_LIBZMQ_LIBRARY_DIRS})
NAMES zmq
PATHS
${ZeroMQ_DIR}/lib
${PC_LIBZMQ_LIBDIR}
${PC_LIBZMQ_LIBRARY_DIRS})
if(ZeroMQ_LIBRARY)
set(ZeroMQ_FOUND ON)
@@ -31,4 +33,9 @@ endif()
include ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS )
find_package_handle_standard_args(ZeroMQ
REQUIRED_VARS
ZeroMQ_LIBRARIES
ZeroMQ_INCLUDE_DIRS
VERSION_VAR
ZeroMQ_VERSION)

View File

@@ -0,0 +1,133 @@
# - Try to find jsoncpp
#
# IMPORTED target
# This module will create the target jsoncpp_lib if jsoncpp is found
#
# Legacy Config Variables
# The following variables are defined for backwards compatibility:
#
# JSONCPP_INCLUDE_DIRS, where to find header, etc.
# JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
# JSONCPP_FOUND, If false, do not try to use jsoncpp.
# JSONCPP_INCLUDE_PREFIX, include prefix for jsoncpp
# try to detect using pkg-config, and use as hints later
find_package(PkgConfig)
pkg_check_modules(PC_jsoncpp QUIET jsoncpp)
find_path(
jsoncpp_INCLUDE_DIR
NAMES json/json.h
HINTS ${PC_jsoncpp_INCLUDE_DIRS}
DOC "jsoncpp include dir"
)
find_library(
jsoncpp_LIBRARY
NAMES jsoncpp
HINTS ${PC_jsoncpp_LIBRARY_DIR}
DOC "jsoncpp library"
)
set(jsoncpp_INCLUDE_DIRS ${jsoncpp_INCLUDE_DIR})
set(jsoncpp_LIBRARIES ${jsoncpp_LIBRARY})
if (jsoncpp_INCLUDE_DIRS AND jsoncpp_LIBRARIES)
set(jsoncpp_FOUND TRUE)
endif()
# Create the IMPORTED target
if (jsoncpp_FOUND AND NOT TARGET jsoncpp_lib)
add_library(jsoncpp_lib UNKNOWN IMPORTED)
set_property(TARGET jsoncpp_lib PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${jsoncpp_INCLUDE_DIR})
set_property(TARGET jsoncpp_lib PROPERTY
IMPORTED_LOCATION ${jsoncpp_LIBRARY})
endif()
# debug library on windows
# same naming convention as in qt (appending debug library with d)
# boost is using the same "hack" as us with "optimized" and "debug"
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
find_library(
jsoncpp_LIBRARY_DEBUG
NAMES jsoncppd
HINTS ${PC_jsoncpp_LIBDIR} ${PC_jsoncpp_LIBRARY_DIRS}
DOC "jsoncpp debug library"
)
set(jsoncpp_LIBRARIES optimized ${jsoncpp_LIBRARIES} debug ${jsoncpp_LIBRARY_DEBUG})
# Add Debug location to IMPORTED target
if(TARGET jsoncpp_lib)
set_property(TARGET jsoncpp_lib APPEND PROPERTY
IMPORTED_LOCATION_Debug ${jsoncpp_LIBRARY_DEBUG})
endif()
endif()
# find jsoncpp_INCLUDE_PREFIX
find_path(
jsoncpp_INCLUDE_PREFIX
NAMES json.h
HINTS ${jsoncpp_INCLUDE_DIR}
PATH_SUFFIXES jsoncpp/json json
)
if (${jsoncpp_INCLUDE_PREFIX} MATCHES "jsoncpp")
set(jsoncpp_INCLUDE_PREFIX "jsoncpp/json")
else()
set(jsoncpp_INCLUDE_PREFIX "json")
endif()
# Check the available version
set(_version_file "${jsoncpp_INCLUDE_DIR}/${jsoncpp_INCLUDE_PREFIX}/version.h")
if (jsoncpp_INCLUDE_DIR AND EXISTS ${_version_file})
file(STRINGS "${_version_file}" jsoncpp_version_str
REGEX "JSONCPP_VERSION_STRING.*\"[^\"]+\"")
if(jsoncpp_version_str MATCHES "JSONCPP_VERSION_STRING.*\"([^\"]+)\"")
set(jsoncpp_VERSION_STRING ${CMAKE_MATCH_1})
endif()
unset(jsoncpp_version_str)
string(REGEX REPLACE "^([0-9]+\.[0-9]+\.[0-9]+).*$" "\\1"
jsoncpp_VERSION "${jsoncpp_VERSION_STRING}")
endif()
if(NOT jsoncpp_VERSION)
unset(jsoncpp_VERSION)
unset(jsoncpp_VERSION_STRING)
endif()
# Check version requirement, if specified
if(jsoncpp_FIND_VERSION AND jsoncpp_VERSION)
if("${jsoncpp_FIND_VERSION}" STREQUAL "${jsoncpp_VERSION}")
set(jsoncpp_VERSION_EXACT TRUE)
endif()
if("${jsoncpp_FIND_VERSION}" VERSION_GREATER "${jsoncpp_VERSION}")
set(jsoncpp_VERSION_COMPATIBLE FALSE)
else()
set(jsoncpp_VERSION_COMPATIBLE TRUE)
endif()
endif()
# Legacy
set(JSONCPP_LIBRARY ${jsoncpp_LIBRARY})
set(JSONCPP_LIBRARIES ${jsoncpp_LIBRARIES})
set(JSONCPP_INCLUDE_DIR ${jsoncpp_INCLUDE_DIR})
set(JSONCPP_INCLUDE_DIRS ${jsoncpp_INCLUDE_DIRS})
set(JSONCPP_INCLUDE_PREFIX ${jsoncpp_INCLUDE_PREFIX})
set(JSONCPP_VERSION ${jsoncpp_VERSION})
set(JSONCPP_FOUND ${jsoncpp_FOUND})
# handle the QUIETLY and REQUIRED arguments and set jsoncpp_FOUND to TRUE
# if all listed variables are TRUE, hide their existence from configuration view
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(jsoncpp
REQUIRED_VARS
jsoncpp_INCLUDE_DIR
jsoncpp_LIBRARY
VERSION_VAR
jsoncpp_VERSION
)
mark_as_advanced (jsoncpp_INCLUDE_DIR jsoncpp_LIBRARY)

View File

@@ -48,7 +48,6 @@ namespace openshot
{
private:
int position;
int start;
bool repeat;
juce::AudioSampleBuffer *buffer;

View File

@@ -54,7 +54,6 @@ namespace openshot
int speed; /// The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
ReaderBase *reader; /// The reader to pull samples from
int64_t original_frame_number; /// The current frame to read from
int64_t frame_number; /// The current frame number
std::shared_ptr<Frame> frame; /// The current frame object that is being read
int64_t frame_position; /// The position of the current frame's buffer

View File

@@ -132,7 +132,7 @@ namespace openshot
ChunkReader(std::string path, ChunkVersion chunk_version);
/// Close the reader
void Close();
void Close() override;
/// @brief Get the chunk size (number of frames to write in each chunk)
/// @returns The number of frames in this chunk
@@ -143,27 +143,27 @@ namespace openshot
void SetChunkSize(int64_t new_size) { chunk_size = new_size; };
/// Get the cache object used by this reader (always return NULL for this reader)
openshot::CacheMemory* GetCache() { return NULL; };
openshot::CacheMemory* GetCache() override { return NULL; };
/// @brief Get an openshot::Frame object for a specific frame number of this reader.
/// @returns The requested frame (containing the image and audio)
/// @param requested_frame The frame number you want to retrieve
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame);
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };
bool IsOpen() override { return is_open; };
/// Return the type name of the class
std::string Name() { return "ChunkReader"; };
std::string Name() override { return "ChunkReader"; };
/// Get and Set JSON methods
std::string Json() const override; ///< Generate JSON string of this object
void SetJson(const std::string value); ///< Load JSON string into this object
void SetJson(const std::string value) override; ///< 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
void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
/// Open the reader. This is required before you can access frames or data from the reader.
void Open();
void Open() override;
};
}

View File

@@ -103,7 +103,6 @@ namespace openshot {
// Audio resampler (if time mapping)
openshot::AudioResampler *resampler;
juce::AudioSampleBuffer *audio_cache;
// File Reader object
openshot::ReaderBase* reader;
@@ -140,11 +139,11 @@ namespace openshot {
void reverse_buffer(juce::AudioSampleBuffer* buffer);
public:
openshot::GravityType gravity; ///< The gravity of a clip determines where it snaps to its parent
openshot::ScaleType scale; ///< The scale determines how a clip should be resized to fit its parent
openshot::AnchorType anchor; ///< The anchor determines what parent a clip should snap to
openshot::FrameDisplayType display; ///< The format to display the frame number (if any)
openshot::VolumeMixType mixing; ///< What strategy should be followed when mixing audio with other clips
openshot::GravityType gravity; ///< The gravity of a clip determines where it snaps to its parent
openshot::ScaleType scale; ///< The scale determines how a clip should be resized to fit its parent
openshot::AnchorType anchor; ///< The anchor determines what parent a clip should snap to
openshot::FrameDisplayType display; ///< The format to display the frame number (if any)
openshot::VolumeMixType mixing; ///< What strategy should be followed when mixing audio with other clips
/// Default Constructor
Clip();
@@ -192,9 +191,9 @@ namespace openshot {
/// Get and Set JSON methods
std::string Json() const override; ///< Generate JSON string of this object
void SetJson(const std::string value); ///< Load JSON string into this object
void SetJson(const std::string value) override; ///< 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
void SetJsonValue(const Json::Value root) override; ///< 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)
@@ -208,15 +207,19 @@ namespace openshot {
bool Waveform() { return waveform; } ///< Get the waveform property of this clip
void Waveform(bool value) { waveform = value; } ///< Set the waveform property of this clip
// Scale and Location curves
// Scale, Location, and Alpha curves
openshot::Keyframe scale_x; ///< Curve representing the horizontal scaling in percent (0 to 1)
openshot::Keyframe scale_y; ///< Curve representing the vertical scaling in percent (0 to 1)
openshot::Keyframe location_x; ///< Curve representing the relative X position in percent based on the gravity (-1 to 1)
openshot::Keyframe location_y; ///< Curve representing the relative Y position in percent based on the gravity (-1 to 1)
// Alpha and Rotation curves
openshot::Keyframe alpha; ///< Curve representing the alpha (1 to 0)
// Rotation and Shear curves (origin point (x,y) is adjustable for both rotation and shear)
openshot::Keyframe rotation; ///< Curve representing the rotation (0 to 360)
openshot::Keyframe shear_x; ///< Curve representing X shear angle in degrees (-45.0=left, 45.0=right)
openshot::Keyframe shear_y; ///< Curve representing Y shear angle in degrees (-45.0=down, 45.0=up)
openshot::Keyframe origin_x; ///< Curve representing X origin point (0.0=0% (left), 1.0=100% (right))
openshot::Keyframe origin_y; ///< Curve representing Y origin point (0.0=0% (top), 1.0=100% (bottom))
// Time and Volume curves
openshot::Keyframe time; ///< Curve representing the frames over time to play (used for speed and direction of video)
@@ -232,9 +235,7 @@ namespace openshot {
openshot::Keyframe crop_x; ///< Curve representing X offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%)
openshot::Keyframe crop_y; ///< Curve representing Y offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%)
// Shear and perspective curves
openshot::Keyframe shear_x; ///< Curve representing X shear angle in degrees (-45.0=left, 45.0=right)
openshot::Keyframe shear_y; ///< Curve representing Y shear angle in degrees (-45.0=down, 45.0=up)
// Perspective curves
openshot::Keyframe perspective_c1_x; ///< Curves representing X for coordinate 1
openshot::Keyframe perspective_c1_y; ///< Curves representing Y for coordinate 1
openshot::Keyframe perspective_c2_x; ///< Curves representing X for coordinate 2

View File

@@ -46,17 +46,65 @@
namespace openshot
{
/**
* @brief This class is used as a simple, dummy reader, which always returns a blank frame.
* @brief This class is used as a simple, dummy reader, which can be very useful when writing
* unit tests. It can return a single blank frame or it can return custom frame objects
* which were passed into the constructor with a Cache object.
*
* A dummy reader can be created with any framerate or samplerate. This is useful in unit
* tests that need to test different framerates or samplerates.
*
* @code
* // Create cache object to store fake Frame objects
* CacheMemory cache;
*
* // Now let's create some test frames
* for (int64_t frame_number = 1; frame_number <= 30; frame_number++)
* {
* // Create blank frame (with specific frame #, samples, and channels)
* // Sample count should be 44100 / 30 fps = 1470 samples per frame
* int sample_count = 1470;
* std::shared_ptr<openshot::Frame> f(new openshot::Frame(frame_number, sample_count, 2));
*
* // Create test samples with incrementing value
* float *audio_buffer = new float[sample_count];
* for (int64_t sample_number = 0; sample_number < sample_count; sample_number++)
* {
* // Generate an incrementing audio sample value (just as an example)
* audio_buffer[sample_number] = float(frame_number) + (float(sample_number) / float(sample_count));
* }
*
* // Add custom audio samples to Frame (bool replaceSamples, int destChannel, int destStartSample, const float* source,
* // int numSamples, float gainToApplyToSource = 1.0f)
* f->AddAudio(true, 0, 0, audio_buffer, sample_count, 1.0); // add channel 1
* f->AddAudio(true, 1, 0, audio_buffer, sample_count, 1.0); // add channel 2
*
* // Add test frame to cache
* cache.Add(f);
* }
*
* // Create a reader (Fraction fps, int width, int height, int sample_rate, int channels, float duration, CacheBase* cache)
* openshot::DummyReader r(openshot::Fraction(30, 1), 1920, 1080, 44100, 2, 30.0, &cache);
* r.Open(); // Open the reader
*
* // Now let's verify our DummyReader works
* std::shared_ptr<openshot::Frame> f = r.GetFrame(1);
* // r.GetFrame(1)->GetAudioSamples(0)[1] should equal 1.00068033 based on our above calculations
*
* // Clean up
* r.Close();
* cache.Clear()
* @endcode
*/
class DummyReader : public ReaderBase
{
private:
CacheBase* dummy_cache;
std::shared_ptr<openshot::Frame> image_frame;
bool is_open;
/// Initialize variables used by constructor
void init(Fraction fps, int width, int height, int sample_rate, int channels, float duration);
public:
/// Blank constructor for DummyReader, with default settings.
@@ -65,35 +113,38 @@ namespace openshot
/// Constructor for DummyReader.
DummyReader(openshot::Fraction fps, int width, int height, int sample_rate, int channels, float duration);
/// Constructor for DummyReader which takes a frame cache object.
DummyReader(openshot::Fraction fps, int width, int height, int sample_rate, int channels, float duration, CacheBase* cache);
virtual ~DummyReader();
/// Close File
void Close();
void Close() override;
/// Get the cache object used by this reader (always returns NULL for this reader)
CacheMemory* GetCache() { return NULL; };
CacheMemory* GetCache() override { return NULL; };
/// Get an openshot::Frame object for a specific frame number of this reader. All numbers
/// return the same Frame, since they all share the same image data.
///
/// @returns The requested frame (containing the image)
/// @param requested_frame The frame number that is requested.
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame);
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };
bool IsOpen() override { return is_open; };
/// Return the type name of the class
std::string Name() { return "DummyReader"; };
std::string Name() override { return "DummyReader"; };
/// Get and Set JSON methods
std::string Json() const override; ///< Generate JSON string of this object
void SetJson(const std::string value); ///< Load JSON string into this object
void SetJson(const std::string value) override; ///< 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
void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
/// Open File - which is called by the constructor automatically
void Open();
void Open() override;
};
}

View File

@@ -38,16 +38,16 @@ namespace openshot {
/**
* @brief Base exception class with a custom message variable.
*
* A custom error message field has been added to the std::exception base class. All
* OpenShot exception classes inherit from this class.
* A std::exception-derived exception class with custom message.
* All OpenShot exception classes inherit from this class.
*/
class BaseException : public std::exception //: public exception
class ExceptionBase : public std::exception //: public exception
{
protected:
std::string m_message;
public:
BaseException(std::string message) : m_message(message) { }
virtual ~BaseException() noexcept {}
ExceptionBase(std::string message) : m_message(message) { }
virtual ~ExceptionBase() noexcept {}
virtual const char* what() const noexcept {
// return custom message
return m_message.c_str();
@@ -55,7 +55,7 @@ namespace openshot {
};
/// Exception when a required chunk is missing
class ChunkNotFound : public BaseException
class ChunkNotFound : public ExceptionBase
{
public:
int64_t frame_number;
@@ -70,13 +70,13 @@ namespace openshot {
* @param chunk_frame The chunk frame
*/
ChunkNotFound(std::string message, int64_t frame_number, int64_t chunk_number, int64_t chunk_frame)
: BaseException(message), frame_number(frame_number), chunk_number(chunk_number), chunk_frame(chunk_frame) { }
: ExceptionBase(message), frame_number(frame_number), chunk_number(chunk_number), chunk_frame(chunk_frame) { }
virtual ~ChunkNotFound() noexcept {}
};
/// Exception when accessing a blackmagic decklink card
class DecklinkError : public BaseException
class DecklinkError : public ExceptionBase
{
public:
/**
@@ -85,12 +85,12 @@ namespace openshot {
* @param message A message to accompany the exception
*/
DecklinkError(std::string message)
: BaseException(message) { }
: ExceptionBase(message) { }
virtual ~DecklinkError() noexcept {}
};
/// Exception when decoding audio packet
class ErrorDecodingAudio : public BaseException
class ErrorDecodingAudio : public ExceptionBase
{
public:
int64_t frame_number;
@@ -101,12 +101,12 @@ namespace openshot {
* @param frame_number The frame number being processed
*/
ErrorDecodingAudio(std::string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
: ExceptionBase(message), frame_number(frame_number) { }
virtual ~ErrorDecodingAudio() noexcept {}
};
/// Exception when encoding audio packet
class ErrorEncodingAudio : public BaseException
class ErrorEncodingAudio : public ExceptionBase
{
public:
int64_t frame_number;
@@ -117,12 +117,12 @@ namespace openshot {
* @param frame_number The frame number being processed
*/
ErrorEncodingAudio(std::string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
: ExceptionBase(message), frame_number(frame_number) { }
virtual ~ErrorEncodingAudio() noexcept {}
};
/// Exception when encoding audio packet
class ErrorEncodingVideo : public BaseException
class ErrorEncodingVideo : public ExceptionBase
{
public:
int64_t frame_number;
@@ -133,12 +133,12 @@ namespace openshot {
* @param frame_number The frame number being processed
*/
ErrorEncodingVideo(std::string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
: ExceptionBase(message), frame_number(frame_number) { }
virtual ~ErrorEncodingVideo() noexcept {}
};
/// Exception when an invalid # of audio channels are detected
class InvalidChannels : public BaseException
class InvalidChannels : public ExceptionBase
{
public:
std::string file_path;
@@ -149,12 +149,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
InvalidChannels(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~InvalidChannels() noexcept {}
};
/// Exception when no valid codec is found for a file
class InvalidCodec : public BaseException
class InvalidCodec : public ExceptionBase
{
public:
std::string file_path;
@@ -165,12 +165,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
InvalidCodec(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~InvalidCodec() noexcept {}
};
/// Exception for files that can not be found or opened
class InvalidFile : public BaseException
class InvalidFile : public ExceptionBase
{
public:
std::string file_path;
@@ -181,12 +181,12 @@ namespace openshot {
* @param file_path The input file being processed
*/
InvalidFile(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~InvalidFile() noexcept {}
};
/// Exception when no valid format is found for a file
class InvalidFormat : public BaseException
class InvalidFormat : public ExceptionBase
{
public:
std::string file_path;
@@ -197,12 +197,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
InvalidFormat(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~InvalidFormat() noexcept {}
};
/// Exception for invalid JSON
class InvalidJSON : public BaseException
class InvalidJSON : public ExceptionBase
{
public:
std::string file_path;
@@ -213,12 +213,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
InvalidJSON(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~InvalidJSON() noexcept {}
};
/// Exception when invalid encoding options are used
class InvalidOptions : public BaseException
class InvalidOptions : public ExceptionBase
{
public:
std::string file_path;
@@ -229,12 +229,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
InvalidOptions(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~InvalidOptions() noexcept {}
};
/// Exception when invalid sample rate is detected during encoding
class InvalidSampleRate : public BaseException
class InvalidSampleRate : public ExceptionBase
{
public:
std::string file_path;
@@ -245,12 +245,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
InvalidSampleRate(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~InvalidSampleRate() noexcept {}
};
/// Exception for missing JSON Change key
class InvalidJSONKey : public BaseException
class InvalidJSONKey : public ExceptionBase
{
public:
std::string json;
@@ -261,12 +261,12 @@ namespace openshot {
* @param json The json data being processed
*/
InvalidJSONKey(std::string message, std::string json)
: BaseException(message), json(json) { }
: ExceptionBase(message), json(json) { }
virtual ~InvalidJSONKey() noexcept {}
};
/// Exception when no streams are found in the file
class NoStreamsFound : public BaseException
class NoStreamsFound : public ExceptionBase
{
public:
std::string file_path;
@@ -277,12 +277,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
NoStreamsFound(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~NoStreamsFound() noexcept {}
};
/// Exception for frames that are out of bounds.
class OutOfBoundsFrame : public BaseException
class OutOfBoundsFrame : public ExceptionBase
{
public:
int64_t FrameRequested;
@@ -295,12 +295,12 @@ namespace openshot {
* @param max_frames The maximum available frame number
*/
OutOfBoundsFrame(std::string message, int64_t frame_requested, int64_t max_frames)
: BaseException(message), FrameRequested(frame_requested), MaxFrames(max_frames) { }
: ExceptionBase(message), FrameRequested(frame_requested), MaxFrames(max_frames) { }
virtual ~OutOfBoundsFrame() noexcept {}
};
/// Exception for an out of bounds key-frame point.
class OutOfBoundsPoint : public BaseException
class OutOfBoundsPoint : public ExceptionBase
{
public:
int PointRequested;
@@ -313,12 +313,12 @@ namespace openshot {
* @param max_points The maximum available point value
*/
OutOfBoundsPoint(std::string message, int point_requested, int max_points)
: BaseException(message), PointRequested(point_requested), MaxPoints(max_points) { }
: ExceptionBase(message), PointRequested(point_requested), MaxPoints(max_points) { }
virtual ~OutOfBoundsPoint() noexcept {}
};
/// Exception when memory could not be allocated
class OutOfMemory : public BaseException
class OutOfMemory : public ExceptionBase
{
public:
std::string file_path;
@@ -329,12 +329,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
OutOfMemory(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~OutOfMemory() noexcept {}
};
/// Exception when a reader is closed, and a frame is requested
class ReaderClosed : public BaseException
class ReaderClosed : public ExceptionBase
{
public:
std::string file_path;
@@ -345,12 +345,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
ReaderClosed(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~ReaderClosed() noexcept {}
};
/// Exception when resample fails
class ResampleError : public BaseException
class ResampleError : public ExceptionBase
{
public:
std::string file_path;
@@ -361,12 +361,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
ResampleError(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~ResampleError() noexcept {}
};
/// Exception when too many seek attempts happen
class TooManySeeks : public BaseException
class TooManySeeks : public ExceptionBase
{
public:
std::string file_path;
@@ -377,12 +377,12 @@ namespace openshot {
* @param file_path (optional) The input file being processed
*/
TooManySeeks(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~TooManySeeks() noexcept {}
};
/// Exception when a writer is closed, and a frame is requested
class WriterClosed : public BaseException
class WriterClosed : public ExceptionBase
{
public:
std::string file_path;
@@ -393,7 +393,7 @@ namespace openshot {
* @param file_path (optional) The output file being written
*/
WriterClosed(std::string message, std::string file_path="")
: BaseException(message), file_path(file_path) { }
: ExceptionBase(message), file_path(file_path) { }
virtual ~WriterClosed() noexcept {}
};
}

View File

@@ -246,31 +246,31 @@ namespace openshot {
virtual ~FFmpegReader();
/// Close File
void Close();
void Close() override;
/// Get the cache object used by this reader
CacheMemory *GetCache() { return &final_cache; };
CacheMemory *GetCache() override { return &final_cache; };
/// Get a shared pointer to a openshot::Frame object for a specific frame number of this reader.
///
/// @returns The requested frame of video
/// @param requested_frame The frame number that is requested.
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame);
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame) override;
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };
bool IsOpen() override { return is_open; };
/// Return the type name of the class
std::string Name() { return "FFmpegReader"; };
std::string Name() override { return "FFmpegReader"; };
/// Get and Set JSON methods
std::string Json() const override; ///< Generate JSON string of this object
void SetJson(const std::string value); ///< Load JSON string into this object
void SetJson(const std::string value) override; ///< 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
void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
/// Open File - which is called by the constructor automatically
void Open();
void Open() override;
};
}

View File

@@ -163,11 +163,10 @@
#define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context)
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type
#define AV_FIND_DECODER_CODEC_ID(av_stream) av_stream->codecpar->codec_id
auto AV_GET_CODEC_CONTEXT = [](AVStream* av_stream, AVCodec* av_codec) { \
AVCodecContext *context = avcodec_alloc_context3(av_codec); \
avcodec_parameters_to_context(context, av_stream->codecpar); \
return context; \
};
#define AV_GET_CODEC_CONTEXT(av_stream, av_codec) \
({ AVCodecContext *context = avcodec_alloc_context3(av_codec); \
avcodec_parameters_to_context(context, av_stream->codecpar); \
context; })
#define AV_GET_CODEC_PAR_CONTEXT(av_stream, av_codec) av_codec;
#define AV_GET_CODEC_FROM_STREAM(av_stream,codec_in)
#define AV_GET_CODEC_ATTRIBUTES(av_stream, av_context) av_stream->codecpar
@@ -199,11 +198,10 @@
#define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context)
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type
#define AV_FIND_DECODER_CODEC_ID(av_stream) av_stream->codecpar->codec_id
auto AV_GET_CODEC_CONTEXT = [](AVStream* av_stream, AVCodec* av_codec) { \
AVCodecContext *context = avcodec_alloc_context3(av_codec); \
avcodec_parameters_to_context(context, av_stream->codecpar); \
return context; \
};
#define AV_GET_CODEC_CONTEXT(av_stream, av_codec) \
({ AVCodecContext *context = avcodec_alloc_context3(av_codec); \
avcodec_parameters_to_context(context, av_stream->codecpar); \
context; })
#define AV_GET_CODEC_PAR_CONTEXT(av_stream, av_codec) av_codec;
#define AV_GET_CODEC_FROM_STREAM(av_stream,codec_in)
#define AV_GET_CODEC_ATTRIBUTES(av_stream, av_context) av_stream->codecpar

View File

@@ -167,7 +167,6 @@ namespace openshot {
AVCodecContext *video_codec;
AVCodecContext *audio_codec;
SwsContext *img_convert_ctx;
double audio_pts, video_pts;
int16_t *samples;
uint8_t *audio_outbuf;
uint8_t *audio_encoder_buffer;

View File

@@ -176,13 +176,13 @@ namespace openshot
void ChangeMapping(Fraction target_fps, PulldownType pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout);
/// Close the openshot::FrameMapper and internal reader
void Close();
void Close() override;
/// Get a frame based on the target frame rate and the new frame number of a frame
MappedFrame GetMappedFrame(int64_t TargetFrameNumber);
/// Get the cache object used by this reader
CacheMemory* GetCache() { return &final_cache; };
CacheMemory* GetCache() override { return &final_cache; };
/// @brief This method is required for all derived classes of ReaderBase, and return the
/// openshot::Frame object, which contains the image and audio information for that
@@ -190,22 +190,22 @@ namespace openshot
///
/// @returns The requested frame of video
/// @param requested_frame The frame number that is requested.
std::shared_ptr<Frame> GetFrame(int64_t requested_frame);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) override;
/// Determine if reader is open or closed
bool IsOpen();
bool IsOpen() override;
/// Return the type name of the class
std::string Name() { return "FrameMapper"; };
std::string Name() override { return "FrameMapper"; };
/// Get and Set JSON methods
std::string Json() const override; ///< Generate JSON string of this object
void SetJson(const std::string value); ///< Load JSON string into this object
void SetJson(const std::string value) override; ///< 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
void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
/// Open the internal reader
void Open();
void Open() override;
/// Print all of the original frames and which new frames they map to
void PrintMapping();

View File

@@ -87,32 +87,32 @@ namespace openshot
ImageReader(std::string path, bool inspect_reader);
/// Close File
void Close();
void Close() override;
/// Get the cache object used by this reader (always returns NULL for this object)
CacheMemory* GetCache() { return NULL; };
CacheMemory* GetCache() override { return NULL; };
/// Get an openshot::Frame object for a specific frame number of this reader. All numbers
/// return the same Frame, since they all share the same image data.
///
/// @returns The requested frame (containing the image)
/// @param requested_frame The frame number that is requested.
std::shared_ptr<Frame> GetFrame(int64_t requested_frame);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) override;
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };
bool IsOpen() override { return is_open; };
/// Return the type name of the class
std::string Name() { return "ImageReader"; };
std::string Name() override { return "ImageReader"; };
/// Get and Set JSON methods
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
void SetJson(const std::string value) override; ///< Load JSON string into this object
Json::Value JsonValue() const override; ///< Generate Json::Value for this object
void SetJsonValue(const Json::Value root) override; ///< Load Json::Value into this object
/// Open File - which is called by the constructor automatically
void Open();
void Open() override;
};
}

View File

@@ -88,7 +88,6 @@ namespace openshot
private:
std::string path;
int cache_size;
bool is_writing;
bool is_open;
int64_t write_video_count;
std::vector<Magick::Image> frames;

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