From 9d01dd7900a4c76e4f04f1c6730d2a1dd51b4eb5 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Wed, 10 Oct 2012 00:52:47 -0500 Subject: [PATCH] Implemented the Close() method, so it closes all clips' readers on the timeline --- src/Main.cpp | 5 ++++- src/Timeline.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index bc39acc9..56707125 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -34,9 +34,12 @@ int main() t.AddClip(&c3); // Request frames - for (int x=0; x<330; x++) + for (int x=0; x<133; x++) t.GetFrame(x); + // Close timeline + t.Close(); + cout << "Successfully Finished Timeline DEMO" << endl; return 0; diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 931eed55..e53c0589 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -70,7 +70,16 @@ void Timeline::SortClips() // Close the reader (and any resources it was consuming) void Timeline::Close() { + // Close all open clips + list::iterator clip_itr; + for (clip_itr=clips.begin(); clip_itr != clips.end(); ++clip_itr) + { + // Get clip object from the iterator + Clip *clip = (*clip_itr); + // Open or Close this clip, based on if it's intersecting or not + update_open_clips(clip, false); + } } // Open the reader (and start consuming resources)