diff --git a/src/Clip.cpp b/src/Clip.cpp
index 287060b8..212a8dd4 100644
--- a/src/Clip.cpp
+++ b/src/Clip.cpp
@@ -324,10 +324,10 @@ tr1::shared_ptr Clip::get_time_mapped_frame(tr1::shared_ptr frame,
// Determine next unique frame (after these repeating frames)
- int next_unique_frame = time.GetInt(frame_number + (time.GetRepeatFraction(frame_number).den - time.GetRepeatFraction(frame_number).num) + 1);
- if (next_unique_frame != new_frame_number)
- // Overlay the next frame on top of this frame (to create a smoother slow motion effect)
- new_frame->AddImage(file_reader->GetFrame(next_unique_frame)->GetImage(), float(time.GetRepeatFraction(frame_number).num) / float(time.GetRepeatFraction(frame_number).den));
+ //int next_unique_frame = time.GetInt(frame_number + (time.GetRepeatFraction(frame_number).den - time.GetRepeatFraction(frame_number).num) + 1);
+ //if (next_unique_frame != new_frame_number)
+ // // Overlay the next frame on top of this frame (to create a smoother slow motion effect)
+ // new_frame->AddImage(file_reader->GetFrame(next_unique_frame)->GetImage(), float(time.GetRepeatFraction(frame_number).num) / float(time.GetRepeatFraction(frame_number).den));
}
else if (abs(delta) > 1 && abs(delta) < 100)
@@ -437,7 +437,7 @@ tr1::shared_ptr Clip::get_time_mapped_frame(tr1::shared_ptr frame,
// clean up
//delete resampler;
//resampler = NULL;
- cout << "samples: "<< samples << endl;
+
delete samples;
samples = NULL;
diff --git a/src/Main.cpp b/src/Main.cpp
index b914d985..922f8571 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -20,13 +20,17 @@ int main()
/* TIMELINE ---------------- */
Timeline t(720, 420, Framerate(24,1), 48000, 2);
- t.color.blue.AddPoint(1, 0);
- t.color.blue.AddPoint(300, 65000);
+
// Add some clips
Clip c1(new FFmpegReader("/home/jonathan/Videos/sintel_trailer-480p.mp4"));
Clip c2(new FFmpegReader("/home/jonathan/Videos/sintel_trailer-480p.mp4"));
- Clip c3(new ImageReader("/home/jonathan/Desktop/icon.png"));
+ Clip c3(new ImageReader("/home/jonathan/Desktop/logo.png"));
+ Clip c4(new ImageReader("/home/jonathan/Desktop/text3.png")); // audio
+ Clip c5(new ImageReader("/home/jonathan/Desktop/text1.png")); // color
+ Clip c6(new ImageReader("/home/jonathan/Desktop/text4.png")); // sub-pixel
+ Clip c7(new ImageReader("/home/jonathan/Desktop/text8.png")); // coming soon
+ Clip c10(new ImageReader("/home/jonathan/Desktop/text10.png")); // time mapping
// CLIP 1 (background movie)
c1.Position(0.0);
@@ -35,17 +39,31 @@ int main()
c1.Layer(0);
c1.End(16.0);
c1.alpha.AddPoint(1, 0.0);
- c1.alpha.AddPoint(360, 0.0, LINEAR);
- c1.alpha.AddPoint(384, 1.0);
+ c1.alpha.AddPoint(500, 0.0);
+ c1.alpha.AddPoint(565, 1.0);
+ c1.time.AddPoint(1, 360);
+ c1.time.AddPoint(384, 180, LINEAR);
+ c1.time.AddPoint(385, 180);
+ c1.time.AddPoint(565, 720, LINEAR);
+ //c1.time.PrintValues();
+ //return 1;
+
// CLIP 2 (wave form)
c2.Position(0.0);
c2.Layer(1);
c2.Waveform(true);
c2.alpha.AddPoint(1, 1.0);
- c2.alpha.AddPoint(100, 0.0);
+ c2.alpha.AddPoint(150, 0.0);
+ c2.alpha.AddPoint(360, 0.0, LINEAR);
+ c2.alpha.AddPoint(384, 1.0);
c2.volume.AddPoint(1, 0.0);
c2.volume.AddPoint(300, 0.0, LINEAR);
+ c2.End(15.0);
+ c2.wave_color.blue.AddPoint(1, 65000);
+ c2.wave_color.blue.AddPoint(300, 0);
+ c2.wave_color.red.AddPoint(1, 0);
+ c2.wave_color.red.AddPoint(300, 65000);
// CLIP 3 (watermark)
c3.Layer(2);
@@ -54,13 +72,76 @@ int main()
c3.scale = SCALE_NONE;
c3.alpha.AddPoint(1, 1.0);
c3.alpha.AddPoint(75, 0.0);
- //c3.location_x = Keyframe(-5);
- //c3.location_y = Keyframe(-5);
+ c3.location_x.AddPoint(1, -5);
+ c3.location_y.AddPoint(1, -5);
+
+ // CLIP 4 (text about waveform)
+ c4.Layer(3);
+ c4.scale = SCALE_NONE;
+ c4.gravity = GRAVITY_CENTER;
+ c4.Position(1);
+ c4.alpha.AddPoint(1, 1.0);
+ c4.alpha.AddPoint(30, 0.0);
+ c4.alpha.AddPoint(100, 0.0);
+ c4.alpha.AddPoint(130, 1.0);
+ c4.End(5.5);
+
+ // CLIP 5 (text about colors)
+ c5.Layer(3);
+ c5.scale = SCALE_NONE;
+ c5.gravity = GRAVITY_CENTER;
+ c5.Position(16);
+ c5.alpha.AddPoint(1, 1.0);
+ c5.alpha.AddPoint(30, 0.0);
+ c5.alpha.AddPoint(100, 0.0);
+ c5.alpha.AddPoint(130, 1.0);
+ c5.End(5.5);
+
+ // CLIP 6 (text about sub-pixel)
+ c6.Layer(3);
+ c6.scale = SCALE_NONE;
+ c6.gravity = GRAVITY_LEFT;
+ c6.Position(24);
+ c6.alpha.AddPoint(1, 1.0);
+ c6.alpha.AddPoint(30, 0.0);
+ c6.alpha.AddPoint(100, 0.0);
+ c6.alpha.AddPoint(130, 1.0);
+ c6.location_x.AddPoint(1,0.05);
+ c6.location_x.AddPoint(130, 0.3);
+ c6.End(5.5);
+
+ // CLIP 7 (text about coming soon)
+ c7.Layer(3);
+ c7.scale = SCALE_NONE;
+ c7.gravity = GRAVITY_CENTER;
+ c7.Position(18.0);
+ c7.alpha.AddPoint(1, 1.0);
+ c7.alpha.AddPoint(30, 0.0);
+ c7.alpha.AddPoint(100, 0.0);
+ c7.alpha.AddPoint(130, 1.0);
+ c7.End(5.5);
+
+
+ // CLIP 10 (text about waveform)
+ c10.Layer(3);
+ c10.scale = SCALE_NONE;
+ c10.gravity = GRAVITY_CENTER;
+ c10.Position(1);
+ c10.alpha.AddPoint(1, 1.0);
+ c10.alpha.AddPoint(30, 0.0);
+ c10.alpha.AddPoint(100, 0.0);
+ c10.alpha.AddPoint(130, 1.0);
+ c10.End(5.5);
// Add clips
t.AddClip(&c1);
- t.AddClip(&c2);
- t.AddClip(&c3);
+ //t.AddClip(&c2);
+ //t.AddClip(&c3);
+ //t.AddClip(&c4);
+ //t.AddClip(&c5);
+ //t.AddClip(&c6);
+ t.AddClip(&c7);
+ t.AddClip(&c10);
/* ---------------- */
@@ -81,7 +162,7 @@ int main()
// Output stream info
w.OutputStreamInfo();
- for (int frame = 1; frame <= 600; frame++)
+ for (int frame = 1; frame <= 565; frame++)
{
tr1::shared_ptr f = t.GetFrame(frame);
if (f)
diff --git a/src/Timeline.cpp b/src/Timeline.cpp
index c2820d6f..3833f7c2 100644
--- a/src/Timeline.cpp
+++ b/src/Timeline.cpp
@@ -200,8 +200,8 @@ void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, in
bool is_x_animated = source_clip->location_x.Points.size() > 2;
bool is_y_animated = source_clip->location_y.Points.size() > 2;
- int offset_x = 0;
- int offset_y = 0;
+ int offset_x = -1;
+ int offset_y = -1;
if ((!isEqual(x, 0) || !isEqual(y, 0)) && (isEqual(r, 0) && isEqual(sx, 1) && isEqual(sy, 1) && !is_x_animated && !is_y_animated))
{
cout << "SIMPLE" << endl;
@@ -340,7 +340,7 @@ tr1::shared_ptr Timeline::GetFrame(int requested_frame) throw(ReaderClose
// Loop through all requested frames
for (int frame_number = requested_frame; frame_number < requested_frame + minimum_frames; frame_number++)
{
- #pragma omp task firstprivate(frame_number)
+ #pragma omp xxx task firstprivate(frame_number)
{
// Create blank frame (which will become the requested frame)
tr1::shared_ptr new_frame(tr1::shared_ptr(new Frame(frame_number, width, height, "#000000", GetSamplesPerFrame(frame_number), channels)));