Merge branch 'fix-swig-flags' into opencv_build_config

This commit is contained in:
FeRD (Frank Dana)
2021-01-13 09:20:35 -05:00
17 changed files with 4220 additions and 81 deletions

9
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -1,19 +0,0 @@
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler/blob/master/README.md
name: Labeler
on: [pull_request]
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

View File

@@ -58,6 +58,12 @@ endif()
set_property(SOURCE openshot.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE openshot.i PROPERTY SWIG_MODULE_NAME openshot)
# Set the SWIG_FLAGS from the library target, IFF its
# COMPILE_DEFINITIONS property is set (in practice, always true)
set(defs $<TARGET_PROPERTY:openshot,COMPILE_DEFINITIONS>)
set_property(SOURCE openshot.i PROPERTY
SWIG_FLAGS $<$<BOOL:${defs}>:-D$<JOIN:${defs}, -D>>)
### Suppress a ton of warnings in the generated SWIG C++ code
set(SWIG_CXX_FLAGS "-Wno-unused-variable -Wno-unused-function \
-Wno-deprecated-copy -Wno-class-memaccess -Wno-cast-function-type \

View File

@@ -74,6 +74,12 @@ endif()
set_property(SOURCE openshot.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE openshot.i PROPERTY SWIG_MODULE_NAME openshot)
# Set the SWIG_FLAGS from the library target, IFF its
# COMPILE_DEFINITIONS property is set (in practice, always true)
set(defs $<TARGET_PROPERTY:openshot,COMPILE_DEFINITIONS>)
set_property(SOURCE openshot.i PROPERTY
SWIG_FLAGS $<$<BOOL:${defs}>:-D$<JOIN:${defs}, -D>>)
### Suppress a ton of warnings in the generated SWIG C++ code
set(SWIG_CXX_FLAGS "-Wno-unused-variable -Wno-unused-function \
-Wno-deprecated-copy -Wno-class-memaccess -Wno-cast-function-type \
@@ -83,9 +89,9 @@ set_property(SOURCE openshot.i PROPERTY GENERATED_COMPILE_OPTIONS ${sw_flags})
### Take include dirs from target, automatically if possible
if (CMAKE_VERSION VERSION_GREATER 3.13)
set_property(SOURCE openshot.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES True)
else ()
set_property(SOURCE openshot.i PROPERTY
set_property(SOURCE openshot.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES True)
elseif (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(SOURCE openshot.i PROPERTY
INCLUDE_DIRECTORIES $<TARGET_PROPERTY:openshot,INCLUDE_DIRECTORIES>)
endif ()

View File

@@ -1,10 +1,8 @@
codecov:
branch: default
coverage:
status:
project:
default:
base: pr # Only post a status to pull requests
only_pulls: true # Only post a status to pull requests
informational: true # Don't block PRs based on coverage stats (yet?)
ignore:
- "examples"

4174
iwyu.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -97,8 +97,6 @@ void AudioReaderSource::GetMoreSamplesFromReader()
} catch (const ReaderClosed & e) {
break;
} catch (const TooManySeeks & e) {
break;
} catch (const OutOfBoundsFrame & e) {
break;
}

View File

@@ -225,7 +225,6 @@ if(ImageMagick_FOUND)
# define a preprocessor macro (used in the C++ source)
target_compile_definitions(openshot PUBLIC USE_IMAGEMAGICK=1)
list(APPEND CMAKE_SWIG_FLAGS -DUSE_IMAGEMAGICK=1)
# Link with ImageMagick library
target_link_libraries(openshot PUBLIC ImageMagick::Magick++)
@@ -359,8 +358,7 @@ if (TARGET Resvg::Resvg)
#include_directories(${Resvg_INCLUDE_DIRS})
target_link_libraries(openshot PUBLIC Resvg::Resvg)
target_compile_definitions(openshot PUBLIC -DUSE_RESVG=1)
list(APPEND CMAKE_SWIG_FLAGS -DUSE_RESVG=1)
target_compile_definitions(openshot PUBLIC USE_RESVG=1)
set(HAVE_RESVG TRUE CACHE BOOL "Building with Resvg support" FORCE)
mark_as_advanced(HAVE_RESVG)
@@ -386,8 +384,7 @@ if (ENABLE_BLACKMAGIC)
target_link_libraries(openshot PUBLIC ${BLACKMAGIC_LIBRARY_DIR})
# define a preprocessor macro (used in the C++)
target_compile_definitions(openshot PUBLIC -DUSE_BLACKMAGIC=1)
list(APPEND CMAKE_SWIG_FLAGS -DUSE_BLACKMAGIC=1)
target_compile_definitions(openshot PUBLIC USE_BLACKMAGIC=1)
endif()
endif()

View File

@@ -717,8 +717,6 @@ std::shared_ptr<Frame> Clip::GetOrCreateFrame(int64_t number)
} catch (const ReaderClosed & e) {
// ...
} catch (const TooManySeeks & e) {
// ...
} catch (const OutOfBoundsFrame & e) {
// ...
}

View File

@@ -365,22 +365,6 @@ namespace openshot {
virtual ~ResampleError() noexcept {}
};
/// Exception when too many seek attempts happen
class TooManySeeks : public ExceptionBase
{
public:
std::string file_path;
/**
* @brief Constructor
*
* @param message A message to accompany the exception
* @param file_path (optional) The input file being processed
*/
TooManySeeks(std::string message, std::string 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 ExceptionBase
{

View File

@@ -1355,7 +1355,13 @@ void FFmpegReader::ProcessVideoPacket(int64_t requested_frame) {
std::shared_ptr<Frame> f = CreateFrame(current_frame);
// Add Image data to frame
f->AddImage(width, height, 4, QImage::Format_RGBA8888_Premultiplied, buffer);
if (!ffmpeg_has_alpha(AV_GET_CODEC_PIXEL_FORMAT(pStream, pCodecCtx))) {
// Add image with no alpha channel, Speed optimization
f->AddImage(width, height, 4, QImage::Format_RGBA8888_Premultiplied, buffer);
} else {
// Add image with alpha channel (this will be converted to premultipled when needed, but is slower)
f->AddImage(width, height, 4, QImage::Format_RGBA8888, buffer);
}
// Update working cache
working_cache.Add(f);

View File

@@ -126,6 +126,16 @@
#define PIX_FMT_YUV444P AV_PIX_FMT_YUV444P
#endif
// Does ffmpeg pixel format contain an alpha channel?
inline static const bool ffmpeg_has_alpha(PixelFormat pix_fmt)
{
if (pix_fmt == AV_PIX_FMT_ARGB || pix_fmt == AV_PIX_FMT_RGBA || pix_fmt == AV_PIX_FMT_ABGR || pix_fmt == AV_PIX_FMT_BGRA || pix_fmt == AV_PIX_FMT_YUVA420P) {
return true;
} else {
return false;
}
}
// FFmpeg's libavutil/common.h defines an RSHIFT incompatible with Ruby's
// definition in ruby/config.h, so we move it to FF_RSHIFT
#ifdef RSHIFT

View File

@@ -369,8 +369,6 @@ std::shared_ptr<Frame> FrameMapper::GetOrCreateFrame(int64_t number)
} catch (const ReaderClosed & e) {
// ...
} catch (const TooManySeeks & e) {
// ...
} catch (const OutOfBoundsFrame & e) {
// ...
}

View File

@@ -44,7 +44,7 @@
// Set max-active-levels to the max supported, if possible
// (supported_active_levels is OpenMP 5.0 (November 2018) or later, only.)
#if (_OPENMP >= 201811)
#define OPEN_MP_MAX_ACTIVE openmp_get_supported_active_levels()
#define OPEN_MP_MAX_ACTIVE omp_get_supported_active_levels()
#else
#define OPEN_MP_MAX_ACTIVE OPEN_MP_NUM_PROCESSORS
#endif

View File

@@ -40,18 +40,6 @@
namespace openshot
{
struct SafeTimeSliceThread : juce::TimeSliceThread
{
SafeTimeSliceThread(const String & s) : juce::TimeSliceThread(s) {}
void run()
{
try {
juce::TimeSliceThread::run();
} catch (const TooManySeeks & e) {
// ...
}
}
};
/**
* @brief Singleton wrapper for AudioDeviceManager (to prevent multiple instances).
@@ -96,8 +84,7 @@ namespace openshot
juce::WaitableEvent played;
int buffer_size;
bool is_playing;
SafeTimeSliceThread time_thread;
juce::TimeSliceThread time_thread;
/// Constructor
AudioPlaybackThread();
/// Destructor

View File

@@ -174,8 +174,6 @@ namespace openshot
} catch (const ReaderClosed & e) {
// ...
} catch (const TooManySeeks & e) {
// ...
} catch (const OutOfBoundsFrame & e) {
// ...
}

View File

@@ -461,8 +461,6 @@ std::shared_ptr<Frame> Timeline::GetOrCreateFrame(Clip* clip, int64_t number)
} catch (const ReaderClosed & e) {
// ...
} catch (const TooManySeeks & e) {
// ...
} catch (const OutOfBoundsFrame & e) {
// ...
}
@@ -725,15 +723,6 @@ std::shared_ptr<Frame> Timeline::GetFrame(int64_t requested_frame)
return frame;
}
// Check if previous frame was cached? (if not, assume we are seeking somewhere else on the Timeline, and need
// to clear all cache (for continuity sake). For example, jumping back to a previous spot can cause issues with audio
// data where the new jump location doesn't match up with the previously cached audio data.
std::shared_ptr<Frame> previous_frame = final_cache->GetFrame(requested_frame - 1);
if (!previous_frame) {
// Seeking to new place on timeline (destroy cache)
ClearAllCache();
}
// Minimum number of frames to process (for performance reasons)
int minimum_frames = OPEN_MP_NUM_PROCESSORS;