Merge branch 'develop' into pr-305

This commit is contained in:
FeRD (Frank Dana)
2019-08-12 09:36:13 -04:00
64 changed files with 676 additions and 483 deletions

3
.gitignore vendored
View File

@@ -1,5 +1,4 @@
build/
build/*
/build*
*.DS_Store
.pydevproject
.settings

View File

@@ -17,7 +17,7 @@ linux-builder:
- export LIBOPENSHOT_AUDIO_DIR=$CI_PROJECT_DIR/build/install-x64
- mkdir -p build; cd build;
- mkdir -p install-x64/python;
- cmake -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/build/install-x64" -D"CMAKE_BUILD_TYPE:STRING=Release" ../
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/build/install-x64" -D"CMAKE_BUILD_TYPE:STRING=Release" ../
- make
- make install
- make doc
@@ -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 -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=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" ../
- make
- make install
- mv install-x64/lib/python3.6/site-packages/*openshot* install-x64/python
@@ -71,14 +71,14 @@ windows-builder-x64:
- $env:LIBOPENSHOT_AUDIO_DIR = "$CI_PROJECT_DIR\build\install-x64"
- $env:UNITTEST_DIR = "C:\msys64\usr"
- $env:ZMQDIR = "C:\msys64\usr"
- $env:RESVGDIR = "C:\msys64\usr"
- $env:Path = "C:\msys64\mingw64\bin;C:\msys64\mingw64\lib;C:\msys64\usr\lib\cmake\UnitTest++;C:\msys64\home\jonathan\depot_tools;C:\msys64\usr;C:\msys64\usr\lib;" + $env:Path;
- New-Item -ItemType Directory -Force -Path build
- New-Item -ItemType Directory -Force -Path build\install-x64\python
- cd build
- cmake -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR\build\install-x64" -G "MinGW Makefiles" -D"CMAKE_BUILD_TYPE:STRING=Release" ../
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR\build\install-x64" -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.6\site-packages\*openshot*" -destination "install-x64\python\"
- cp src\libopenshot.dll install-x64\lib
- 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..HEAD" --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"
@@ -100,16 +100,15 @@ windows-builder-x86:
- Expand-Archive -Path artifacts.zip -DestinationPath .
- $env:LIBOPENSHOT_AUDIO_DIR = "$CI_PROJECT_DIR\build\install-x86"
- $env:UNITTEST_DIR = "C:\msys32\usr"
- $env:RESVGDIR = "C:\msys32\usr\local"
- $env:RESVGDIR = "C:\msys32\usr"
- $env:ZMQDIR = "C:\msys32\usr"
- $env:Path = "C:\msys32\mingw32\bin;C:\msys32\mingw32\lib;C:\msys32\usr\lib\cmake\UnitTest++;C:\msys32\home\jonathan\depot_tools;C:\msys32\usr;C:\msys32\usr\lib;" + $env:Path;
- New-Item -ItemType Directory -Force -Path build
- New-Item -ItemType Directory -Force -Path build\install-x86\python
- cd build
- cmake -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR\build\install-x86" -G "MinGW Makefiles" -D"CMAKE_BUILD_TYPE:STRING=Release" -D"CMAKE_CXX_FLAGS=-m32" -D"CMAKE_EXE_LINKER_FLAGS=-Wl,--large-address-aware" -D"CMAKE_C_FLAGS=-m32" ../
- cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -D"CMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR\build\install-x86" -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -D"CMAKE_BUILD_TYPE:STRING=Release" -D"CMAKE_CXX_FLAGS=-m32" -D"CMAKE_EXE_LINKER_FLAGS=-Wl,--large-address-aware" -D"CMAKE_C_FLAGS=-m32" ../
- mingw32-make install
- Move-Item -Force -path "install-x86\lib\python3.6\site-packages\*openshot*" -destination "install-x86\python\"
- cp src\libopenshot.dll install-x86\lib
- Move-Item -Force -path "install-x86\lib\python3.7\site-packages\*openshot*" -destination "install-x86\python\"
- New-Item -path "install-x86/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..HEAD" --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-x86/share/$CI_PROJECT_NAME.log"

View File

@@ -39,49 +39,45 @@ For more information, please visit <http://www.openshot.org/>.
################ ADD CMAKE MODULES ##################
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
################ GET VERSION INFORMATION FROM VERSION.H ##################
message(STATUS "Determining Version Number (from Version.h file)")
################ PROJECT VERSION ####################
set(PROJECT_VERSION_FULL "0.2.3-dev1")
set(PROJECT_SO_VERSION 17)
#### Get the lines related to libopenshot version from the Version.h header
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/include/Version.h
OPENSHOT_VERSION_LINES
REGEX "#define[ ]+OPENSHOT_VERSION_.*[0-9]+;.*")
#### Set each line into its own variable
list (GET OPENSHOT_VERSION_LINES 0 LINE_MAJOR)
list (GET OPENSHOT_VERSION_LINES 1 LINE_MINOR)
list (GET OPENSHOT_VERSION_LINES 2 LINE_BUILD)
list (GET OPENSHOT_VERSION_LINES 3 LINE_SO)
#### Get the version number out of each line
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_MAJOR[ ]+([0-9]+);(.*)" "\\1" MAJOR_VERSION "${LINE_MAJOR}")
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_MINOR[ ]+([0-9]+);(.*)" "\\1" MINOR_VERSION "${LINE_MINOR}")
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_BUILD[ ]+([0-9]+);(.*)" "\\1" BUILD_VERSION "${LINE_BUILD}")
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_SO[ ]+([0-9]+);(.*)" "\\1" SO_VERSION "${LINE_SO}")
message(STATUS "MAJOR Version: ${MAJOR_VERSION}")
message(STATUS "MINOR Version: ${MINOR_VERSION}")
message(STATUS "BUILD Version: ${BUILD_VERSION}")
message(STATUS "SO/API/ABI Version: ${SO_VERSION}")
message(STATUS "Determining Version Number - done")
# Remove the dash and anything following, to get the #.#.# version for project()
STRING(REGEX REPLACE "\-.*$" "" VERSION_NUM "${PROJECT_VERSION_FULL}")
################### SETUP PROJECT ###################
PROJECT(libopenshot LANGUAGES C CXX
VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_VERSION})
# This will define the following variables
# PROJECT_NAME
# PROJECT_VERSION, libopenshot_VERSION
# PROJECT_VERSION_MAJOR, libopenshot_VERSION_MAJOR
# PROJECT_VERSION_MINOR, libopenshot_VERSION_MINOR
# PROJECT_VERSION_PATCH, libopenshot_VERSION_PATCH
PROJECT(libopenshot LANGUAGES C CXX VERSION ${VERSION_NUM})
message("
Generating build files for OpenShot
Building ${PROJECT_NAME} (version ${PROJECT_VERSION})
SO/API/ABI Version: ${SO_VERSION}
SO/API/ABI Version: ${PROJECT_SO_VERSION}
")
#### Work around a GCC < 9 bug with handling of _Pragma() in macros
#### See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55578
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.0.0"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-integrated-cpp")
endif()
# Define install paths according to system conventions
# XXX: This must be AFTER THE PROJECT() COMMAND w/ languages enabled,
# in order to properly configure CMAKE_INSTALL_LIBDIR path
include(GNUInstallDirs)
########## Configure Version.h header ##############
configure_file(include/OpenShotVersion.h.in include/OpenShotVersion.h @ONLY)
# We'll want that installed later
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/OpenShotVersion.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libopenshot)
############### Set up include paths #################
list(APPEND OPENSHOT_INCLUDE_DIRS
include
include/effects
include/Qt
${CMAKE_CURRENT_BINARY_DIR}/include )
#### Enable C++11 (for std::shared_ptr support)
set(CMAKE_CXX_STANDARD 11)
@@ -104,5 +100,11 @@ add_subdirectory(tests)
# Find Doxygen (used for documentation)
include(cmake/Modules/UseDoxygen.cmake)
file(GLOB_RECURSE doc_files ${CMAKE_CURRENT_BINARY_DIR}/doc/html/*.*)
INSTALL(FILES ${doc_files} DESTINATION share/doc/libopenshot)
# Install docs, if the user builds them with `make doc`
install(CODE "MESSAGE(\"Checking for documentation files to install...\")")
install(CODE "MESSAGE(\"(Compile with 'make doc' command, requires Doxygen)\")")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html/
DESTINATION ${CMAKE_INSTALL_DOCDIR}/API
MESSAGE_NEVER # Don't spew about file copies
OPTIONAL ) # No error if the docs aren't found

View File

@@ -5,34 +5,112 @@
# LIBOPENSHOT_AUDIO_INCLUDE_DIRS - The juce.h include directories
# LIBOPENSHOT_AUDIO_LIBRARIES - The libraries needed to use juce
message("$ENV{LIBOPENSHOT_AUDIO_DIR}")
if("$ENV{LIBOPENSHOT_AUDIO_DIR}" AND NOT "${OpenShotAudio_FIND_QUIETLY}")
message(STATUS "Looking for OpenShotAudio in: $ENV{LIBOPENSHOT_AUDIO_DIR}")
endif()
# Find the libopenshot-audio header files
find_path(LIBOPENSHOT_AUDIO_INCLUDE_DIR JuceHeader.h
PATHS $ENV{LIBOPENSHOT_AUDIO_DIR}/include/libopenshot-audio/
/usr/include/libopenshot-audio/
/usr/local/include/libopenshot-audio/ )
# Find the libopenshot-audio header files (check env/cache vars first)
find_path(
LIBOPENSHOT_AUDIO_INCLUDE_DIR
JuceHeader.h
HINTS
ENV LIBOPENSHOT_AUDIO_DIR
PATHS
${LIBOPENSHOT_AUDIO_DIR}
PATH_SUFFIXES
include/libopenshot-audio
libopenshot-audio
include
NO_DEFAULT_PATH
)
# Find the libopenshot-audio.so (check env var first)
find_library(LIBOPENSHOT_AUDIO_LIBRARY
NAMES libopenshot-audio openshot-audio
PATHS $ENV{LIBOPENSHOT_AUDIO_DIR}/lib/ NO_DEFAULT_PATH)
# Find the libopenshot-audio header files (fallback to std. paths)
find_path(
LIBOPENSHOT_AUDIO_INCLUDE_DIR
JuceHeader.h
HINTS
ENV LIBOPENSHOT_AUDIO_DIR
PATHS
${LIBOPENSHOT_AUDIO_DIR}
PATH_SUFFIXES
include/libopenshot-audio
libopenshot-audio
include
)
# Find the libopenshot-audio.so / libopenshot-audio.dll library (fallback)
find_library(LIBOPENSHOT_AUDIO_LIBRARY
NAMES libopenshot-audio openshot-audio
HINTS $ENV{LIBOPENSHOT_AUDIO_DIR}/lib/
/usr/lib/
/usr/lib/libopenshot-audio/
/usr/local/lib/ )
# Find libopenshot-audio.so / libopenshot-audio.dll (check env/cache vars first)
find_library(
LIBOPENSHOT_AUDIO_LIBRARY
NAMES
libopenshot-audio
openshot-audio
HINTS
ENV LIBOPENSHOT_AUDIO_DIR
PATHS
${LIBOPENSHOT_AUDIO_DIR}
PATH_SUFFIXES
lib/libopenshot-audio
libopenshot-audio
lib
NO_DEFAULT_PATH
)
set(LIBOPENSHOT_AUDIO_LIBRARIES ${LIBOPENSHOT_AUDIO_LIBRARY})
set(LIBOPENSHOT_AUDIO_LIBRARY ${LIBOPENSHOT_AUDIO_LIBRARIES})
# Find libopenshot-audio.so / libopenshot-audio.dll (fallback)
find_library(
LIBOPENSHOT_AUDIO_LIBRARY
NAMES
libopenshot-audio
openshot-audio
HINTS
ENV LIBOPENSHOT_AUDIO_DIR
PATHS
${LIBOPENSHOT_AUDIO_DIR}
PATH_SUFFIXES
lib/libopenshot-audio
libopenshot-audio
lib
)
set(LIBOPENSHOT_AUDIO_INCLUDE_DIRS ${LIBOPENSHOT_AUDIO_INCLUDE_DIR} )
set(LIBOPENSHOT_AUDIO_LIBRARIES "${LIBOPENSHOT_AUDIO_LIBRARY}")
set(LIBOPENSHOT_AUDIO_LIBRARY "${LIBOPENSHOT_AUDIO_LIBRARIES}")
set(LIBOPENSHOT_AUDIO_INCLUDE_DIRS "${LIBOPENSHOT_AUDIO_INCLUDE_DIR}")
if(LIBOPENSHOT_AUDIO_INCLUDE_DIR AND EXISTS "${LIBOPENSHOT_AUDIO_INCLUDE_DIR}/JuceHeader.h")
file(STRINGS "${LIBOPENSHOT_AUDIO_INCLUDE_DIR}/JuceHeader.h" libosa_version_str
REGEX "versionString.*=.*\"[^\"]+\"")
if(libosa_version_str MATCHES "versionString.*=.*\"([^\"]+)\"")
set(LIBOPENSHOT_AUDIO_VERSION_STRING ${CMAKE_MATCH_1})
endif()
unset(libosa_version_str)
string(REGEX REPLACE "^([0-9]+\.[0-9]+\.[0-9]+).*$" "\\1"
LIBOPENSHOT_AUDIO_VERSION "${LIBOPENSHOT_AUDIO_VERSION_STRING}")
endif()
# If we couldn't parse M.N.B version, don't keep any of it
if(NOT LIBOPENSHOT_AUDIO_VERSION)
unset(LIBOPENSHOT_AUDIO_VERSION)
unset(LIBOPENSHOT_AUDIO_VERSION_STRING)
endif()
# Determine compatibility with requested version in find_package()
if(OpenShotAudio_FIND_VERSION AND LIBOPENSHOT_AUDIO_VERSION)
if("${OpenShotAudio_FIND_VERSION}" STREQUAL "${LIBOPENSHOT_AUDIO_VERSION}")
set(OpenShotAudio_VERSION_EXACT TRUE)
endif()
if("${OpenShotAudio_FIND_VERSION}" VERSION_GREATER "${LIBOPENSHOT_AUDIO_VERSION}")
set(OpenShotAudio_VERSION_COMPATIBLE FALSE)
else()
set(OpenShotAudio_VERSION_COMPATIBLE TRUE)
endif()
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBOPENSHOT_AUDIO_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LIBOPENSHOT_AUDIO DEFAULT_MSG
LIBOPENSHOT_AUDIO_LIBRARY LIBOPENSHOT_AUDIO_INCLUDE_DIR)
find_package_handle_standard_args(OpenShotAudio
REQUIRED_VARS
LIBOPENSHOT_AUDIO_LIBRARY
LIBOPENSHOT_AUDIO_INCLUDE_DIRS
VERSION_VAR
LIBOPENSHOT_AUDIO_VERSION_STRING
)

View File

@@ -7,20 +7,22 @@ our support for this in the future!
The following table summarizes our current level of support:
| | Linux Decode | Linux Encode | Mac Decode | Mac Encode |Windows Decode| Windows Encode | Notes |
|--------------------|------------------------|----------------------|------------------|----------------|--------------|------------------|------------------|
| VA-API | :heavy_check_mark: | :heavy_check_mark: | - | - | - | - | *Linux Only* |
| VDPAU | :heavy_check_mark:(+) |:white_check_mark:(++)| - | - | - | - | *Linux Only* |
| CUDA (NVDEC/NVENC) | :x:(+++) | :heavy_check_mark: | - | - | - |:heavy_check_mark:| *Cross Platform* |
| VideoToolBox | - | - |:heavy_check_mark:| :x:(++++) | - | - | *Mac Only* |
| DXVA2 | - | - | - | - | :x:(+++) | - | *Windows Only* |
| D3D11VA | - | - | - | - | :x:(+++) | - | *Windows Only* |
| QSV | :x:(+++) | :x: | :x: | :x: | :x: | :x: | *Cross Platform* |
| | Linux Decode | Linux Encode | Mac Decode | Mac Encode | Windows Decode | Windows Encode | Notes |
|--------------------|:---------------:|:--------------:|:----------:|:--------------:|:--------------:|:--------------:|------------------|
| VA-API | ✔️ &nbsp; | ✔️ &nbsp; | - | - | - | - | *Linux Only* |
| VDPAU | ✔️ <sup>1</sup> | ✅ <sup>2</sup> | - | - | - | - | *Linux Only* |
| CUDA (NVDEC/NVENC) | ❌ <sup>3</sup> | ✔️ &nbsp; | - | - | - | ✔️ &nbsp; | *Cross Platform* |
| VideoToolBox | - | - | ✔️ &nbsp; | ❌ <sup>4</sup> | - | - | *Mac Only* |
| DXVA2 | - | - | - | - | ❌ <sup>3</sup> | - | *Windows Only* |
| D3D11VA | - | - | - | - | ❌ <sup>3</sup> | - | *Windows Only* |
| QSV | ❌ <sup>3</sup> | ❌ &nbsp; | ❌ &nbsp; | ❌ &nbsp; | ❌ &nbsp; | ❌ &nbsp; | *Cross Platform* |
* *(+) VDPAU for some reason needs a card number one higher than it really is*
* *(++) VDPAU is a decoder only.*
* *(+++) Green frames (pixel data not correctly tranferred back to system memory)*
* *(++++) Crashes and burns*
#### Notes
1. VDPAU for some reason needs a card number one higher than it really is
2. VDPAU is a decoder only
3. Green frames (pixel data not correctly tranferred back to system memory)
4. Crashes and burns
## Supported FFmpeg Versions
@@ -37,7 +39,7 @@ included.
The following settings are use by libopenshot to enable, disable, and control
the various hardware acceleration features.
```
```{cpp}
/// Use video codec for faster video decoding (if supported)
int HARDWARE_DECODER = 0;
@@ -76,9 +78,9 @@ in Ubuntu 18.04) for the AppImage to work with hardware acceleration.
An AppImage that works on both systems (supporting libva and libva2),
might be possible when no libva is included in the AppImage.
* vaapi is working for intel and AMD
* vaapi is working for decode only for nouveau
* nVidia driver is working for export only
* vaapi is working for intel and AMD
* vaapi is working for decode only for nouveau
* nVidia driver is working for export only
## AMD Graphics Cards (RadeonOpenCompute/ROCm)

View File

@@ -32,7 +32,6 @@
#define OPENSHOT_EXCEPTIONS_H
#include <string>
using namespace std;
namespace openshot {
@@ -45,11 +44,11 @@ namespace openshot {
class BaseException : public std::exception //: public exception
{
protected:
string m_message;
std::string m_message;
public:
BaseException(string message) : m_message(message) { }
virtual ~BaseException() throw () {}
virtual const char* what() const throw () {
BaseException(std::string message) : m_message(message) { }
virtual ~BaseException() noexcept {}
virtual const char* what() const noexcept {
// return custom message
return m_message.c_str();
}
@@ -59,13 +58,12 @@ namespace openshot {
class ChunkNotFound : public BaseException
{
public:
string file_path;
int64_t frame_number;
int64_t chunk_number;
int64_t chunk_frame;
ChunkNotFound(string message, int64_t frame_number, int64_t chunk_number, int64_t 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) { }
virtual ~ChunkNotFound() throw () {}
virtual ~ChunkNotFound() noexcept {}
};
@@ -73,132 +71,129 @@ namespace openshot {
class DecklinkError : public BaseException
{
public:
DecklinkError(string message)
DecklinkError(std::string message)
: BaseException(message) { }
virtual ~DecklinkError() throw () {}
virtual ~DecklinkError() noexcept {}
};
/// Exception when decoding audio packet
class ErrorDecodingAudio : public BaseException
{
public:
string file_path;
int64_t frame_number;
ErrorDecodingAudio(string message, int64_t frame_number)
ErrorDecodingAudio(std::string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorDecodingAudio() throw () {}
virtual ~ErrorDecodingAudio() noexcept {}
};
/// Exception when encoding audio packet
class ErrorEncodingAudio : public BaseException
{
public:
string file_path;
int64_t frame_number;
ErrorEncodingAudio(string message, int64_t frame_number)
ErrorEncodingAudio(std::string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorEncodingAudio() throw () {}
virtual ~ErrorEncodingAudio() noexcept {}
};
/// Exception when encoding audio packet
class ErrorEncodingVideo : public BaseException
{
public:
string file_path;
int64_t frame_number;
ErrorEncodingVideo(string message, int64_t frame_number)
ErrorEncodingVideo(std::string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorEncodingVideo() throw () {}
virtual ~ErrorEncodingVideo() noexcept {}
};
/// Exception when an invalid # of audio channels are detected
class InvalidChannels : public BaseException
{
public:
string file_path;
InvalidChannels(string message, string file_path)
std::string file_path;
InvalidChannels(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidChannels() throw () {}
virtual ~InvalidChannels() noexcept {}
};
/// Exception when no valid codec is found for a file
class InvalidCodec : public BaseException
{
public:
string file_path;
InvalidCodec(string message, string file_path)
std::string file_path;
InvalidCodec(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidCodec() throw () {}
virtual ~InvalidCodec() noexcept {}
};
/// Exception for files that can not be found or opened
class InvalidFile : public BaseException
{
public:
string file_path;
InvalidFile(string message, string file_path)
std::string file_path;
InvalidFile(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidFile() throw () {}
virtual ~InvalidFile() noexcept {}
};
/// Exception when no valid format is found for a file
class InvalidFormat : public BaseException
{
public:
string file_path;
InvalidFormat(string message, string file_path)
std::string file_path;
InvalidFormat(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidFormat() throw () {}
virtual ~InvalidFormat() noexcept {}
};
/// Exception for invalid JSON
class InvalidJSON : public BaseException
{
public:
string file_path;
InvalidJSON(string message, string file_path)
std::string file_path;
InvalidJSON(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidJSON() throw () {}
virtual ~InvalidJSON() noexcept {}
};
/// Exception when invalid encoding options are used
class InvalidOptions : public BaseException
{
public:
string file_path;
InvalidOptions(string message, string file_path)
std::string file_path;
InvalidOptions(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidOptions() throw () {}
virtual ~InvalidOptions() noexcept {}
};
/// Exception when invalid sample rate is detected during encoding
class InvalidSampleRate : public BaseException
{
public:
string file_path;
InvalidSampleRate(string message, string file_path)
std::string file_path;
InvalidSampleRate(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidSampleRate() throw () {}
virtual ~InvalidSampleRate() noexcept {}
};
/// Exception for missing JSON Change key
class InvalidJSONKey : public BaseException
{
public:
string json;
InvalidJSONKey(string message, string json)
std::string json;
InvalidJSONKey(std::string message, std::string json)
: BaseException(message), json(json) { }
virtual ~InvalidJSONKey() throw () {}
virtual ~InvalidJSONKey() noexcept {}
};
/// Exception when no streams are found in the file
class NoStreamsFound : public BaseException
{
public:
string file_path;
NoStreamsFound(string message, string file_path)
std::string file_path;
NoStreamsFound(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~NoStreamsFound() throw () {}
virtual ~NoStreamsFound() noexcept {}
};
/// Exception for frames that are out of bounds.
@@ -207,9 +202,9 @@ namespace openshot {
public:
int64_t FrameRequested;
int64_t MaxFrames;
OutOfBoundsFrame(string message, int64_t frame_requested, int64_t max_frames)
OutOfBoundsFrame(std::string message, int64_t frame_requested, int64_t max_frames)
: BaseException(message), FrameRequested(frame_requested), MaxFrames(max_frames) { }
virtual ~OutOfBoundsFrame() throw () {}
virtual ~OutOfBoundsFrame() noexcept {}
};
/// Exception for an out of bounds key-frame point.
@@ -218,59 +213,59 @@ namespace openshot {
public:
int PointRequested;
int MaxPoints;
OutOfBoundsPoint(string message, int point_requested, int max_points)
OutOfBoundsPoint(std::string message, int point_requested, int max_points)
: BaseException(message), PointRequested(point_requested), MaxPoints(max_points) { }
virtual ~OutOfBoundsPoint() throw () {}
virtual ~OutOfBoundsPoint() noexcept {}
};
/// Exception when memory could not be allocated
class OutOfMemory : public BaseException
{
public:
string file_path;
OutOfMemory(string message, string file_path)
std::string file_path;
OutOfMemory(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~OutOfMemory() throw () {}
virtual ~OutOfMemory() noexcept {}
};
/// Exception when a reader is closed, and a frame is requested
class ReaderClosed : public BaseException
{
public:
string file_path;
ReaderClosed(string message, string file_path)
std::string file_path;
ReaderClosed(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~ReaderClosed() throw () {}
virtual ~ReaderClosed() noexcept {}
};
/// Exception when resample fails
class ResampleError : public BaseException
{
public:
string file_path;
ResampleError(string message, string file_path)
std::string file_path;
ResampleError(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~ResampleError() throw () {}
virtual ~ResampleError() noexcept {}
};
/// Exception when too many seek attempts happen
class TooManySeeks : public BaseException
{
public:
string file_path;
TooManySeeks(string message, string file_path)
std::string file_path;
TooManySeeks(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~TooManySeeks() throw () {}
virtual ~TooManySeeks() noexcept {}
};
/// Exception when a writer is closed, and a frame is requested
class WriterClosed : public BaseException
{
public:
string file_path;
WriterClosed(string message, string file_path)
std::string file_path;
WriterClosed(std::string message, std::string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~WriterClosed() throw () {}
virtual ~WriterClosed() noexcept {}
};
}

View File

@@ -91,12 +91,11 @@
#endif
// This wraps an unsafe C macro to be C++ compatible function
static const std::string av_make_error_string(int errnum)
inline static const std::string av_make_error_string(int errnum)
{
char errbuf[AV_ERROR_MAX_STRING_SIZE];
av_strerror(errnum, errbuf, AV_ERROR_MAX_STRING_SIZE);
std::string errstring(errbuf);
return errstring;
return (std::string)errbuf;
}
// Redefine the C macro to use our new C++ function
@@ -106,13 +105,13 @@
// Define this for compatibility
#ifndef PixelFormat
#define PixelFormat AVPixelFormat
#endif
#endif
#ifndef PIX_FMT_RGBA
#define PIX_FMT_RGBA AV_PIX_FMT_RGBA
#endif
#endif
#ifndef PIX_FMT_NONE
#define PIX_FMT_NONE AV_PIX_FMT_NONE
#endif
#endif
#ifndef PIX_FMT_RGB24
#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24
#endif
@@ -150,11 +149,12 @@
#define AV_REGISTER_ALL
#define AVCODEC_REGISTER_ALL
#define AV_FILENAME url
#define AV_SET_FILENAME(oc, f) oc->AV_FILENAME = av_strdup(f)
#define MY_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
#define AV_ALLOCATE_FRAME() av_frame_alloc()
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1)
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
#define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context)
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type
@@ -185,11 +185,12 @@
#define AV_REGISTER_ALL av_register_all();
#define AVCODEC_REGISTER_ALL avcodec_register_all();
#define AV_FILENAME filename
#define AV_SET_FILENAME(oc, f) snprintf(oc->AV_FILENAME, sizeof(oc->AV_FILENAME), "%s", f)
#define MY_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
#define AV_ALLOCATE_FRAME() av_frame_alloc()
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1)
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
#define AV_FREE_CONTEXT(av_context) avcodec_free_context(&av_context)
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codecpar->codec_type
@@ -223,11 +224,12 @@
#define AV_REGISTER_ALL av_register_all();
#define AVCODEC_REGISTER_ALL avcodec_register_all();
#define AV_FILENAME filename
#define AV_SET_FILENAME(oc, f) snprintf(oc->AV_FILENAME, sizeof(oc->AV_FILENAME), "%s", f)
#define MY_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
#define AV_ALLOCATE_FRAME() av_frame_alloc()
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) avpicture_alloc((AVPicture *) av_frame, pix_fmt, width, height)
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
#define AV_FREE_CONTEXT(av_context) avcodec_close(av_context)
#define AV_GET_CODEC_TYPE(av_stream) av_stream->codec->codec_type
@@ -253,6 +255,7 @@
#define AV_REGISTER_ALL av_register_all();
#define AVCODEC_REGISTER_ALL avcodec_register_all();
#define AV_FILENAME filename
#define AV_SET_FILENAME(oc, f) snprintf(oc->AV_FILENAME, sizeof(oc->AV_FILENAME), "%s", f)
#define MY_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
#define AV_ALLOCATE_FRAME() avcodec_alloc_frame()
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) avpicture_alloc((AVPicture *) av_frame, pix_fmt, width, height)

View File

@@ -65,9 +65,6 @@
#include "MagickUtilities.h"
#endif
#pragma SWIG nowarn=362
using namespace std;
namespace openshot
{
/**
@@ -131,7 +128,7 @@ namespace openshot
int width;
int height;
int sample_rate;
string color;
std::string color;
int64_t max_audio_sample; ///< The max audio sample count added to this frame
/// Constrain a color value from 0 to 255
@@ -147,13 +144,13 @@ namespace openshot
Frame();
/// Constructor - image only (48kHz audio silence)
Frame(int64_t number, int width, int height, string color);
Frame(int64_t number, int width, int height, std::string color);
/// Constructor - audio only (300x200 blank image)
Frame(int64_t number, int samples, int channels);
/// Constructor - image & audio
Frame(int64_t number, int width, int height, string color, int samples, int channels);
Frame(int64_t number, int width, int height, std::string color, int samples, int channels);
/// Copy constructor
Frame ( const Frame &other );
@@ -165,7 +162,7 @@ namespace openshot
virtual ~Frame();
/// Add (or replace) pixel data to the frame (based on a solid color)
void AddColor(int new_width, int new_height, string new_color);
void AddColor(int new_width, int new_height, std::string new_color);
/// Add (or replace) pixel data to the frame
void AddImage(int new_width, int new_height, int bytes_per_pixel, QImage::Format type, const unsigned char *pixels_);
@@ -283,7 +280,7 @@ namespace openshot
void SampleRate(int orig_sample_rate) { sample_rate = orig_sample_rate; };
/// Save the frame image to the specified path. The image format can be BMP, JPG, JPEG, PNG, PPM, XBM, XPM
void Save(string path, float scale, string format="PNG", int quality=100);
void Save(std::string path, float scale, std::string format="PNG", int quality=100);
/// Set frame number
void SetFrameNumber(int64_t number);
@@ -293,8 +290,8 @@ namespace openshot
/// Thumbnail the frame image with tons of options to the specified path. The image format is determined from the extension (i.e. image.PNG, image.JPEG).
/// This method allows for masks, overlays, background color, and much more accurate resizing (including padding and centering)
void Thumbnail(string path, int new_width, int new_height, string mask_path, string overlay_path,
string background_color, bool ignore_aspect, string format="png", int quality=100, float rotate=0.0);
void Thumbnail(std::string path, int new_width, int new_height, std::string mask_path, std::string overlay_path,
std::string background_color, bool ignore_aspect, std::string format="png", int quality=100, float rotate=0.0);
/// Play audio samples for this frame
void Play();

View File

@@ -96,7 +96,7 @@
*/
// Include the version number of OpenShot Library
#include "Version.h"
#include "OpenShotVersion.h"
// Include all other classes
#include "AudioBufferSource.h"

