28 #include "../include/ImageReader.h" 49 image = tr1::shared_ptr<Magick::Image>(
new Magick::Image(path));
52 image->backgroundColor(Magick::Color(
"none"));
55 catch (Magick::Exception
e) {
57 throw InvalidFile(
"File could not be opened.", path);
111 throw ReaderClosed(
"The FFmpegReader is closed. Call Open() before calling this method.", path);
114 tr1::shared_ptr<Frame> image_frame(
new Frame(requested_frame, image->size().width(), image->size().height(),
"#000000", 0, 2));
117 image_frame->AddMagickImage(image);
135 root[
"type"] =
"ImageReader";
148 bool success = reader.parse( value, root );
151 throw InvalidJSON(
"JSON could not be parsed (or is invalid)",
"");
161 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)",
"");
172 if (!root[
"path"].isNull())
173 path = root[
"path"].asString();
long long file_size
Size of file (in bytes)
int num
Numerator for the fraction.
int width
The width of the video (in pixesl)
This class represents a single frame of video (i.e. image & audio data)
float duration
Length of time (in seconds)
Exception when a reader is closed, and a frame is requested.
bool has_video
Determines if this file has a video stream.
Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) ...
bool has_audio
Determines if this file has an audio stream.
void SetJsonValue(Json::Value root)
Load Json::JsonValue into this object.
int height
The height of the video (in pixels)
Exception for files that can not be found or opened.
string Json()
Get and Set JSON methods.
void SetJson(string value)
Load JSON string into this object.
void Open()
Open File - which is called by the constructor automatically.
This class represents a fraction.
bool has_single_image
Determines if this file only contains a single image.
virtual Json::Value JsonValue()=0
Generate Json::JsonValue for this object.
virtual void SetJsonValue(Json::Value root)=0
Load Json::JsonValue into this object.
ReaderInfo info
Information about the current media file.
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) ...
This namespace is the default namespace for all code in the openshot library.
Exception for invalid JSON.
Json::Value JsonValue()
Generate Json::JsonValue for this object.
string vcodec
The name of the video codec used to encode / decode the video stream.
int den
Denominator for the fraction.
tr1::shared_ptr< Frame > GetFrame(long int requested_frame)
long int video_length
The number of frames in the video stream.
double ToDouble()
Return this fraction as a double (i.e. 1/2 = 0.5)