show loading icon for proxy generation
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
#include "global/config.h"
|
||||
#include "global/path.h"
|
||||
#include "rendering/audio.h"
|
||||
#include "rendering/bitdepths.h"
|
||||
#include "rendering/pixelformats.h"
|
||||
#include "panels/panels.h"
|
||||
#include "ui/columnedgridlayout.h"
|
||||
#include "ui/mainwindow.h"
|
||||
@@ -170,36 +170,62 @@ void PreferencesDialog::delete_previews(PreviewDeleteTypes type) {
|
||||
|
||||
void PreferencesDialog::populate_ocio_menus(OCIO::ConstConfigRcPtr config)
|
||||
{
|
||||
// Get current display name (if the config is empty, get the current default display)
|
||||
QString current_display = olive::CurrentConfig.ocio_display;
|
||||
if (current_display.isEmpty()) {
|
||||
current_display = config->getDefaultDisplay();
|
||||
}
|
||||
if (config == nullptr) {
|
||||
|
||||
// Populate the display menu
|
||||
ocio_display->clear();
|
||||
for (int i=0;i<config->getNumDisplays();i++) {
|
||||
ocio_display->addItem(config->getDisplay(i));
|
||||
// Just clear everything
|
||||
ocio_display->clear();
|
||||
ocio_view->clear();
|
||||
ocio_look->clear();
|
||||
|
||||
// Check if this index is the currently selected
|
||||
if (config->getDisplay(i) == current_display) {
|
||||
ocio_display->setCurrentIndex(i);
|
||||
} else {
|
||||
|
||||
// Get current display name (if the config is empty, get the current default display)
|
||||
QString current_display = olive::CurrentConfig.ocio_display;
|
||||
if (current_display.isEmpty()) {
|
||||
current_display = config->getDefaultDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
update_ocio_view_menu(config);
|
||||
// Populate the display menu
|
||||
ocio_display->clear();
|
||||
for (int i=0;i<config->getNumDisplays();i++) {
|
||||
ocio_display->addItem(config->getDisplay(i));
|
||||
|
||||
// Populate the look menu
|
||||
ocio_look->clear();
|
||||
ocio_look->addItem(tr("(None)"), QString());
|
||||
for (int i=0;i<config->getNumLooks();i++) {
|
||||
const char* look = config->getLookNameByIndex(i);
|
||||
|
||||
ocio_look->addItem(look, look);
|
||||
|
||||
if (look == olive::CurrentConfig.ocio_look) {
|
||||
ocio_look->setCurrentIndex(i);
|
||||
// Check if this index is the currently selected
|
||||
if (config->getDisplay(i) == current_display) {
|
||||
ocio_display->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
update_ocio_view_menu(config);
|
||||
|
||||
// Populate the look menu
|
||||
ocio_look->clear();
|
||||
ocio_look->addItem(tr("(None)"), QString());
|
||||
for (int i=0;i<config->getNumLooks();i++) {
|
||||
const char* look = config->getLookNameByIndex(i);
|
||||
|
||||
ocio_look->addItem(look, look);
|
||||
|
||||
if (look == olive::CurrentConfig.ocio_look) {
|
||||
ocio_look->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
OCIO::ConstConfigRcPtr PreferencesDialog::TestOCIOConfig(const QString &url)
|
||||
{
|
||||
// Check whether OCIO can load it
|
||||
try {
|
||||
OCIO::ConstConfigRcPtr config = OCIO::Config::CreateFromFile(ocio_config_file->text().toUtf8());
|
||||
return config;
|
||||
} catch (OCIO::Exception& e) {
|
||||
QMessageBox::critical(this,
|
||||
tr("OpenColorIO Config Error"),
|
||||
tr("Failed to set OpenColorIO configuration: %1").arg(e.what()),
|
||||
QMessageBox::Ok);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,13 +257,13 @@ void PreferencesDialog::update_ocio_view_menu(OCIO::ConstConfigRcPtr config)
|
||||
|
||||
void PreferencesDialog::update_ocio_config(const QString &s)
|
||||
{
|
||||
if (!s.isEmpty() && QFileInfo::exists(s)) {
|
||||
try {
|
||||
OCIO::ConstConfigRcPtr file_config = OCIO::Config::CreateFromFile(s.toUtf8());
|
||||
OCIO::ConstConfigRcPtr file_config = nullptr;
|
||||
|
||||
populate_ocio_menus(file_config);
|
||||
} catch (OCIO::Exception& e) {}
|
||||
if (!s.isEmpty() && QFileInfo::exists(s)) {
|
||||
file_config = TestOCIOConfig(s);
|
||||
}
|
||||
|
||||
populate_ocio_menus(file_config);
|
||||
}
|
||||
|
||||
void PreferencesDialog::AddBoolPair(QCheckBox *ui, bool *value, bool restart_required)
|
||||
@@ -315,13 +341,9 @@ void PreferencesDialog::accept() {
|
||||
} else if (olive::CurrentConfig.ocio_config_path != ocio_config_file->text()) {
|
||||
|
||||
// Check whether OCIO can load it
|
||||
try {
|
||||
OCIO::Config::CreateFromFile(ocio_config_file->text().toUtf8());
|
||||
} catch (OCIO::Exception& e) {
|
||||
QMessageBox::critical(this,
|
||||
tr("OpenColorIO Config Error"),
|
||||
tr("Failed to set OpenColorIO configuration: %1").arg(e.what()),
|
||||
QMessageBox::Ok);
|
||||
OCIO::ConstConfigRcPtr file_config = TestOCIOConfig(ocio_config_file->text().toUtf8());
|
||||
|
||||
if (file_config == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1066,8 +1088,8 @@ void PreferencesDialog::setup_ui() {
|
||||
|
||||
// COLOR MANAGEMENT -> Bit Depth -> Playback
|
||||
playback_bit_depth = new QComboBox();
|
||||
for (int i=0;i<olive::rendering::bit_depths.size();i++) {
|
||||
playback_bit_depth->addItem(olive::rendering::bit_depths.at(i).name, i);
|
||||
for (int i=0;i<olive::pixel_formats.size();i++) {
|
||||
playback_bit_depth->addItem(olive::pixel_formats.at(i).name, i);
|
||||
}
|
||||
playback_bit_depth->setCurrentIndex(olive::CurrentConfig.playback_bit_depth);
|
||||
bit_depth_groupbox_layout->addWidget(new QLabel(tr("Playback (Offline):")), 0, 0);
|
||||
@@ -1075,8 +1097,8 @@ void PreferencesDialog::setup_ui() {
|
||||
|
||||
// COLOR MANAGEMENT -> Bit Depth -> Export
|
||||
export_bit_depth = new QComboBox();
|
||||
for (int i=0;i<olive::rendering::bit_depths.size();i++) {
|
||||
export_bit_depth->addItem(olive::rendering::bit_depths.at(i).name, i);
|
||||
for (int i=0;i<olive::pixel_formats.size();i++) {
|
||||
export_bit_depth->addItem(olive::pixel_formats.at(i).name, i);
|
||||
}
|
||||
export_bit_depth->setCurrentIndex(olive::CurrentConfig.export_bit_depth);
|
||||
bit_depth_groupbox_layout->addWidget(new QLabel(tr("Export (Online):")), 0, 2);
|
||||
|
||||
@@ -301,6 +301,19 @@ private:
|
||||
*/
|
||||
QVector<KeySequenceEditor*> key_shortcut_fields;
|
||||
|
||||
/**
|
||||
* @brief Tests an OpenColorIO configuration file to determine whether it's valid and throws a messagebox if not
|
||||
*
|
||||
* @param url
|
||||
*
|
||||
* URL to the OpenColorIO configuration file.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* A OCIO::ConstConfigRcPtr config pointer if the configuration file is valid, nullptr if not.
|
||||
*/
|
||||
OCIO::ConstConfigRcPtr TestOCIOConfig(const QString& url);
|
||||
|
||||
/**
|
||||
* @brief Add an automated QCheckBox+boolean value pair
|
||||
*
|
||||
|
||||
+2
-2
@@ -80,8 +80,8 @@ Config::Config()
|
||||
default_sequence_framerate(29.97),
|
||||
default_sequence_audio_frequency(48000),
|
||||
default_sequence_audio_channel_layout(3),
|
||||
playback_bit_depth(olive::rendering::PIX_FMT_RGBA16F),
|
||||
export_bit_depth(olive::rendering::PIX_FMT_RGBA32F)
|
||||
playback_bit_depth(olive::PIX_FMT_RGBA16F),
|
||||
export_bit_depth(olive::PIX_FMT_RGBA32F)
|
||||
{}
|
||||
|
||||
void Config::load(QString path) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "global/config.h"
|
||||
#include "global/global.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "rendering/bitdepths.h"
|
||||
#include "rendering/pixelformats.h"
|
||||
#include "ui/mediaiconservice.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
@@ -133,7 +133,7 @@ int main(int argc, char *argv[]) {
|
||||
olive::timeline::MultiplyTrackSizesByDPI();
|
||||
|
||||
// set up rendering bit depths
|
||||
olive::rendering::InitializeBitDepths();
|
||||
olive::InitializePixelFormats();
|
||||
|
||||
// connect main window's first paint to global's init finished function
|
||||
QObject::connect(&w, SIGNAL(finished_first_paint()), olive::Global.get(), SLOT(finished_initialize()), Qt::QueuedConnection);
|
||||
|
||||
@@ -173,12 +173,12 @@ SOURCES += \
|
||||
ui/blur.cpp \
|
||||
ui/menu.cpp \
|
||||
rendering/qopenglshaderprogramptr.cpp \
|
||||
rendering/bitdepths.cpp \
|
||||
timeline/mediaimportdata.cpp \
|
||||
dialogs/autocutsilencedialog.cpp \
|
||||
ui/columnedgridlayout.cpp \
|
||||
rendering/shadergenerators.cpp \
|
||||
global/timing.cpp
|
||||
global/timing.cpp \
|
||||
rendering/pixelformats.cpp
|
||||
|
||||
HEADERS += \
|
||||
ui/mainwindow.h \
|
||||
@@ -305,12 +305,12 @@ HEADERS += \
|
||||
ui/blur.h \
|
||||
ui/menu.h \
|
||||
rendering/qopenglshaderprogramptr.h \
|
||||
rendering/bitdepths.h \
|
||||
timeline/mediaimportdata.h \
|
||||
dialogs/autocutsilencedialog.h \
|
||||
ui/columnedgridlayout.h \
|
||||
rendering/shadergenerators.h \
|
||||
global/timing.h
|
||||
global/timing.h \
|
||||
rendering/pixelformats.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
|
||||
+9
-2
@@ -63,7 +63,8 @@ QString get_channel_layout_name(int channels, uint64_t layout) {
|
||||
|
||||
Media::Media() :
|
||||
root(false),
|
||||
type(-1)
|
||||
type(-1),
|
||||
disable_thumbnail_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -230,6 +231,11 @@ void Media::set_name(const QString &n) {
|
||||
}
|
||||
}
|
||||
|
||||
void Media::disable_thumbnail(bool disable)
|
||||
{
|
||||
disable_thumbnail_ = disable;
|
||||
}
|
||||
|
||||
double Media::get_frame_rate(int stream) {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
@@ -308,7 +314,8 @@ QVariant Media::data(int column, int role) {
|
||||
if (column == 0) {
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
if (f->video_tracks.size() > 0
|
||||
if (!disable_thumbnail_
|
||||
&& f->video_tracks.size() > 0
|
||||
&& f->video_tracks.at(0).preview_done) {
|
||||
return QIcon(QPixmap::fromImage(f->video_tracks.at(0).video_preview));
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
int get_type();
|
||||
const QString& get_name();
|
||||
void set_name(const QString& n);
|
||||
void disable_thumbnail(bool disable);
|
||||
|
||||
double get_frame_rate(int stream = -1);
|
||||
int get_sampling_rate(int stream = -1);
|
||||
@@ -95,6 +96,7 @@ private:
|
||||
QString folder_name;
|
||||
QString tooltip;
|
||||
QIcon icon;
|
||||
bool disable_thumbnail_;
|
||||
};
|
||||
|
||||
#endif // MEDIA_H
|
||||
|
||||
+19
-12
@@ -20,23 +20,24 @@
|
||||
|
||||
#include "proxygenerator.h"
|
||||
|
||||
#include "global/path.h"
|
||||
#include "project/previewgenerator.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QtMath>
|
||||
#include <QStatusBar>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QtMath>
|
||||
#include <QStatusBar>
|
||||
#include <QDebug>
|
||||
|
||||
#include "global/path.h"
|
||||
#include "project/previewgenerator.h"
|
||||
#include "ui/mediaiconservice.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
// TODO provide more codecs than just this one
|
||||
enum AVCodecID temp_enc_codec = AV_CODEC_ID_PRORES;
|
||||
|
||||
ProxyGenerator::ProxyGenerator() : cancelled(false) {}
|
||||
@@ -123,7 +124,7 @@ void ProxyGenerator::transcode(const ProxyInfo& info) {
|
||||
enc_ctx->width = qFloor(dec_ctx->width*info.size_multiplier);
|
||||
enc_ctx->height = qFloor(dec_ctx->height*info.size_multiplier);
|
||||
enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
|
||||
enc_ctx->pix_fmt = enc_codec->pix_fmts[0];
|
||||
enc_ctx->pix_fmt = avcodec_find_best_pix_fmt_of_list(enc_codec->pix_fmts, dec_ctx->pix_fmt, 1, nullptr);
|
||||
enc_ctx->framerate = dec_ctx->framerate;
|
||||
enc_ctx->time_base = in_stream->time_base;
|
||||
out_stream->time_base = in_stream->time_base;
|
||||
@@ -356,9 +357,15 @@ void ProxyGenerator::run() {
|
||||
// set skip to false
|
||||
skip = false;
|
||||
|
||||
// set media icon to animated loading icon
|
||||
olive::media_icon_service->SetMediaIcon(info.media, ICON_TYPE_LOADING);
|
||||
|
||||
// transcode proxy
|
||||
transcode(info);
|
||||
|
||||
// set media icon back to video
|
||||
olive::media_icon_service->SetMediaIcon(info.media, ICON_TYPE_VIDEO);
|
||||
|
||||
// we're finished with this proxy, remove it
|
||||
proxy_queue.removeFirst();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
+21
-4
@@ -585,9 +585,9 @@ 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());
|
||||
const olive::PixelFormatInfo& pix_fmt_info = olive::pixel_formats.at(cacher.media_pixel_format());
|
||||
|
||||
f->glPixelStorei(GL_UNPACK_ROW_LENGTH, frame->linesize[0]/bit_depth_info.bytes_per_pixel);
|
||||
f->glPixelStorei(GL_UNPACK_ROW_LENGTH, frame->linesize[0]/pix_fmt_info.bytes_per_pixel);
|
||||
|
||||
if (allocate_data) {
|
||||
|
||||
@@ -595,12 +595,29 @@ bool Clip::Retrieve()
|
||||
// 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, bit_depth_info.internal_format, video_width, video_height, 0, bit_depth_info.pixel_format, bit_depth_info.pixel_type, frame->data[0]
|
||||
GL_TEXTURE_2D,
|
||||
0,
|
||||
pix_fmt_info.internal_format,
|
||||
video_width,
|
||||
video_height,
|
||||
0,
|
||||
pix_fmt_info.pixel_format,
|
||||
pix_fmt_info.pixel_type,
|
||||
frame->data[0]
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
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]);
|
||||
f->glTexSubImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
video_width,
|
||||
video_height,
|
||||
pix_fmt_info.pixel_format,
|
||||
pix_fmt_info.pixel_type,
|
||||
frame->data[0]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,13 @@ MediaIconService::MediaIconService() {
|
||||
throbber_pixmap_ = QPixmap(":/icons/throbber.png");
|
||||
}
|
||||
|
||||
void MediaIconService::SetMediaIcon(Media *media, int icon_type) {
|
||||
void MediaIconService::SetMediaIcon(Media *media, IconType icon_type) {
|
||||
// if this icon is already part of the throbber animation loop, remove it
|
||||
if (throbber_items_.contains(media)) {
|
||||
throbber_lock_.lock();
|
||||
|
||||
throbber_items_.removeAll(media);
|
||||
media->disable_thumbnail(false);
|
||||
|
||||
throbber_lock_.unlock();
|
||||
|
||||
@@ -66,6 +67,8 @@ void MediaIconService::SetMediaIcon(Media *media, int icon_type) {
|
||||
case ICON_TYPE_LOADING:
|
||||
throbber_items_.append(media);
|
||||
|
||||
media->disable_thumbnail(true);
|
||||
|
||||
// if the animation timer isn't running, start it
|
||||
if (!throbber_animator_.isActive()) {
|
||||
// set starting frame to 0
|
||||
|
||||
@@ -40,7 +40,7 @@ class MediaIconService : public QObject {
|
||||
public:
|
||||
MediaIconService();
|
||||
public slots:
|
||||
void SetMediaIcon(Media* media, int icon_type);
|
||||
void SetMediaIcon(Media* media, IconType icon_type);
|
||||
signals:
|
||||
void IconChanged();
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user