Skip to content

Commit

Permalink
Merge branch 'develop' into clip-refactor-keyframes
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/CacheDisk.cpp
#	src/Clip.cpp
#	src/Frame.cpp
#	src/QtHtmlReader.cpp
#	src/QtImageReader.cpp
#	src/QtTextReader.cpp
#	src/effects/Bars.cpp
#	src/effects/Crop.cpp
  • Loading branch information
jonoomph committed Oct 16, 2020
2 parents 1eecda3 + 8f6c642 commit 1dfbb0e
Show file tree
Hide file tree
Showing 32 changed files with 523 additions and 423 deletions.
11 changes: 7 additions & 4 deletions .gitlab-ci.yml
Expand Up @@ -2,6 +2,9 @@ stages:
- build-libopenshot
- trigger-openshot-qt

variables:
GIT_LOG_FORMAT: "- %h %ad %s [%aN]"

linux-builder:
stage: build-libopenshot
artifacts:
Expand All @@ -22,7 +25,7 @@ linux-builder:
- make doc
- ~/auto-update-docs "$CI_PROJECT_DIR/build" "$CI_COMMIT_REF_NAME"
- echo -e "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" > "install-x64/share/$CI_PROJECT_NAME"
- git log $(git describe --tags --abbrev=0 @^)..@ --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"
- git log $(git describe --tags --abbrev=0 '@^')..@ --oneline --no-abbrev --date=short --no-merges --pretty="tformat:$GIT_LOG_FORMAT" > "install-x64/share/$CI_PROJECT_NAME.log"
when: always
except:
- tags
Expand All @@ -47,7 +50,7 @@ mac-builder:
- make
- make install
- echo -e "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" > "install-x64/share/$CI_PROJECT_NAME"
- git log $(git describe --tags --abbrev=0 @^)..@ --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"
- git log $(git describe --tags --abbrev=0 '@^')..@ --oneline --no-abbrev --date=short --no-merges --pretty="tformat:$GIT_LOG_FORMAT" > "install-x64/share/$CI_PROJECT_NAME.log"
when: always
except:
- tags
Expand All @@ -74,7 +77,7 @@ windows-builder-x64:
- mingw32-make install
- 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"
- git log "$PREV_GIT_LABEL..@" --oneline --no-abbrev --date=short --no-merges --pretty="tformat:$GIT_LOG_FORMAT" > "install-x64/share/$CI_PROJECT_NAME.log"
when: always
except:
- tags
Expand All @@ -101,7 +104,7 @@ windows-builder-x86:
- mingw32-make install
- 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..@" --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"
- git log "$PREV_GIT_LABEL..@" --oneline --no-abbrev --date=short --no-merges --pretty="tformat:$GIT_LOG_FORMAT" > "install-x86/share/$CI_PROJECT_NAME.log"
when: always
except:
- tags
Expand Down
2 changes: 1 addition & 1 deletion include/DummyReader.h
Expand Up @@ -69,7 +69,7 @@ namespace openshot
* // 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));
* auto f = std::make_shared<openshot::Frame>(frame_number, sample_count, 2);
*
* // Create test samples with incrementing value
* float *audio_buffer = new float[sample_count];
Expand Down
15 changes: 7 additions & 8 deletions include/FFmpegReader.h
Expand Up @@ -233,14 +233,13 @@ namespace openshot {
/// codecs have trouble seeking, and can introduce artifacts or blank images into the video.
bool enable_seek;

/// Constructor for FFmpegReader. This automatically opens the media file and loads
/// frame 1, or it throws one of the following exceptions.
FFmpegReader(std::string path);

/// Constructor for FFmpegReader. This only opens the media file to inspect its properties
/// if inspect_reader=true. When not inspecting the media file, it's much faster, and useful
/// when you are inflating the object using JSON after instantiating it.
FFmpegReader(std::string path, bool inspect_reader);
/// @brief Constructor for FFmpegReader.
///
/// Sets (and possibly opens) the media file path,
/// or throws an exception.
/// @param path The filesystem location to load
/// @param inspect_reader if true (the default), automatically open the media file and loads frame 1.
FFmpegReader(const std::string& path, bool inspect_reader=true);

/// Destructor
virtual ~FFmpegReader();
Expand Down
8 changes: 4 additions & 4 deletions include/FFmpegWriter.h
Expand Up @@ -47,8 +47,6 @@

#include <cmath>
#include <ctime>
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include "CacheMemory.h"
#include "Exceptions.h"
Expand Down Expand Up @@ -251,9 +249,11 @@ namespace openshot {

public:

/// @brief Constructor for FFmpegWriter. Throws one of the following exceptions.
/// @brief Constructor for FFmpegWriter.
/// Throws an exception on failure to open path.
///
/// @param path The file path of the video file you want to open and read
FFmpegWriter(std::string path);
FFmpegWriter(const std::string& path);

/// Close the writer
void Close();
Expand Down
26 changes: 9 additions & 17 deletions include/Frame.h
Expand Up @@ -34,16 +34,8 @@
#include <iomanip>
#include <sstream>
#include <queue>
#include <QtWidgets/QApplication>
#include <QtGui/QImage>
#include <QtGui/QColor>
#include <QtGui/QBitmap>
#include <QtCore/QString>
#include <QtCore/QVector>
#include <QtGui/QPainter>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QWidget>
#include <QtWidgets/QLabel>
#include <QApplication>
#include <QImage>
#include <memory>
#include <unistd.h>
#include "ZmqLogger.h"
Expand Down Expand Up @@ -73,17 +65,17 @@ namespace openshot
* There are many ways to create an instance of an openshot::Frame:
* @code
*
* // Most basic: a blank frame (300x200 blank image, 48kHz audio silence)
* // Most basic: a blank frame (all default values)
* Frame();
*
* // Image only settings (48kHz audio silence)
* // Image only settings
* Frame(1, // Frame number
* 720, // Width of image
* 480, // Height of image
* "#000000" // HTML color code of background color
* );
*
* // Audio only (300x200 blank image)
* // Audio only
* Frame(number, // Frame number
* 44100, // Sample rate of audio stream
* 2 // Number of audio channels
Expand All @@ -99,7 +91,7 @@ namespace openshot
* );
*
* // Some methods require a shared pointer to an openshot::Frame object.
* std::shared_ptr<Frame> f(new Frame(1, 720, 480, "#000000", 44100, 2));
* auto f = std::make_shared<openshot::Frame>(1, 720, 480, "#000000", 44100, 2);
*
* @endcode
*/
Expand Down Expand Up @@ -131,13 +123,13 @@ namespace openshot
bool has_image_data; ///< This frame has been loaded with pixel data


/// Constructor - blank frame (300x200 blank image, 48kHz audio silence)
/// Constructor - blank frame
Frame();

/// Constructor - image only (48kHz audio silence)
/// Constructor - image only
Frame(int64_t number, int width, int height, std::string color);

/// Constructor - audio only (300x200 blank image)
/// Constructor - audio only
Frame(int64_t number, int samples, int channels);

/// Constructor - image & audio
Expand Down
7 changes: 7 additions & 0 deletions include/OpenMPUtilities.h
Expand Up @@ -41,5 +41,12 @@
#define OPEN_MP_NUM_PROCESSORS (std::min(omp_get_num_procs(), std::max(2, openshot::Settings::Instance()->OMP_THREADS) ))
#define FF_NUM_PROCESSORS (std::min(omp_get_num_procs(), std::max(2, openshot::Settings::Instance()->FF_THREADS) ))

// 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()
#else
#define OPEN_MP_MAX_ACTIVE OPEN_MP_NUM_PROCESSORS
#endif

#endif
6 changes: 4 additions & 2 deletions include/Qt/VideoRenderWidget.h
Expand Up @@ -31,11 +31,13 @@
#ifndef OPENSHOT_VIDEO_RENDERER_WIDGET_H
#define OPENSHOT_VIDEO_RENDERER_WIDGET_H

#include <QtWidgets/QWidget>
#include <QtGui/QImage>
#include "../Fraction.h"
#include "VideoRenderer.h"

#include <QWidget>
#include <QImage>
#include <QPaintEvent>
#include <QRect>

class VideoRenderWidget : public QWidget
{
Expand Down
22 changes: 13 additions & 9 deletions include/Timeline.h
Expand Up @@ -219,19 +219,23 @@ namespace openshot {

public:

/// @brief Default Constructor for the timeline (which sets the canvas width and height and FPS)
/// @param width The width of the timeline (and thus, the generated openshot::Frame objects)
/// @param height The height of the timeline (and thus, the generated openshot::Frame objects)
/// @param fps The frames rate of the timeline
/// @param sample_rate The sample rate of the timeline's audio
/// @param channels The number of audio channels of the timeline
/// @brief Default Constructor for the timeline (which configures the default frame properties)
/// @param width The image width of generated openshot::Frame objects
/// @param height The image height of generated openshot::Frame objects
/// @param fps The frame rate of the generated video
/// @param sample_rate The audio sample rate
/// @param channels The number of audio channels
/// @param channel_layout The channel layout (i.e. mono, stereo, 3 point surround, etc...)
Timeline(int width, int height, openshot::Fraction fps, int sample_rate, int channels, openshot::ChannelLayout channel_layout);

/// @brief Constructor for the timeline (which loads a JSON structure from a file path, and initializes a timeline)
/// @brief Project-file constructor for the timeline
///
/// Loads a JSON structure from a file path, and
/// initializes the timeline described within.
///
/// @param projectPath The path of the UTF-8 *.osp project file (JSON contents). Contents will be loaded automatically.
/// @param convert_absolute_paths Should all paths be converted to absolute paths (based on the folder of the path provided)
Timeline(std::string projectPath, bool convert_absolute_paths);
/// @param convert_absolute_paths Should all paths be converted to absolute paths (relative to the location of projectPath)
Timeline(const std::string& projectPath, bool convert_absolute_paths);

virtual ~Timeline();

Expand Down
1 change: 0 additions & 1 deletion include/effects/Pixelate.h
Expand Up @@ -36,7 +36,6 @@
#include <cmath>
#include <stdio.h>
#include <memory>
#include "../Color.h"
#include "../Json.h"
#include "../KeyFrame.h"

Expand Down
14 changes: 10 additions & 4 deletions include/effects/Saturation.h
Expand Up @@ -64,15 +64,21 @@ namespace openshot
void init_effect_details();

public:
Keyframe saturation; ///< The color saturation: 0.0 = black and white, 1.0 = normal, 2.0 = double saturation
Keyframe saturation; ///< Overall color saturation: 0.0 = greyscale, 1.0 = normal, 2.0 = double saturation
Keyframe saturation_R; ///< Red color saturation
Keyframe saturation_G; ///< Green color saturation
Keyframe saturation_B; ///< Blue color saturation

/// Blank constructor, useful when using Json to load the effect properties
Saturation();

/// Default constructor, which takes 1 curve, to adjust the color saturation over time.
/// Default constructor, which takes four curves (one common curve and one curve per color), to adjust the color saturation over time.
///
/// @param new_saturation The curve to adjust the saturation of the frame's image (0.0 = black and white, 1.0 = normal, 2.0 = double saturation)
Saturation(Keyframe new_saturation);
/// @param saturation The curve to adjust the saturation of the frame's image (0.0 = greyscale, 1.0 = normal, 2.0 = double saturation)
/// @param saturation_R The curve to adjust red saturation of the frame's image (0.0 = greyscale, 1.0 = normal, 2.0 = double saturation)
/// @param saturation_G The curve to adjust green saturation of the frame's image (0.0 = greyscale, 1.0 = normal, 2.0 = double saturation)
/// @param saturation_B The curve to adjust blue saturation of the frame's image (0.0 = greyscale, 1.0 = normal, 2.0 = double saturation)
Saturation(Keyframe saturation, Keyframe saturation_R, Keyframe saturation_G, Keyframe saturation_B);

/// @brief This method is required for all derived classes of ClipBase, and returns a
/// new openshot::Frame object. All Clip keyframes and effects are resolved into
Expand Down
6 changes: 3 additions & 3 deletions src/CacheDisk.cpp
Expand Up @@ -231,14 +231,14 @@ std::shared_ptr<Frame> CacheDisk::GetFrame(int64_t frame_number)
if (path.exists(frame_path)) {

// Load image file
std::shared_ptr<QImage> image = std::shared_ptr<QImage>(new QImage());
auto image = std::make_shared<QImage>();
image->load(frame_path);

// Set pixel formatimage->
image = std::shared_ptr<QImage>(new QImage(image->convertToFormat(QImage::Format_RGBA8888_Premultiplied)));
image = std::make_shared<QImage>(image->convertToFormat(QImage::Format_RGBA8888_Premultiplied));

// Create frame object
std::shared_ptr<Frame> frame(new Frame());
auto frame = std::make_shared<Frame>();
frame->number = frame_number;
frame->AddImage(image);

Expand Down
4 changes: 3 additions & 1 deletion src/ChunkWriter.cpp
Expand Up @@ -134,7 +134,9 @@ void ChunkWriter::WriteFrame(std::shared_ptr<Frame> frame)
writer_thumb->WriteFrame(last_frame);
} else {
// Write the 1st frame (of the 1st chunk)... since no previous chunk is available
std::shared_ptr<Frame> blank_frame(new Frame(1, info.width, info.height, "#000000", info.sample_rate, info.channels));
auto blank_frame = std::make_shared<Frame>(
1, info.width, info.height, "#000000",
info.sample_rate, info.channels);
blank_frame->AddColor(info.width, info.height, "#000000");
writer_final->WriteFrame(blank_frame);
writer_preview->WriteFrame(blank_frame);
Expand Down
2 changes: 1 addition & 1 deletion src/Clip.cpp
Expand Up @@ -387,7 +387,7 @@ std::shared_ptr<Frame> Clip::GetFrame(std::shared_ptr<openshot::Frame> frame, in

// Copy the image from the odd field
if (enabled_video)
frame->AddImage(std::shared_ptr<QImage>(new QImage(*original_frame->GetImage())));
frame->AddImage(std::make_shared<QImage>(*original_frame->GetImage()));

// Loop through each channel, add audio
if (enabled_audio && reader->info.has_audio)
Expand Down
8 changes: 3 additions & 5 deletions src/DecklinkInput.cpp
Expand Up @@ -139,7 +139,7 @@ HRESULT DeckLinkInputDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame*
{
// Handle Video Frame
if(videoFrame)
{
{

if (videoFrame->GetFlags() & bmdFrameHasNoInputSource)
{
Expand Down Expand Up @@ -245,7 +245,8 @@ omp_set_nested(true);
m_rgbFrame->GetBytes(&frameBytes);

// *********** CREATE OPENSHOT FRAME **********
std::shared_ptr<openshot::Frame> f(new openshot::Frame(copy_frameCount, width, height, "#000000", 2048, 2));
auto f = std::make_shared<openshot::Frame>(
copy_frameCount, width, height, "#000000", 2048, 2);

// Add Image data to openshot frame
// TODO: Fix Decklink support with QImage Upgrade
Expand Down Expand Up @@ -289,6 +290,3 @@ HRESULT DeckLinkInputDelegate::VideoInputFormatChanged(BMDVideoInputFormatChange
{
return S_OK;
}



2 changes: 1 addition & 1 deletion src/DecklinkWriter.cpp
Expand Up @@ -142,7 +142,7 @@ void DecklinkWriter::Open()
// throw DecklinkError("Failed to enable audio output. Is another application using the card?");

// Begin video preroll by scheduling a second of frames in hardware
//std::shared_ptr<Frame> f(new Frame(1, displayMode->GetWidth(), displayMode->GetHeight(), "Blue"));
//auto f = std::make_shared<Frame>(1, displayMode->GetWidth(), displayMode->GetHeight(), "Blue");
//f->AddColor(displayMode->GetWidth(), displayMode->GetHeight(), "Blue");

// Preroll 1 second of video
Expand Down

0 comments on commit 1dfbb0e

Please sign in to comment.