OpenShot Library | libopenshot
0.3.3
|
Go to the documentation of this file.
13 #ifndef OPENSHOT_FRAMEMAPPER_H
14 #define OPENSHOT_FRAMEMAPPER_H
77 int remaining_samples = samples;
78 while (remaining_samples > 0) {
82 if (remaining_samples +
sample_end < samples_per_frame) {
84 remaining_samples = 0;
87 remaining_samples -= (samples_per_frame -
sample_end);
94 remaining_samples = 0;
109 int remaining_samples = samples;
110 while (remaining_samples > 0) {
115 remaining_samples = 0;
125 if (
sample_start + remaining_samples < samples_per_frame) {
127 remaining_samples = 0;
130 remaining_samples -= (samples_per_frame -
sample_start);
146 Extend(samples, fps, sample_rate, channels,
true);
147 Shrink(samples, fps, sample_rate, channels,
false);
150 Extend(samples, fps, sample_rate, channels,
false);
151 Shrink(samples, fps, sample_rate, channels,
true);
202 float parent_position;
204 int64_t previous_frame;
211 void AddField(int64_t frame);
212 void AddField(int64_t frame,
bool isOdd);
213 void AddField(
Field field);
219 std::shared_ptr<Frame> GetOrCreateFrame(int64_t number);
222 int64_t AdjustFrameNumber(int64_t clip_frame_number);
245 void Close()
override;
259 std::shared_ptr<Frame>
GetFrame(int64_t requested_frame)
override;
265 std::string
Name()
override {
return "FrameMapper"; };
268 std::string
Json()
const override;
269 void SetJson(
const std::string value)
override;
274 void Open()
override;
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.
std::vector< Field > fields
Header file for FFmpegUtilities.
void ResampleMappedAudio(std::shared_ptr< Frame > frame, int64_t original_frame_number)
Resample audio and map channels (if needed)
Header file for Fraction class.
void PrintMapping(std::ostream *out=&std::cout)
Print all of the original frames and which new frames they map to.
This namespace is the default namespace for all code in the openshot library.
void Shrink(int64_t samples, openshot::Fraction fps, int sample_rate, int channels, bool right_side)
Shrink SampleRange on either side.
This class represents a fraction.
void Reader(ReaderBase *new_reader)
Set the current reader.
This struct holds a single field (half a frame).
Header file for AudioResampler class.
std::string Name() override
Return the type name of the class.
std::string Json() const override
Generate JSON string of this object.
Header file for the Keyframe class.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
CacheMemory * GetCache() override
Get the cache object used by this reader.
This class is used to resample audio data for many sequential frames.
void Open() override
Open the internal reader.
virtual ~FrameMapper()
Destructor.
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,...
std::vector< MappedFrame > frames
This class is a memory-based cache manager for Frame objects.
void Close() override
Close the openshot::FrameMapper and internal reader.
bool IsOpen() override
Determine if reader is open or closed.
Header file for CacheMemory class.
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.
This struct holds two fields which together make up a complete video frame.
This struct holds a the range of samples needed by this frame.
Header file for Frame class.
This class creates a mapping between 2 different frame rates, applying a specific pull-down technique...
int GetSamplesPerFrame(openshot::Fraction fps, int sample_rate, int channels)
Calculate the # of samples per video frame (for the current frame number)
Json::Value JsonValue() const override
Generate Json::Value for this object.
@ PULLDOWN_ADVANCED
Advanced 2:3:3:2 pull-down (minimal dirty frames)
Header file for ReaderBase class.
MappedFrame GetMappedFrame(int64_t TargetFrameNumber)
Get a frame based on the target frame rate and the new frame number of a frame.
void Shift(int64_t samples, openshot::Fraction fps, int sample_rate, int channels, bool right_side)
Header file for OpenMPUtilities (set some common macros)
This abstract class is the base class, used by all readers in libopenshot.
PulldownType
This enumeration determines how frame rates are increased or decreased.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
ReaderBase * Reader()
Get the current reader.
@ PULLDOWN_NONE
Do not apply pull-down techniques, just repeat or skip entire frames.
void SetJson(const std::string value) override
Load JSON string into this object.
void Extend(int64_t samples, openshot::Fraction fps, int sample_rate, int channels, bool right_side)
Extend SampleRange on either side.
@ PULLDOWN_CLASSIC
Classic 2:3:2:3 pull-down.