Improved Clip class, and worked on constructors, file readers (image and ffmpeg), and more curves (shear, perspective, and crop)

This commit is contained in:
Jonathan Thomas
2012-10-04 01:34:45 -05:00
parent e96bd5ba98
commit 2266a4ab7a
2 changed files with 111 additions and 13 deletions

View File

@@ -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;
}
}
}