You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Improved Json methods to correct work with swig and inheritance.
This commit is contained in:
@@ -149,6 +149,12 @@ namespace openshot
|
||||
/// @param requested_frame The frame number you want to retrieve
|
||||
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed, ChunkNotFound);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open the reader. This is required before you can access frames or data from the reader.
|
||||
void Open() throw(InvalidFile);
|
||||
};
|
||||
|
||||
@@ -34,51 +34,26 @@
|
||||
#endif
|
||||
|
||||
#include <tr1/memory>
|
||||
#include <string>
|
||||
#include "JuceLibraryCode/JuceHeader.h"
|
||||
#include "AudioResampler.h"
|
||||
#include "ClipBase.h"
|
||||
#include "Color.h"
|
||||
#include "Enums.h"
|
||||
#include "FFmpegReader.h"
|
||||
#include "FrameRate.h"
|
||||
#include "FrameMapper.h"
|
||||
#include "ImageReader.h"
|
||||
#include "TextReader.h"
|
||||
#include "ChunkReader.h"
|
||||
#include "KeyFrame.h"
|
||||
#include "JuceLibraryCode/JuceHeader.h"
|
||||
#include "AudioResampler.h"
|
||||
#include "ReaderBase.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
|
||||
namespace openshot {
|
||||
|
||||
/// This enumeration determines how clips are aligned to their parent container.
|
||||
enum GravityType
|
||||
{
|
||||
GRAVITY_TOP_LEFT, ///< Align clip to the top left of its parent
|
||||
GRAVITY_TOP, ///< Align clip to the top center of its parent
|
||||
GRAVITY_TOP_RIGHT, ///< Align clip to the top right of its parent
|
||||
GRAVITY_LEFT, ///< Align clip to the left of its parent (middle aligned)
|
||||
GRAVITY_CENTER, ///< Align clip to the center of its parent (middle aligned)
|
||||
GRAVITY_RIGHT, ///< Align clip to the right of its parent (middle aligned)
|
||||
GRAVITY_BOTTOM_LEFT, ///< Align clip to the bottom left of its parent
|
||||
GRAVITY_BOTTOM, ///< Align clip to the bottom center of its parent
|
||||
GRAVITY_BOTTOM_RIGHT ///< Align clip to the bottom right of its parent
|
||||
};
|
||||
|
||||
/// This enumeration determines how clips are scaled to fit their parent container.
|
||||
enum ScaleType
|
||||
{
|
||||
SCALE_CROP, ///< Scale the clip until both height and width fill the canvas (cropping the overlap)
|
||||
SCALE_FIT, ///< Scale the clip until either height or width fills the canvas (with no cropping)
|
||||
SCALE_STRETCH, ///< Scale the clip until both height and width fill the canvas (distort to fit)
|
||||
SCALE_NONE ///< Do not scale the clip
|
||||
};
|
||||
|
||||
/// This enumeration determines what parent a clip should be aligned to.
|
||||
enum AnchorType
|
||||
{
|
||||
ANCHOR_CANVAS, ///< Anchor the clip to the canvas
|
||||
ANCHOR_VIEWPORT ///< Anchor the clip to the viewport (which can be moved / animated around the canvas)
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class represents a clip (used to arrange readers on the timeline)
|
||||
*
|
||||
@@ -122,7 +97,7 @@ namespace openshot {
|
||||
AudioSampleBuffer *audio_cache;
|
||||
|
||||
// File Reader object
|
||||
ReaderBase* file_reader;
|
||||
ReaderBase* reader;
|
||||
|
||||
/// Adjust frame number minimum value
|
||||
int adjust_frame_number_minimum(int frame_number);
|
||||
@@ -172,7 +147,7 @@ namespace openshot {
|
||||
|
||||
/// @brief Set the current reader
|
||||
/// @param reader The reader to be used by this clip
|
||||
void Reader(ReaderBase* reader);
|
||||
void Reader(ReaderBase* new_reader);
|
||||
|
||||
/// Get the current reader
|
||||
ReaderBase* Reader() throw(ReaderClosed);
|
||||
@@ -182,8 +157,10 @@ namespace openshot {
|
||||
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) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Waveform property
|
||||
bool Waveform() { return waveform; } ///< Get the waveform property of this clip
|
||||
|
||||
@@ -76,10 +76,10 @@ namespace openshot {
|
||||
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
|
||||
virtual string Json() = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(string value) throw(InvalidJSON) = 0; ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ namespace openshot {
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ namespace openshot {
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -108,6 +108,12 @@ namespace openshot
|
||||
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed);
|
||||
unsigned long GetCurrentFrameNumber();
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open device and video stream - which is called by the constructor automatically
|
||||
void Open() throw(DecklinkError);
|
||||
};
|
||||
|
||||
@@ -78,6 +78,12 @@ namespace openshot
|
||||
/// @param requested_frame The frame number that is requested.
|
||||
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open File - which is called by the constructor automatically
|
||||
void Open() throw(InvalidFile);
|
||||
};
|
||||
|
||||
@@ -90,9 +90,9 @@ namespace openshot
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Get the order that this effect should be executed.
|
||||
int Order() { return order; }
|
||||
|
||||
65
include/Enums.h
Normal file
65
include/Enums.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Header file for TextReader class
|
||||
* @author Jonathan Thomas <jonathan@openshot.org>
|
||||
*
|
||||
* @section LICENSE
|
||||
*
|
||||
* Copyright (c) 2008-2013 OpenShot Studios, LLC
|
||||
* (http://www.openshotstudios.com). This file is part of
|
||||
* OpenShot Library (http://www.openshot.org), an open-source project
|
||||
* dedicated to delivering high quality video editing and animation solutions
|
||||
* to the world.
|
||||
*
|
||||
* OpenShot Library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPENSHOT_ENUMS_H
|
||||
#define OPENSHOT_ENUMS_H
|
||||
|
||||
|
||||
namespace openshot
|
||||
{
|
||||
/// This enumeration determines how clips are aligned to their parent container.
|
||||
enum GravityType
|
||||
{
|
||||
GRAVITY_TOP_LEFT, ///< Align clip to the top left of its parent
|
||||
GRAVITY_TOP, ///< Align clip to the top center of its parent
|
||||
GRAVITY_TOP_RIGHT, ///< Align clip to the top right of its parent
|
||||
GRAVITY_LEFT, ///< Align clip to the left of its parent (middle aligned)
|
||||
GRAVITY_CENTER, ///< Align clip to the center of its parent (middle aligned)
|
||||
GRAVITY_RIGHT, ///< Align clip to the right of its parent (middle aligned)
|
||||
GRAVITY_BOTTOM_LEFT, ///< Align clip to the bottom left of its parent
|
||||
GRAVITY_BOTTOM, ///< Align clip to the bottom center of its parent
|
||||
GRAVITY_BOTTOM_RIGHT ///< Align clip to the bottom right of its parent
|
||||
};
|
||||
|
||||
/// This enumeration determines how clips are scaled to fit their parent container.
|
||||
enum ScaleType
|
||||
{
|
||||
SCALE_CROP, ///< Scale the clip until both height and width fill the canvas (cropping the overlap)
|
||||
SCALE_FIT, ///< Scale the clip until either height or width fills the canvas (with no cropping)
|
||||
SCALE_STRETCH, ///< Scale the clip until both height and width fill the canvas (distort to fit)
|
||||
SCALE_NONE ///< Do not scale the clip
|
||||
};
|
||||
|
||||
/// This enumeration determines what parent a clip should be aligned to.
|
||||
enum AnchorType
|
||||
{
|
||||
ANCHOR_CANVAS, ///< Anchor the clip to the canvas
|
||||
ANCHOR_VIEWPORT ///< Anchor the clip to the viewport (which can be moved / animated around the canvas)
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -239,8 +239,10 @@ namespace openshot
|
||||
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed, TooManySeeks);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open File - which is called by the constructor automatically
|
||||
void Open() throw(InvalidFile, NoStreamsFound, InvalidCodec);
|
||||
|
||||
@@ -171,6 +171,12 @@ namespace openshot
|
||||
/// @param requested_frame The frame number that is requested.
|
||||
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Get the target framerate
|
||||
Framerate TargetFPS() { return target; };
|
||||
|
||||
|
||||
@@ -88,8 +88,10 @@ namespace openshot
|
||||
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open File - which is called by the constructor automatically
|
||||
void Open() throw(InvalidFile);
|
||||
|
||||
@@ -137,8 +137,8 @@ namespace openshot {
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
|
||||
/**
|
||||
* @brief Calculate all of the values for this keyframe.
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
#endif
|
||||
#include "DummyReader.h"
|
||||
#include "EffectBase.h"
|
||||
#include "Enums.h"
|
||||
#include "Exceptions.h"
|
||||
#include "ReaderBase.h"
|
||||
#include "WriterBase.h"
|
||||
|
||||
@@ -117,8 +117,8 @@ namespace openshot
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <tr1/memory>
|
||||
#include <stdlib.h>
|
||||
#include "Fraction.h"
|
||||
#include "Frame.h"
|
||||
#include "Json.h"
|
||||
@@ -105,10 +106,10 @@ namespace openshot
|
||||
void InitFileInfo();
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
virtual string Json() = 0; ///< Generate JSON string of this object
|
||||
virtual void SetJson(string value) throw(InvalidJSON) = 0; ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open the reader (and start consuming resources, such as images or video files)
|
||||
virtual void Open() = 0;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <tr1/memory>
|
||||
#include "Magick++.h"
|
||||
#include "Cache.h"
|
||||
#include "Clip.h"
|
||||
#include "Enums.h"
|
||||
#include "Exceptions.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -97,7 +97,10 @@ namespace openshot
|
||||
|
||||
public:
|
||||
|
||||
/// @brief Constructor for TextReader.
|
||||
/// Default constructor (blank text)
|
||||
TextReader();
|
||||
|
||||
/// @brief Constructor for TextReader with all parameters.
|
||||
/// @param width The width of the requested openshot::Frame (not the size of the text)
|
||||
/// @param height The height of the requested openshot::Frame (not the size of the text)
|
||||
/// @param x_offset The number of pixels to offset the text on the X axis (horizontal)
|
||||
@@ -121,8 +124,10 @@ namespace openshot
|
||||
tr1::shared_ptr<Frame> GetFrame(int requested_frame) throw(ReaderClosed);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open Reader - which is called by the constructor automatically
|
||||
void Open();
|
||||
|
||||
@@ -228,6 +228,12 @@ namespace openshot {
|
||||
// Background color
|
||||
Color color; ///<Background color of timeline canvas
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Open the reader (and start consuming resources)
|
||||
void Open();
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ namespace openshot
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
|
||||
/// Display file information in the standard output stream (stdout)
|
||||
void DisplayInfo();
|
||||
|
||||
@@ -80,8 +80,10 @@ namespace openshot
|
||||
tr1::shared_ptr<Frame> GetFrame(tr1::shared_ptr<Frame> frame, int frame_number);
|
||||
|
||||
/// Get and Set JSON methods
|
||||
string Json(); ///< Generate JSON string of this object
|
||||
void SetJson(string value) throw(InvalidJSON); ///< Load JSON string into this object
|
||||
Json::Value JsonValue(); ///< Generate Json::JsonValue for this object
|
||||
void Json(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user