Skip to content

Commit

Permalink
Clip: GetEffect implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Sep 2, 2020
1 parent 466f871 commit 36dab0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/Clip.h
Expand Up @@ -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)
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions src/Clip.cpp
Expand Up @@ -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)
{
Expand Down

0 comments on commit 36dab0b

Please sign in to comment.