|
OpenShot Library | libopenshot 1.1.1
|
This abstract class is the base class, used by all readers in libopenshot. More...
#include <ReaderBase.h>
Public Member Functions | |
| bool | ApplyOrientationMetadata () const |
| Return whether readers apply source orientation metadata to returned frames. More... | |
| void | ApplyOrientationMetadata (bool value) |
| Set whether readers should apply source orientation metadata to returned frames. More... | |
| 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) |
| virtual | ~ReaderBase ()=default |
Public Attributes | |
| openshot::ReaderInfo | info |
| Information about the current media file. More... | |
Protected Attributes | |
| bool | apply_orientation_metadata |
| Apply source orientation metadata while reading frames. More... | |
| 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 |
| bool ReaderBase::ApplyOrientationMetadata | ( | ) | const |
Return whether readers apply source orientation metadata to returned frames.
Definition at line 274 of file ReaderBase.cpp.
| void ReaderBase::ApplyOrientationMetadata | ( | bool | value | ) |
Set whether readers should apply source orientation metadata to returned frames.
Definition at line 270 of file ReaderBase.cpp.
Referenced by openshot::Clip::init_reader_rotation(), openshot::Clip::Reader(), and openshot::Clip::SetJsonValue().
|
pure virtual |
Close the reader (and any resources it was consuming)
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Referenced by openshot::ChunkWriter::Close(), openshot::Clip::Close(), openshot::FrameMapper::Close(), openshot::ChunkReader::GetFrame(), openshot::EffectBase::MaskReader(), openshot::Clip::Reader(), and openshot::Displace::Reader().
| void ReaderBase::DisplayInfo | ( | std::ostream * | out = &std::cout | ) |
Display file information in the standard output stream (stdout)
Definition at line 64 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::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Referenced by openshot::Timeline::ClearAllCache(), openshot::AudioReaderSource::getNextAudioBlock(), openshot::VideoCacheThread::isReady(), 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::Clip, openshot::CameraCaptureReader, openshot::ScreenCaptureReader, openshot::ChunkReader, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.
Referenced by openshot::ChunkReader::GetFrame(), openshot::AudioReaderSource::getNextAudioBlock(), openshot::VideoCacheThread::prefetchWindow(), openshot::ChunkWriter::WriteFrame(), openshot::FFmpegWriter::WriteFrame(), and openshot::ImageWriter::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 140 of file ReaderBase.h.
| bool ReaderBase::HasMaxDecodeSize | ( | ) | const |
Return true when a maximum decoded frame size is active.
Definition at line 266 of file ReaderBase.cpp.
|
pure virtual |
Determine if reader is open or closed.
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Referenced by openshot::FrameMapper::IsOpen(), and openshot::Clip::SetJsonValue().
|
pure virtual |
Generate JSON string of this object.
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Referenced by openshot::EffectBase::BasePropertiesJSON(), and openshot::Displace::PropertiesJSON().
|
pure virtual |
Generate Json::Value for this object.
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Definition at line 110 of file ReaderBase.cpp.
Referenced by openshot::Displace::Displace(), openshot::EffectBase::JsonValue(), openshot::CameraCaptureReader::JsonValue(), openshot::ChunkReader::JsonValue(), openshot::Clip::JsonValue(), openshot::DummyReader::JsonValue(), openshot::Displace::JsonValue(), openshot::FFmpegReader::JsonValue(), openshot::FrameMapper::JsonValue(), openshot::ImageReader::JsonValue(), openshot::QtHtmlReader::JsonValue(), openshot::QtImageReader::JsonValue(), openshot::QtTextReader::JsonValue(), openshot::ScreenCaptureReader::JsonValue(), openshot::TextReader::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 262 of file ReaderBase.cpp.
| int ReaderBase::MaxDecodeWidth | ( | ) | const |
Return the current maximum decoded frame width (0 when unlimited).
Definition at line 258 of file ReaderBase.cpp.
|
pure virtual |
Return the type name of the class.
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Referenced by openshot::Clip::Reader().
|
pure virtual |
Open the reader (and start consuming resources, such as images or video files)
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Referenced by openshot::ChunkWriter::ChunkWriter(), openshot::ChunkReader::GetFrame(), openshot::Clip::Open(), openshot::FrameMapper::Open(), and openshot::Clip::SetJsonValue().
| openshot::ClipBase * ReaderBase::ParentClip | ( | ) |
Parent clip object of this reader (which can be unparented and NULL)
Definition at line 244 of file ReaderBase.cpp.
Referenced by openshot::Clip::Clip(), openshot::FrameMapper::GetFrame(), openshot::ObjectDetection::GetFrame(), openshot::EffectBase::MaskReader(), openshot::EffectBase::ParentClip(), openshot::Clip::Reader(), openshot::Displace::Reader(), and openshot::Clip::SetJsonValue().
| void ReaderBase::ParentClip | ( | openshot::ClipBase * | new_clip | ) |
Set parent clip object of this reader.
Definition at line 249 of file ReaderBase.cpp.
|
pure virtual |
Load JSON string into this object.
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
|
pure virtual |
Load Json::Value into this object.
Implemented in openshot::CameraCaptureReader, openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::ScreenCaptureReader, openshot::TextReader, and openshot::Timeline.
Definition at line 161 of file ReaderBase.cpp.
Referenced by openshot::EffectBase::CreateReaderFromJson(), openshot::ChunkReader::SetJsonValue(), openshot::Clip::SetJsonValue(), openshot::DummyReader::SetJsonValue(), openshot::FFmpegReader::SetJsonValue(), openshot::FrameMapper::SetJsonValue(), openshot::ImageReader::SetJsonValue(), openshot::QtHtmlReader::SetJsonValue(), openshot::QtImageReader::SetJsonValue(), openshot::QtTextReader::SetJsonValue(), openshot::TextReader::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. Reduced FFmpeg previews align both dimensions to four pixels (minimum 4x4).
Definition at line 253 of file ReaderBase.cpp.
|
protected |
Apply source orientation metadata while reading frames.
Definition at line 83 of file ReaderBase.h.
Referenced by ApplyOrientationMetadata(), and ReaderBase().
|
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::FFmpegReader::Close(), openshot::FrameMapper::Close(), openshot::ScreenCaptureReader::Close(), openshot::Timeline::Close(), openshot::ScreenCaptureReader::GetFrame(), openshot::DummyReader::GetFrame(), openshot::FFmpegReader::GetFrame(), openshot::FrameMapper::GetFrame(), openshot::QtHtmlReader::GetFrame(), openshot::QtImageReader::GetFrame(), openshot::QtTextReader::GetFrame(), openshot::Timeline::GetFrame(), openshot::ScreenCaptureReader::IsOpen(), openshot::FFmpegReader::Open(), openshot::ScreenCaptureReader::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 91 of file ReaderBase.h.
Referenced by openshot::ScreenCaptureReader::AddSystemAudio(), openshot::Timeline::apply_effects(), openshot::FrameMapper::ChangeMapping(), openshot::Clip::Clip(), openshot::FFmpegReader::Close(), openshot::QtHtmlReader::Close(), openshot::QtImageReader::Close(), openshot::QtTextReader::Close(), openshot::WriterBase::CopyReaderInfo(), openshot::EffectBase::CreateReaderFromJson(), DisplayInfo(), openshot::Clip::End(), openshot::AudioWaveformer::ExtractSamples(), openshot::FFmpegReader::FFmpegReader(), openshot::FrameMapper::FrameMapper(), openshot::ScreenCaptureReader::GetFrame(), openshot::FFmpegReader::GetFrame(), openshot::FrameMapper::GetFrame(), openshot::QtHtmlReader::GetFrame(), openshot::QtImageReader::GetFrame(), openshot::QtTextReader::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(), JsonValue(), openshot::EffectBase::MapMaskFrameNumber(), openshot::CameraCaptureReader::Open(), openshot::Clip::Open(), openshot::DummyReader::Open(), openshot::FFmpegReader::Open(), openshot::ImageReader::Open(), openshot::QtHtmlReader::Open(), openshot::QtImageReader::Open(), openshot::ScreenCaptureReader::Open(), openshot::TextReader::Open(), openshot::VideoCacheThread::prefetchWindow(), openshot::Clip::PropertiesJSON(), ReaderBase(), openshot::EffectBase::ResolveMaskHostFps(), openshot::EffectBase::ResolveMaskSourceDuration(), openshot::VideoCacheThread::resolveTimelineEnd(), openshot::VideoCacheThread::run(), openshot::ScreenCaptureReader::ScreenCaptureReader(), openshot::Timeline::SetJsonValue(), 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().