From 60e645da61933f0fb7fd67d72c17b96bf3a6daf0 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Wed, 10 Oct 2012 01:07:47 -0500 Subject: [PATCH] Added a FrameRate() method to the timeline, to get or set the fps. Also, added a unit test for that, and refactored some header files to be alphabetical. --- include/FFmpegReader.h | 2 +- include/ImageReader.h | 2 +- include/Timeline.h | 43 +++++++++++++++++++++--------------- src/FFmpegReader.cpp | 2 +- src/ImageReader.cpp | 2 +- tests/FFmpegReader_Tests.cpp | 5 +---- tests/Timeline_Tests.cpp | 17 ++++++++++++++ 7 files changed, 47 insertions(+), 26 deletions(-) diff --git a/include/FFmpegReader.h b/include/FFmpegReader.h index 3e007a78..73b5b038 100644 --- a/include/FFmpegReader.h +++ b/include/FFmpegReader.h @@ -174,7 +174,7 @@ namespace openshot /// Constructor for FFmpegReader. This automatically opens the media file and loads /// frame 1, or it throws one of the following exceptions. - FFmpegReader(string path); + FFmpegReader(string path) throw(InvalidFile, NoStreamsFound, InvalidCodec); /// Close File void Close(); diff --git a/include/ImageReader.h b/include/ImageReader.h index 54db9c18..53f69fa9 100644 --- a/include/ImageReader.h +++ b/include/ImageReader.h @@ -39,7 +39,7 @@ namespace openshot /// Constructor for ImageReader. This automatically opens the media file and loads /// frame 1, or it throws one of the following exceptions. - ImageReader(string path); + ImageReader(string path) throw(InvalidFile); /// Close File void Close(); diff --git a/include/Timeline.h b/include/Timeline.h index bab76de9..c1e5e89a 100644 --- a/include/Timeline.h +++ b/include/Timeline.h @@ -52,33 +52,27 @@ namespace openshot { /// Default Constructor for the timeline (which sets the canvas width and height and FPS) Timeline(int width, int height, Framerate fps); + /// Add an openshot::Clip to the timeline + void AddClip(Clip* clip); + + /// Close the reader (and any resources it was consuming) + void Close(); + + /// Get the framerate of this timeline + Framerate FrameRate() { return fps; }; + + /// Set the framerate for this timeline + void FrameRate(Framerate new_fps) { fps = new_fps; }; + /// Get an openshot::Frame object for a specific frame number of this timeline. /// /// @returns The requested frame (containing the image) /// @param[requested_frame] number The frame number that is requested. Frame* GetFrame(int requested_frame) throw(ReaderClosed); - /// Close the reader (and any resources it was consuming) - void Close(); - - /// Open the reader (and start consuming resources) - void Open(); - - /// Add an openshot::Clip to the timeline - void AddClip(Clip* clip); - - /// Sort clips by position on the timeline - void SortClips(); - - /// Get the width of canvas and viewport - int Width() { return width; } - /// Get the height of canvas and viewport int Height() { return height; } - /// Set the width of canvas and viewport - void Width(int new_width) { width = new_width; } - /// Set the height of canvas and viewport void Height(int new_height) { height = new_height; } @@ -86,6 +80,19 @@ namespace openshot { Keyframe viewport_scale; ///