Loading...
Searching...
No Matches
openshot::ReaderBase Class Referenceabstract

This abstract class is the base class, used by all readers in libopenshot. More...

`#include <ReaderBase.h>`

Inheritance diagram for openshot::ReaderBase:

## Public Member Functions

virtual void | Close ()=0
| Close the reader (and any resources it was consuming)
void | DisplayInfo (std::ostream *out=&std::cout)
| Display file information in the standard output stream (stdout)
virtual openshot::CacheBase * | GetCache ()=0
| Get the cache object used by this reader (note: not all readers use cache)
virtual std::shared_ptr< openshot::Frame > | GetFrame (int64_t number)=0
virtual bool | IsOpen ()=0
| Determine if reader is open or closed.
virtual std::string | Json () const =0
| Generate JSON string of this object.
virtual Json::Value | JsonValue () const =0
| Generate Json::Value for this object.
virtual std::string | Name ()=0
| Return the type name of the class.
virtual void | Open ()=0
| Open the reader (and start consuming resources, such as images or video files)
openshot::ClipBase * | ParentClip ()
| Parent clip object of this reader (which can be unparented and NULL)
void | ParentClip (openshot::ClipBase *new_clip)
| Set parent clip object of this reader.
| ReaderBase ()
| Constructor for the base reader, where many things are initialized.
virtual void | SetJson (const std::string value)=0
| Load JSON string into this object.
virtual void | SetJsonValue (const Json::Value root)=0
| Load Json::Value into this object.
virtual | ~ReaderBase ()=default

## Public Attributes

openshot::ReaderInfo | info
| Information about the current media file.

## Protected Attributes

openshot::ClipBase * | clip
| Pointer to the parent clip instance (if any)
std::recursive_mutex | getFrameMutex
| Mutex for multiple threads.

## Detailed Description

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.

## Constructor & Destructor Documentation

## ReaderBase()

ReaderBase::ReaderBase | ( |  | ) |

Constructor for the base reader, where many things are initialized.

Definition at line 27 of file ReaderBase.cpp.

## ~ReaderBase()

virtual openshot::ReaderBase::~ReaderBase | ( |  | ) |

virtual default

## Member Function Documentation

## Close()

virtual void openshot::ReaderBase::Close | ( |  | ) |

pure virtual

Close the reader (and any resources it was consuming)

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Referenced by openshot::ChunkWriter::Close(), openshot::Clip::Close(), openshot::FrameMapper::Close(), openshot::ChunkReader::GetFrame(), openshot::Clip::Reader(), and openshot::Mask::SetJsonValue().

## DisplayInfo()

void ReaderBase::DisplayInfo | ( | std::ostream * | out = `&std::cout` | ) |

Display file information in the standard output stream (stdout)

Definition at line 61 of file ReaderBase.cpp.

Referenced by openshot::QtPlayer::SetSource(), and openshot::QtPlayer::SetTimelineSource().

## GetCache()

virtual openshot::CacheBase * openshot::ReaderBase::GetCache | ( |  | ) |

pure virtual

Get the cache object used by this reader (note: not all readers use cache)

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Referenced by openshot::Timeline::ClearAllCache(), openshot::VideoCacheThread::run(), and openshot::VideoCacheThread::Seek().

## GetFrame()

virtual std::shared_ptr< openshot::Frame > openshot::ReaderBase::GetFrame | ( | int64_t | number | ) |

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.

Returns
  The requested frame of video

Parameters

  [in] | number | The frame number that is requested.

Implemented in openshot::Clip, openshot::ChunkReader, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Referenced by openshot::AudioWaveformer::ExtractSamples(), openshot::ChunkReader::GetFrame(), openshot::Mask::GetFrame(), openshot::AudioReaderSource::getNextAudioBlock(), openshot::VideoCacheThread::run(), openshot::ChunkWriter::WriteFrame(), openshot::ChunkWriter::WriteFrame(), openshot::FFmpegWriter::WriteFrame(), and openshot::ImageWriter::WriteFrame().

## IsOpen()

virtual bool openshot::ReaderBase::IsOpen | ( |  | ) |

pure virtual

Determine if reader is open or closed.

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Referenced by openshot::AudioWaveformer::ExtractSamples(), openshot::Mask::GetFrame(), openshot::FrameMapper::IsOpen(), and openshot::Clip::SetJsonValue().

## Json()

virtual std::string openshot::ReaderBase::Json | ( |  | ) | const

pure virtual

Generate JSON string of this object.

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Referenced by openshot::Mask::PropertiesJSON().

## JsonValue()

Json::Value ReaderBase::JsonValue | ( |  | ) | const

pure virtual

Generate Json::Value for this object.

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Definition at line 107 of file ReaderBase.cpp.

Referenced by openshot::ChunkReader::JsonValue(), openshot::Clip::JsonValue(), openshot::DummyReader::JsonValue(), openshot::Mask::JsonValue(), openshot::FFmpegReader::JsonValue(), openshot::FrameMapper::JsonValue(), openshot::ImageReader::JsonValue(), openshot::QtHtmlReader::JsonValue(), openshot::QtImageReader::JsonValue(), openshot::QtTextReader::JsonValue(), openshot::TextReader::JsonValue(), and openshot::Timeline::JsonValue().

## Name()

virtual std::string openshot::ReaderBase::Name | ( |  | ) |

pure virtual

