32 #ifdef USE_IMAGEMAGICK 58 image = std::make_shared<Magick::Image>(path);
61 image->backgroundColor(Magick::Color(
"none"));
64 catch (
const Magick::Exception& e) {
66 throw InvalidFile(
"File could not be opened.", path);
120 throw ReaderClosed(
"The FFmpegReader is closed. Call Open() before calling this method.", path);
123 auto image_frame = std::make_shared<Frame>(
124 requested_frame, image->size().width(), image->size().height(),
128 image_frame->AddMagickImage(image);
146 root[
"type"] =
"ImageReader";
163 catch (
const std::exception& e)
166 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
177 if (!root[
"path"].isNull())
178 path = root[
"path"].asString();
188 #endif //USE_IMAGEMAGICK void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
int num
Numerator for the fraction.
void Close() override
Close File.
int width
The width of the video (in pixesl)
#define MAGICK_IMAGE_ALPHA(im, a)
std::shared_ptr< Frame > GetFrame(int64_t requested_frame) override
float duration
Length of time (in seconds)
double ToDouble() const
Return this fraction as a double (i.e. 1/2 = 0.5)
void SetJson(const std::string value) override
Load JSON string into this object.
const Json::Value stringToJson(const std::string value)
Exception when a reader is closed, and a frame is requested.
bool has_video
Determines if this file has a video stream.
int64_t file_size
Size of file (in bytes)
Header file for all Exception classes.
bool has_audio
Determines if this file has an audio stream.
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
int64_t video_length
The number of frames in the video stream.
int height
The height of the video (in pixels)
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
Exception for files that can not be found or opened.
This class represents a fraction.
bool has_single_image
Determines if this file only contains a single image.
void Open() override
Open File - which is called by the constructor automatically.
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
openshot::ReaderInfo info
Information about the current media file.
std::string vcodec
The name of the video codec used to encode / decode the video stream.
Json::Value JsonValue() const override
Generate Json::Value for this object.
This namespace is the default namespace for all code in the openshot library.
Exception for invalid JSON.
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) ...
openshot::Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) ...
ImageReader(const std::string &path, bool inspect_reader=true)
Constructor for ImageReader.
Header file for ImageReader class.
int den
Denominator for the fraction.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
std::string Json() const override
Generate JSON string of this object.