Merge pull request #296 from OpenShot/std-prefixes

Remove all 'using namespace' directives from headers
This commit is contained in:
Jonathan Thomas
2019-11-17 16:18:14 -06:00
committed by GitHub
110 changed files with 1034 additions and 1132 deletions

View File

@@ -42,8 +42,6 @@
#include <iomanip>
#include "JuceHeader.h"
using namespace std;
/// This namespace is the default namespace for all code in the openshot library
namespace openshot
{

View File

@@ -37,10 +37,11 @@
*
* The type and name of the audio device.
*/
struct AudioDeviceInfo
{
string name;
string type;
};
#endif
namespace openshot {
struct AudioDeviceInfo
{
std::string name;
std::string type;
};
}
#endif

View File

@@ -43,8 +43,6 @@
#include "ReaderBase.h"
#include "JuceHeader.h"
using namespace std;
/// This namespace is the default namespace for all code in the openshot library
namespace openshot
{

View File

@@ -57,7 +57,7 @@ namespace openshot {
private:
juce::AudioSampleBuffer *buffer;
juce::AudioSampleBuffer *resampled_buffer;
AudioBufferSource *buffer_source;
openshot::AudioBufferSource *buffer_source;
juce::ResamplingAudioSource *resample_source;
juce::AudioSourceChannelInfo resample_callback_buffer;

View File

@@ -49,7 +49,7 @@ namespace openshot {
class CacheBase
{
protected:
string cache_type; ///< This is a friendly type name of the derived cache instance
std::string cache_type; ///< This is a friendly type name of the derived cache instance
int64_t max_bytes; ///< This is the max number of bytes to cache (0 = no limit)
/// Section lock for multiple threads
@@ -66,7 +66,7 @@ namespace openshot {
/// @brief Add a Frame to the cache
/// @param frame The openshot::Frame object needing to be cached.
virtual void Add(std::shared_ptr<Frame> frame) = 0;
virtual void Add(std::shared_ptr<openshot::Frame> frame) = 0;
/// Clear the cache of all frames
virtual void Clear() = 0;
@@ -76,13 +76,13 @@ namespace openshot {
/// @brief Get a frame from the cache
/// @param frame_number The frame number of the cached frame
virtual std::shared_ptr<Frame> GetFrame(int64_t frame_number) = 0;
virtual std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) = 0;
/// Gets the maximum bytes value
virtual int64_t GetBytes() = 0;
/// Get the smallest frame number
virtual std::shared_ptr<Frame> GetSmallestFrame() = 0;
virtual std::shared_ptr<openshot::Frame> GetSmallestFrame() = 0;
/// @brief Remove a specific frame
/// @param frame_number The frame number of the cached frame
@@ -109,8 +109,8 @@ namespace openshot {
void SetMaxBytesFromInfo(int64_t number_of_frames, int width, int height, int sample_rate, int channels);
/// Get and Set JSON methods
virtual string Json() = 0; ///< Generate JSON string of this object
virtual void SetJson(string value) = 0; ///< Load JSON string into this object
virtual std::string Json() = 0; ///< Generate JSON string of this object
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
virtual ~CacheBase() = default;

View File

@@ -53,24 +53,24 @@ namespace openshot {
class CacheDisk : public CacheBase {
private:
QDir path; ///< This is the folder path of the cache directory
map<int64_t, int64_t> frames; ///< This map holds the frame number and Frame objects
deque<int64_t> frame_numbers; ///< This queue holds a sequential list of cached Frame numbers
string image_format;
std::map<int64_t, int64_t> frames; ///< This map holds the frame number and Frame objects
std::deque<int64_t> frame_numbers; ///< This queue holds a sequential list of cached Frame numbers
std::string image_format;
float image_quality;
float image_scale;
int64_t frame_size_bytes; ///< The size of the cached frame in bytes
bool needs_range_processing; ///< Something has changed, and the range data needs to be re-calculated
string json_ranges; ///< JSON ranges of frame numbers
vector<int64_t> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
map<int64_t, int64_t> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
std::string json_ranges; ///< JSON ranges of frame numbers
std::vector<int64_t> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
std::map<int64_t, int64_t> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
int64_t range_version; ///< The version of the JSON range data (incremented with each change)
/// Clean up cached frames that exceed the max number of bytes
void CleanUp();
/// Init path directory
void InitPath(string cache_path);
void InitPath(std::string cache_path);
/// Calculate ranges of frames
void CalculateRanges();
@@ -81,7 +81,7 @@ namespace openshot {
/// @param format The image format for disk caching (ppm, jpg, png)
/// @param quality The quality of the image (1.0=highest quality/slowest speed, 0.0=worst quality/fastest speed)
/// @param scale The scale factor for the preview images (1.0 = original size, 0.5=half size, 0.25=quarter size, etc...)
CacheDisk(string cache_path, string format, float quality, float scale);
CacheDisk(std::string cache_path, std::string format, float quality, float scale);
/// @brief Constructor that sets the max bytes to cache
/// @param cache_path The folder path of the cache directory (empty string = /tmp/preview-cache/)
@@ -89,14 +89,14 @@ namespace openshot {
/// @param quality The quality of the image (1.0=highest quality/slowest speed, 0.0=worst quality/fastest speed)
/// @param scale The scale factor for the preview images (1.0 = original size, 0.5=half size, 0.25=quarter size, etc...)
/// @param max_bytes The maximum bytes to allow in the cache. Once exceeded, the cache will purge the oldest frames.
CacheDisk(string cache_path, string format, float quality, float scale, int64_t max_bytes);
CacheDisk(std::string cache_path, std::string format, float quality, float scale, int64_t max_bytes);
// Default destructor
~CacheDisk();
/// @brief Add a Frame to the cache
/// @param frame The openshot::Frame object needing to be cached.
void Add(std::shared_ptr<Frame> frame);
void Add(std::shared_ptr<openshot::Frame> frame);
/// Clear the cache of all frames
void Clear();
@@ -106,13 +106,13 @@ namespace openshot {
/// @brief Get a frame from the cache
/// @param frame_number The frame number of the cached frame
std::shared_ptr<Frame> GetFrame(int64_t frame_number);
std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number);
/// Gets the maximum bytes value
int64_t GetBytes();
/// Get the smallest frame number
std::shared_ptr<Frame> GetSmallestFrame();
std::shared_ptr<openshot::Frame> GetSmallestFrame();
/// @brief Move frame to front of queue (so it lasts longer)
/// @param frame_number The frame number of the cached frame
@@ -128,8 +128,8 @@ namespace openshot {
void Remove(int64_t start_frame_number, int64_t end_frame_number);
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
void SetJson(string value); ///< Load JSON string into this object
std::string Json(); ///< Generate JSON string of this object
void SetJson(std::string value); ///< Load JSON string into this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
};

View File

@@ -50,13 +50,13 @@ namespace openshot {
*/
class CacheMemory : public CacheBase {
private:
map<int64_t, std::shared_ptr<Frame> > frames; ///< This map holds the frame number and Frame objects
deque<int64_t> frame_numbers; ///< This queue holds a sequential list of cached Frame numbers
std::map<int64_t, std::shared_ptr<openshot::Frame> > frames; ///< This map holds the frame number and Frame objects
std::deque<int64_t> frame_numbers; ///< This queue holds a sequential list of cached Frame numbers
bool needs_range_processing; ///< Something has changed, and the range data needs to be re-calculated
string json_ranges; ///< JSON ranges of frame numbers
vector<int64_t> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
map<int64_t, int64_t> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
std::string json_ranges; ///< JSON ranges of frame numbers
std::vector<int64_t> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
std::map<int64_t, int64_t> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
int64_t range_version; ///< The version of the JSON range data (incremented with each change)
/// Clean up cached frames that exceed the max number of bytes
@@ -78,7 +78,7 @@ namespace openshot {
/// @brief Add a Frame to the cache
/// @param frame The openshot::Frame object needing to be cached.
void Add(std::shared_ptr<Frame> frame);
void Add(std::shared_ptr<openshot::Frame> frame);
/// Clear the cache of all frames
void Clear();
@@ -88,13 +88,13 @@ namespace openshot {
/// @brief Get a frame from the cache
/// @param frame_number The frame number of the cached frame
std::shared_ptr<Frame> GetFrame(int64_t frame_number);
std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number);
/// Gets the maximum bytes value
int64_t GetBytes();
/// Get the smallest frame number
std::shared_ptr<Frame> GetSmallestFrame();
std::shared_ptr<openshot::Frame> GetSmallestFrame();
/// @brief Move frame to front of queue (so it lasts longer)
/// @param frame_number The frame number of the cached frame
@@ -110,8 +110,8 @@ namespace openshot {
void Remove(int64_t start_frame_number, int64_t end_frame_number);
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
void SetJson(string value); ///< Load JSON string into this object
std::string Json(); ///< Generate JSON string of this object
void SetJson(std::string value); ///< Load JSON string into this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
};

View File

@@ -45,8 +45,6 @@
#include "CacheMemory.h"
#include "Exceptions.h"
using namespace std;
namespace openshot
{
@@ -105,22 +103,22 @@ namespace openshot
class ChunkReader : public ReaderBase
{
private:
string path;
std::string path;
bool is_open;
int64_t chunk_size;
ReaderBase *local_reader;
openshot::ReaderBase *local_reader;
ChunkLocation previous_location;
ChunkVersion version;
std::shared_ptr<Frame> last_frame;
std::shared_ptr<openshot::Frame> last_frame;
/// Check if folder path existing
bool does_folder_exist(string path);
bool does_folder_exist(std::string path);
/// Find the location of a frame in a chunk
ChunkLocation find_chunk_frame(int64_t requested_frame);
/// get a formatted path of a specific chunk
string get_chunk_path(int64_t chunk_number, string folder, string extension);
std::string get_chunk_path(int64_t chunk_number, std::string folder, std::string extension);
/// Load JSON meta data about this chunk folder
void load_json();
@@ -131,7 +129,7 @@ namespace openshot
/// frame 1, or it throws one of the following exceptions.
/// @param path The folder path / location of a chunk (chunks are stored as folders)
/// @param chunk_version Choose the video version / quality (THUMBNAIL, PREVIEW, or FINAL)
ChunkReader(string path, ChunkVersion chunk_version);
ChunkReader(std::string path, ChunkVersion chunk_version);
/// Close the reader
void Close();
@@ -145,22 +143,22 @@ 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)
CacheMemory* GetCache() { return NULL; };
openshot::CacheMemory* GetCache() { 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<Frame> GetFrame(int64_t requested_frame);
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame);
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };
/// Return the type name of the class
string Name() { return "ChunkReader"; };
std::string Name() { return "ChunkReader"; };
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
void SetJson(string value); ///< Load JSON string into this object
std::string Json(); ///< Generate JSON string of this object
void SetJson(std::string value); ///< Load JSON string into this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object

View File

@@ -49,8 +49,6 @@
#include "Json.h"
using namespace std;
namespace openshot
{
/**
@@ -83,27 +81,27 @@ namespace openshot
class ChunkWriter : public WriterBase
{
private:
string path;
std::string path;
int64_t chunk_count;
int64_t chunk_size;
int64_t frame_count;
bool is_open;
bool is_writing;
ReaderBase *local_reader;
FFmpegWriter *writer_thumb;
FFmpegWriter *writer_preview;
FFmpegWriter *writer_final;
openshot::ReaderBase *local_reader;
openshot::FFmpegWriter *writer_thumb;
openshot::FFmpegWriter *writer_preview;
openshot::FFmpegWriter *writer_final;
std::shared_ptr<Frame> last_frame;
bool last_frame_needed;
string default_extension;
string default_vcodec;
string default_acodec;
std::string default_extension;
std::string default_vcodec;
std::string default_acodec;
/// check for chunk folder
void create_folder(string path);
void create_folder(std::string path);
/// get a formatted path of a specific chunk
string get_chunk_path(int64_t chunk_number, string folder, string extension);
std::string get_chunk_path(int64_t chunk_number, std::string folder, std::string extension);
/// check for valid chunk json
bool is_chunk_valid();
@@ -116,7 +114,7 @@ namespace openshot
/// @brief Constructor for ChunkWriter. Throws one of the following exceptions.
/// @param path The folder path of the chunk file to be created
/// @param reader The initial reader to base this chunk file's meta data on (such as fps, height, width, etc...)
ChunkWriter(string path, ReaderBase *reader);
ChunkWriter(std::string path, openshot::ReaderBase *reader);
/// Close the writer
void Close();
@@ -136,7 +134,7 @@ namespace openshot
/// @brief Add a frame to the stack waiting to be encoded.
/// @param frame The openshot::Frame object that needs to be written to this chunk file.
void WriteFrame(std::shared_ptr<Frame> frame);
void WriteFrame(std::shared_ptr<openshot::Frame> frame);
/// @brief Write a block of frames from a reader
/// @param start The starting frame number to write (of the reader passed into the constructor)
@@ -147,7 +145,7 @@ namespace openshot
/// @param reader The reader containing the frames you need
/// @param start The starting frame number to write
/// @param length The number of frames to write
void WriteFrame(ReaderBase* reader, int64_t start, int64_t length);
void WriteFrame(openshot::ReaderBase* reader, int64_t start, int64_t length);
};

View File

@@ -51,16 +51,13 @@
#include "ReaderBase.h"
#include "JuceHeader.h"
using namespace std;
using namespace openshot;
namespace openshot {
/// Comparison method for sorting effect pointers (by Position, Layer, and Order). Effects are sorted
/// from lowest layer to top layer (since that is sequence clips are combined), and then by
/// position, and then by effect order.
struct CompareClipEffects{
bool operator()( EffectBase* lhs, EffectBase* rhs){
bool operator()( openshot::EffectBase* lhs, openshot::EffectBase* rhs){
if( lhs->Layer() < rhs->Layer() ) return true;
if( lhs->Layer() == rhs->Layer() && lhs->Position() < rhs->Position() ) return true;
if( lhs->Layer() == rhs->Layer() && lhs->Position() == rhs->Position() && lhs->Order() > rhs->Order() ) return true;
@@ -79,7 +76,7 @@ namespace openshot {
* Clip c1(new ImageReader("MyAwesomeLogo.jpeg"));
* Clip c2(new FFmpegReader("BackgroundVideo.webm"));
*
* // CLIP 1 (logo) - Set some clip properties (with Keyframes)
* // CLIP 1 (logo) - Set some clip properties (with openshot::Keyframes)
* c1.Position(0.0); // Set the position or location (in seconds) on the timeline
* c1.gravity = GRAVITY_LEFT; // Set the alignment / gravity of the clip (position on the screen)
* c1.scale = SCALE_CROP; // Set the scale mode (how the image is resized to fill the screen)
@@ -90,7 +87,7 @@ namespace openshot {
* c1.alpha.AddPoint(500, 0.0); // Keep the alpha transparent until frame #500
* c1.alpha.AddPoint(565, 1.0); // Animate the alpha from transparent to visible (between frame #501 and #565)
*
* // CLIP 2 (background video) - Set some clip properties (with Keyframes)
* // CLIP 2 (background video) - Set some clip properties (with openshot::Keyframes)
* c2.Position(0.0); // Set the position or location (in seconds) on the timeline
* c2.Start(10.0); // Set the starting position of the video (trim the left side of the video)
* c2.Layer(0); // Set the layer of the timeline (higher layers cover up images of lower layers)
@@ -100,40 +97,40 @@ namespace openshot {
* c2.alpha.AddPoint(384, 1.0); // Animate the alpha to visible (between frame #360 and frame #384)
* @endcode
*/
class Clip : public ClipBase {
class Clip : public openshot::ClipBase {
protected:
/// Section lock for multiple threads
juce::CriticalSection getFrameCriticalSection;
private:
bool waveform; ///< Should a waveform be used instead of the clip's image
std::list<EffectBase*> effects; ///<List of clips on this timeline
std::list<openshot::EffectBase*> effects; ///<List of clips on this timeline
// Audio resampler (if time mapping)
AudioResampler *resampler;
openshot::AudioResampler *resampler;
juce::AudioSampleBuffer *audio_cache;
// File Reader object
ReaderBase* reader;
openshot::ReaderBase* reader;
/// If we allocated a reader, we store it here to free it later
/// (reader member variable itself may have been replaced)
ReaderBase* allocated_reader;
openshot::ReaderBase* allocated_reader;
/// Adjust frame number minimum value
int64_t adjust_frame_number_minimum(int64_t frame_number);
/// Apply effects to the source frame (if any)
std::shared_ptr<Frame> apply_effects(std::shared_ptr<Frame> frame);
std::shared_ptr<openshot::Frame> apply_effects(std::shared_ptr<openshot::Frame> frame);
/// Get file extension
std::string get_file_extension(std::string path);
/// Get a frame object or create a blank one
std::shared_ptr<Frame> GetOrCreateFrame(int64_t number);
std::shared_ptr<openshot::Frame> GetOrCreateFrame(int64_t number);
/// Adjust the audio and image of a time mapped frame
void get_time_mapped_frame(std::shared_ptr<Frame> frame, int64_t frame_number);
void get_time_mapped_frame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number);
/// Init default settings for a clip
void init_settings();
@@ -148,117 +145,117 @@ namespace openshot {
void reverse_buffer(juce::AudioSampleBuffer* buffer);
public:
GravityType gravity; ///< The gravity of a clip determines where it snaps to its parent
ScaleType scale; ///< The scale determines how a clip should be resized to fit its parent
AnchorType anchor; ///< The anchor determines what parent a clip should snap to
FrameDisplayType display; ///< The format to display the frame number (if any)
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();
/// @brief Constructor with filepath (reader is automatically created... by guessing file extensions)
/// @param path The path of a reader (video file, image file, etc...). The correct reader will be used automatically.
Clip(string path);
Clip(std::string path);
/// @brief Constructor with reader
/// @param new_reader The reader to be used by this clip
Clip(ReaderBase* new_reader);
Clip(openshot::ReaderBase* new_reader);
/// Destructor
virtual ~Clip();
/// @brief Add an effect to the clip
/// @param effect Add an effect to the clip. An effect can modify the audio or video of an openshot::Frame.
void AddEffect(EffectBase* effect);
void AddEffect(openshot::EffectBase* effect);
/// Close the internal reader
void Close();
/// Return the list of effects on the timeline
list<EffectBase*> Effects() { return effects; };
std::list<openshot::EffectBase*> Effects() { return effects; };
/// @brief Get an openshot::Frame object for a specific frame number of this timeline.
///
/// @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<openshot::Frame> GetFrame(int64_t requested_frame);
/// Open the internal reader
void Open();
/// @brief Set the current reader
/// @param new_reader The reader to be used by this clip
void Reader(ReaderBase* new_reader);
void Reader(openshot::ReaderBase* new_reader);
/// Get the current reader
ReaderBase* Reader();
openshot::ReaderBase* Reader();
/// Override End() method
float End(); ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
void SetJson(string value); ///< Load JSON string into this object
std::string Json(); ///< Generate JSON string of this object
void SetJson(std::string value); ///< Load JSON string into this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue 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)
string PropertiesJSON(int64_t requested_frame);
std::string PropertiesJSON(int64_t requested_frame);
/// @brief Remove an effect from the clip
/// @param effect Remove an effect from the clip.
void RemoveEffect(EffectBase* effect);
void RemoveEffect(openshot::EffectBase* effect);
/// Waveform property
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
Keyframe scale_x; ///< Curve representing the horizontal scaling in percent (0 to 1)
Keyframe scale_y; ///< Curve representing the vertical scaling in percent (0 to 1)
Keyframe location_x; ///< Curve representing the relative X position in percent based on the gravity (-1 to 1)
Keyframe location_y; ///< Curve representing the relative Y position in percent based on the gravity (-1 to 1)
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
Keyframe alpha; ///< Curve representing the alpha (1 to 0)
Keyframe rotation; ///< Curve representing the rotation (0 to 360)
openshot::Keyframe alpha; ///< Curve representing the alpha (1 to 0)
openshot::Keyframe rotation; ///< Curve representing the rotation (0 to 360)
// Time and Volume curves
Keyframe time; ///< Curve representing the frames over time to play (used for speed and direction of video)
Keyframe volume; ///< Curve representing the volume (0 to 1)
openshot::Keyframe time; ///< Curve representing the frames over time to play (used for speed and direction of video)
openshot::Keyframe volume; ///< Curve representing the volume (0 to 1)
/// Curve representing the color of the audio wave form
Color wave_color;
openshot::Color wave_color;
// Crop settings and curves
GravityType crop_gravity; ///< Cropping needs to have a gravity to determine what side we are cropping
Keyframe crop_width; ///< Curve representing width in percent (0.0=0%, 1.0=100%)
Keyframe crop_height; ///< Curve representing height in percent (0.0=0%, 1.0=100%)
Keyframe crop_x; ///< Curve representing X offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%)
Keyframe crop_y; ///< Curve representing Y offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%)
openshot::GravityType crop_gravity; ///< Cropping needs to have a gravity to determine what side we are cropping
openshot::Keyframe crop_width; ///< Curve representing width in percent (0.0=0%, 1.0=100%)
openshot::Keyframe crop_height; ///< Curve representing height in percent (0.0=0%, 1.0=100%)
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
Keyframe shear_x; ///< Curve representing X shear angle in degrees (-45.0=left, 45.0=right)
Keyframe shear_y; ///< Curve representing Y shear angle in degrees (-45.0=down, 45.0=up)
Keyframe perspective_c1_x; ///< Curves representing X for coordinate 1
Keyframe perspective_c1_y; ///< Curves representing Y for coordinate 1
Keyframe perspective_c2_x; ///< Curves representing X for coordinate 2
Keyframe perspective_c2_y; ///< Curves representing Y for coordinate 2
Keyframe perspective_c3_x; ///< Curves representing X for coordinate 3
Keyframe perspective_c3_y; ///< Curves representing Y for coordinate 3
Keyframe perspective_c4_x; ///< Curves representing X for coordinate 4
Keyframe perspective_c4_y; ///< Curves representing Y for coordinate 4
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 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
openshot::Keyframe perspective_c2_y; ///< Curves representing Y for coordinate 2
openshot::Keyframe perspective_c3_x; ///< Curves representing X for coordinate 3
openshot::Keyframe perspective_c3_y; ///< Curves representing Y for coordinate 3
openshot::Keyframe perspective_c4_x; ///< Curves representing X for coordinate 4
openshot::Keyframe perspective_c4_y; ///< Curves representing Y for coordinate 4
/// Audio channel filter and mappings
Keyframe channel_filter; ///< A number representing an audio channel to filter (clears all other channels)
Keyframe channel_mapping; ///< A number representing an audio channel to output (only works when filtering a channel)
openshot::Keyframe channel_filter; ///< A number representing an audio channel to filter (clears all other channels)
openshot::Keyframe channel_mapping; ///< A number representing an audio channel to output (only works when filtering a channel)
/// Override has_video and has_audio properties of clip (and their readers)
Keyframe has_audio; ///< An optional override to determine if this clip has audio (-1=undefined, 0=no, 1=yes)
Keyframe has_video; ///< An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes)
openshot::Keyframe has_audio; ///< An optional override to determine if this clip has audio (-1=undefined, 0=no, 1=yes)
openshot::Keyframe has_video; ///< An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes)
};

View File

@@ -43,8 +43,6 @@
#include "KeyFrame.h"
#include "Json.h"
using namespace std;
namespace openshot {
/**
@@ -55,18 +53,18 @@ namespace openshot {
*/
class ClipBase {
protected:
string id; ///< ID Property for all derived Clip and Effect classes.
std::string id; ///< ID Property for all derived Clip and Effect classes.
float position; ///< The position on the timeline where this clip should start playing
int layer; ///< The layer this clip is on. Lower clips are covered up by higher clips.
float start; ///< The position in seconds to start playing (used to trim the beginning of a clip)
float end; ///< The position in seconds to end playing (used to trim the ending of a clip)
string previous_properties; ///< This string contains the previous JSON properties
std::string previous_properties; ///< This string contains the previous JSON properties
/// Generate JSON for a property
Json::Value add_property_json(string name, float value, string type, string memo, Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame);
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame);
/// Generate JSON choice for a property (dropdown properties)
Json::Value add_property_choice_json(string name, int value, int selected_value);
Json::Value add_property_choice_json(std::string name, int value, int selected_value);
public:
@@ -80,7 +78,7 @@ namespace openshot {
bool operator>= ( ClipBase& a) { return (Position() >= a.Position()); }
/// Get basic properties
string Id() { return id; } ///< Get the Id of this clip object
std::string Id() { return id; } ///< Get the Id of this clip object
float Position() { return position; } ///< Get position on timeline (in seconds)
int Layer() { return layer; } ///< Get layer of clip on timeline (lower number is covered by higher numbers)
float Start() { return start; } ///< Get start position (in seconds) of clip (trim start of video)
@@ -88,21 +86,21 @@ namespace openshot {
float Duration() { return end - start; } ///< Get the length of this clip (in seconds)
/// Set basic properties
void Id(string value) { id = value; } ///> Set the Id of this clip object
void Id(std::string value) { id = value; } ///> Set the Id of this clip object
void Position(float value) { position = value; } ///< Set position on timeline (in seconds)
void Layer(int value) { layer = value; } ///< Set layer of clip on timeline (lower number is covered by higher numbers)
void Start(float value) { start = value; } ///< Set start position (in seconds) of clip (trim start of video)
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
/// Get and Set JSON methods
virtual string Json() = 0; ///< Generate JSON string of this object
virtual void SetJson(string value) = 0; ///< Load JSON string into this object
virtual std::string Json() = 0; ///< Generate JSON string of this object
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue 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)
virtual string PropertiesJSON(int64_t requested_frame) = 0;
virtual std::string PropertiesJSON(int64_t requested_frame) = 0;
virtual ~ClipBase() = default;
};

View File

@@ -45,33 +45,33 @@ namespace openshot {
class Color{
public:
Keyframe red; ///<Curve representing the red value (0 - 255)
Keyframe green; ///<Curve representing the green value (0 - 255)
Keyframe blue; ///<Curve representing the red value (0 - 255)
Keyframe alpha; ///<Curve representing the alpha value (0 - 255)
openshot::Keyframe red; ///<Curve representing the red value (0 - 255)
openshot::Keyframe green; ///<Curve representing the green value (0 - 255)
openshot::Keyframe blue; ///<Curve representing the red value (0 - 255)
openshot::Keyframe alpha; ///<Curve representing the alpha value (0 - 255)
/// Default constructor
Color() {};
/// Constructor which takes a HEX color code
Color(string color_hex);
Color(std::string color_hex);
/// Constructor which takes R,G,B,A
Color(unsigned char Red, unsigned char Green, unsigned char Blue, unsigned char Alpha);
/// Constructor which takes 4 existing Keyframe curves
Color(Keyframe Red, Keyframe Green, Keyframe Blue, Keyframe Alpha);
Color(openshot::Keyframe Red, openshot::Keyframe Green, openshot::Keyframe Blue, openshot::Keyframe Alpha);
/// Get the HEX value of a color at a specific frame
string GetColorHex(int64_t frame_number);
std::string GetColorHex(int64_t frame_number);
/// Get the distance between 2 RGB pairs. (0=identical colors, 10=very close colors, 760=very different colors)
static long GetDistance(long R1, long G1, long B1, long R2, long G2, long B2);
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
std::string Json(); ///< Generate JSON string of this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJson(string value); ///< Load JSON string into this object
void SetJson(std::string value); ///< Load JSON string into this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
};

View File

@@ -36,8 +36,6 @@
#include "Fraction.h"
#include "Json.h"
using namespace std;
namespace openshot {
/**
@@ -68,9 +66,9 @@ namespace openshot {
Coordinate(double x, double y);
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
std::string Json(); ///< Generate JSON string of this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJson(string value); ///< Load JSON string into this object
void SetJson(std::string value); ///< Load JSON string into this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
};

View File

@@ -79,7 +79,7 @@ public:
unsigned long final_frameCount;
// Queue of raw video frames
deque<IDeckLinkMutableVideoFrame*> raw_video_frames;
std::deque<IDeckLinkMutableVideoFrame*> raw_video_frames;
openshot::CacheMemory final_frames;
// Convert between YUV and RGB

View File

@@ -93,14 +93,14 @@ protected:
unsigned long frameCount;
//map<int, IDeckLinkMutableVideoFrame* > temp_cache;
map<int, uint8_t * > temp_cache;
std::map<int, uint8_t * > temp_cache;
BMDTimeValue frameRateDuration, frameRateScale;
// Queue of raw video frames
//deque<IDeckLinkMutableVideoFrame*> final_frames;
deque<uint8_t * > final_frames;
deque<std::shared_ptr<openshot::Frame> > raw_video_frames;
std::deque<uint8_t * > final_frames;
std::deque<std::shared_ptr<openshot::Frame> > raw_video_frames;
// Convert between YUV and RGB
IDeckLinkOutput *deckLinkOutput;

View File

@@ -50,8 +50,6 @@
#include "Frame.h"
#include "DecklinkInput.h"
using namespace std;
namespace openshot
{
@@ -117,11 +115,11 @@ namespace openshot
bool IsOpen() { return is_open; };
/// Return the type name of the class
string Name() { return "DecklinkReader"; };
std::string Name() { return "DecklinkReader"; };
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
void SetJson(string value); ///< Load JSON string into this object
std::string Json(); ///< Generate JSON string of this object
void SetJson(std::string value); ///< Load JSON string into this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object

View File

@@ -50,8 +50,6 @@
#include "Frame.h"
#include "DecklinkOutput.h"
using namespace std;
namespace openshot
{

View File

@@ -43,8 +43,6 @@
#include "Exceptions.h"
#include "Fraction.h"
using namespace std;
namespace openshot
{
/**
@@ -56,7 +54,7 @@ namespace openshot
class DummyReader : public ReaderBase
{
private:
std::shared_ptr<Frame> image_frame;
std::shared_ptr<openshot::Frame> image_frame;
bool is_open;
public:
@@ -65,7 +63,7 @@ namespace openshot
DummyReader();
/// Constructor for DummyReader.
DummyReader(Fraction fps, int width, int height, int sample_rate, int channels, float duration);
DummyReader(openshot::Fraction fps, int width, int height, int sample_rate, int channels, float duration);
virtual ~DummyReader();
@@ -80,17 +78,17 @@ namespace openshot
///
/// @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<openshot::Frame> GetFrame(int64_t requested_frame);
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };
/// Return the type name of the class
string Name() { return "DummyReader"; };
std::string Name() { return "DummyReader"; };
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object
void SetJson(string value); ///< Load JSON string into this object
std::string Json(); ///< Generate JSON string of this object
void SetJson(std::string value); ///< Load JSON string into this object
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object

View File

@@ -38,8 +38,6 @@
#include "Json.h"
#include "Frame.h"
using namespace std;
namespace openshot
{
/**
@@ -51,10 +49,10 @@ namespace openshot
*/
struct EffectInfoStruct
{
string class_name; ///< The class name of the effect
string short_name; ///< A short name of the effect, commonly used for icon names, etc...
string name; ///< The name of the effect
string description; ///< The description of this effect and what it does
std::string class_name; ///< The class name of the effect
std::string short_name; ///< A short name of the effect, commonly used for icon names, etc...
std::string name; ///< The name of the effect
std::string description; ///< The description of this effect and what it does
bool has_video; ///< Determines if this effect manipulates the image of a frame
bool has_audio; ///< Determines if this effect manipulates the audio of a frame
};
@@ -90,15 +88,15 @@ namespace openshot
/// @returns The modified openshot::Frame object
/// @param frame The frame object that needs the effect applied to it
/// @param frame_number The frame number (starting at 1) of the effect on the timeline.
virtual std::shared_ptr<Frame> GetFrame(std::shared_ptr<Frame> frame, int64_t frame_number) = 0;
virtual std::shared_ptr<openshot::Frame> GetFrame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number) = 0;
/// Initialize the values of the EffectInfo struct. It is important for derived classes to call
/// this method, or the EffectInfo struct values will not be initialized.
void InitEffectInfo();
/// Get and Set JSON methods
virtual string Json() = 0; ///< Generate JSON string of this object
virtual void SetJson(string value) = 0; ///< Load JSON string into this object
virtual std::string Json() = 0; ///< Generate JSON string of this object
virtual void SetJson(std::string value) = 0; ///< Load JSON string into this object
virtual Json::Value JsonValue() = 0; ///< Generate Json::JsonValue for this object
virtual void SetJsonValue(Json::Value root) = 0; ///< Load Json::JsonValue into this object
Json::Value JsonInfo(); ///< Generate JSON object of meta data / info

View File

@@ -34,8 +34,6 @@
#include "Effects.h"
using namespace std;
namespace openshot
{
@@ -49,10 +47,10 @@ namespace openshot
{
public:
// Create an instance of an effect (factory style)
EffectBase* CreateEffect(string effect_type);
EffectBase* CreateEffect(std::string effect_type);
/// JSON methods
static string Json(); ///< Generate JSON string of this object
static std::string Json(); ///< Generate JSON string of this object
static Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
};

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