You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Initializing Clip info struct, and fixing clip cache settings
This commit is contained in:
committed by
FeRD (Frank Dana)
parent
8d36b12754
commit
b936ea837c
@@ -98,6 +98,15 @@ namespace openshot {
|
||||
/// Section lock for multiple threads
|
||||
juce::CriticalSection getFrameCriticalSection;
|
||||
|
||||
/// Init default settings for a clip
|
||||
void init_settings();
|
||||
|
||||
/// Init reader info details
|
||||
void init_reader_settings();
|
||||
|
||||
/// Update default rotation from reader
|
||||
void init_reader_rotation();
|
||||
|
||||
private:
|
||||
bool waveform; ///< Should a waveform be used instead of the clip's image
|
||||
std::list<openshot::EffectBase*> effects; ///<List of clips on this timeline
|
||||
@@ -131,12 +140,6 @@ namespace openshot {
|
||||
/// Adjust the audio and image of a time mapped frame
|
||||
void get_time_mapped_frame(std::shared_ptr<openshot::Frame> frame, int64_t frame_number);
|
||||
|
||||
/// Init default settings for a clip
|
||||
void init_settings();
|
||||
|
||||
/// Update default rotation from reader
|
||||
void init_reader_rotation();
|
||||
|
||||
/// Compare 2 floating point numbers
|
||||
bool isEqual(double a, double b);
|
||||
|
||||
|
||||
29
src/Clip.cpp
29
src/Clip.cpp
@@ -69,9 +69,6 @@ void Clip::init_settings()
|
||||
// Init alpha
|
||||
alpha = Keyframe(1.0);
|
||||
|
||||
// Init rotation
|
||||
init_reader_rotation();
|
||||
|
||||
// Init time & volume
|
||||
time = Keyframe(1.0);
|
||||
volume = Keyframe(1.0);
|
||||
@@ -101,8 +98,22 @@ void Clip::init_settings()
|
||||
has_audio = Keyframe(-1.0);
|
||||
has_video = Keyframe(-1.0);
|
||||
|
||||
// Initialize Clip cache
|
||||
cache.SetMaxBytesFromInfo(OPEN_MP_NUM_PROCESSORS * 2, info.width, info.height, info.sample_rate, info.channels);
|
||||
// Init reader info struct and cache size
|
||||
init_reader_settings();
|
||||
}
|
||||
|
||||
// Init reader info details
|
||||
void Clip::init_reader_settings() {
|
||||
if (reader) {
|
||||
// Init rotation (if any)
|
||||
init_reader_rotation();
|
||||
|
||||
// Initialize info struct
|
||||
info = reader->info;
|
||||
|
||||
// Initialize Clip cache
|
||||
cache.SetMaxBytesFromInfo(OPEN_MP_NUM_PROCESSORS * 2, info.width, info.height, info.sample_rate, info.channels);
|
||||
}
|
||||
}
|
||||
|
||||
// Init reader's rotation (if any)
|
||||
@@ -208,8 +219,8 @@ Clip::Clip(std::string path) : resampler(NULL), reader(NULL), allocated_reader(N
|
||||
End(reader->info.duration);
|
||||
reader->SetParentClip(this);
|
||||
allocated_reader = reader;
|
||||
init_reader_rotation();
|
||||
}
|
||||
// Init reader info struct and cache size
|
||||
init_reader_settings(); }
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -237,8 +248,8 @@ void Clip::Reader(ReaderBase* new_reader)
|
||||
// set parent
|
||||
reader->SetParentClip(this);
|
||||
|
||||
// Init rotation (if any)
|
||||
init_reader_rotation();
|
||||
// Init reader info struct and cache size
|
||||
init_reader_settings();
|
||||
}
|
||||
|
||||
/// Get the current reader
|
||||
|
||||
Reference in New Issue
Block a user