OpenShot Library | libopenshot 0.5.0
Loading...
Searching...
No Matches
ImageReader.h
Go to the documentation of this file.
1
8
9// Copyright (c) 2008-2019 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_IMAGE_READER_H
14#define OPENSHOT_IMAGE_READER_H
15
16// Require ImageMagick support
17#ifdef USE_IMAGEMAGICK
18
19#include <memory>
20#include <string>
21
22#include "ReaderBase.h"
23#include "Json.h"
24
25// Forward decls
26namespace Magick {
27 class Image;
28}
29namespace openshot {
30 class CacheBase;
31 class Frame;
32}
33
34namespace openshot
35{
55 class ImageReader : public ReaderBase
56 {
57 private:
58 std::string path;
59 std::shared_ptr<Magick::Image> image;
60 bool is_open;
61
62 public:
71 ImageReader(const std::string& path, bool inspect_reader=true);
72
74 void Close() override;
75
77 CacheBase* GetCache() override { return NULL; };
78
84 std::shared_ptr<Frame> GetFrame(int64_t requested_frame) override;
85
87 bool IsOpen() override { return is_open; };
88
90 std::string Name() override { return "ImageReader"; };
91
92 // Get and Set JSON methods
93 std::string Json() const override;
94 void SetJson(const std::string value) override;
95 Json::Value JsonValue() const override;
96 void SetJsonValue(const Json::Value root) override;
97
99 void Open() override;
100 };
101
102}
103
104#endif //USE_IMAGEMAGICK
105#endif //OPENSHOT_IMAGE_READER_H
Header file for JSON class.
Header file for ReaderBase class.
All cache managers in libopenshot are based on this CacheBase class.
Definition CacheBase.h:35
bool IsOpen() override
Determine if reader is open or closed.
Definition ImageReader.h:87
void Open() override
Open File - which is called by the constructor automatically.
std::shared_ptr< Frame > GetFrame(int64_t requested_frame) override
ImageReader(const std::string &path, bool inspect_reader=true)
Constructor for ImageReader.
std::string Name() override
Return the type name of the class.
Definition ImageReader.h:90
void SetJson(const std::string value) override
Load JSON string into this object.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Json::Value JsonValue() const override
Generate Json::Value for this object.
CacheBase * GetCache() override
Get the cache object used by this reader (always returns NULL for this object).
Definition ImageReader.h:77
std::string Json() const override
Generate JSON string of this object.
void Close() override
Close File.
ReaderBase()
Constructor for the base reader, where many things are initialized.
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29