Made Keyframe objects thread safe, by generating the values as Points are added, and the Timeline's Open and Close logic was made thread safe, so a reader is not closed while it's still being accessed on another thread. Also removed some unneeded code and comments.

This commit is contained in:
Jonathan Thomas
2012-12-03 22:55:46 -06:00
parent a8fa5a91d2
commit 0d82a4e716
9 changed files with 51 additions and 32 deletions

View File

@@ -61,10 +61,10 @@ int main()
// Add some clips
//Clip c1(new FFmpegReader("/home/jonathan/Apps/videcho_site/media/user_files/videos/bd0bf442-3221-11e2-8bf6-001fd00ee3aa.webm"));
//Clip c1(new FFmpegReader("/home/jonathan/Videos/Movie Music/02 - Shattered [Turn The Car Around] (Album Version).mp3"));
FFmpegReader r1("../../src/examples/piano.wav");
Clip c1(new FFmpegReader("/home/jonathan/Videos/sintel_trailer-720p.mp4"));
Clip c2(new ImageReader("/home/jonathan/Desktop/logo.png"));
Clip c3(new FFmpegReader("/home/jonathan/Videos/sintel_trailer-720p.mp4"));
FFmpegReader r1("/home/jonathan/Videos/sintel-1024-stereo.mp4");
Clip c1(new FFmpegReader("/home/jonathan/Videos/sintel-1024-stereo.mp4"));
Clip c2(new ImageReader("/home/jonathan/Desktop/Logo.png"));
Clip c3(new FFmpegReader("/home/jonathan/Videos/sintel-1024-stereo.mp4"));
//Clip c3(new FFmpegReader("/home/jonathan/Videos/Movie Music/01 Whip It.mp3"));
c1.Position(0.0);
c1.gravity = GRAVITY_CENTER;
@@ -181,10 +181,10 @@ int main()
// Add clips
t.AddClip(&c1);
//t.AddClip(&c2);
t.AddClip(&c2);
//t.AddClip(&c3);
r1.Open();
//r1.Open();
// Create a writer
FFmpegWriter w("/home/jonathan/output.webm");
@@ -192,8 +192,8 @@ int main()
// Set options
//w.SetAudioOptions(true, "libmp3lame", 44100, 2, 128000, false);
w.SetAudioOptions(true, "libvorbis", 48000, 2, 128000);
w.SetVideoOptions(true, "libvpx", Fraction(24,1), 624, 348, Fraction(1,1), false, false, 2000000);
w.SetAudioOptions(true, "libvorbis", 44100, 2, 128000);
w.SetVideoOptions(true, "libvpx", Fraction(25,1), 624, 348, Fraction(1,1), false, false, 2000000);
// Prepare Streams
w.PrepareStreams();
@@ -204,13 +204,13 @@ int main()
// Output stream info
w.OutputStreamInfo();
for (int frame = 1; frame <= 100; frame++)
for (int frame = 100; frame <= 200; frame++)
{
tr1::shared_ptr<Frame> f = r1.GetFrame(frame);
tr1::shared_ptr<Frame> f = t.GetFrame(frame);
if (f)
{
//if (frame >= 13)
//f->DisplayWaveform();
//f->Display();
// Write frame
cout << "queue frame " << frame << " (" << f->number << ", " << f << ")" << endl;