OpenShot Library | libopenshot  0.1.3
Public Member Functions | Public Attributes | List of all members
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:
openshot::ReaderBase

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...
 
CacheMemoryGetCache ()
 Get the cache object used by this reader. More...
 
tr1::shared_ptr< FrameGetFrame (long int requested_frame) throw (ReaderClosed)
 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 (long int TargetFrameNumber) throw (OutOfBoundsFrame)
 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 () throw (InvalidFile)
 Open the internal reader. More...
 
void PrintMapping ()
 Print all of the original frames and which new frames they map to. More...
 
void ResampleMappedAudio (tr1::shared_ptr< Frame > frame, long int original_frame_number)
 Resample audio and map channels (if needed) More...
 
void SetJson (string value) throw (InvalidJSON)
 Load JSON string into this object. More...
 
void SetJsonValue (Json::Value root) throw (InvalidFile)
 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< Fieldfields
 
vector< MappedFrameframes
 
- 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.

FrameMapper.png

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);
tr1::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 663 of file FrameMapper.cpp.

◆ Close()

void FrameMapper::Close ( )
virtual

Close the openshot::FrameMapper and internal reader.

Implements openshot::ReaderBase.

Definition at line 585 of file FrameMapper.cpp.

◆ GetCache()

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

Get the cache object used by this reader.

Implements openshot::ReaderBase.

Definition at line 185 of file FrameMapper.h.

◆ GetFrame()

tr1::shared_ptr< Frame > FrameMapper::GetFrame ( long int  requested_frame)
throw (ReaderClosed
)
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_frameThe frame number that is requested.

Implements openshot::ReaderBase.

Definition at line 373 of file FrameMapper.cpp.

◆ GetMappedFrame()

MappedFrame FrameMapper::GetMappedFrame ( long int  TargetFrameNumber)
throw (OutOfBoundsFrame
)

Get a frame based on the target frame rate and the new frame number of a frame.

Definition at line 301 of file FrameMapper.cpp.

◆ IsOpen()

bool FrameMapper::IsOpen ( )
virtual

Determine if reader is open or closed.

Implements openshot::ReaderBase.

Definition at line 564 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 608 of file FrameMapper.cpp.

◆ JsonValue()

Json::Value FrameMapper::JsonValue ( )
virtual

Generate Json::JsonValue for this object.

Implements openshot::ReaderBase.

Definition at line 615 of file FrameMapper.cpp.

◆ Name()

string openshot::FrameMapper::Name ( )
inlinevirtual

Return the type name of the class.

Implements openshot::ReaderBase.

Definition at line 199 of file FrameMapper.h.

◆ Open()

void FrameMapper::Open ( )
throw (InvalidFile
)
virtual

Open the internal reader.

Implements openshot::ReaderBase.

Definition at line 573 of file FrameMapper.cpp.

◆ PrintMapping()

void FrameMapper::PrintMapping ( )

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

Definition at line 530 of file FrameMapper.cpp.

◆ ResampleMappedAudio()

void FrameMapper::ResampleMappedAudio ( tr1::shared_ptr< Frame frame,
long int  original_frame_number 
)

Resample audio and map channels (if needed)

Definition at line 692 of file FrameMapper.cpp.

◆ SetJson()

void FrameMapper::SetJson ( string  value)
throw (InvalidJSON
)
virtual

Load JSON string into this object.

Implements openshot::ReaderBase.

Definition at line 626 of file FrameMapper.cpp.

◆ SetJsonValue()

void FrameMapper::SetJsonValue ( Json::Value  root)
throw (InvalidFile
)
virtual

Load Json::JsonValue into this object.

Implements openshot::ReaderBase.

Definition at line 649 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: