OpenShot Library | libopenshot
0.3.3
|
This class creates a mapping between 2 different frame rates, applying a specific pull-down technique. More...
#include <FrameMapper.h>
Public Member Functions | |
void | ChangeMapping (Fraction target_fps, PulldownType pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout) |
Change frame rate or audio mapping details. More... | |
void | Close () override |
Close the openshot::FrameMapper and internal reader. More... | |
FrameMapper (ReaderBase *reader, Fraction target_fps, PulldownType target_pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout) | |
Default constructor for openshot::FrameMapper class. More... | |
CacheMemory * | GetCache () override |
Get the cache object used by this reader. More... | |
std::shared_ptr< Frame > | GetFrame (int64_t requested_frame) override |
This method is required for all derived classes of ReaderBase, and return the openshot::Frame object, which contains the image and audio information for that frame of video. More... | |
MappedFrame | GetMappedFrame (int64_t TargetFrameNumber) |
Get a frame based on the target frame rate and the new frame number of a frame. 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 internal reader. More... | |
void | PrintMapping (std::ostream *out=&std::cout) |
Print all of the original frames and which new frames they map to. More... | |
ReaderBase * | Reader () |
Get the current reader. More... | |
void | Reader (ReaderBase *new_reader) |
Set the current reader. More... | |
void | ResampleMappedAudio (std::shared_ptr< Frame > frame, int64_t original_frame_number) |
Resample audio and map channels (if needed) 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... | |
virtual | ~FrameMapper () |
Destructor. 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 |
Public Attributes | |
std::vector< Field > | fields |
std::vector< MappedFrame > | frames |
Public Attributes inherited from openshot::ReaderBase | |
openshot::ReaderInfo | info |
Information about the current media file. More... | |
Additional Inherited Members | |
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 creates a mapping between 2 different frame rates, applying a specific pull-down technique.
This class creates a mapping between 2 different video files, and supports many pull-down techniques, such as 2:3:2:3 or 2:3:3:2, and also supports inverse telecine. Pull-down techniques are only needed to remove artificial fields added when converting between 24 fps (film) and television fps (29.97 fps NTSC or 25 fps PAL).
The following graphic displays a how frame rates are mapped, and how time remapping affects the order of frames returned from the FrameMapper.
Please see the following Example Code:
Definition at line 193 of file FrameMapper.h.
FrameMapper::FrameMapper | ( | ReaderBase * | reader, |
Fraction | target_fps, | ||
PulldownType | target_pulldown, | ||
int | target_sample_rate, | ||
int | target_channels, | ||
ChannelLayout | target_channel_layout | ||
) |
Default constructor for openshot::FrameMapper class.
Definition at line 25 of file FrameMapper.cpp.
|
virtual |
Destructor.
Definition at line 55 of file FrameMapper.cpp.
void FrameMapper::ChangeMapping | ( | Fraction | target_fps, |
PulldownType | pulldown, | ||
int | target_sample_rate, | ||
int | target_channels, | ||
ChannelLayout | target_channel_layout | ||
) |
Change frame rate or audio mapping details.
Definition at line 787 of file FrameMapper.cpp.
|
overridevirtual |
Close the openshot::FrameMapper and internal reader.
Implements openshot::ReaderBase.
Definition at line 697 of file FrameMapper.cpp.
Referenced by openshot::Timeline::Clear(), SetJsonValue(), and ~FrameMapper().
|
inlineoverridevirtual |
Get the cache object used by this reader.
Implements openshot::ReaderBase.
Definition at line 251 of file FrameMapper.h.
|
overridevirtual |
This method is required for all derived classes of ReaderBase, and return the openshot::Frame object, which contains the image and audio information for that frame of video.
requested_frame | The frame number that is requested. |
Implements openshot::ReaderBase.
Definition at line 431 of file FrameMapper.cpp.
MappedFrame FrameMapper::GetMappedFrame | ( | int64_t | TargetFrameNumber | ) |
Get a frame based on the target frame rate and the new frame number of a frame.
Definition at line 347 of file FrameMapper.cpp.
Referenced by GetFrame().
|
overridevirtual |
Determine if reader is open or closed.
Implements openshot::ReaderBase.
Definition at line 677 of file FrameMapper.cpp.
|
overridevirtual |
Generate JSON string of this object.
Implements openshot::ReaderBase.
Definition at line 729 of file FrameMapper.cpp.
|
overridevirtual |
Generate Json::Value for this object.
Implements openshot::ReaderBase.
Definition at line 736 of file FrameMapper.cpp.
Referenced by Json().
|
inlineoverridevirtual |
Return the type name of the class.
Implements openshot::ReaderBase.
Definition at line 265 of file FrameMapper.h.
|
overridevirtual |
Open the internal reader.
Implements openshot::ReaderBase.
Definition at line 685 of file FrameMapper.cpp.
Referenced by SetJsonValue().
void FrameMapper::PrintMapping | ( | std::ostream * | out = &std::cout | ) |
Print all of the original frames and which new frames they map to.
Definition at line 651 of file FrameMapper.cpp.
ReaderBase * FrameMapper::Reader | ( | ) |
Get the current reader.
Definition at line 64 of file FrameMapper.cpp.
Referenced by openshot::Timeline::Clear(), openshot::Timeline::ClearAllCache(), and openshot::Clip::Reader().
|
inline |
Set the current reader.
Definition at line 283 of file FrameMapper.h.
void FrameMapper::ResampleMappedAudio | ( | std::shared_ptr< Frame > | frame, |
int64_t | original_frame_number | ||
) |
Resample audio and map channels (if needed)
Definition at line 832 of file FrameMapper.cpp.
Referenced by GetFrame().
|
overridevirtual |
Load JSON string into this object.
Implements openshot::ReaderBase.
Definition at line 750 of file FrameMapper.cpp.
|
overridevirtual |
Load Json::Value into this object.
Implements openshot::ReaderBase.
Definition at line 773 of file FrameMapper.cpp.
Referenced by SetJson().
std::vector<Field> openshot::FrameMapper::fields |
Definition at line 232 of file FrameMapper.h.
std::vector<MappedFrame> openshot::FrameMapper::frames |
Definition at line 233 of file FrameMapper.h.
Referenced by GetMappedFrame(), and PrintMapping().