diff --git a/include/ChunkReader.h b/include/ChunkReader.h index 915f1365..6c92419b 100644 --- a/include/ChunkReader.h +++ b/include/ChunkReader.h @@ -7,7 +7,7 @@ * \author Copyright (c) 2013 Jonathan Thomas */ -#include "FileReaderBase.h" +#include "ReaderBase.h" #include "FFmpegReader.h" #include @@ -49,7 +49,7 @@ namespace openshot * \brief This class reads a special chunk-formatted file, which can be easily * shared in a distributed environment, and can return openshot::Frame objects. */ - class ChunkReader : public FileReaderBase + class ChunkReader : public ReaderBase { private: string path; diff --git a/include/ChunkWriter.h b/include/ChunkWriter.h index 3f05472c..6e92f059 100644 --- a/include/ChunkWriter.h +++ b/include/ChunkWriter.h @@ -7,8 +7,8 @@ * \author Copyright (c) 2013 Jonathan Thomas */ -#include "FileReaderBase.h" -#include "FileWriterBase.h" +#include "ReaderBase.h" +#include "WriterBase.h" #include "FFmpegWriter.h" #include @@ -37,7 +37,7 @@ namespace openshot * chunks of small video and audio data. These chunks can easily be passed around in a distributed * computing environment, without needing to share the entire video file. */ - class ChunkWriter : public FileWriterBase + class ChunkWriter : public WriterBase { private: string path; @@ -45,7 +45,7 @@ namespace openshot int chunk_size; int frame_count; bool is_writing; - FileReaderBase *local_reader; + ReaderBase *local_reader; FFmpegWriter *writer_thumb; FFmpegWriter *writer_preview; FFmpegWriter *writer_final; @@ -69,7 +69,7 @@ namespace openshot public: /// Constructor for ChunkWriter. Throws one of the following exceptions. - ChunkWriter(string path, FileReaderBase *reader) throw(InvalidFile, InvalidFormat, InvalidCodec, InvalidOptions, OutOfMemory); + ChunkWriter(string path, ReaderBase *reader) throw(InvalidFile, InvalidFormat, InvalidCodec, InvalidOptions, OutOfMemory); /// Close the writer void Close(); @@ -87,7 +87,7 @@ namespace openshot void WriteFrame(int start, int length); /// Write a block of frames from a reader - void WriteFrame(FileReaderBase* reader, int start, int length); + void WriteFrame(ReaderBase* reader, int start, int length); }; diff --git a/include/Clip.h b/include/Clip.h index 1f465614..bb3f5846 100644 --- a/include/Clip.h +++ b/include/Clip.h @@ -83,7 +83,7 @@ namespace openshot { AudioSampleBuffer *audio_cache; // File Reader object - FileReaderBase* file_reader; + ReaderBase* file_reader; /// Adjust frame number minimum value int adjust_frame_number_minimum(int frame_number); @@ -121,7 +121,7 @@ namespace openshot { Clip(string path); /// Constructor with reader - Clip(FileReaderBase* reader); + Clip(ReaderBase* reader); /// Close the internal reader void Close(); @@ -136,10 +136,10 @@ namespace openshot { void Open() throw(InvalidFile); /// Set the current reader - void Reader(FileReaderBase* reader); + void Reader(ReaderBase* reader); /// Get the current reader - FileReaderBase* Reader(); + ReaderBase* Reader(); /// Get basic properties float Position() { return position; } /// #include @@ -36,7 +36,7 @@ namespace openshot * \brief This class uses the Blackmagic Decklink libraries, to open video streams on Blackmagic devices, and return * openshot::Frame objects containing the image and audio data. */ - class DecklinkReader : public FileReaderBase + class DecklinkReader : public ReaderBase { private: bool is_open; diff --git a/include/DecklinkWriter.h b/include/DecklinkWriter.h index ca5439a1..31f2bc76 100644 --- a/include/DecklinkWriter.h +++ b/include/DecklinkWriter.h @@ -7,7 +7,7 @@ * \author Copyright (c) 2011 Jonathan Thomas */ -#include "FileWriterBase.h" +#include "WriterBase.h" #include #include @@ -36,7 +36,7 @@ namespace openshot * \brief This class uses the Blackmagic Decklink libraries, to open video streams on Blackmagic devices, and return * openshot::Frame objects containing the image and audio data. */ - class DecklinkWriter : public FileWriterBase + class DecklinkWriter : public WriterBase { private: bool is_open; @@ -73,11 +73,11 @@ namespace openshot /// Close the device and video stream void Close(); - /// This method is required for all derived classes of FileWriterBase. Write a Frame to the video file. + /// This method is required for all derived classes of WriterBase. Write a Frame to the video file. void WriteFrame(tr1::shared_ptr frame); - /// This method is required for all derived classes of FileWriterBase. Write a block of frames from a reader. - void WriteFrame(FileReaderBase* reader, int start, int length); + /// This method is required for all derived classes of WriterBase. Write a block of frames from a reader. + void WriteFrame(ReaderBase* reader, int start, int length); /// Open device and video stream - which is called by the constructor automatically void Open() throw(DecklinkError); diff --git a/include/DummyReader.h b/include/DummyReader.h index da130daa..3b0e82db 100644 --- a/include/DummyReader.h +++ b/include/DummyReader.h @@ -7,7 +7,7 @@ * \author Copyright (c) 2011 Jonathan Thomas */ -#include "FileReaderBase.h" +#include "ReaderBase.h" #include #include @@ -29,7 +29,7 @@ namespace openshot * can be created with any framerate or samplerate. This is useful in unit tests that need to test * different framerates or samplerates. */ - class DummyReader : public FileReaderBase + class DummyReader : public ReaderBase { private: tr1::shared_ptr image_frame; diff --git a/include/FFmpegReader.h b/include/FFmpegReader.h index 66699378..3097221b 100644 --- a/include/FFmpegReader.h +++ b/include/FFmpegReader.h @@ -7,7 +7,7 @@ * \author Copyright (c) 2011 Jonathan Thomas */ -#include "FileReaderBase.h" +#include "ReaderBase.h" // Include FFmpeg headers and macros #include "FFmpegUtilities.h" @@ -80,7 +80,7 @@ namespace openshot * to start retrieving frames. Use the info struct to obtain info on the file, such as the length * (in frames), height, width, bitrate, frames per second (fps), etc... */ - class FFmpegReader : public FileReaderBase + class FFmpegReader : public ReaderBase { private: string path; diff --git a/include/FFmpegWriter.h b/include/FFmpegWriter.h index 0bc3c5e9..9e1f1bf4 100644 --- a/include/FFmpegWriter.h +++ b/include/FFmpegWriter.h @@ -7,8 +7,8 @@ * \author Copyright (c) 2011 Jonathan Thomas */ -#include "FileReaderBase.h" -#include "FileWriterBase.h" +#include "ReaderBase.h" +#include "WriterBase.h" // Include FFmpeg headers and macros #include "FFmpegUtilities.h" @@ -43,7 +43,7 @@ namespace openshot * * TODO */ - class FFmpegWriter : public FileWriterBase + class FFmpegWriter : public WriterBase { private: string path; @@ -172,7 +172,7 @@ namespace openshot void WriteFrame(tr1::shared_ptr frame); /// Write a block of frames from a reader - void WriteFrame(FileReaderBase* reader, int start, int length); + void WriteFrame(ReaderBase* reader, int start, int length); /// Write the file trailer (after all frames are written) void WriteTrailer(); diff --git a/include/FrameMapper.h b/include/FrameMapper.h index 788cfb7c..65831a70 100644 --- a/include/FrameMapper.h +++ b/include/FrameMapper.h @@ -13,7 +13,7 @@ #include #include #include "../include/Cache.h" -#include "../include/FileReaderBase.h" +#include "../include/ReaderBase.h" #include "../include/Frame.h" #include "../include/FrameRate.h" #include "../include/Exceptions.h" @@ -102,7 +102,7 @@ namespace openshot * assert(frame2.Odd.Frame == 2); * \endcode */ - class FrameMapper : public FileReaderBase { + class FrameMapper : public ReaderBase { private: vector fields; // List of all fields vector frames; // List of all frames @@ -110,7 +110,7 @@ namespace openshot Framerate original; // The original frame rate Framerate target; // The target frame rate Pulldown_Method pulldown; // The pull-down technique - FileReaderBase *reader; // The source video reader + ReaderBase *reader; // The source video reader Cache final_cache; // Cache of actual Frame objects // Internal methods used by init @@ -128,7 +128,7 @@ namespace openshot public: /// Default constructor for FrameMapper class - FrameMapper(FileReaderBase *reader, Framerate target, Pulldown_Method pulldown); + FrameMapper(ReaderBase *reader, Framerate target, Pulldown_Method pulldown); /// Close the internal reader void Close(); @@ -136,7 +136,7 @@ namespace openshot /// Get a frame based on the target frame rate and the new frame number of a frame MappedFrame GetMappedFrame(int TargetFrameNumber) throw(OutOfBoundsFrame); - /// This method is required for all derived classes of FileReaderBase, and return the + /// This method is required for all derived classes of ReaderBase, and return the /// openshot::Frame object, which contains the image and audio information for that /// frame of video. /// diff --git a/include/ImageReader.h b/include/ImageReader.h index 935728da..fcebdb8e 100644 --- a/include/ImageReader.h +++ b/include/ImageReader.h @@ -7,7 +7,7 @@ * \author Copyright (c) 2011 Jonathan Thomas */ -#include "FileReaderBase.h" +#include "ReaderBase.h" #include #include @@ -28,7 +28,7 @@ namespace openshot * \brief This class uses the ImageMagick++ libraries, to open image files, and return * openshot::Frame objects containing the image. */ - class ImageReader : public FileReaderBase + class ImageReader : public ReaderBase { private: string path; diff --git a/include/OpenShot.h b/include/OpenShot.h index 78a87b90..988d5492 100644 --- a/include/OpenShot.h +++ b/include/OpenShot.h @@ -38,8 +38,8 @@ #endif #include "DummyReader.h" #include "Exceptions.h" -#include "FileReaderBase.h" -#include "FileWriterBase.h" +#include "ReaderBase.h" +#include "WriterBase.h" #include "FFmpegReader.h" #include "FFmpegWriter.h" #include "Fraction.h" diff --git a/include/Player.h b/include/Player.h index 8a4d6161..837cea86 100644 --- a/include/Player.h +++ b/include/Player.h @@ -9,7 +9,7 @@ #include #include -#include "../include/FileReaderBase.h" +#include "../include/ReaderBase.h" #define _SDL_main_h // This prevents SDL_main from replacing our main() function. #include @@ -31,7 +31,7 @@ namespace openshot class Player { private: - FileReaderBase *reader; + ReaderBase *reader; CallbackPtr callback; void *pythonmethod; @@ -43,7 +43,7 @@ namespace openshot Player(); /// Set the current reader, such as a FFmpegReader - void SetReader(FileReaderBase *p_reader); + void SetReader(ReaderBase *p_reader); /// Set a callback function which will be invoked each time a frame is ready to be displayed void SetFrameCallback(CallbackPtr p_callback, void *p_pythonmethod); diff --git a/include/FileReaderBase.h b/include/ReaderBase.h similarity index 89% rename from include/FileReaderBase.h rename to include/ReaderBase.h index d4c75419..01e6576c 100644 --- a/include/FileReaderBase.h +++ b/include/ReaderBase.h @@ -3,7 +3,7 @@ /** * \file - * \brief Header file for FileReaderBase class + * \brief Header file for ReaderBase class * \author Copyright (c) 2011 Jonathan Thomas */ @@ -20,8 +20,8 @@ namespace openshot /** * \brief This struct contains info about a media file, such as height, width, frames per second, etc... * - * Each derived class of FileReaderBase is responsible for updating this struct to reflect accurate information - * about the streams. Derived classes of FileReaderBase should call the InitFileInfo() method to initialize the + * Each derived class of ReaderBase is responsible for updating this struct to reflect accurate information + * about the streams. Derived classes of ReaderBase should call the InitFileInfo() method to initialize the * default values of this struct. */ struct ReaderInfo @@ -58,7 +58,7 @@ namespace openshot * The only requirements for a 'reader', are to derive from this base class, implement the * GetFrame method, and call the InitFileInfo() method. */ - class FileReaderBase + class ReaderBase { public: /// Information about the current media file @@ -70,7 +70,7 @@ namespace openshot /// Display file information in the standard output stream (stdout) void DisplayInfo(); - /// This method is required for all derived classes of FileReaderBase, and return the + /// This method is required for all derived classes of ReaderBase, and return the /// openshot::Frame object, which contains the image and audio information for that /// frame of video. /// diff --git a/include/TextReader.h b/include/TextReader.h index 3efa4735..6d569b2a 100644 --- a/include/TextReader.h +++ b/include/TextReader.h @@ -7,7 +7,7 @@ * \author Copyright (c) 2011 Jonathan Thomas */ -#include "FileReaderBase.h" +#include "ReaderBase.h" #include #include @@ -29,7 +29,7 @@ namespace openshot * \brief This class uses the ImageMagick++ libraries, to create frames with "Text", and return * openshot::Frame objects containing the image of the text. */ - class TextReader : public FileReaderBase + class TextReader : public ReaderBase { private: int width; diff --git a/include/Timeline.h b/include/Timeline.h index 62a8e296..e3c7e6c9 100644 --- a/include/Timeline.h +++ b/include/Timeline.h @@ -22,7 +22,7 @@ #include "Cache.h" #include "Color.h" #include "Clip.h" -#include "FileReaderBase.h" +#include "ReaderBase.h" #include "Fraction.h" #include "Frame.h" #include "FrameRate.h" @@ -47,7 +47,7 @@ namespace openshot { * video output will be rendered. It has a collection of layers and clips, that arrange, * sequence, and generate the final video output. */ - class Timeline : public FileReaderBase { + class Timeline : public ReaderBase { private: int width; /// #include "Fraction.h" #include "Frame.h" -#include "FileReaderBase.h" +#include "ReaderBase.h" using namespace std; @@ -20,7 +20,7 @@ namespace openshot /** * \brief This struct contains info about encoding a media file, such as height, width, frames per second, etc... * - * Each derived class of FileWriterBase is responsible for updating this struct to reflect accurate information + * Each derived class of WriterBase is responsible for updating this struct to reflect accurate information * about the streams. */ struct WriterInfo @@ -57,20 +57,20 @@ namespace openshot * The only requirements for a 'writer', are to derive from this base class, and implement the * WriteFrame method. */ - class FileWriterBase + class WriterBase { public: /// Information about the current media file WriterInfo info; /// This method copy's the info struct of a reader, and sets the writer with the same info - void CopyReaderInfo(FileReaderBase* reader); + void CopyReaderInfo(ReaderBase* reader); - /// This method is required for all derived classes of FileWriterBase. Write a Frame to the video file. + /// This method is required for all derived classes of WriterBase. Write a Frame to the video file. virtual void WriteFrame(tr1::shared_ptr frame) = 0; - /// This method is required for all derived classes of FileWriterBase. Write a block of frames from a reader. - virtual void WriteFrame(FileReaderBase* reader, int start, int length) = 0; + /// This method is required for all derived classes of WriterBase. Write a block of frames from a reader. + virtual void WriteFrame(ReaderBase* reader, int start, int length) = 0; /// Initialize the values of the WriterInfo struct. It is important for derived classes to call /// this method, or the WriterInfo struct values will not be initialized. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 75602dc4..95f32112 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,8 +79,8 @@ SET ( OPENSHOT_SOURCE_FILES Clip.cpp Coordinate.cpp DummyReader.cpp - FileReaderBase.cpp - FileWriterBase.cpp + ReaderBase.cpp + WriterBase.cpp FFmpegReader.cpp FFmpegWriter.cpp Fraction.cpp diff --git a/src/ChunkWriter.cpp b/src/ChunkWriter.cpp index 4a22ed51..d692eb71 100644 --- a/src/ChunkWriter.cpp +++ b/src/ChunkWriter.cpp @@ -9,7 +9,7 @@ using namespace openshot; -ChunkWriter::ChunkWriter(string path, FileReaderBase *reader) throw (InvalidFile, InvalidFormat, InvalidCodec, InvalidOptions, OutOfMemory) : +ChunkWriter::ChunkWriter(string path, ReaderBase *reader) throw (InvalidFile, InvalidFormat, InvalidCodec, InvalidOptions, OutOfMemory) : local_reader(reader), path(path), chunk_size(24*3), chunk_count(1), frame_count(1), is_writing(false), default_extension(".webm"), default_vcodec("libvpx"), default_acodec("libvorbis") { @@ -138,7 +138,7 @@ void ChunkWriter::WriteFrame(tr1::shared_ptr frame) // Write a block of frames from a reader -void ChunkWriter::WriteFrame(FileReaderBase* reader, int start, int length) +void ChunkWriter::WriteFrame(ReaderBase* reader, int start, int length) { // Loop through each frame (and encoded it) for (int number = start; number <= length; number++) diff --git a/src/Clip.cpp b/src/Clip.cpp index d9d8b25a..6d37de6a 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -66,7 +66,7 @@ Clip::Clip() } // Constructor with reader -Clip::Clip(FileReaderBase* reader) +Clip::Clip(ReaderBase* reader) { // Init all default settings init_settings(); @@ -128,14 +128,14 @@ Clip::Clip(string path) } /// Set the current reader -void Clip::Reader(FileReaderBase* reader) +void Clip::Reader(ReaderBase* reader) { // set reader pointer file_reader = reader; } /// Get the current reader -FileReaderBase* Clip::Reader() +ReaderBase* Clip::Reader() { return file_reader; } diff --git a/src/DecklinkWriter.cpp b/src/DecklinkWriter.cpp index cc9b7650..9651dda6 100644 --- a/src/DecklinkWriter.cpp +++ b/src/DecklinkWriter.cpp @@ -202,14 +202,14 @@ void DecklinkWriter::Close() } } -// This method is required for all derived classes of FileWriterBase. Write a Frame to the video file. +// This method is required for all derived classes of WriterBase. Write a Frame to the video file. void DecklinkWriter::WriteFrame(tr1::shared_ptr frame) { delegate->WriteFrame(frame); } -// This method is required for all derived classes of FileWriterBase. Write a block of frames from a reader. -void DecklinkWriter::WriteFrame(FileReaderBase* reader, int start, int length) +// This method is required for all derived classes of WriterBase. Write a block of frames from a reader. +void DecklinkWriter::WriteFrame(ReaderBase* reader, int start, int length) { // Loop through each frame (and encoded it) for (int number = start; number <= length; number++) diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp index a5d75518..c0fda1fa 100644 --- a/src/FFmpegWriter.cpp +++ b/src/FFmpegWriter.cpp @@ -418,7 +418,7 @@ void FFmpegWriter::write_queued_frames() } // Write a block of frames from a reader -void FFmpegWriter::WriteFrame(FileReaderBase* reader, int start, int length) +void FFmpegWriter::WriteFrame(ReaderBase* reader, int start, int length) { // Loop through each frame (and encoded it) for (int number = start; number <= length; number++) diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index df7838c5..0b16be5a 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -9,7 +9,7 @@ using namespace std; using namespace openshot; -FrameMapper::FrameMapper(FileReaderBase *reader, Framerate target, Pulldown_Method pulldown) : +FrameMapper::FrameMapper(ReaderBase *reader, Framerate target, Pulldown_Method pulldown) : reader(reader), target(target), pulldown(pulldown), final_cache(820 * 1024) { diff --git a/src/Player.cpp b/src/Player.cpp index 10909428..6c1a0c8e 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -8,7 +8,7 @@ Player::Player() { }; // Set the current reader, such as a FFmpegReader -void Player::SetReader(FileReaderBase *p_reader) +void Player::SetReader(ReaderBase *p_reader) { // Set the reader reader = p_reader; diff --git a/src/FileReaderBase.cpp b/src/ReaderBase.cpp similarity index 96% rename from src/FileReaderBase.cpp rename to src/ReaderBase.cpp index a6237d27..0caa2d61 100644 --- a/src/FileReaderBase.cpp +++ b/src/ReaderBase.cpp @@ -1,9 +1,9 @@ -#include "../include/FileReaderBase.h" +#include "../include/ReaderBase.h" using namespace openshot; // Initialize the values of the FileInfo struct -void FileReaderBase::InitFileInfo() +void ReaderBase::InitFileInfo() { info.has_video = false; info.has_audio = false; @@ -31,7 +31,7 @@ void FileReaderBase::InitFileInfo() } // Display file information -void FileReaderBase::DisplayInfo() { +void ReaderBase::DisplayInfo() { cout << fixed << setprecision(2) << boolalpha; cout << "----------------------------" << endl; cout << "----- File Information -----" << endl; diff --git a/src/FileWriterBase.cpp b/src/WriterBase.cpp similarity index 96% rename from src/FileWriterBase.cpp rename to src/WriterBase.cpp index 005b46f9..2a56af8b 100644 --- a/src/FileWriterBase.cpp +++ b/src/WriterBase.cpp @@ -1,9 +1,9 @@ -#include "../include/FileWriterBase.h" +#include "../include/WriterBase.h" using namespace openshot; // Initialize the values of the FileInfo struct -void FileWriterBase::InitFileInfo() +void WriterBase::InitFileInfo() { info.has_video = false; info.has_audio = false; @@ -31,7 +31,7 @@ void FileWriterBase::InitFileInfo() } // This method copy's the info struct of a reader, and sets the writer with the same info -void FileWriterBase::CopyReaderInfo(FileReaderBase* reader) +void WriterBase::CopyReaderInfo(ReaderBase* reader) { info.has_video = reader->info.has_video; info.has_audio = reader->info.has_audio; @@ -64,7 +64,7 @@ void FileWriterBase::CopyReaderInfo(FileReaderBase* reader) } // Display file information -void FileWriterBase::DisplayInfo() { +void WriterBase::DisplayInfo() { cout << fixed << setprecision(2) << boolalpha; cout << "----------------------------" << endl; cout << "----- File Information -----" << endl; diff --git a/src/openshot.i b/src/openshot.i index a82b1a29..7def47c9 100644 --- a/src/openshot.i +++ b/src/openshot.i @@ -17,8 +17,8 @@ %shared_ptr(Frame) %{ -#include "../include/FileReaderBase.h" -#include "../include/FileWriterBase.h" +#include "../include/ReaderBase.h" +#include "../include/WriterBase.h" #include "../include/Cache.h" #include "../include/Clip.h" #include "../include/ChunkReader.h" @@ -47,8 +47,8 @@ %} #endif -%include "../include/FileReaderBase.h" -%include "../include/FileWriterBase.h" +%include "../include/ReaderBase.h" +%include "../include/WriterBase.h" %include "../include/Cache.h" %include "../include/ChunkReader.h" %include "../include/ChunkWriter.h" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b4786e3b..72a3fb26 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -70,7 +70,7 @@ add_executable(tester Cache_Tests.cpp Clip_Tests.cpp Coordinate_Tests.cpp - FileReaderBase_Tests.cpp + ReaderBase_Tests.cpp FFmpegReader_Tests.cpp Fraction_Tests.cpp FrameMapper_Tests.cpp diff --git a/tests/FileReaderBase_Tests.cpp b/tests/ReaderBase_Tests.cpp similarity index 87% rename from tests/FileReaderBase_Tests.cpp rename to tests/ReaderBase_Tests.cpp index 8702b7e6..8e3af1ed 100644 --- a/tests/FileReaderBase_Tests.cpp +++ b/tests/ReaderBase_Tests.cpp @@ -6,10 +6,10 @@ using namespace openshot; // Since it is not possible to instantiate an abstract class, this test creates // a new derived class, in order to test the base class file info struct. -TEST(FileReaderBase_Derived_Class) +TEST(ReaderBase_Derived_Class) { - // Create a new derived class from type FileReaderBase - class TestReader : public FileReaderBase + // Create a new derived class from type ReaderBase + class TestReader : public ReaderBase { public: TestReader() { InitFileInfo(); };