Skip to content

Commit

Permalink
Merge branch 'clip-refactor-keyframes' of https://github.com/OpenShot…
Browse files Browse the repository at this point in the history
…/libopenshot into clip-refactor-keyframes
  • Loading branch information
ferdnyc committed Oct 19, 2020
2 parents d2521bc + 29107bc commit f4ae897
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
10 changes: 2 additions & 8 deletions include/ReaderBase.h
Expand Up @@ -111,16 +111,10 @@ namespace openshot
openshot::ReaderInfo info;

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

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

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

/// Deprecated alias for SetParentClip()
inline void SetClip(openshot::ClipBase* clip) { parent = clip; };
void ParentClip(openshot::ClipBase* new_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 @@ -160,7 +160,7 @@ Clip::Clip(ReaderBase* new_reader) : resampler(NULL), reader(new_reader), alloca
// Update duration and set parent
if (reader) {
End(reader->info.duration);
reader->SetParentClip(this);
reader->ParentClip(this);
}
}

Expand Down Expand Up @@ -217,7 +217,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->SetParentClip(this);
reader->ParentClip(this);
allocated_reader = reader;
// Init reader info struct and cache size
init_reader_settings(); }
Expand Down Expand Up @@ -246,7 +246,7 @@ void Clip::Reader(ReaderBase* new_reader)
reader = new_reader;

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

// Init reader info struct and cache size
init_reader_settings();
Expand Down Expand Up @@ -1062,7 +1062,7 @@ void Clip::SetJsonValue(const Json::Value root) {

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

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

Clip *parent = (Clip *) GetParentClip();
Clip *parent = (Clip *) ParentClip();
if (parent) {
if (parent->ParentTimeline()) {
// Set max width/height based on parent clip's timeline (if attached to a timeline)
Expand Down
6 changes: 4 additions & 2 deletions src/Frame.cpp
Expand Up @@ -221,7 +221,8 @@ std::shared_ptr<QImage> Frame::GetWaveform(int width, int height, int Red, int G
}

// Create blank image
wave_image = std::make_shared<QImage>(total_width, total_height, QImage::Format_RGBA8888_Premultiplied);
wave_image = std::make_shared<QImage>(
total_width, total_height, QImage::Format_RGBA8888_Premultiplied);
wave_image->fill(QColor(0,0,0,0));

// Load QPainter with wave_image device
Expand Down Expand Up @@ -836,7 +837,8 @@ void Frame::AddImage(std::shared_ptr<QImage> new_image, bool only_odd_lines)
ret = true;
}
else if (new_image->format() != QImage::Format_RGBA8888_Premultiplied) {
new_image = std::make_shared<QImage>(new_image->convertToFormat(QImage::Format_RGBA8888_Premultiplied));
new_image = std::make_shared<QImage>(
new_image->convertToFormat(QImage::Format_RGBA8888_Premultiplied));
}
}
if (ret) {
Expand Down
2 changes: 1 addition & 1 deletion src/QtImageReader.cpp
Expand Up @@ -174,7 +174,7 @@ std::shared_ptr<Frame> QtImageReader::GetFrame(int64_t requested_frame)
int max_width = info.width;
int max_height = info.height;

Clip* parent = (Clip*) GetParentClip();
Clip* parent = (Clip*) ParentClip();
if (parent) {
if (parent->ParentTimeline()) {
// Set max width/height based on parent clip's timeline (if attached to a timeline)
Expand Down

0 comments on commit f4ae897

Please sign in to comment.