Skip to content

Commit

Permalink
ImageReader: Consolidate ctors using default arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Oct 17, 2020
1 parent 49b7e62 commit 06d45cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
18 changes: 9 additions & 9 deletions include/ImageReader.h
Expand Up @@ -76,15 +76,15 @@ namespace openshot
bool is_open;

public:

/// Constructor for ImageReader. This automatically opens the media file and loads
/// frame 1, or it throws one of the following exceptions.
ImageReader(std::string path);

/// Constructor for ImageReader. This only opens the media file to inspect its properties
/// if inspect_reader=true. When not inspecting the media file, it's much faster, and useful
/// when you are inflating the object using JSON after instantiating it.
ImageReader(std::string path, bool inspect_reader);
/// @brief Constructor for ImageReader.
///
/// Opens the media file to inspect its properties and loads frame 1,
/// iff inspect_reader == true (the default). Pass a false value in
/// the optional parameter to defer this initial Open()/Close() cycle.
///
/// When not inspecting the media file, it's much faster, and useful
/// when you are inflating the object using JSON after instantiation.
ImageReader(const std::string& path, bool inspect_reader=true);

/// Close File
void Close() override;
Expand Down
9 changes: 1 addition & 8 deletions src/ImageReader.cpp
Expand Up @@ -35,14 +35,7 @@

using namespace openshot;

ImageReader::ImageReader(std::string path) : path(path), is_open(false)
{
// Open and Close the reader, to populate its attributes (such as height, width, etc...)
Open();
Close();
}

ImageReader::ImageReader(std::string path, bool inspect_reader) : path(path), is_open(false)
ImageReader::ImageReader(const std::string& path, bool inspect_reader) : path(path), is_open(false)
{
// Open and Close the reader, to populate its attributes (such as height, width, etc...)
if (inspect_reader) {
Expand Down

0 comments on commit 06d45cb

Please sign in to comment.