better support for various bit rates

This commit is contained in:
itsmattkc
2019-03-26 21:42:45 +11:00
parent 3083e3920b
commit d8acef21a8
51 changed files with 812 additions and 712 deletions
+6 -5
View File
@@ -35,6 +35,7 @@
#include "project/clipboard.h"
#include "undo/undo.h"
#include "global/debug.h"
#include "global/timing.h"
const int kRGBAComponentCount = 4;
@@ -492,7 +493,7 @@ void Clip::Close(bool wait) {
open_ = false;
if (media() != nullptr && media()->get_type() == MEDIA_TYPE_SEQUENCE) {
close_active_clips(media()->to_sequence().get());
media()->to_sequence()->Close();
}
// destroy opengl texture in main thread
@@ -511,10 +512,8 @@ void Clip::Close(bool wait) {
// delete framebuffers
fbo.clear();
#ifndef NO_OCIO
// delete OCIO shader
ocio_shader = nullptr;
#endif
if (UsesCacher()) {
cacher.Close(wait);
@@ -590,18 +589,20 @@ bool Clip::Retrieve()
int video_width = cacher.media_width();
int video_height = cacher.media_height();
const olive::rendering::BitDepthInfo& bit_depth_info = olive::rendering::bit_depths.at(cacher.media_pixel_format());
if (allocate_data) {
// the raw frame size may differ from the one we're using (e.g. a lower resolution proxy), so we make sure
// the texture is using the correct dimensions, but then treat it as if it's the original resolution in the
// composition
f->glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGBA8, video_width, video_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, frame->data[0]
GL_TEXTURE_2D, 0, bit_depth_info.internal_format, video_width, video_height, 0, bit_depth_info.pixel_format, bit_depth_info.pixel_type, frame->data[0]
);
} else {
f->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, video_width, video_height, GL_RGBA, GL_UNSIGNED_BYTE, frame->data[0]);
f->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, video_width, video_height, bit_depth_info.pixel_format, bit_depth_info.pixel_type, frame->data[0]);
}
-5
View File
@@ -39,11 +39,6 @@
#include "marker.h"
extern "C" {
#include <libavformat/avformat.h>
#include <libavfilter/avfilter.h>
}
struct ClipSpeed {
ClipSpeed();
double value;
+10 -2
View File
@@ -34,8 +34,6 @@ Sequence::Sequence() :
{
}
Sequence::~Sequence() {}
SequencePtr Sequence::copy() {
SequencePtr s = std::make_shared<Sequence>();
s->name = QCoreApplication::translate("Sequence", "%1 (copy)").arg(name);
@@ -75,6 +73,16 @@ long Sequence::getEndFrame() {
return end;
}
void Sequence::Close()
{
for (int i=0;i<clips.size();i++) {
Clip* c = clips.at(i).get();
if (c != nullptr) {
c->Close(true);
}
}
}
void Sequence::RefreshClips(Media *m) {
for (int i=0;i<clips.size();i++) {
ClipPtr c = clips.at(i);
+14 -1
View File
@@ -31,8 +31,8 @@
class Sequence {
public:
Sequence();
~Sequence();
SequencePtr copy();
QString name;
void getTrackLimits(int* video_tracks, int* audio_tracks);
long getEndFrame();
@@ -42,6 +42,19 @@ public:
int audio_frequency;
int audio_layout;
/**
* @brief Close all open clips in a Sequence
*
* Closes any currently open clips on a Sequence and waits for them to close before returning. This may be slow as a
* result on large Sequence objects. If a Clip is a nested Sequence, this function calls itself recursively on that
* Sequence too.
*
* @param s
*
* The Sequence to close all clips on.
*/
void Close();
void RefreshClips(Media* m = nullptr);
QVector<Clip*> SelectedClips(bool containing = true);
QVector<int> SelectedClipIndexes();