Merge branch 'master' into hashremoval

This commit is contained in:
itsmattkc
2022-05-16 09:12:49 -07:00
969 changed files with 4837 additions and 2393 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
# Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,5 +1,5 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
# Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+7 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -36,6 +36,7 @@ public:
{
iterations_ = 1;
iterative_input_ = nullptr;
will_change_image_size_ = true;
}
const QString& GetShaderID() const
@@ -99,6 +100,9 @@ public:
return vertex_overrides_;
}
bool GetWillChangeImageSize() const { return will_change_image_size_; }
void SetWillChangeImageSize(bool e) { will_change_image_size_ = e; }
private:
QString shader_id_;
@@ -110,6 +114,8 @@ private:
QVector<float> vertex_overrides_;
bool will_change_image_size_;
};
}
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,5 +1,5 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
# Copyright (C) 2022 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
+1 -1
View File
@@ -1,5 +1,5 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 Olive Team
# Copyright (C) 2022 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
+7 -10
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -422,8 +422,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
GL_PREAMBLE;
// If this node is iterative, we'll pick up which input here
QString iterative_name;
GLuint iterative_input = 0;
QMap<QString, GLuint> texture_index_map;
QVector<TextureToBind> textures_to_bind;
GLuint shader = s.value<GLuint>();
@@ -495,11 +494,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
// Set value to bound texture
functions_->glUniform1i(variable_location, textures_to_bind.size());
// If this texture binding is the iterative input, set it here
if (it.key() == job.GetIterativeInput()) {
iterative_input = textures_to_bind.size();
iterative_name = it.key();
}
texture_index_map.insert(it.key(), textures_to_bind.size());
textures_to_bind.append({texture, job.GetInterpolation(it.key())});
@@ -518,6 +513,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
case NodeValue::kFile:
case NodeValue::kVideoParams:
case NodeValue::kAudioParams:
case NodeValue::kSubtitleParams:
case NodeValue::kBezier:
case NodeValue::kNone:
case NodeValue::kDataTypeCount:
@@ -654,11 +650,12 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
if (iteration > 0) {
// If this is not the first iteration, replace the iterative texture with the one we
// last drew
functions_->glActiveTexture(GL_TEXTURE0 + iterative_input);
const QString &iterative_input = job.GetIterativeInput();
functions_->glActiveTexture(GL_TEXTURE0 + texture_index_map.value(iterative_input));
functions_->glBindTexture(GL_TEXTURE_2D, input_tex->id().value<GLuint>());
// At this time, we only support iterating 2D textures
PrepareInputTexture(GL_TEXTURE_2D, job.GetInterpolation(iterative_name));
PrepareInputTexture(GL_TEXTURE_2D, job.GetInterpolation(iterative_input));
}
// Swap so that the next iteration, the texture we draw now will be the input texture next
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+13 -13
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -62,7 +62,7 @@ PreviewAutoCacher::~PreviewAutoCacher()
SetViewerNode(nullptr);
}
RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, bool prioritize)
RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, RenderTicketPriority priority)
{
// If we have a single frame render queued (but not yet sent to the RenderManager), cancel it now
CancelQueuedSingleFrameRender();
@@ -71,7 +71,7 @@ RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, bool priori
auto sfr = std::make_shared<RenderTicket>();
sfr->Start();
sfr->setProperty("time", QVariant::fromValue(t));
sfr->setProperty("prioritize", prioritize);
sfr->setProperty("priority", int(priority));
// Queue it and try to render
single_frame_render_ = sfr;
@@ -80,9 +80,9 @@ RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, bool priori
return sfr;
}
RenderTicketPtr PreviewAutoCacher::GetRangeOfAudio(TimeRange range, bool prioritize)
RenderTicketPtr PreviewAutoCacher::GetRangeOfAudio(TimeRange range, RenderTicketPriority priority)
{
return RenderAudio(range, false, prioritize);
return RenderAudio(range, false, priority);
}
void PreviewAutoCacher::VideoInvalidated(const TimeRange &range)
@@ -211,7 +211,7 @@ void PreviewAutoCacher::VideoRendered()
w->SetTicket(RenderManager::instance()->SaveFrameToCache(viewer_node_->video_frame_cache(),
frame,
it.value(),
true));
RenderTicketPriority::kHigh));
}
}
@@ -554,7 +554,7 @@ void PreviewAutoCacher::TryRender()
single_frame_render_->Finish(watcher->property("frame"));
} else {
watcher = RenderFrame(single_frame_render_->property("time").value<rational>(),
single_frame_render_->property("prioritize").toBool(),
RenderTicketPriority(single_frame_render_->property("priority").toInt()),
!viewer_node_->GetVideoAutoCacheEnabled());
video_immediate_passthroughs_[watcher].append(single_frame_render_);
@@ -574,7 +574,7 @@ void PreviewAutoCacher::TryRender()
// We want this hash, if we're not already rendering, start render now
if (!render_task && !video_download_tasks_.key(t)) {
// Don't render any hash more than once
RenderFrame(t, false, false);
RenderFrame(t, RenderTicketPriority::kNormal, false);
}
emit SignalCacheProxyTaskProgress(double(queued_frame_iterator_.frame_index()) / double(queued_frame_iterator_.size()));
@@ -594,13 +594,13 @@ void PreviewAutoCacher::TryRender()
r.set_out(qMin(r.out(), r.in() + AudioVisualWaveform::kMinimumSampleRate.flipped()));
// Start job
RenderAudio(r, true, false);
RenderAudio(r, true, RenderTicketPriority::kNormal);
audio_iterator_.remove(r);
}
}
RenderTicketWatcher* PreviewAutoCacher::RenderFrame(const rational& time, bool prioritize, bool texture_only)
RenderTicketWatcher* PreviewAutoCacher::RenderFrame(const rational& time, RenderTicketPriority priority, bool texture_only)
{
RenderTicketWatcher* watcher = new RenderTicketWatcher();
watcher->setProperty("job", QVariant::fromValue(last_update_time_));
@@ -611,19 +611,19 @@ RenderTicketWatcher* PreviewAutoCacher::RenderFrame(const rational& time, bool p
time,
RenderMode::kOffline,
viewer_node_->video_frame_cache(),
prioritize,
priority,
texture_only));
return watcher;
}
RenderTicketPtr PreviewAutoCacher::RenderAudio(const TimeRange &r, bool generate_waveforms, bool prioritize)
RenderTicketPtr PreviewAutoCacher::RenderAudio(const TimeRange &r, bool generate_waveforms, RenderTicketPriority priority)
{
RenderTicketWatcher* watcher = new RenderTicketWatcher();
watcher->setProperty("job", QVariant::fromValue(last_update_time_));
connect(watcher, &RenderTicketWatcher::Finished, this, &PreviewAutoCacher::AudioRendered);
audio_tasks_.insert(watcher, r);
RenderTicketPtr ticket = RenderManager::instance()->RenderAudio(copied_viewer_node_, r, RenderMode::kOffline, generate_waveforms, prioritize);
RenderTicketPtr ticket = RenderManager::instance()->RenderAudio(copied_viewer_node_, r, RenderMode::kOffline, generate_waveforms, priority);
watcher->SetTicket(ticket);
return ticket;
}
+6 -5
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -32,6 +32,7 @@
#include "node/project/project.h"
#include "render/audioparams.h"
#include "render/renderjobtracker.h"
#include "threading/threadpool.h"
#include "threading/threadticketwatcher.h"
namespace olive {
@@ -49,9 +50,9 @@ public:
virtual ~PreviewAutoCacher() override;
RenderTicketPtr GetSingleFrame(const rational& t, bool prioritize);
RenderTicketPtr GetSingleFrame(const rational& t, RenderTicketPriority prioritize);
RenderTicketPtr GetRangeOfAudio(TimeRange range, bool prioritize);
RenderTicketPtr GetRangeOfAudio(TimeRange range, RenderTicketPriority prioritize);
/**
* @brief Set the viewer node to auto-cache
@@ -100,8 +101,8 @@ signals:
private:
void TryRender();
RenderTicketWatcher *RenderFrame(const rational &time, bool prioritize, bool texture_only);
RenderTicketPtr RenderAudio(const TimeRange &range, bool generate_waveforms, bool prioritize);
RenderTicketWatcher *RenderFrame(const rational &time, RenderTicketPriority priority, bool texture_only);
RenderTicketPtr RenderAudio(const TimeRange &range, bool generate_waveforms, RenderTicketPriority priority);
/**
* @brief Process all changes to internal NodeGraph copy
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+20 -56
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -36,10 +36,9 @@
namespace olive {
RenderManager* RenderManager::instance_ = nullptr;
const int RenderManager::kDecoderMaximumInactivity = 10000;
RenderManager::RenderManager(QObject *parent) :
ThreadPool(QThread::IdlePriority, 0, parent),
ThreadPool(0, parent),
backend_(kOpenGL)
{
Renderer* graphics_renderer = nullptr;
@@ -56,10 +55,6 @@ RenderManager::RenderManager(QObject *parent) :
decoder_cache_ = new DecoderCache();
shader_cache_ = new ShaderCache();
default_shader_ = context_->CreateNativeShader(ShaderCode(QString(), QString()));
decoder_clear_timer_.setInterval(kDecoderMaximumInactivity);
connect(&decoder_clear_timer_, &QTimer::timeout, this, &RenderManager::ClearOldDecoders);
decoder_clear_timer_.start();
} else {
qCritical() << "Tried to initialize unknown graphics backend";
context_ = nullptr;
@@ -81,27 +76,9 @@ RenderManager::~RenderManager()
}
}
void RenderManager::ClearOldDecoders()
{
QMutexLocker locker(decoder_cache_->mutex());
qint64 min_age = QDateTime::currentMSecsSinceEpoch() - kDecoderMaximumInactivity;
for (auto it=decoder_cache_->begin(); it!=decoder_cache_->end(); ) {
DecoderPair decoder = it.value();
if (decoder.decoder->GetLastAccessedTime() < min_age) {
decoder.decoder->Close();
it = decoder_cache_->erase(it);
} else {
it++;
}
}
}
RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* color_manager,
const rational& time, RenderMode::Mode mode,
FrameHashCache* cache, bool prioritize, bool texture_only)
FrameHashCache* cache, RenderTicketPriority priority, bool texture_only)
{
return RenderFrame(viewer,
color_manager,
@@ -114,7 +91,7 @@ RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* c
VideoParams::kFormatInvalid,
nullptr,
cache,
prioritize,
priority,
texture_only);
}
@@ -124,7 +101,7 @@ RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* c
const QSize& force_size,
const QMatrix4x4& force_matrix, VideoParams::Format force_format,
ColorProcessorPtr force_color_output,
FrameHashCache* cache, bool prioritize, bool texture_only)
FrameHashCache* cache, RenderTicketPriority priority, bool texture_only)
{
// Create ticket
RenderTicketPtr ticket = std::make_shared<RenderTicket>();
@@ -146,24 +123,17 @@ RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* c
ticket->setProperty("cache", cache->GetCacheDirectory());
}
if (ticket->thread() != this->thread()) {
ticket->moveToThread(this->thread());
}
// Queue appending the ticket and running the next job on our thread to make this function thread-safe
QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection,
OLIVE_NS_ARG(RenderTicketPtr, ticket),
Q_ARG(bool, prioritize));
AddTicket(ticket, priority);
return ticket;
}
RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, bool prioritize)
RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority)
{
return RenderAudio(viewer, r, viewer->GetAudioParams(), mode, generate_waveforms, prioritize);
return RenderAudio(viewer, r, viewer->GetAudioParams(), mode, generate_waveforms, priority);
}
RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange &r, const AudioParams &params, RenderMode::Mode mode, bool generate_waveforms, bool prioritize)
RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange &r, const AudioParams &params, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority)
{
// Create ticket
RenderTicketPtr ticket = std::make_shared<RenderTicket>();
@@ -175,19 +145,12 @@ RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange
ticket->setProperty("enablewaveforms", generate_waveforms);
ticket->setProperty("aparam", QVariant::fromValue(params));
if (ticket->thread() != this->thread()) {
ticket->moveToThread(this->thread());
}
// Queue appending the ticket and running the next job on our thread to make this function thread-safe
QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection,
OLIVE_NS_ARG(RenderTicketPtr, ticket),
Q_ARG(bool, prioritize));
AddTicket(ticket, priority);
return ticket;
}
RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr frame, const rational &time, bool prioritize)
RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr frame, const rational &time, RenderTicketPriority priority)
{
// Create ticket
RenderTicketPtr ticket = std::make_shared<RenderTicket>();
@@ -198,20 +161,21 @@ RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr
ticket->setProperty("uuid", QVariant::fromValue(cache->GetUuid()));
ticket->setProperty("type", kTypeVideoDownload);
if (ticket->thread() != this->thread()) {
ticket->moveToThread(this->thread());
}
// Queue appending the ticket and running the next job on our thread to make this function thread-safe
QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection,
OLIVE_NS_ARG(RenderTicketPtr, ticket),
Q_ARG(bool, prioritize));
AddTicket(ticket, priority);
return ticket;
}
void RenderManager::RunTicket(RenderTicketPtr ticket) const
{
// Setup the ticket for ::Process
ticket->Start();
if (ticket->IsCancelled()) {
ticket->Finish();
return;
}
RenderProcessor::Process(ticket, context_, decoder_cache_, shader_cache_, default_shader_);
}
+6 -19
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -69,36 +69,30 @@ public:
* The ticket from this function will return a FramePtr - the rendered frame in reference color
* space.
*
* Setting `prioritize` to TRUE puts this ticket at the top of the queue. Leaving it as FALSE
* appends it to the bottom.
*
* This function is thread-safe.
*/
RenderTicketPtr RenderFrame(ViewerOutput *viewer, ColorManager* color_manager,
const rational& time, RenderMode::Mode mode,
FrameHashCache* cache = nullptr, bool prioritize = false, bool texture_only = false);
FrameHashCache* cache = nullptr, RenderTicketPriority priority = RenderTicketPriority::kNormal, bool texture_only = false);
RenderTicketPtr RenderFrame(ViewerOutput* viewer, ColorManager* color_manager,
const rational& time, RenderMode::Mode mode,
const VideoParams& video_params, const AudioParams& audio_params,
const QSize& force_size,
const QMatrix4x4& force_matrix, VideoParams::Format force_format,
ColorProcessorPtr force_color_output,
FrameHashCache* cache = nullptr, bool prioritize = false, bool texture_only = false);
FrameHashCache* cache = nullptr, RenderTicketPriority priority = RenderTicketPriority::kNormal, bool texture_only = false);
/**
* @brief Asynchronously generate a chunk of audio
*
* The ticket from this function will return a SampleBufferPtr - the rendered audio.
*
* Setting `prioritize` to TRUE puts this ticket at the top of the queue. Leaving it as FALSE
* appends it to the bottom.
*
* This function is thread-safe.
*/
RenderTicketPtr RenderAudio(ViewerOutput* viewer, const TimeRange& r, const AudioParams& params, RenderMode::Mode mode, bool generate_waveforms, bool prioritize = false);
RenderTicketPtr RenderAudio(ViewerOutput *viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, bool prioritize = false);
RenderTicketPtr RenderAudio(ViewerOutput* viewer, const TimeRange& r, const AudioParams& params, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority = RenderTicketPriority::kNormal);
RenderTicketPtr RenderAudio(ViewerOutput *viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority = RenderTicketPriority::kNormal);
RenderTicketPtr SaveFrameToCache(FrameHashCache* cache, FramePtr frame, const rational &time, bool prioritize = false);
RenderTicketPtr SaveFrameToCache(FrameHashCache* cache, FramePtr frame, const rational &time, RenderTicketPriority priority = RenderTicketPriority::kNormal);
virtual void RunTicket(RenderTicketPtr ticket) const override;
@@ -137,13 +131,6 @@ private:
QVariant default_shader_;
QTimer decoder_clear_timer_;
static const int kDecoderMaximumInactivity;
private slots:
void ClearOldDecoders();
};
}
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+4 -4
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -52,7 +52,7 @@ TexturePtr RenderProcessor::GenerateTexture(const rational &time, const rational
NodeValueTable table;
if (Node *texture_output = viewer->GetConnectedTextureOutput()) {
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kTextureInput), range);
table = GenerateTable(texture_output, range);
}
NodeValue tex_val = table.Get(NodeValue::kTexture);
@@ -193,7 +193,7 @@ void RenderProcessor::Run()
NodeValueTable table;
if (Node *texture_output = viewer->GetConnectedSampleOutput()) {
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kSamplesInput),time);
table = GenerateTable(texture_output, time);
}
NodeValue sample_val = table.Get(NodeValue::kSamples);
@@ -291,7 +291,7 @@ NodeValueTable RenderProcessor::GenerateBlockTable(const Track *track, const Tim
int max_dest_sz = audio_params.time_to_samples(range_for_block.length());
// Destination buffer
NodeValueTable table = GenerateTable(b, track->GetValueHintForInput(Track::kBlockInput, track->GetArrayIndexFromBlock(b)),Track::TransformRangeForBlock(b, range_for_block));
NodeValueTable table = GenerateTable(b, Track::TransformRangeForBlock(b, range_for_block));
SampleBuffer samples_from_this_block = table.Take(NodeValue::kSamples).toSamples();
ClipBlock *clip_cast = dynamic_cast<ClipBlock*>(b);
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+55 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -22,6 +22,8 @@
#include <QCoreApplication>
#include "common/xmlutils.h"
namespace olive {
QString SubtitleParams::GenerateASSHeader()
@@ -106,4 +108,56 @@ QString SubtitleParams::GenerateASSHeader()
return ass_code;
}
void SubtitleParams::Load(QXmlStreamReader *reader)
{
this->clear();
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("streamindex")) {
set_stream_index(reader->readElementText().toInt());
} else if (reader->name() == QStringLiteral("enabled")) {
set_enabled(reader->readElementText().toInt());
} else if (reader->name() == QStringLiteral("subtitles")) {
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("subtitle")) {
rational in, out;
QString text;
XMLAttributeLoop(reader, attr) {
if (attr.name() == QStringLiteral("in")) {
in = rational::fromString(attr.value().toString());
} else if (attr.name() == QStringLiteral("out")) {
out = rational::fromString(attr.value().toString());
}
}
text = reader->readElementText();
this->push_back(Subtitle(TimeRange(in, out), text));
} else {
reader->skipCurrentElement();
}
}
} else {
reader->skipCurrentElement();
}
}
}
void SubtitleParams::Save(QXmlStreamWriter *writer) const
{
writer->writeTextElement(QStringLiteral("streamindex"), QString::number(stream_index_));
writer->writeTextElement(QStringLiteral("enabled"), QString::number(enabled_));
writer->writeStartElement(QStringLiteral("subtitles"));
for (auto it=this->cbegin(); it!=this->cend(); it++) {
writer->writeStartElement(QStringLiteral("subtitle"));
writer->writeAttribute(QStringLiteral("in"), it->time().in().toString());
writer->writeAttribute(QStringLiteral("out"), it->time().out().toString());
writer->writeCharacters(it->text());
writer->writeEndElement(); // subtitle
}
writer->writeEndElement(); // subtitles
}
}
+70 -2
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
@@ -21,16 +21,84 @@
#ifndef SUBTITLEPARAMS_H
#define SUBTITLEPARAMS_H
#include <QRect>
#include <QString>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include "common/timerange.h"
namespace olive {
class SubtitleParams {
class Subtitle
{
public:
Subtitle() = default;
Subtitle(const TimeRange &time, const QString &text) :
range_(time),
text_(text)
{
}
const TimeRange &time() const { return range_; }
void set_time(const TimeRange &t) { range_ = t; }
const QString &text() const { return text_; }
void set_text(const QString &t) { text_ = t; }
private:
TimeRange range_;
QString text_;
};
class SubtitleParams : public std::vector<Subtitle>
{
public:
SubtitleParams()
{
stream_index_ = 0;
enabled_ = true;
}
static QString GenerateASSHeader();
void Load(QXmlStreamReader* reader);
void Save(QXmlStreamWriter* writer) const;
bool is_valid() const
{
return !this->empty();
}
rational duration() const
{
if (this->empty()) {
return 0;
} else {
return back().time().out();
}
}
int stream_index() const { return stream_index_; }
void set_stream_index(int i) { stream_index_ = i; }
bool enabled() const { return enabled_; }
void set_enabled(bool e) { enabled_ = e; }
private:
int stream_index_;
bool enabled_;
};
}
Q_DECLARE_METATYPE(olive::Subtitle)
Q_DECLARE_METATYPE(olive::SubtitleParams)
#endif // SUBTITLEPARAMS_H
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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
+1 -1
View File
@@ -1,7 +1,7 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2021 Olive Team
Copyright (C) 2022 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