37 void DummyReader::init(
Fraction fps,
int width,
int height,
int sample_rate,
int channels,
float duration) {
70 init(
Fraction(24,1), 1280, 768, 44100, 2, 30.0);
77 init(fps, width, height, sample_rate, channels, duration);
84 init(fps, width, height, sample_rate, channels, duration);
124 throw ReaderClosed(
"The ImageReader is closed. Call Open() before calling this method.",
"dummy");
126 int dummy_cache_count = 0;
128 dummy_cache_count = dummy_cache->
Count();
131 if (dummy_cache_count == 0 && image_frame) {
136 image_frame->number = requested_frame;
139 }
else if (dummy_cache_count > 0) {
144 std::shared_ptr<openshot::Frame> f = dummy_cache->
GetFrame(requested_frame);
150 throw InvalidFile(
"Requested frame not found. You can only access Frame numbers that exist in the Cache object.",
"dummy");
155 throw InvalidFile(
"No frame could be created from this type of file.",
"dummy");
170 root[
"type"] =
"DummyReader";
186 catch (
const std::exception& e)
189 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
int num
Numerator for the fraction.
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
Header file for DummyReader class.
int width
The width of the video (in pixesl)
float ToFloat()
Return this fraction as a float (i.e. 1/2 = 0.5)
float duration
Length of time (in seconds)
void Open() override
Open File - which is called by the constructor automatically.
const Json::Value stringToJson(const std::string value)
std::string Json() const override
Generate JSON string of this object.
Exception when a reader is closed, and a frame is requested.
bool has_video
Determines if this file has a video stream.
DummyReader()
Blank constructor for DummyReader, with default settings.
void Close() override
Close File.
int64_t file_size
Size of file (in bytes)
void SetJson(const std::string value) override
Load JSON string into this object.
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)
virtual int64_t Count()=0
Count the frames in the queue.
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.
virtual std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number)=0
Get a frame from the cache.
juce::CriticalSection getFrameCriticalSection
Section lock for multiple threads.
All cache managers in libopenshot are based on this CacheBase class.
Fraction Reciprocal() const
Return the reciprocal as a Fraction.
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.
This namespace is the default namespace for all code in the openshot library.
Json::Value JsonValue() const override
Generate Json::Value for this object.
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) ...
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
int den
Denominator for the fraction.
int channels
The number of audio channels used in the audio stream.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
std::string acodec
The name of the audio codec used to encode / decode the video stream.
int sample_rate
The number of audio samples per second (44100 is a common sample rate)