View File

@@ -31,18 +31,16 @@
#ifndef OPENSHOT_VERSION_H
#define OPENSHOT_VERSION_H
// Crazy c++ macro to convert an integer into a string
#ifndef STRINGIZE
#define STRINGIZE_(x) #x
#define STRINGIZE(x) STRINGIZE_(x)
#endif
#define OPENSHOT_VERSION_ALL "@PROJECT_VERSION@" /// A string of the entire version "Major.Minor.Build"
#define OPENSHOT_VERSION_FULL "@PROJECT_VERSION_FULL@" /// A string of the full version identifier, including suffixes (e.g. "0.0.0-dev0")
#define OPENSHOT_VERSION_MAJOR 0; /// Major version number is incremented when huge features are added or improved.
#define OPENSHOT_VERSION_MINOR 2; /// Minor version is incremented when smaller (but still very important) improvements are added.
#define OPENSHOT_VERSION_BUILD 3; /// Build number is incremented when minor bug fixes and less important improvements are added.
#define OPENSHOT_VERSION_SO 17; /// Shared object version number. This increments any time the API and ABI changes (so old apps will no longer link)
#define OPENSHOT_VERSION_MAJOR_MINOR STRINGIZE(OPENSHOT_VERSION_MAJOR) "." STRINGIZE(OPENSHOT_VERSION_MINOR); /// A string of the "Major.Minor" version
#define OPENSHOT_VERSION_ALL STRINGIZE(OPENSHOT_VERSION_MAJOR) "." STRINGIZE(OPENSHOT_VERSION_MINOR) "." STRINGIZE(OPENSHOT_VERSION_BUILD); /// A string of the entire version "Major.Minor.Build"
#define OPENSHOT_VERSION_MAJOR_MINOR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@" /// A string of the "Major.Minor" version
#define OPENSHOT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ /// Major version number is incremented when huge features are added or improved.
#define OPENSHOT_VERSION_MINOR @PROJECT_VERSION_MINOR@ /// Minor version is incremented when smaller (but still very important) improvements are added.
#define OPENSHOT_VERSION_BUILD @PROJECT_VERSION_PATCH@ /// Build number is incremented when minor bug fixes and less important improvements are added.
#define OPENSHOT_VERSION_SO @PROJECT_SO_VERSION@ /// Shared object version number. This increments any time the API and ABI changes (so old apps will no longer link)
#include <sstream>
using namespace std;

