openshot::FrameMapper Class Reference

This class creates a mapping between 2 different frame rates, applying a specific pull-down technique. More...

`#include <FrameMapper.h>`

Inheritance diagram for openshot::FrameMapper:

## 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 ()
| 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 ()
| Get the cache object used by this reader. More...
std::shared_ptr< Frame > | GetFrame (int64_t requested_frame)
| 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 ()
| Determine if reader is open or closed. More...
string | Json ()
| Get and Set JSON methods. More...
Json::Value | JsonValue ()
| Generate Json::JsonValue for this object. More...
string | Name ()
| Return the type name of the class. More...
void | Open ()
| Open the internal reader. More...
void | PrintMapping ()
| Print all of the original frames and which new frames they map to. More...
ReaderBase * | Reader ()
| Get 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 (string value)
| Load JSON string into this object. More...
void | SetJsonValue (Json::Value root)
| Load Json::JsonValue into this object. More...
| ~FrameMapper ()
| Destructor. More...
Public Member Functions inherited from openshot::ReaderBase
void | DisplayInfo ()
| Display file information in the standard output stream (stdout) More...
| ReaderBase ()
| Constructor for the base reader, where many things are initialized. More...
void | SetMaxSize (int width, int height)
| Set Max Image Size (used for performance optimization) More...

## Public Attributes

vector< Field > | fields
vector< MappedFrame > | frames
Public Attributes inherited from openshot::ReaderBase
ReaderInfo | info
| Information about the current media file. More...

## Additional Inherited Members

Protected Attributes inherited from openshot::ReaderBase
CriticalSection | getFrameCriticalSection
| Section lock for multiple threads. More...
int | max_height
| The maximium image height needed by this clip (used for optimizations) More...
int | max_width
| The maximum image width needed by this clip (used for optimizations) More...
CriticalSection | processingCriticalSection

## Detailed Description

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:

// Create a frame mapper for a reader, and convert the frame rate (from 24 fps to 29.97 fps)
FrameMapper mapping(reader, Fraction(30000, 1001), PULLDOWN_CLASSIC, 44100, 2, LAYOUT_STEREO);
std::shared_ptr<Frame> frame2 = mapping.GetFrame(2);
// If you need to change the mapping...
mapping.ChangeMapping(Fraction(24, 1), PULLDOWN_CLASSIC, 48000, 2, LAYOUT_MONO)

Definition at line 139 of file FrameMapper.h.

## Constructor & Destructor Documentation

## FrameMapper()

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 33 of file FrameMapper.cpp.

## ~FrameMapper()

FrameMapper::~FrameMapper | ( |  | ) |

Destructor.

Definition at line 63 of file FrameMapper.cpp.

## Member Function Documentation

## ChangeMapping()

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 718 of file FrameMapper.cpp.

## Close()

void FrameMapper::Close | ( |  | ) |

virtual

Close the openshot::FrameMapper and internal reader.

Implements openshot::ReaderBase.

Definition at line 640 of file FrameMapper.cpp.

## GetCache()

CacheMemory* openshot::FrameMapper::GetCache | ( |  | ) |

inline virtual

Get the cache object used by this reader.

Implements openshot::ReaderBase.

Definition at line 185 of file FrameMapper.h.

## GetFrame()

std::shared_ptr< Frame > FrameMapper::GetFrame | ( | int64_t | requested_frame | ) |

virtual

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.

Returns
  The requested frame of video

Parameters

  requested_frame | The frame number that is requested.

Implements openshot::ReaderBase.

Definition at line 384 of file FrameMapper.cpp.

## GetMappedFrame()

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 311 of file FrameMapper.cpp.

## IsOpen()

bool FrameMapper::IsOpen | ( |  | ) |

virtual

Determine if reader is open or closed.

Implements openshot::ReaderBase.

Definition at line 619 of file FrameMapper.cpp.

## Json()

string FrameMapper::Json | ( |  | ) |

virtual

Get and Set JSON methods.

Generate JSON string of this object

Implements openshot::ReaderBase.

Definition at line 663 of file FrameMapper.cpp.

## JsonValue()

Json::Value FrameMapper::JsonValue | ( |  | ) |

virtual

Generate Json::JsonValue for this object.

Implements openshot::ReaderBase.

Definition at line 670 of file FrameMapper.cpp.

## Name()

string openshot::FrameMapper::Name | ( |  | ) |

inline virtual

Return the type name of the class.

Implements openshot::ReaderBase.

Definition at line 199 of file FrameMapper.h.

## Open()

void FrameMapper::Open | ( |  | ) |

virtual

Open the internal reader.

Implements openshot::ReaderBase.

Definition at line 628 of file FrameMapper.cpp.

## PrintMapping()

void FrameMapper::PrintMapping | ( |  | ) |

Print all of the original frames and which new frames they map to.

Definition at line 585 of file FrameMapper.cpp.

## Reader()

ReaderBase * FrameMapper::Reader | ( |  | ) |

Get the current reader.

Definition at line 70 of file FrameMapper.cpp.

## ResampleMappedAudio()

void FrameMapper::ResampleMappedAudio | ( | std::shared_ptr< Frame > | frame,
|  | int64_t | original_frame_number
| ) |  |

Resample audio and map channels (if needed)

Definition at line 755 of file FrameMapper.cpp.

## SetJson()

void FrameMapper::SetJson | ( | string | value | ) |

virtual

Load JSON string into this object.

Implements openshot::ReaderBase.

Definition at line 681 of file FrameMapper.cpp.

## SetJsonValue()

void FrameMapper::SetJsonValue | ( | Json::Value | root | ) |

virtual

Load Json::JsonValue into this object.

Implements openshot::ReaderBase.

Definition at line 704 of file FrameMapper.cpp.

## Member Data Documentation

## fields

vector<Field> openshot::FrameMapper::fields

Definition at line 166 of file FrameMapper.h.

## frames

vector<MappedFrame> openshot::FrameMapper::frames

Definition at line 167 of file FrameMapper.h.

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

- FrameMapper.h
- FrameMapper.cpp

openshot::LAYOUT_STEREO
@ LAYOUT_STEREO
Definition: ChannelLayouts.h:46
openshot::LAYOUT_MONO
@ LAYOUT_MONO
Definition: ChannelLayouts.h:45
openshot::FrameMapper::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: FrameMapper.cpp:33
openshot::PULLDOWN_CLASSIC
@ PULLDOWN_CLASSIC
Classic 2:3:2:3 pull-down.
Definition: FrameMapper.h:62