ImageReader: Consolidate ctors using default arg

This commit is contained in:
FeRD (Frank Dana)
2020-10-17 05:56:02 -04:00
parent 49b7e623ce
commit 06d45cb88a
2 changed files with 10 additions and 17 deletions

View File

@@ -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;

View File

@@ -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) {