Return the type name of the class.

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Referenced by openshot::Clip::Reader().

## Open()

virtual void openshot::ReaderBase::Open | ( |  | ) |

pure virtual

Open the reader (and start consuming resources, such as images or video files)

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Referenced by openshot::ChunkWriter::ChunkWriter(), openshot::AudioWaveformer::ExtractSamples(), openshot::ChunkReader::GetFrame(), openshot::Mask::GetFrame(), openshot::Clip::Open(), openshot::FrameMapper::Open(), and openshot::Clip::SetJsonValue().

## ParentClip() [1/2]

openshot::ClipBase * ReaderBase::ParentClip | ( |  | ) |

Parent clip object of this reader (which can be unparented and NULL)

Definition at line 245 of file ReaderBase.cpp.

Referenced by openshot::Clip::Clip(), openshot::Clip::Clip(), openshot::FrameMapper::GetFrame(), openshot::ObjectDetection::GetFrame(), openshot::Clip::Reader(), and openshot::Clip::SetJsonValue().

## ParentClip() [2/2]

void ReaderBase::ParentClip | ( | openshot::ClipBase * | new_clip | ) |

Set parent clip object of this reader.

Definition at line 250 of file ReaderBase.cpp.

## SetJson()

virtual void openshot::ReaderBase::SetJson | ( | const std::string | value | ) |

pure virtual

Load JSON string into this object.

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

## SetJsonValue()

void ReaderBase::SetJsonValue | ( | const Json::Value | root | ) |

pure virtual

Load Json::Value into this object.

Implemented in openshot::ChunkReader, openshot::Clip, openshot::DummyReader, openshot::FFmpegReader, openshot::FrameMapper, openshot::ImageReader, openshot::QtHtmlReader, openshot::QtImageReader, openshot::QtTextReader, openshot::TextReader, and openshot::Timeline.

Definition at line 162 of file ReaderBase.cpp.

Referenced by openshot::ChunkReader::SetJsonValue(), openshot::Clip::SetJsonValue(), openshot::DummyReader::SetJsonValue(), openshot::Mask::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().

## Member Data Documentation

## clip

openshot::ClipBase* openshot::ReaderBase::clip

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(), ParentClip(), ReaderBase(), openshot::Timeline::RemoveClip(), and openshot::Timeline::Timeline().

## getFrameMutex

std::recursive_mutex openshot::ReaderBase::getFrameMutex

protected

Mutex for multiple threads.

Definition at line 79 of file ReaderBase.h.

Referenced by openshot::Timeline::AddClip(), openshot::Timeline::ApplyJsonDiff(), openshot::Timeline::Clear(), openshot::FFmpegReader::Close(), openshot::FrameMapper::Close(), openshot::Timeline::Close(), openshot::DummyReader::GetFrame(), openshot::FFmpegReader::GetFrame(), openshot::FrameMapper::GetFrame(), openshot::QtHtmlReader::GetFrame(), openshot::QtImageReader::GetFrame(), openshot::QtTextReader::GetFrame(), openshot::Timeline::GetFrame(), openshot::FFmpegReader::Open(), openshot::Timeline::RemoveClip(), openshot::Timeline::SetCache(), openshot::Timeline::SetJson(), and openshot::Timeline::SetJsonValue().

## info

openshot::ReaderInfo openshot::ReaderBase::info

Information about the current media file.

Definition at line 88 of file ReaderBase.h.

Referenced by openshot::Timeline::apply_effects(), openshot::FrameMapper::ChangeMapping(), openshot::Clip::Clip(), openshot::Clip::Clip(), openshot::FFmpegReader::Close(), openshot::QtHtmlReader::Close(), openshot::QtImageReader::Close(), openshot::QtTextReader::Close(), openshot::WriterBase::CopyReaderInfo(), DisplayInfo(), openshot::Clip::End(), openshot::AudioWaveformer::ExtractSamples(), openshot::FFmpegReader::FFmpegReader(), openshot::FrameMapper::FrameMapper(), openshot::FFmpegReader::GetFrame(), openshot::FrameMapper::GetFrame(), openshot::QtHtmlReader::GetFrame(), openshot::QtImageReader::GetFrame(), openshot::QtTextReader::GetFrame(), openshot::Timeline::GetFrame(), openshot::Mask::GetFrame(), openshot::FrameMapper::GetMappedFrame(), openshot::Timeline::GetMaxFrame(), openshot::AudioReaderSource::getTotalLength(), openshot::Clip::init_reader_rotation(), openshot::Clip::init_reader_settings(), JsonValue(), openshot::Clip::Open(), openshot::DummyReader::Open(), openshot::FFmpegReader::Open(), openshot::ImageReader::Open(), openshot::QtHtmlReader::Open(), openshot::QtImageReader::Open(), openshot::QtTextReader::Open(), openshot::TextReader::Open(), openshot::Clip::PropertiesJSON(), ReaderBase(), openshot::FrameMapper::ResampleMappedAudio(), openshot::VideoCacheThread::run(), openshot::Timeline::SetJsonValue(), SetJsonValue(), openshot::Timeline::SetMaxSize(), openshot::QtPlayer::SetSource(), openshot::QtPlayer::Speed(), openshot::Timeline::Timeline(), and openshot::Timeline::Timeline().

The documentation for this class was generated from the following files:

- ReaderBase.h
- ReaderBase.cpp