|
OpenShot Library | libopenshot
0.6.0
|
This abstract class is the base class, used by all readers in libopenshot. More...
#include <ReaderBase.h>
Public Member Functions | |
| virtual void | Close ()=0 |
| Close the reader (and any resources it was consuming) More... | |
| void | DisplayInfo (std::ostream *out=&std::cout) |
| Display file information in the standard output stream (stdout) More... | |
| virtual openshot::CacheBase * | GetCache ()=0 |
| Get the cache object used by this reader (note: not all readers use cache) More... | |
| virtual std::shared_ptr< openshot::Frame > | GetFrame (int64_t number)=0 |
| virtual bool | HardwareDecodeSuccessful () const |
| bool | HasMaxDecodeSize () const |
| Return true when a maximum decoded frame size is active. More... | |
| virtual bool | IsOpen ()=0 |
| Determine if reader is open or closed. More... | |
| virtual std::string | Json () const =0 |
| Generate JSON string of this object. More... | |
| virtual Json::Value | JsonValue () const =0 |
| Generate Json::Value for this object. More... | |
| int | MaxDecodeHeight () const |
| Return the current maximum decoded frame height (0 when unlimited). More... | |
| int | MaxDecodeWidth () const |
| Return the current maximum decoded frame width (0 when unlimited). More... | |
| virtual std::string | Name ()=0 |
| Return the type name of the class. More... | |
| virtual void | Open ()=0 |
| Open the reader (and start consuming resources, such as images or video files) More... | |
| openshot::ClipBase * | ParentClip () |
| Parent clip object of this reader (which can be unparented and NULL) More... | |
| void | ParentClip (openshot::ClipBase *new_clip) |
| Set parent clip object of this reader. More... | |
| ReaderBase () | |
| Constructor for the base reader, where many things are initialized. More... | |
| virtual void | SetJson (const std::string value)=0 |
| Load JSON string into this object. More... | |
| virtual void | SetJsonValue (const Json::Value root)=0 |
| Load Json::Value into this object. More... | |
| void | SetMaxDecodeSize (int width, int height) |
| Set an optional maximum decoded frame size. Use 0,0 to disable the limit. More... | |
| virtual | ~ReaderBase ()=default |
Public Attributes | |
| openshot::ReaderInfo | info |
| Information about the current media file. More... | |
Protected Attributes | |
| openshot::ClipBase * | clip |
| Pointer to the parent clip instance (if any) More... | |
| std::recursive_mutex | getFrameMutex |
| Mutex for multiple threads. More... | |
| int | max_decode_height |
| Optional maximum decoded frame height (0 disables the limit) More... | |
| int | max_decode_width |
| Optional maximum decoded frame width (0 disables the limit) More... | |
This abstract class is the base class, used by all readers in libopenshot.
Readers are types of classes that read video, audio, and image files, and return openshot::Frame objects. The only requirements for a 'reader', are to derive from this base class, implement the GetFrame method, and populate ReaderInfo.
Definition at line 75 of file ReaderBase.h.
| ReaderBase::ReaderBase | ( | ) |
Constructor for the base reader, where many things are initialized.
Definition at line 27 of file ReaderBase.cpp.
|
virtualdefault |
|
pure virtual |
Close the reader (and any resources it was consuming)
Implemented in openshot::Timeline, openshot::FFmpegReader, openshot::FrameMapper, openshot::Clip, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Referenced by openshot::ChunkWriter::Close(), openshot::Clip::Close(), openshot::FrameMapper::Close(), openshot::ChunkReader::GetFrame(), openshot::EffectBase::MaskReader(), and openshot::Clip::Reader().
| void ReaderBase::DisplayInfo | ( | std::ostream * | out = &std::cout | ) |
Display file information in the standard output stream (stdout)
Definition at line 63 of file ReaderBase.cpp.
Referenced by openshot::QtPlayer::SetSource(), and openshot::QtPlayer::SetTimelineSource().
|
pure virtual |
Get the cache object used by this reader (note: not all readers use cache)
Implemented in openshot::Timeline, openshot::FFmpegReader, openshot::FrameMapper, openshot::Clip, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Referenced by openshot::Timeline::ClearAllCache(), openshot::VideoCacheThread::NotifyPlaybackPosition(), openshot::VideoCacheThread::run(), and openshot::VideoCacheThread::Seek().
|
pure virtual |
This method is required for all derived classes of ReaderBase, and returns the openshot::Frame object, which contains the image and audio information for that frame of video.
| [in] | number | The frame number that is requested. |
Implemented in openshot::Timeline, openshot::FFmpegReader, openshot::FrameMapper, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, openshot::ImageReader, and openshot::Clip.
Referenced by openshot::ChunkReader::GetFrame(), openshot::AudioReaderSource::getNextAudioBlock(), openshot::VideoCacheThread::prefetchWindow(), openshot::ImageWriter::WriteFrame(), openshot::ChunkWriter::WriteFrame(), and openshot::FFmpegWriter::WriteFrame().
|
inlinevirtual |
Return true if hardware decode successfully produced at least one frame. Readers without hardware decode support should return false.
Reimplemented in openshot::FFmpegReader.
Definition at line 132 of file ReaderBase.h.
| bool ReaderBase::HasMaxDecodeSize | ( | ) | const |
Return true when a maximum decoded frame size is active.
Definition at line 265 of file ReaderBase.cpp.
|
pure virtual |
Determine if reader is open or closed.
Implemented in openshot::Timeline, openshot::FFmpegReader, openshot::FrameMapper, openshot::Clip, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Referenced by openshot::FrameMapper::IsOpen(), and openshot::Clip::SetJsonValue().
|
pure virtual |
Generate JSON string of this object.
Implemented in openshot::Timeline, openshot::Clip, openshot::FFmpegReader, openshot::FrameMapper, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Referenced by openshot::EffectBase::BasePropertiesJSON().
|
pure virtual |
Generate Json::Value for this object.
Implemented in openshot::Timeline, openshot::Clip, openshot::FFmpegReader, openshot::FrameMapper, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Definition at line 109 of file ReaderBase.cpp.
Referenced by openshot::ImageReader::JsonValue(), openshot::QtHtmlReader::JsonValue(), openshot::TextReader::JsonValue(), openshot::QtTextReader::JsonValue(), openshot::DummyReader::JsonValue(), openshot::QtImageReader::JsonValue(), openshot::ChunkReader::JsonValue(), openshot::EffectBase::JsonValue(), openshot::FrameMapper::JsonValue(), openshot::FFmpegReader::JsonValue(), openshot::Clip::JsonValue(), openshot::Timeline::JsonValue(), openshot::Mask::Mask(), and openshot::Mask::Reader().
| int ReaderBase::MaxDecodeHeight | ( | ) | const |
Return the current maximum decoded frame height (0 when unlimited).
Definition at line 261 of file ReaderBase.cpp.
| int ReaderBase::MaxDecodeWidth | ( | ) | const |
Return the current maximum decoded frame width (0 when unlimited).
Definition at line 257 of file ReaderBase.cpp.
|
pure virtual |
Return the type name of the class.
Implemented in openshot::Timeline, openshot::FFmpegReader, openshot::FrameMapper, openshot::Clip, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Referenced by openshot::Clip::Reader().
|
pure virtual |
Open the reader (and start consuming resources, such as images or video files)
Implemented in openshot::Timeline, openshot::FFmpegReader, openshot::Clip, openshot::FrameMapper, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Referenced by openshot::ChunkWriter::ChunkWriter(), openshot::ChunkReader::GetFrame(), openshot::FrameMapper::Open(), openshot::Clip::Open(), and openshot::Clip::SetJsonValue().
| openshot::ClipBase * ReaderBase::ParentClip | ( | ) |
Parent clip object of this reader (which can be unparented and NULL)
Definition at line 243 of file ReaderBase.cpp.
Referenced by openshot::Clip::Clip(), openshot::ObjectDetection::GetFrame(), openshot::FrameMapper::GetFrame(), openshot::EffectBase::MaskReader(), openshot::EffectBase::ParentClip(), openshot::Clip::Reader(), and openshot::Clip::SetJsonValue().
| void ReaderBase::ParentClip | ( | openshot::ClipBase * | new_clip | ) |
Set parent clip object of this reader.
Definition at line 248 of file ReaderBase.cpp.
|
pure virtual |
Load JSON string into this object.
Implemented in openshot::Timeline, openshot::Clip, openshot::FFmpegReader, openshot::FrameMapper, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
|
pure virtual |
Load Json::Value into this object.
Implemented in openshot::Timeline, openshot::Clip, openshot::FFmpegReader, openshot::FrameMapper, openshot::ChunkReader, openshot::DummyReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, openshot::QtHtmlReader, and openshot::ImageReader.
Definition at line 160 of file ReaderBase.cpp.
Referenced by openshot::EffectBase::CreateReaderFromJson(), openshot::ImageReader::SetJsonValue(), openshot::QtHtmlReader::SetJsonValue(), openshot::TextReader::SetJsonValue(), openshot::QtTextReader::SetJsonValue(), openshot::QtImageReader::SetJsonValue(), openshot::DummyReader::SetJsonValue(), openshot::ChunkReader::SetJsonValue(), openshot::FrameMapper::SetJsonValue(), openshot::FFmpegReader::SetJsonValue(), openshot::Clip::SetJsonValue(), and openshot::Timeline::SetJsonValue().
| void ReaderBase::SetMaxDecodeSize | ( | int | width, |
| int | height | ||
| ) |
Set an optional maximum decoded frame size. Use 0,0 to disable the limit.
Definition at line 252 of file ReaderBase.cpp.
|
protected |
Pointer to the parent clip instance (if any)
Definition at line 80 of file ReaderBase.h.
Referenced by openshot::Timeline::AddClip(), openshot::Timeline::ApplyMapperToClips(), openshot::Timeline::Clear(), openshot::Timeline::ClearAllCache(), openshot::Timeline::ClipEffects(), openshot::Timeline::Close(), openshot::Timeline::GetClip(), openshot::Timeline::GetClipEffect(), openshot::Timeline::GetFrame(), ParentClip(), ReaderBase(), openshot::Timeline::RemoveClip(), and openshot::Timeline::Timeline().
|
protected |
Mutex for multiple threads.
Definition at line 79 of file ReaderBase.h.
Referenced by openshot::Timeline::AddClip(), openshot::Timeline::AddEffect(), openshot::Timeline::ApplyJsonDiff(), openshot::FrameMapper::ChangeMapping(), openshot::Timeline::Clear(), openshot::Timeline::ClearAllCache(), openshot::FrameMapper::Close(), openshot::FFmpegReader::Close(), openshot::Timeline::Close(), openshot::QtHtmlReader::GetFrame(), openshot::QtTextReader::GetFrame(), openshot::QtImageReader::GetFrame(), openshot::DummyReader::GetFrame(), openshot::FrameMapper::GetFrame(), openshot::FFmpegReader::GetFrame(), openshot::Timeline::GetFrame(), openshot::FFmpegReader::Open(), openshot::Timeline::RemoveClip(), openshot::Timeline::RemoveEffect(), openshot::Timeline::SetCache(), openshot::Timeline::SetJson(), and openshot::Timeline::SetJsonValue().
| openshot::ReaderInfo openshot::ReaderBase::info |
Information about the current media file.
Definition at line 90 of file ReaderBase.h.
Referenced by openshot::Timeline::apply_effects(), openshot::FrameMapper::ChangeMapping(), openshot::Clip::Clip(), openshot::QtHtmlReader::Close(), openshot::QtTextReader::Close(), openshot::QtImageReader::Close(), openshot::FFmpegReader::Close(), openshot::WriterBase::CopyReaderInfo(), openshot::EffectBase::CreateReaderFromJson(), DisplayInfo(), openshot::Clip::End(), openshot::AudioWaveformer::ExtractSamples(), openshot::FrameMapper::FrameMapper(), openshot::QtHtmlReader::GetFrame(), openshot::QtTextReader::GetFrame(), openshot::QtImageReader::GetFrame(), openshot::FrameMapper::GetFrame(), openshot::FFmpegReader::GetFrame(), openshot::Timeline::GetFrame(), openshot::FrameMapper::GetMappedFrame(), openshot::Timeline::GetMaxFrame(), openshot::Timeline::GetMinFrame(), openshot::AudioReaderSource::getTotalLength(), openshot::Clip::init_reader_rotation(), openshot::Clip::init_reader_settings(), openshot::VideoCacheThread::isReady(), JsonValue(), openshot::EffectBase::MapMaskFrameNumber(), openshot::ImageReader::Open(), openshot::QtHtmlReader::Open(), openshot::TextReader::Open(), openshot::QtTextReader::Open(), openshot::DummyReader::Open(), openshot::QtImageReader::Open(), openshot::Clip::Open(), openshot::FFmpegReader::Open(), openshot::Clip::PropertiesJSON(), ReaderBase(), openshot::EffectBase::ResolveMaskHostFps(), openshot::EffectBase::ResolveMaskSourceDuration(), openshot::VideoCacheThread::resolveTimelineEnd(), openshot::VideoCacheThread::run(), SetJsonValue(), openshot::Timeline::SetJsonValue(), openshot::Timeline::SetMaxSize(), openshot::QtPlayer::SetSource(), openshot::QtPlayer::Speed(), and openshot::Timeline::Timeline().
|
protected |
Optional maximum decoded frame height (0 disables the limit)
Definition at line 82 of file ReaderBase.h.
Referenced by HasMaxDecodeSize(), MaxDecodeHeight(), ReaderBase(), and SetMaxDecodeSize().
|
protected |
Optional maximum decoded frame width (0 disables the limit)
Definition at line 81 of file ReaderBase.h.
Referenced by HasMaxDecodeSize(), MaxDecodeWidth(), ReaderBase(), and SetMaxDecodeSize().
1.8.17