show loading icon for proxy generation

This commit is contained in:
itsmattkc
2019-03-26 22:32:24 +11:00
parent 6b40a4ccf8
commit 091889fbe0
19 changed files with 310 additions and 148 deletions
-62
View File
@@ -1,62 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "bitdepths.h"
#include <QCoreApplication>
namespace olive {
namespace rendering {
QVector<BitDepthInfo> bit_depths;
void InitializeBitDepths() {
bit_depths.resize(PIX_FMT_COUNT);
bit_depths[PIX_FMT_RGBA8].name = QCoreApplication::translate("bitdepths", "8-bit");
bit_depths[PIX_FMT_RGBA8].internal_format = GL_RGBA8;
bit_depths[PIX_FMT_RGBA8].pixel_format = GL_RGBA;
bit_depths[PIX_FMT_RGBA8].pixel_type = GL_UNSIGNED_BYTE;
bit_depths[PIX_FMT_RGBA8].bytes_per_pixel = 4;
bit_depths[PIX_FMT_RGBA16].name = QCoreApplication::translate("bitdepths", "16-bit Integer");
bit_depths[PIX_FMT_RGBA16].internal_format = GL_RGBA16;
bit_depths[PIX_FMT_RGBA16].pixel_format = GL_RGBA;
bit_depths[PIX_FMT_RGBA16].pixel_type = GL_UNSIGNED_SHORT;
bit_depths[PIX_FMT_RGBA16].bytes_per_pixel = 8;
bit_depths[PIX_FMT_RGBA16F].name = QCoreApplication::translate("bitdepths", "Half-Float (16-bit)");
bit_depths[PIX_FMT_RGBA16F].internal_format = GL_RGBA16F;
bit_depths[PIX_FMT_RGBA16F].pixel_format = GL_RGBA;
bit_depths[PIX_FMT_RGBA16F].pixel_type = GL_HALF_FLOAT;
bit_depths[PIX_FMT_RGBA16F].bytes_per_pixel = 8;
bit_depths[PIX_FMT_RGBA32F].name = QCoreApplication::translate("bitdepths", "Full-Float (32-bit)");
bit_depths[PIX_FMT_RGBA32F].internal_format = GL_RGBA32F;
bit_depths[PIX_FMT_RGBA32F].pixel_format = GL_RGBA;
bit_depths[PIX_FMT_RGBA32F].pixel_type = GL_FLOAT;
bit_depths[PIX_FMT_RGBA32F].bytes_per_pixel = 16;
}
}
}
+3 -3
View File
@@ -999,10 +999,10 @@ void Cacher::OpenWorker() {
if (pix_fmt == AV_PIX_FMT_RGBA) {
qDebug() << "This is an 8-bit image.";
media_pixel_format_ = olive::rendering::PIX_FMT_RGBA8;
media_pixel_format_ = olive::PIX_FMT_RGBA8;
} else {
qDebug() << "This is an HDR image.";
media_pixel_format_ = olive::rendering::PIX_FMT_RGBA16;
media_pixel_format_ = olive::PIX_FMT_RGBA16;
}
const char* chosen_format = av_get_pix_fmt_name(pix_fmt);
@@ -1353,7 +1353,7 @@ ClipQueue *Cacher::queue()
return &queue_;
}
const olive::rendering::PixelFormat &Cacher::media_pixel_format()
const olive::PixelFormat &Cacher::media_pixel_format()
{
return media_pixel_format_;
}
+3 -3
View File
@@ -43,7 +43,7 @@ extern "C" {
#include <QMutex>
#include "rendering/clipqueue.h"
#include "rendering/bitdepths.h"
#include "rendering/pixelformats.h"
class Clip;
@@ -262,7 +262,7 @@ public:
*
* A olive::rendering::PixelFormat value corresponding to a member of olive::rendering::bit_depths.
*/
const olive::rendering::PixelFormat& media_pixel_format();
const olive::PixelFormat& media_pixel_format();
private:
/**
@@ -596,7 +596,7 @@ private:
/**
* @brief Internal struct holding bit depth information for the current media
*/
olive::rendering::PixelFormat media_pixel_format_;
olive::PixelFormat media_pixel_format_;
};
#endif // CACHER_H
+68
View File
@@ -0,0 +1,68 @@
#include "framebuffercollection.h"
FramebufferCollection::FramebufferCollection()
{
}
void FramebufferCollection::Create(QOpenGLContext* ctx,
int width,
int height,
int count)
{
Q_ASSERT(count > 1);
fbo_.resize(count);
for (int i=0;i<fbo_.size();i++) {
fbo_[i].Create(ctx, width, height);
}
fbo_index_ = -1;
}
void FramebufferCollection::Destroy()
{
fbo_.clear();
}
GLuint FramebufferCollection::CurrentTexture()
{
if (!IsCreated() || fbo_index_ < 0) {
return 0;
}
return fbo_.at(fbo_index_%fbo_.size()).texture();
}
const FramebufferObject& FramebufferCollection::CurrentFramebuffer()
{
Q_ASSERT(IsCreated());
return fbo_.at(fbo_index_%fbo_.size());
}
const FramebufferObject& FramebufferCollection::NextFramebuffer()
{
fbo_index_++;
return CurrentFramebuffer();
}
bool FramebufferCollection::TextureBelongsToCollection(GLuint tex)
{
if (tex == 0) {
return false;
}
for (int i=0;i<fbo_.size();i++) {
if (fbo_.at(i).texture() == tex) {
return true;
}
}
return false;
}
bool FramebufferCollection::IsCreated()
{
return !fbo_.isEmpty();
}
+27
View File
@@ -0,0 +1,27 @@
#ifndef FRAMEBUFFERCOLLECTION_H
#define FRAMEBUFFERCOLLECTION_H
#include <QVector>
#include "framebufferobject.h"
class FramebufferCollection
{
public:
FramebufferCollection();
void Create(QOpenGLContext *ctx, int width, int height, int count);
void Destroy();
GLuint CurrentTexture();
const FramebufferObject& CurrentFramebuffer();
const FramebufferObject& NextFramebuffer();
bool TextureBelongsToCollection(GLuint tex);
bool IsCreated();
private:
QVector<FramebufferObject> fbo_;
int fbo_index_;
};
#endif // FRAMEBUFFERCOLLECTION_H
+4 -4
View File
@@ -26,7 +26,7 @@
#include "global/config.h"
#include "global/global.h"
#include "bitdepths.h"
#include "pixelformats.h"
FramebufferObject::FramebufferObject() :
buffer_(0),
@@ -65,9 +65,9 @@ void FramebufferObject::Create(QOpenGLContext *ctx, int width, int height)
ctx->functions()->glBindTexture(GL_TEXTURE_2D, texture_);
// allocate storage for texture
const olive::rendering::BitDepthInfo& bit_depth = olive::rendering::bit_depths.at(olive::Global->is_exporting() ?
olive::CurrentConfig.export_bit_depth :
olive::CurrentConfig.playback_bit_depth);
const olive::PixelFormatInfo& bit_depth = olive::pixel_formats.at(olive::Global->is_exporting() ?
olive::CurrentConfig.export_bit_depth :
olive::CurrentConfig.playback_bit_depth);
ctx->functions()->glTexImage2D(
GL_TEXTURE_2D,
+60
View File
@@ -0,0 +1,60 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "pixelformats.h"
#include <QCoreApplication>
namespace olive {
QVector<PixelFormatInfo> pixel_formats;
void InitializePixelFormats() {
pixel_formats.resize(PIX_FMT_COUNT);
pixel_formats[PIX_FMT_RGBA8].name = QCoreApplication::translate("bitdepths", "8-bit");
pixel_formats[PIX_FMT_RGBA8].internal_format = GL_RGBA8;
pixel_formats[PIX_FMT_RGBA8].pixel_format = GL_RGBA;
pixel_formats[PIX_FMT_RGBA8].pixel_type = GL_UNSIGNED_BYTE;
pixel_formats[PIX_FMT_RGBA8].bytes_per_pixel = 4;
pixel_formats[PIX_FMT_RGBA16].name = QCoreApplication::translate("bitdepths", "16-bit Integer");
pixel_formats[PIX_FMT_RGBA16].internal_format = GL_RGBA16;
pixel_formats[PIX_FMT_RGBA16].pixel_format = GL_RGBA;
pixel_formats[PIX_FMT_RGBA16].pixel_type = GL_UNSIGNED_SHORT;
pixel_formats[PIX_FMT_RGBA16].bytes_per_pixel = 8;
pixel_formats[PIX_FMT_RGBA16F].name = QCoreApplication::translate("bitdepths", "Half-Float (16-bit)");
pixel_formats[PIX_FMT_RGBA16F].internal_format = GL_RGBA16F;
pixel_formats[PIX_FMT_RGBA16F].pixel_format = GL_RGBA;
pixel_formats[PIX_FMT_RGBA16F].pixel_type = GL_HALF_FLOAT;
pixel_formats[PIX_FMT_RGBA16F].bytes_per_pixel = 8;
pixel_formats[PIX_FMT_RGBA32F].name = QCoreApplication::translate("bitdepths", "Full-Float (32-bit)");
pixel_formats[PIX_FMT_RGBA32F].internal_format = GL_RGBA32F;
pixel_formats[PIX_FMT_RGBA32F].pixel_format = GL_RGBA;
pixel_formats[PIX_FMT_RGBA32F].pixel_type = GL_FLOAT;
pixel_formats[PIX_FMT_RGBA32F].bytes_per_pixel = 16;
}
}
@@ -26,9 +26,8 @@
#include <QOpenGLExtraFunctions>
namespace olive {
namespace rendering {
struct BitDepthInfo {
struct PixelFormatInfo {
QString name;
GLint internal_format;
GLenum pixel_format;
@@ -37,10 +36,10 @@ struct BitDepthInfo {
};
/**
* @brief The OlivePixelFormat enum
* @brief The PixelFormat enum
*
* Olive's internal supported pixel formats. With the exception of OLIVE_PIX_FMT_COUNT, these must all
* be defined in InitializeBitDepths().
* be defined in InitializePixelFormats().
*/
enum PixelFormat {
PIX_FMT_RGBA8,
@@ -50,11 +49,10 @@ enum PixelFormat {
PIX_FMT_COUNT
};
extern QVector<BitDepthInfo> bit_depths;
extern QVector<PixelFormatInfo> pixel_formats;
void InitializeBitDepths();
void InitializePixelFormats();
}
}
#endif // BITDEPTHS_H