View File

@@ -57,7 +57,7 @@ public:
~PlayerDemo();
protected:
void keyPressEvent(QKeyEvent *event);
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private slots:

View File

@@ -1,38 +0,0 @@
/**
* @file
* @brief Header file for UnitTests
* @author Jonathan Thomas <jonathan@openshot.org>
*
* @ref License
*/
/* LICENSE
*
* Copyright (c) 2008-2019 OpenShot Studios, LLC
* <http://www.openshotstudios.com/>. This file is part of
* OpenShot Library (libopenshot), an open-source project dedicated to
* delivering high quality video editing and animation solutions to the
* world. For more information visit <http://www.openshot.org/>.
*
* OpenShot Library (libopenshot) is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* OpenShot Library (libopenshot) is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENSHOT_UNITTESTS_H
#define OPENSHOT_UNITTESTS_H
#ifndef TEST_MEDIA_PATH
#define TEST_MEDIA_PATH "../../src/examples/"
#endif
#endif

View File

@@ -45,8 +45,6 @@
#include "JuceHeader.h"
using namespace std;
namespace openshot {
/**
@@ -58,11 +56,11 @@ namespace openshot {
class ZmqLogger {
private:
CriticalSection loggerCriticalSection;
string connection;
std::string connection;
// Logfile related vars
string file_path;
ofstream log_file;
std::string file_path;
std::ofstream log_file;
bool enabled;
/// ZMQ Context
@@ -96,30 +94,31 @@ namespace openshot {
static ZmqLogger * Instance();
/// Append debug information
void AppendDebugMethod(string method_name, string arg1_name, float arg1_value,
string arg2_name, float arg2_value,
string arg3_name, float arg3_value,
string arg4_name, float arg4_value,
string arg5_name, float arg5_value,
string arg6_name, float arg6_value);
void AppendDebugMethod(std::string method_name,
std::string arg1_name="", float arg1_value=-1.0,
std::string arg2_name="", float arg2_value=-1.0,
std::string arg3_name="", float arg3_value=-1.0,
std::string arg4_name="", float arg4_value=-1.0,
std::string arg5_name="", float arg5_value=-1.0,
std::string arg6_name="", float arg6_value=-1.0);
/// Close logger (sockets and/or files)
void Close();
/// Set or change connection info for logger (i.e. tcp://*:5556)
void Connection(string new_connection);
void Connection(std::string new_connection);
/// Enable/Disable logging
void Enable(bool is_enabled) { enabled = is_enabled;};
/// Set or change the file path (optional)
void Path(string new_path);
void Path(std::string new_path);
/// Log message to all subscribers of this logger (if any)
void Log(string message);
void Log(std::string message);
/// Log message to a file (if path set)
void LogToFile(string message);
void LogToFile(std::string message);
};
}

View File

@@ -75,8 +75,8 @@ namespace openshot
/// Default constructor, which takes 2 curves. The curves adjust the brightness and
// contrast of a frame's image.
///
/// @param new_brightness The curve to adjust the brightness (between 100 and -100)
/// @param new_contrast The curve to adjust the contrast (3 is typical, 20 is a lot, 0 is invalid)
/// @param new_brightness The curve to adjust the brightness (from -1 to +1, 0 is default/"off")
/// @param new_contrast The curve to adjust the contrast (3 is typical, 20 is a lot, 100 is max. 0 is invalid)
Brightness(Keyframe new_brightness, Keyframe new_contrast);
/// @brief This method is required for all derived classes of EffectBase, and returns a

View File

@@ -66,7 +66,7 @@ void AudioReaderSource::GetMoreSamplesFromReader()
}
// Debug
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::GetMoreSamplesFromReader", "amount_needed", amount_needed, "amount_remaining", amount_remaining, "", -1, "", -1, "", -1, "", -1);
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::GetMoreSamplesFromReader", "amount_needed", amount_needed, "amount_remaining", amount_remaining);
// Init estimated buffer equal to the current frame position (before getting more samples)
estimated_frame = frame_number;
@@ -149,7 +149,7 @@ juce::AudioSampleBuffer* AudioReaderSource::reverse_buffer(juce::AudioSampleBuff
int channels = buffer->getNumChannels();
// Debug
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::reverse_buffer", "number_of_samples", number_of_samples, "channels", channels, "", -1, "", -1, "", -1, "", -1);
ZmqLogger::Instance()->AppendDebugMethod("AudioReaderSource::reverse_buffer", "number_of_samples", number_of_samples, "channels", channels);
// Reverse array (create new buffer to hold the reversed version)
AudioSampleBuffer *reversed = new juce::AudioSampleBuffer(channels, number_of_samples);

View File

@@ -24,6 +24,9 @@
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
################################################################################
# Pick up our include directories from the parent context
include_directories(${OPENSHOT_INCLUDE_DIRS})
################ OPTIONS ##################
# Optional build settings for libopenshot
OPTION(USE_SYSTEM_JSONCPP "Use system installed JsonCpp" OFF)
@@ -109,7 +112,7 @@ ENDIF (AVRESAMPLE_FOUND)
################# LIBOPENSHOT-AUDIO ###################
# Find JUCE-based openshot Audio libraries
FIND_PACKAGE(OpenShotAudio REQUIRED)
FIND_PACKAGE(OpenShotAudio 0.1.8 REQUIRED)
# Include Juce headers (needed for compile)
include_directories(${LIBOPENSHOT_AUDIO_INCLUDE_DIRS})
@@ -302,7 +305,7 @@ add_library(openshot SHARED
set_target_properties(openshot
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${SO_VERSION}
SOVERSION ${PROJECT_SO_VERSION}
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
)
@@ -403,6 +406,7 @@ set(LIB_INSTALL_DIR lib${LIB_SUFFIX}) # determine correct lib folder
INSTALL( TARGETS openshot
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${LIB_INSTALL_DIR}
COMPONENT library )
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/

View File

@@ -495,6 +495,8 @@ Json::Value CacheDisk::JsonValue() {
string errors;
bool success = reader->parse( json_ranges.c_str(),
json_ranges.c_str() + json_ranges.size(), &ranges, &errors );
delete reader;
if (success)
root["ranges"] = ranges;
@@ -512,7 +514,9 @@ void CacheDisk::SetJson(string value) {
string errors;
bool success = reader->parse( value.c_str(),
value.c_str() + value.size(), &root, &errors );
value.c_str() + value.size(), &root, &errors );
delete reader;
if (!success)
// Raise exception
throw InvalidJSON("JSON could not be parsed (or is invalid)", "");
@@ -522,7 +526,7 @@ void CacheDisk::SetJson(string value) {
// Set all values that match
SetJsonValue(root);
}
catch (exception e)
catch (const std::exception& e)
{
// Error parsing JSON (or missing keys)
throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", "");

View File

@@ -345,10 +345,11 @@ Json::Value CacheMemory::JsonValue() {
Json::Value ranges;
Json::CharReaderBuilder rbuilder;
Json::CharReader* reader(rbuilder.newCharReader());
string errors;
bool success = reader->parse( json_ranges.c_str(),
json_ranges.c_str() + json_ranges.size(), &ranges, &errors );
delete reader;
if (success)
root["ranges"] = ranges;
@@ -368,6 +369,7 @@ void CacheMemory::SetJson(string value) {
string errors;
bool success = reader->parse( value.c_str(),
value.c_str() + value.size(), &root, &errors );
delete reader;
if (!success)
// Raise exception
throw InvalidJSON("JSON could not be parsed (or is invalid)", "");
@@ -377,7 +379,7 @@ void CacheMemory::SetJson(string value) {
// Set all values that match
SetJsonValue(root);
}
catch (exception e)
catch (const std::exception& e)
{
// Error parsing JSON (or missing keys)
throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", "");

View File

@@ -121,7 +121,7 @@ void ChunkReader::load_json()
info.audio_timebase.den = root["audio_timebase"]["den"].asInt();
}
catch (exception e)
catch (const std::exception& e)
{
// Error parsing JSON (or missing keys)
throw InvalidJSON("JSON could not be parsed (or is invalid).", path);
@@ -235,7 +235,7 @@ std::shared_ptr<Frame> ChunkReader::GetFrame(int64_t requested_frame)
local_reader = new FFmpegReader(chunk_video_path);
local_reader->Open(); // open reader
} catch (InvalidFile)
} catch (const InvalidFile& e)
{
// Invalid Chunk (possibly it is not found)
throw ChunkNotFound(path, requested_frame, location.number, location.frame);
@@ -285,10 +285,11 @@ void ChunkReader::SetJson(string value) {
Json::Value root;
Json::CharReaderBuilder rbuilder;
Json::CharReader* reader(rbuilder.newCharReader());
string errors;
bool success = reader->parse( value.c_str(),
value.c_str() + value.size(), &root, &errors );
delete reader;
if (!success)
// Raise exception
throw InvalidJSON("JSON could not be parsed (or is invalid)", "");
@@ -298,7 +299,7 @@ void ChunkReader::SetJson(string value) {
// Set all values that match
SetJsonValue(root);
}
catch (exception e)
catch (const std::exception& e)
{
// Error parsing JSON (or missing keys)
throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", "");

View File

@@ -79,9 +79,9 @@ void Clip::init_settings()
wave_color = Color((unsigned char)0, (unsigned char)123, (unsigned char)255, (unsigned char)255);
// Init crop settings
crop_gravity = GRAVITY_CENTER;
crop_width = Keyframe(-1.0);
crop_height = Keyframe(-1.0);
crop_gravity = GRAVITY_TOP_LEFT;
crop_width = Keyframe(1.0);
crop_height = Keyframe(1.0);
crop_x = Keyframe(0.0);
crop_y = Keyframe(0.0);
@@ -123,7 +123,7 @@ void Clip::init_reader_rotation() {
try {
float rotate_metadata = strtof(reader->info.metadata["rotate"].c_str(), 0);
rotation = Keyframe(rotate_metadata);
} catch (exception e) {}
} catch (const std::exception& e) {}
}
else
// Default no rotation
@@ -259,7 +259,7 @@ void Clip::Open()
void Clip::Close()
{
if (reader) {
ZmqLogger::Instance()->AppendDebugMethod("Clip::Close", "", -1, "", -1, "", -1, "", -1, "", -1, "", -1);
ZmqLogger::Instance()->AppendDebugMethod("Clip::Close");
// Close the reader
reader->Close();
@@ -616,7 +616,7 @@ std::shared_ptr<Frame> Clip::GetOrCreateFrame(int64_t number)
try {
// Debug output
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (from reader)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1);
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (from reader)", "number", number, "samples_in_frame", samples_in_frame);
// Attempt to get a frame (but this could fail if a reader has just been closed)
new_frame = reader->GetFrame(number);
@@ -634,7 +634,7 @@ std::shared_ptr<Frame> Clip::GetOrCreateFrame(int64_t number)
}
// Debug output
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (create blank)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1);
ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (create blank)", "number", number, "samples_in_frame", samples_in_frame);
// Create blank frame
new_frame = std::make_shared<Frame>(number, reader->info.width, reader->info.height, "#000000", samples_in_frame, reader->info.channels);
@@ -716,6 +716,19 @@ string Clip::PropertiesJSON(int64_t requested_frame) {
root["has_audio"] = add_property_json("Enable Audio", has_audio.GetValue(requested_frame), "int", "", &has_audio, -1, 1.0, false, requested_frame);
root["has_video"] = add_property_json("Enable Video", has_video.GetValue(requested_frame), "int", "", &has_video, -1, 1.0, false, requested_frame);
// Add enable audio/video choices (dropdown style)
root["has_audio"]["choices"].append(add_property_choice_json("Auto", -1, has_audio.GetValue(requested_frame)));
root["has_audio"]["choices"].append(add_property_choice_json("Off", 0, has_audio.GetValue(requested_frame)));
root["has_audio"]["choices"].append(add_property_choice_json("On", 1, has_audio.GetValue(requested_frame)));
root["has_video"]["choices"].append(add_property_choice_json("Auto", -1, has_video.GetValue(requested_frame)));
root["has_video"]["choices"].append(add_property_choice_json("Off", 0, has_video.GetValue(requested_frame)));
root["has_video"]["choices"].append(add_property_choice_json("On", 1, has_video.GetValue(requested_frame)));
root["crop_x"] = add_property_json("Crop X", crop_x.GetValue(requested_frame), "float", "", &crop_x, -1.0, 1.0, false, requested_frame);
root["crop_y"] = add_property_json("Crop Y", crop_y.GetValue(requested_frame), "float", "", &crop_y, -1.0, 1.0, false, requested_frame);
root["crop_width"] = add_property_json("Crop Width", crop_width.GetValue(requested_frame), "float", "", &crop_width, 0.0, 1.0, false, requested_frame);
root["crop_height"] = add_property_json("Crop Height", crop_height.GetValue(requested_frame), "float", "", &crop_height, 0.0, 1.0, false, requested_frame);
root["wave_color"] = add_property_json("Wave Color", 0.0, "color", "", &wave_color.red, 0, 255, false, requested_frame);
root["wave_color"]["red"] = add_property_json("Red", wave_color.red.GetValue(requested_frame), "float", "", &wave_color.red, 0, 255, false, requested_frame);
root["wave_color"]["blue"] = add_property_json("Blue", wave_color.blue.GetValue(requested_frame), "float", "", &wave_color.blue, 0, 255, false, requested_frame);
@@ -791,10 +804,12 @@ void Clip::SetJson(string value) {
Json::Value root;
Json::CharReaderBuilder rbuilder;
Json::CharReader* reader(rbuilder.newCharReader());
string errors;
bool success = reader->parse( value.c_str(),
value.c_str() + value.size(), &root, &errors );
delete reader;
if (!success)
// Raise exception
throw InvalidJSON("JSON could not be parsed (or is invalid)", "");
@@ -804,7 +819,7 @@ void Clip::SetJson(string value) {
// Set all values that match
SetJsonValue(root);
}
catch (exception e)
catch (const std::exception& e)
{
// Error parsing JSON (or missing keys)
throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", "");

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