Skip to content

Commit

Permalink
ReaderBase: Deprecate SetClip/GetClip names
Browse files Browse the repository at this point in the history
- Replacement method names are SetParentClip/GetParentClip
- Old names are retained as deprecated alternates, for now
- libopenshot internal calls (very few) are updated

ReaderBase.cpp: Remove (Set,Get)Clip
  • Loading branch information
ferdnyc committed Sep 2, 2020
1 parent f71051e commit bd90b8d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
10 changes: 8 additions & 2 deletions include/ReaderBase.h
Expand Up @@ -111,10 +111,16 @@ namespace openshot
openshot::ReaderInfo info;

/// Parent clip object of this reader (which can be unparented and NULL)
openshot::ClipBase* GetClip();
inline openshot::ClipBase* GetParentClip() { return parent; };

/// Deprecated alias for GetParentClip()
inline openshot::ClipBase* GetClip() { return parent; };

/// Set parent clip object of this reader
void SetClip(openshot::ClipBase* clip);
inline void SetParentClip(openshot::ClipBase* clip) { parent = clip; };

/// Deprecated alias for SetParentClip()
inline void SetClip(openshot::ClipBase* clip) { parent = clip; };

/// Close the reader (and any resources it was consuming)
virtual void Close() = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/Clip.cpp
Expand Up @@ -153,7 +153,7 @@ Clip::Clip(ReaderBase* new_reader) : resampler(NULL), reader(new_reader), alloca
// Update duration and set parent
if (reader) {
End(reader->info.duration);
reader->SetClip(this);
reader->SetParentClip(this);
}
}

Expand Down Expand Up @@ -210,7 +210,7 @@ Clip::Clip(std::string path) : resampler(NULL), reader(NULL), allocated_reader(N
// Update duration and set parent
if (reader) {
End(reader->info.duration);
reader->SetClip(this);
reader->SetParentClip(this);
allocated_reader = reader;
init_reader_rotation();
}
Expand Down Expand Up @@ -239,7 +239,7 @@ void Clip::Reader(ReaderBase* new_reader)
reader = new_reader;

// set parent
reader->SetClip(this);
reader->SetParentClip(this);

// Init rotation (if any)
init_reader_rotation();
Expand Down Expand Up @@ -993,7 +993,7 @@ void Clip::SetJsonValue(const Json::Value root) {

// mark as managed reader and set parent
if (reader) {
reader->SetClip(this);
reader->SetParentClip(this);
allocated_reader = reader;
}

Expand Down
2 changes: 1 addition & 1 deletion src/FFmpegReader.cpp
Expand Up @@ -1293,7 +1293,7 @@ void FFmpegReader::ProcessVideoPacket(int64_t requested_frame) {
if (max_height <= 0)
max_height = info.height;

Clip *parent = (Clip *) GetClip();
Clip *parent = (Clip *) GetParentClip();
if (parent) {
if (parent->scale == SCALE_FIT || parent->scale == SCALE_STRETCH) {
// Best fit or Stretch scaling (based on max timeline size * scaling keyframes)
Expand Down
2 changes: 1 addition & 1 deletion src/QtImageReader.cpp
Expand Up @@ -187,7 +187,7 @@ std::shared_ptr<Frame> QtImageReader::GetFrame(int64_t requested_frame)
if (max_height <= 0)
max_height = info.height;

Clip* parent = (Clip*) GetClip();
Clip* parent = (Clip*) GetParentClip();
if (parent) {
if (parent->scale == SCALE_FIT || parent->scale == SCALE_STRETCH) {
// Best fit or Stretch scaling (based on max timeline size * scaling keyframes)
Expand Down
10 changes: 0 additions & 10 deletions src/ReaderBase.cpp
Expand Up @@ -249,13 +249,3 @@ void ReaderBase::SetJsonValue(const Json::Value root) {
}
}
}

/// Parent clip object of this reader (which can be unparented and NULL)
openshot::ClipBase* ReaderBase::GetClip() {
return parent;
}

/// Set parent clip object of this reader
void ReaderBase::SetClip(openshot::ClipBase* clip) {
parent = clip;
}

0 comments on commit bd90b8d

Please sign in to comment.