You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Refactor how Clip overrides ClipBase::End()
This commit is contained in:
13
src/Clip.cpp
13
src/Clip.cpp
@@ -39,7 +39,7 @@ void Clip::init_settings()
|
||||
Position(0.0);
|
||||
Layer(0);
|
||||
Start(0.0);
|
||||
End(0.0);
|
||||
ClipBase::End(0.0);
|
||||
gravity = GRAVITY_CENTER;
|
||||
scale = SCALE_FIT;
|
||||
anchor = ANCHOR_CANVAS;
|
||||
@@ -147,7 +147,7 @@ Clip::Clip(ReaderBase* new_reader) : resampler(NULL), reader(new_reader), alloca
|
||||
|
||||
// Update duration and set parent
|
||||
if (reader) {
|
||||
End(reader->info.duration);
|
||||
ClipBase::End(reader->info.duration);
|
||||
reader->ParentClip(this);
|
||||
// Init reader info struct
|
||||
init_reader_settings();
|
||||
@@ -206,7 +206,7 @@ Clip::Clip(std::string path) : resampler(NULL), reader(NULL), allocated_reader(N
|
||||
|
||||
// Update duration and set parent
|
||||
if (reader) {
|
||||
End(reader->info.duration);
|
||||
ClipBase::End(reader->info.duration);
|
||||
reader->ParentClip(this);
|
||||
allocated_reader = reader;
|
||||
// Init reader info struct
|
||||
@@ -302,7 +302,7 @@ void Clip::Open()
|
||||
|
||||
// Set some clip properties from the file reader
|
||||
if (end == 0.0)
|
||||
End(reader->info.duration);
|
||||
ClipBase::End(reader->info.duration);
|
||||
}
|
||||
else
|
||||
// Throw error if reader not initialized
|
||||
@@ -346,6 +346,11 @@ float Clip::End() const
|
||||
return end;
|
||||
}
|
||||
|
||||
// Override End() position
|
||||
void Clip::End(float value) {
|
||||
ClipBase::End(value);
|
||||
}
|
||||
|
||||
// Create an openshot::Frame object for a specific frame number of this reader.
|
||||
std::shared_ptr<Frame> Clip::GetFrame(int64_t frame_number)
|
||||
{
|
||||
|
||||
@@ -260,9 +260,9 @@ namespace openshot {
|
||||
/// Get the current reader
|
||||
openshot::ReaderBase* Reader();
|
||||
|
||||
// Override End() method
|
||||
float End() const; ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
|
||||
void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
|
||||
// Override End() position (in seconds) of clip (trim end of video)
|
||||
float End() const override; ///< Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
|
||||
void End(float value) override; ///< Set end position (in seconds) of clip (trim end of video)
|
||||
|
||||
// Get and Set JSON methods
|
||||
std::string Json() const override; ///< Generate JSON string of this object
|
||||
|
||||
Reference in New Issue
Block a user