OpenShot Library | libopenshot
0.4.0
|
This class reads a special chunk-formatted file, which can be easily shared in a distributed environment. More...
#include <ChunkReader.h>
Public Member Functions | |
ChunkReader (std::string path, ChunkVersion chunk_version) | |
Constructor for ChunkReader. This automatically opens the chunk file or folder and loads frame 1, or it throws one of the following exceptions. More... | |
void | Close () override |
Close the reader. More... | |
openshot::CacheBase * | GetCache () override |
Get the cache object used by this reader (always return NULL for this reader) More... | |
int64_t | GetChunkSize () |
Get the chunk size (number of frames to write in each chunk) More... | |
std::shared_ptr< openshot::Frame > | GetFrame (int64_t requested_frame) override |
Get an openshot::Frame object for a specific frame number of this reader. More... | |
bool | IsOpen () override |
Determine if reader is open or closed. More... | |
std::string | Json () const override |
Generate JSON string of this object. More... | |
Json::Value | JsonValue () const override |
Generate Json::Value for this object. More... | |
std::string | Name () override |
Return the type name of the class. More... | |
void | Open () override |
Open the reader. This is required before you can access frames or data from the reader. More... | |
void | SetChunkSize (int64_t new_size) |
Set the chunk size (number of frames to write in each chunk) More... | |
void | SetJson (const std::string value) override |
Load JSON string into this object. More... | |
void | SetJsonValue (const Json::Value root) override |
Load Json::Value into this object. More... | |
Public Member Functions inherited from openshot::ReaderBase | |
void | DisplayInfo (std::ostream *out=&std::cout) |
Display file information in the standard output stream (stdout) 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 | ~ReaderBase ()=default |
Additional Inherited Members | |
Public Attributes inherited from openshot::ReaderBase | |
openshot::ReaderInfo | info |
Information about the current media file. More... | |
Protected Attributes inherited from openshot::ReaderBase | |
openshot::ClipBase * | clip |
Pointer to the parent clip instance (if any) More... | |
std::recursive_mutex | getFrameMutex |
Mutex for multiple threads. More... | |
This class reads a special chunk-formatted file, which can be easily shared in a distributed environment.
It stores the video in small "chunks", which are really just short video clips, a few seconds each. A ChunkReader only needs the part of the chunk that contains the frames it is looking for. For example, if you only need the end of a video, only the last few chunks might be needed to successfully access those openshot::Frame objects.
Definition at line 78 of file ChunkReader.h.
ChunkReader::ChunkReader | ( | std::string | path, |
ChunkVersion | chunk_version | ||
) |
Constructor for ChunkReader. This automatically opens the chunk file or folder and loads frame 1, or it throws one of the following exceptions.
path | The folder path / location of a chunk (chunks are stored as folders) |
chunk_version | Choose the video version / quality (THUMBNAIL, PREVIEW, or FINAL) |
Definition at line 23 of file ChunkReader.cpp.
|
overridevirtual |
Close the reader.
Implements openshot::ReaderBase.
Definition at line 149 of file ChunkReader.cpp.
Referenced by ChunkReader(), and SetJsonValue().
|
inlineoverridevirtual |
Get the cache object used by this reader (always return NULL for this reader)
Implements openshot::ReaderBase.
Definition at line 121 of file ChunkReader.h.
|
inline |
Get the chunk size (number of frames to write in each chunk)
Definition at line 114 of file ChunkReader.h.
|
overridevirtual |
Get an openshot::Frame object for a specific frame number of this reader.
requested_frame | The frame number you want to retrieve |
Implements openshot::ReaderBase.
Definition at line 183 of file ChunkReader.cpp.
|
inlineoverridevirtual |
Determine if reader is open or closed.
Implements openshot::ReaderBase.
Definition at line 129 of file ChunkReader.h.
|
overridevirtual |
Generate JSON string of this object.
Implements openshot::ReaderBase.
Definition at line 244 of file ChunkReader.cpp.
|
overridevirtual |
Generate Json::Value for this object.
Implements openshot::ReaderBase.
Definition at line 251 of file ChunkReader.cpp.
Referenced by Json().
|
inlineoverridevirtual |
Return the type name of the class.
Implements openshot::ReaderBase.
Definition at line 132 of file ChunkReader.h.
|
overridevirtual |
Open the reader. This is required before you can access frames or data from the reader.
Implements openshot::ReaderBase.
Definition at line 135 of file ChunkReader.cpp.
Referenced by ChunkReader(), and SetJsonValue().
|
inline |
Set the chunk size (number of frames to write in each chunk)
new_size | The number of frames per chunk |
Definition at line 118 of file ChunkReader.h.
|
overridevirtual |
Load JSON string into this object.
Implements openshot::ReaderBase.
Definition at line 267 of file ChunkReader.cpp.
|
overridevirtual |
Load Json::Value into this object.
Implements openshot::ReaderBase.
Definition at line 283 of file ChunkReader.cpp.
Referenced by SetJson().