OpenShot Library | libopenshot
0.3.3
|
Go to the documentation of this file.
13 #ifndef OPENSHOT_CLIP_H
14 #define OPENSHOT_CLIP_H
17 #define int64 opencv_broken_int
18 #define uint64 opencv_broken_uint
19 #include <opencv2/opencv.hpp>
20 #include <opencv2/core.hpp>
108 std::list<openshot::EffectBase*> effects;
110 std::string parentObjectId;
111 std::shared_ptr<openshot::TrackedObjectBase> parentTrackedObject;
128 int64_t adjust_frame_number_minimum(int64_t frame_number);
131 void apply_background(std::shared_ptr<openshot::Frame> frame, std::shared_ptr<openshot::Frame> background_frame);
134 void apply_effects(std::shared_ptr<openshot::Frame> frame, int64_t timeline_frame_number,
TimelineInfoStruct* options,
bool before_keyframes);
137 void apply_keyframes(std::shared_ptr<Frame> frame, QSize timeline_size);
140 void apply_waveform(std::shared_ptr<Frame> frame, QSize timeline_size);
143 int64_t adjust_timeline_framenumber(int64_t clip_frame_number);
146 QTransform get_transform(std::shared_ptr<Frame> frame,
int width,
int height);
149 std::string get_file_extension(std::string
path);
152 std::shared_ptr<openshot::Frame> GetOrCreateFrame(int64_t number,
bool enable_time=
true);
155 void apply_timemapping(std::shared_ptr<openshot::Frame> frame);
158 bool isNear(
double a,
double b);
164 QSize scale_size(QSize source_size,
ScaleType source_scale,
int target_width,
int target_height);
197 bool IsOpen()
override {
return is_open; };
208 void SetAttachedObject(std::shared_ptr<openshot::TrackedObjectBase> trackedObject);
212 std::shared_ptr<openshot::TrackedObjectBase>
GetAttachedObject()
const {
return parentTrackedObject; };
217 std::string
Name()
override {
return "Clip"; };
224 void Close()
override;
233 std::list<openshot::EffectBase*>
Effects() {
return effects; };
243 std::shared_ptr<openshot::Frame>
GetFrame(int64_t clip_frame_number)
override;
255 std::shared_ptr<openshot::Frame>
GetFrame(std::shared_ptr<openshot::Frame> background_frame, int64_t clip_frame_number)
override;
272 void Open()
override;
282 float End()
const override;
283 void End(
float value)
override;
288 std::string
Json()
const override;
289 void SetJson(
const std::string value)
override;
295 std::string
PropertiesJSON(int64_t requested_frame)
const override;
302 bool Waveform() {
return waveform; }
303 void Waveform(
bool value) { waveform = value; }
346 #endif // OPENSHOT_CLIP_H
void Open() override
Open the internal reader.
openshot::TimelineBase * timeline
Pointer to the parent timeline instance (if any)
This abstract class is the base class, used by all effects in libopenshot.
openshot::AnchorType anchor
The anchor determines what parent a clip should snap to.
std::string GetAttachedId() const
Get and set the object id that this clip is attached to.
AudioLocation previous_location
Previous time-mapped audio location.
openshot::CacheMemory * GetCache() override
Get the cache object (always return NULL for this reader)
openshot::EffectBase * GetEffect(const std::string &id)
Look up an effect by ID.
This namespace is the default namespace for all code in the openshot library.
openshot::Keyframe scale_y
Curve representing the vertical scaling in percent (0 to 1)
std::string PropertiesJSON(int64_t requested_frame) const override
This struct holds the associated video frame and starting sample # for an audio packet.
openshot::Keyframe time
Curve representing the frames over time to play (used for speed and direction of video)
This class represents a clip (used to arrange readers on the timeline)
openshot::Keyframe alpha
Curve representing the alpha (1 to 0)
float End() const override
Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
Header file for AudioLocation class.
openshot::Keyframe origin_x
Curve representing X origin point (0.0=0% (left), 1.0=100% (right))
void ParentTimeline(openshot::TimelineBase *new_timeline) override
Set associated Timeline pointer.
std::shared_ptr< openshot::Frame > GetFrame(int64_t clip_frame_number) override
Get an openshot::Frame object for a specific frame number of this clip. The image size and number of ...
void Close() override
Close the internal reader.
openshot::Keyframe location_y
Curve representing the relative Y position in percent based on the gravity (-1 to 1)
GravityType
This enumeration determines how clips are aligned to their parent container.
openshot::Keyframe origin_y
Curve representing Y origin point (0.0=0% (top), 1.0=100% (bottom))
std::shared_ptr< openshot::TrackedObjectBase > GetParentTrackedObject()
Return the associated Parent Tracked Object (if any)
std::list< openshot::EffectBase * > Effects()
Return the list of effects on the timeline.
openshot::Keyframe channel_mapping
A number representing an audio channel to output (only works when filtering a channel)
void AddEffect(openshot::EffectBase *effect)
Add an effect to the clip.
virtual ~Clip()
Destructor.
Header file for EffectBase class.
std::string Json() const override
Generate JSON string of this object.
void Position(float value)
Set the Id of this clip object
Header file for the Keyframe class.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
This class represents a color (used on the timeline and clips)
openshot::FrameDisplayType display
The format to display the frame number (if any)
openshot::Keyframe perspective_c2_y
Curves representing Y for coordinate 2.
openshot::Keyframe scale_x
Curve representing the horizontal scaling in percent (0 to 1)
This class is used to resample audio data for many sequential frames.
void SetAttachedId(std::string value)
Set id of the object id that this clip is attached to.
openshot::Keyframe perspective_c3_y
Curves representing Y for coordinate 3.
Clip * GetAttachedClip() const
Return a pointer to the clip this clip is attached to.
openshot::Keyframe perspective_c4_y
Curves representing Y for coordinate 4.
openshot::Keyframe has_video
An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes)
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
openshot::GravityType gravity
The gravity of a clip determines where it snaps to its parent.
std::string Name() override
Return the type name of the class.
Header file for the EffectInfo class.
This class is a memory-based cache manager for Frame objects.
openshot::Keyframe perspective_c1_x
Curves representing X for coordinate 1.
void init_settings()
Init default settings for a clip.
This struct contains info about the current Timeline clip instance.
bool IsOpen() override
Determine if reader is open or closed.
openshot::ReaderBase * Reader()
Get the current reader.
openshot::Keyframe perspective_c2_x
Curves representing X for coordinate 2.
openshot::Keyframe volume
Curve representing the volume (0 to 1)
int Order() const
Get the order that this effect should be executed.
void SetJson(const std::string value) override
Load JSON string into this object.
Header file for ReaderBase class.
void SetAttachedClip(Clip *clipObject)
Set the pointer to the clip this clip is attached to.
openshot::Keyframe perspective_c4_x
Curves representing X for coordinate 4.
openshot::Keyframe perspective_c1_y
Curves representing Y for coordinate 1.
openshot::Keyframe channel_filter
A number representing an audio channel to filter (clears all other channels)
void init_reader_rotation()
Update default rotation from reader.
Header file for TextReader class.
void init_reader_settings()
Init reader info details.
This class represents a timeline (used for building generic timeline implementations)
Clip()
Default Constructor.
This abstract class is the base class, used by all readers in libopenshot.
void SetAttachedObject(std::shared_ptr< openshot::TrackedObjectBase > trackedObject)
Set the pointer to the trackedObject this clip is attached to.
openshot::ScaleType scale
The scale determines how a clip should be resized to fit its parent.
Header file for Color class.
AnchorType
This enumeration determines what parent a clip should be aligned to.
ScaleType
This enumeration determines how clips are scaled to fit their parent container.
void AttachToObject(std::string object_id)
Attach clip to Tracked Object or to another Clip.
openshot::Keyframe has_audio
An optional override to determine if this clip has audio (-1=undefined, 0=no, 1=yes)
openshot::Clip * GetParentClip()
Return the associated ParentClip (if any)
openshot::Keyframe rotation
Curve representing the rotation (0 to 360)
bool operator()(openshot::EffectBase *lhs, openshot::EffectBase *rhs)
Json::Value JsonValue() const override
Generate Json::Value for this object.
openshot::Keyframe perspective_c3_x
Curves representing X for coordinate 3.
This abstract class is the base class, used by all clips in libopenshot.
Header file for the TrackedObjectBase class.
void Layer(int value)
Set layer of clip on timeline (lower number is covered by higher numbers)
VolumeMixType
This enumeration determines the strategy when mixing audio with other clips.
Header file for ClipBase class.
openshot::Color wave_color
Curve representing the color of the audio wave form.
openshot::Keyframe shear_y
Curve representing Y shear angle in degrees (-45.0=down, 45.0=up)
void RemoveEffect(openshot::EffectBase *effect)
Remove an effect from the clip.
openshot::VolumeMixType mixing
What strategy should be followed when mixing audio with other clips.
std::shared_ptr< openshot::TrackedObjectBase > GetAttachedObject() const
Return a pointer to the trackedObject this clip is attached to.
openshot::Keyframe shear_x
Curve representing X shear angle in degrees (-45.0=left, 45.0=right)
openshot::Keyframe location_x
Curve representing the relative X position in percent based on the gravity (-1 to 1)
std::recursive_mutex getFrameMutex
Mutex for multiple threads.
FrameDisplayType
This enumeration determines the display format of the clip's frame number (if any)....