Clip: GetEffect implementation

This commit is contained in:
FeRD (Frank Dana)
2020-09-01 22:53:46 -04:00
parent 466f8713aa
commit 36dab0b1db
2 changed files with 17 additions and 4 deletions

View File

@@ -169,6 +169,9 @@ namespace openshot {
/// Return the list of effects on the timeline
std::list<openshot::EffectBase*> Effects() { return effects; };
/// Look up an effect by ID
openshot::EffectBase* GetEffect(const std::string& id);
/// @brief Get an openshot::Frame object for a specific frame number of this timeline.
///
/// @returns The requested frame (containing the image)
@@ -253,8 +256,6 @@ namespace openshot {
openshot::Keyframe has_audio; ///< An optional override to determine if this clip has audio (-1=undefined, 0=no, 1=yes)
openshot::Keyframe has_video; ///< An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes)
};
} // namespace
}
#endif
#endif // OPENSHOT_CLIP_H

View File

@@ -368,6 +368,18 @@ std::shared_ptr<Frame> Clip::GetFrame(int64_t requested_frame)
throw ReaderClosed("No Reader has been initialized for this Clip. Call Reader(*reader) before calling this method.");
}
// Look up an effect by ID
openshot::EffectBase* Clip::GetEffect(const std::string& id)
{
// Find the matching effect (if any)
for (const auto& effect : effects) {
if (effect->Id() == id) {
return effect;
}
}
return nullptr;
}
// Get file extension
std::string Clip::get_file_extension(std::string path)
{