You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Improved Clip class, and worked on constructors, file readers (image and ffmpeg), and more curves (shear, perspective, and crop)
This commit is contained in:
64
src/Clip.cpp
64
src/Clip.cpp
@@ -2,14 +2,14 @@
|
||||
|
||||
using namespace openshot;
|
||||
|
||||
// Default Constructor for a clip
|
||||
Clip::Clip()
|
||||
// Init default settings for a clip
|
||||
void Clip::init_settings()
|
||||
{
|
||||
// Init clip settings
|
||||
position = 0.0;
|
||||
layer = 0;
|
||||
start = 0.0;
|
||||
end = 0.0;
|
||||
set_position(0.0);
|
||||
set_layer(0);
|
||||
set_start(0.0);
|
||||
set_end(0.0);
|
||||
gravity = CENTER;
|
||||
scale = FIT;
|
||||
anchor = CANVAS;
|
||||
@@ -30,4 +30,56 @@ Clip::Clip()
|
||||
time = Keyframe(0.0);
|
||||
volume = Keyframe(100.0);
|
||||
|
||||
// Init crop settings
|
||||
crop_gravity = CENTER;
|
||||
crop_width = Keyframe(-1.0);
|
||||
crop_height = Keyframe(-1.0);
|
||||
crop_x = Keyframe(0.0);
|
||||
crop_y = Keyframe(0.0);
|
||||
|
||||
// Init shear and perspective curves
|
||||
shear_x = Keyframe(0.0);
|
||||
shear_y = Keyframe(0.0);
|
||||
perspective_c1_x = Keyframe(-1.0);
|
||||
perspective_c1_y = Keyframe(-1.0);
|
||||
perspective_c2_x = Keyframe(-1.0);
|
||||
perspective_c2_y = Keyframe(-1.0);
|
||||
perspective_c3_x = Keyframe(-1.0);
|
||||
perspective_c3_y = Keyframe(-1.0);
|
||||
perspective_c4_x = Keyframe(-1.0);
|
||||
perspective_c4_y = Keyframe(-1.0);
|
||||
}
|
||||
|
||||
// Default Constructor for a clip
|
||||
Clip::Clip()
|
||||
{
|
||||
// Init all default settings
|
||||
init_settings();
|
||||
}
|
||||
|
||||
// Constructor with filepath
|
||||
Clip::Clip(string path)
|
||||
{
|
||||
// Init all default settings
|
||||
init_settings();
|
||||
|
||||
// Try each type of reader (until one works)
|
||||
try
|
||||
{
|
||||
file_reader = new ImageReader(path);
|
||||
cout << "READER FOUND: ImageReader" << endl;
|
||||
|
||||
} catch(...) {
|
||||
try
|
||||
{
|
||||
file_reader = new FFmpegReader(path);
|
||||
cout << "READER FOUND: FFmpegReader" << endl;
|
||||
|
||||
} catch(BaseException ex) {
|
||||
// let exception bubble up
|
||||
cout << "READER NOT FOUND" << endl;
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user