Merge branch 'master' into rational_slider
This commit is contained in:
@@ -18,7 +18,6 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
|||||||
|
|
||||||
project(olive-editor VERSION 0.2.0 LANGUAGES CXX)
|
project(olive-editor VERSION 0.2.0 LANGUAGES CXX)
|
||||||
|
|
||||||
option(UPDATE_TS "Update translations" OFF)
|
|
||||||
option(BUILD_DOXYGEN "Build Doxygen documentation" OFF)
|
option(BUILD_DOXYGEN "Build Doxygen documentation" OFF)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
#include "audiovisualwaveform.h"
|
||||||
#include "common/define.h"
|
#include "common/define.h"
|
||||||
#include "outputmanager.h"
|
#include "outputmanager.h"
|
||||||
#include "render/audioparams.h"
|
#include "render/audioparams.h"
|
||||||
@@ -94,6 +95,8 @@ signals:
|
|||||||
|
|
||||||
void OutputDeviceStarted(AudioPlaybackCache* cache, qint64 offset, int playback_speed);
|
void OutputDeviceStarted(AudioPlaybackCache* cache, qint64 offset, int playback_speed);
|
||||||
|
|
||||||
|
void OutputWaveformStarted(const AudioVisualWaveform* waveform, const rational &start, int playback_speed);
|
||||||
|
|
||||||
void AudioParamsChanged(const AudioParams& params);
|
void AudioParamsChanged(const AudioParams& params);
|
||||||
|
|
||||||
void OutputPushed(const QByteArray& data);
|
void OutputPushed(const QByteArray& data);
|
||||||
|
|||||||
+211
-159
@@ -23,14 +23,69 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
|
#include "common/functiontimer.h"
|
||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
const int AudioVisualWaveform::kSumSampleRate = 200;
|
AudioVisualWaveform::AudioVisualWaveform() :
|
||||||
|
channels_(0)
|
||||||
void AudioVisualWaveform::AddSum(const float *samples, int nb_samples, int nb_channels)
|
|
||||||
{
|
{
|
||||||
data_.append(SumSamples(samples, nb_samples, nb_channels));
|
// Must be a power of 2
|
||||||
|
static const rational kMinimumSampleRate = rational(1, 8);
|
||||||
|
static const rational kMaximumSampleRate = 8192;
|
||||||
|
|
||||||
|
for (rational i=kMinimumSampleRate; i<=kMaximumSampleRate; i*=2) {
|
||||||
|
mipmapped_data_.insert({i, Sample()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioVisualWaveform::OverwriteSamplesFromBuffer(SampleBufferPtr samples, int sample_rate, const rational &start, double target_rate, Sample& data, int &start_index, int &samples_length)
|
||||||
|
{
|
||||||
|
start_index = time_to_samples(start, target_rate);
|
||||||
|
samples_length = time_to_samples(static_cast<double>(samples->sample_count()) / static_cast<double>(sample_rate), target_rate);
|
||||||
|
|
||||||
|
int end_index = start_index + samples_length;
|
||||||
|
if (data.size() < end_index) {
|
||||||
|
data.resize(end_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int chunk_size = sample_rate / target_rate;
|
||||||
|
|
||||||
|
for (int i=0; i<samples_length; i+=channels_) {
|
||||||
|
int src_index = (i * chunk_size) / channels_;
|
||||||
|
|
||||||
|
Sample summary = SumSamples(samples,
|
||||||
|
src_index,
|
||||||
|
qMin(chunk_size, samples->sample_count() - src_index));
|
||||||
|
|
||||||
|
memcpy(&data.data()[i + start_index],
|
||||||
|
summary.constData(),
|
||||||
|
summary.size() * sizeof(SamplePerChannel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioVisualWaveform::OverwriteSamplesFromMipmap(const AudioVisualWaveform::Sample &input, double input_sample_rate, int &input_start, int &input_length, const rational &start, double output_rate, AudioVisualWaveform::Sample &output_data)
|
||||||
|
{
|
||||||
|
int start_index = time_to_samples(start, output_rate);
|
||||||
|
int samples_length = time_to_samples(static_cast<double>(input_length / channels_) / input_sample_rate, output_rate);
|
||||||
|
|
||||||
|
int end_index = start_index + samples_length;
|
||||||
|
if (output_data.size() < end_index) {
|
||||||
|
output_data.resize(end_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int chunk_size = input_sample_rate / output_rate;
|
||||||
|
|
||||||
|
for (int i=0; i<samples_length; i+=channels_) {
|
||||||
|
Sample summary = ReSumSamples(&input.constData()[input_start + (i*chunk_size)], chunk_size * channels_, channels_);
|
||||||
|
|
||||||
|
memcpy(&output_data.data()[i + start_index],
|
||||||
|
summary.constData(),
|
||||||
|
summary.size() * sizeof(SamplePerChannel));
|
||||||
|
}
|
||||||
|
|
||||||
|
input_start = start_index;
|
||||||
|
input_length = samples_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioVisualWaveform::OverwriteSamples(SampleBufferPtr samples, int sample_rate, const rational &start)
|
void AudioVisualWaveform::OverwriteSamples(SampleBufferPtr samples, int sample_rate, const rational &start)
|
||||||
@@ -40,178 +95,158 @@ void AudioVisualWaveform::OverwriteSamples(SampleBufferPtr samples, int sample_r
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int start_index = time_to_samples(start);
|
// Old less optimized code. Keeping this around as a reference, but the below code is at least
|
||||||
int samples_length = time_to_samples(static_cast<double>(samples->sample_count()) / static_cast<double>(sample_rate));
|
// 10x faster so this shouldn't be used in production.
|
||||||
|
//
|
||||||
|
// int input_start, input_length;
|
||||||
|
// for (auto it=mipmapped_data_.begin(); it!=mipmapped_data_.end(); it++) {
|
||||||
|
// OverwriteSamplesFromBuffer(samples, sample_rate, start, it->first.toDouble(), it->second, input_start, input_length);
|
||||||
|
// }
|
||||||
|
|
||||||
int end_index = start_index + samples_length;
|
// Process the largest mipmap directly for the samples
|
||||||
if (data_.size() < end_index) {
|
auto current_mipmap = mipmapped_data_.rbegin();
|
||||||
data_.resize(end_index);
|
int input_start, input_length;
|
||||||
}
|
OverwriteSamplesFromBuffer(samples, sample_rate, start, current_mipmap->first.toDouble(), current_mipmap->second, input_start, input_length);
|
||||||
|
|
||||||
int chunk_size = sample_rate / kSumSampleRate;
|
while (true) {
|
||||||
|
// For each smaller mipmap, we just process from the mipmap before it, making each one
|
||||||
|
// exponentially faster to create
|
||||||
|
auto previous_mipmap = current_mipmap;
|
||||||
|
current_mipmap++;
|
||||||
|
if (current_mipmap == mipmapped_data_.rend()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0; i<samples_length; i+=channels_) {
|
OverwriteSamplesFromMipmap(previous_mipmap->second, previous_mipmap->first.toDouble(),
|
||||||
int src_index = (i * chunk_size) / channels_;
|
input_start, input_length, start, current_mipmap->first.toDouble(),
|
||||||
|
current_mipmap->second);
|
||||||
QVector<SamplePerChannel> summary = SumSamples(samples,
|
|
||||||
src_index,
|
|
||||||
qMin(chunk_size, samples->sample_count() - src_index));
|
|
||||||
|
|
||||||
memcpy(&data_.data()[i + start_index],
|
|
||||||
summary.constData(),
|
|
||||||
summary.size() * sizeof(SamplePerChannel));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioVisualWaveform::OverwriteSums(const AudioVisualWaveform &sums, const rational &dest, const rational& offset, const rational& length)
|
void AudioVisualWaveform::OverwriteSums(const AudioVisualWaveform &sums, const rational &dest, const rational& offset, const rational& length)
|
||||||
{
|
{
|
||||||
if (sums.data_.isEmpty()) {
|
for (auto it=mipmapped_data_.begin(); it!=mipmapped_data_.end(); it++) {
|
||||||
return;
|
rational rate = it->first;
|
||||||
|
|
||||||
|
Sample& our_arr = it->second;
|
||||||
|
const Sample& their_arr = sums.mipmapped_data_.at(rate);
|
||||||
|
|
||||||
|
double rate_dbl = rate.toDouble();
|
||||||
|
|
||||||
|
// Get our destination sample
|
||||||
|
int our_start_index = time_to_samples(dest, rate_dbl);
|
||||||
|
|
||||||
|
// Get our source sample
|
||||||
|
int their_start_index = time_to_samples(offset, rate_dbl);
|
||||||
|
|
||||||
|
// Determine how much we're copying
|
||||||
|
int copy_len = their_arr.size() - their_start_index;
|
||||||
|
if (!length.isNull()) {
|
||||||
|
copy_len = qMin(copy_len, time_to_samples(length, rate_dbl));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine end index of our array
|
||||||
|
int end_index = our_start_index + copy_len;
|
||||||
|
if (our_arr.size() < end_index) {
|
||||||
|
our_arr.resize(end_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(reinterpret_cast<char*>(our_arr.data()) + our_start_index * sizeof(SamplePerChannel),
|
||||||
|
reinterpret_cast<const char*>(their_arr.constData()) + their_start_index * sizeof(SamplePerChannel),
|
||||||
|
copy_len * sizeof(SamplePerChannel));
|
||||||
}
|
}
|
||||||
|
|
||||||
int start_index = time_to_samples(dest);
|
|
||||||
int sample_start = time_to_samples(offset);
|
|
||||||
|
|
||||||
int copy_len = sums.data_.size() - sample_start;
|
|
||||||
if (!length.isNull()) {
|
|
||||||
copy_len = qMin(copy_len, time_to_samples(length));
|
|
||||||
}
|
|
||||||
|
|
||||||
int end_index = start_index + copy_len;
|
|
||||||
|
|
||||||
if (data_.size() < end_index) {
|
|
||||||
data_.resize(end_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(reinterpret_cast<char*>(data_.data()) + start_index * sizeof(SamplePerChannel),
|
|
||||||
reinterpret_cast<const char*>(sums.data_.constData()) + time_to_samples(offset) * sizeof(SamplePerChannel),
|
|
||||||
copy_len * sizeof(SamplePerChannel));
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioVisualWaveform AudioVisualWaveform::Mid(const rational &time) const
|
|
||||||
{
|
|
||||||
int sample_index = time_to_samples(time);
|
|
||||||
|
|
||||||
// Create a copy of this waveform chop the early section off
|
|
||||||
AudioVisualWaveform copy = *this;
|
|
||||||
copy.data_ = data_.mid(sample_index);
|
|
||||||
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioVisualWaveform::Append(const AudioVisualWaveform &waveform)
|
|
||||||
{
|
|
||||||
data_.append(waveform.data_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioVisualWaveform::TrimIn(const rational &time)
|
|
||||||
{
|
|
||||||
data_ = data_.mid(time_to_samples(time));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioVisualWaveform::TrimOut(const rational &time)
|
|
||||||
{
|
|
||||||
data_.resize(data_.size() - time_to_samples(time));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioVisualWaveform::PrependSilence(const rational &time)
|
|
||||||
{
|
|
||||||
int added_samples = time_to_samples(time);
|
|
||||||
|
|
||||||
// Resize buffer for extra space
|
|
||||||
data_.resize(data_.size() + added_samples);
|
|
||||||
|
|
||||||
// Shift all data forward
|
|
||||||
for (int i=data_.size()-1; i>=added_samples; i--) {
|
|
||||||
data_[i] = data_[i - added_samples];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill remainder with silence
|
|
||||||
memset(reinterpret_cast<char*>(data_.data()), 0, added_samples * sizeof(SamplePerChannel));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioVisualWaveform::AppendSilence(const rational &time)
|
|
||||||
{
|
|
||||||
int added_samples = time_to_samples(time);
|
|
||||||
|
|
||||||
// Resize buffer for extra space
|
|
||||||
int old_size = data_.size();
|
|
||||||
data_.resize(old_size + added_samples);
|
|
||||||
|
|
||||||
// Fill remainder with silence
|
|
||||||
memset(reinterpret_cast<char*>(&data_[old_size]), 0, (data_.size() - old_size) * sizeof(SamplePerChannel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioVisualWaveform::Shift(const rational &from, const rational &to)
|
void AudioVisualWaveform::Shift(const rational &from, const rational &to)
|
||||||
{
|
{
|
||||||
int from_index = time_to_samples(from);
|
for (auto it=mipmapped_data_.begin(); it!=mipmapped_data_.end(); it++) {
|
||||||
int to_index = time_to_samples(to);
|
rational rate = it->first;
|
||||||
|
double rate_dbl = rate.toDouble();
|
||||||
|
Sample& data = it->second;
|
||||||
|
|
||||||
if (from_index == to_index) {
|
int from_index = time_to_samples(from, rate_dbl);
|
||||||
return;
|
int to_index = time_to_samples(to, rate_dbl);
|
||||||
}
|
|
||||||
|
|
||||||
if (from_index > data_.size()) {
|
if (from_index == to_index) {
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (from_index > to_index) {
|
|
||||||
// Shifting backwards <-
|
|
||||||
int copy_sz = data_.size() - from_index;
|
|
||||||
|
|
||||||
for (int i=0; i<copy_sz; i++) {
|
|
||||||
data_.replace(to_index + i, data_.at(from_index + i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data_.resize(data_.size() - (from_index - to_index));
|
if (from_index > data.size()) {
|
||||||
} else {
|
return;
|
||||||
// Shifting forwards ->
|
|
||||||
int old_sz = data_.size();
|
|
||||||
|
|
||||||
int distance = (to_index - from_index);
|
|
||||||
|
|
||||||
data_.resize(data_.size() + distance);
|
|
||||||
|
|
||||||
int copy_sz = old_sz - from_index;
|
|
||||||
|
|
||||||
for (int i=0; i<copy_sz; i++) {
|
|
||||||
data_.replace(data_.size() - i - 1, data_.at(old_sz - i - 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(reinterpret_cast<char*>(&data_[from_index]), 0, distance * sizeof(SamplePerChannel));
|
if (from_index > to_index) {
|
||||||
|
// Shifting backwards <-
|
||||||
|
int copy_sz = data.size() - from_index;
|
||||||
|
|
||||||
|
for (int i=0; i<copy_sz; i++) {
|
||||||
|
data.replace(to_index + i, data.at(from_index + i));
|
||||||
|
}
|
||||||
|
|
||||||
|
data.resize(data.size() - (from_index - to_index));
|
||||||
|
} else {
|
||||||
|
// Shifting forwards ->
|
||||||
|
int old_sz = data.size();
|
||||||
|
|
||||||
|
int distance = (to_index - from_index);
|
||||||
|
|
||||||
|
data.resize(data.size() + distance);
|
||||||
|
|
||||||
|
int copy_sz = old_sz - from_index;
|
||||||
|
|
||||||
|
for (int i=0; i<copy_sz; i++) {
|
||||||
|
data.replace(data.size() - i - 1, data.at(old_sz - i - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(reinterpret_cast<char*>(&data[from_index]), 0, distance * sizeof(SamplePerChannel));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> AudioVisualWaveform::SumSamples(const float *samples, int nb_samples, int nb_channels)
|
AudioVisualWaveform::Sample AudioVisualWaveform::GetSummaryFromTime(const rational &start, const rational &length) const
|
||||||
{
|
{
|
||||||
return SumSamplesInternal<float>(samples, nb_samples, nb_channels);
|
// Find mipmap that requries
|
||||||
|
auto using_mipmap = GetMipmapForScale(length.flipped().toDouble());
|
||||||
|
|
||||||
|
double rate_dbl = using_mipmap->first.toDouble();
|
||||||
|
|
||||||
|
int start_sample = time_to_samples(start, rate_dbl);
|
||||||
|
int sample_length = time_to_samples(length, rate_dbl);
|
||||||
|
|
||||||
|
return ReSumSamples(&using_mipmap->second.constData()[start_sample], sample_length, channels_);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> AudioVisualWaveform::SumSamples(const qfloat16 *samples, int nb_samples, int nb_channels)
|
AudioVisualWaveform::Sample AudioVisualWaveform::SumSamples(const float *samples, int nb_samples, int nb_channels)
|
||||||
{
|
{
|
||||||
return SumSamplesInternal<qfloat16>(samples, nb_samples, nb_channels);
|
AudioVisualWaveform::Sample summed_samples(nb_channels);
|
||||||
|
|
||||||
|
for (int i=0;i<nb_samples;i++) {
|
||||||
|
ExpandMinMax(summed_samples[i%nb_channels], samples[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return summed_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> AudioVisualWaveform::SumSamples(SampleBufferPtr samples, int start_index, int length)
|
AudioVisualWaveform::Sample AudioVisualWaveform::SumSamples(SampleBufferPtr samples, int start_index, int length)
|
||||||
{
|
{
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> summed_samples(samples->audio_params().channel_count());
|
AudioVisualWaveform::Sample summed_samples(samples->audio_params().channel_count());
|
||||||
|
|
||||||
int end_index = start_index + length;
|
int end_index = start_index + length;
|
||||||
|
|
||||||
for (int i=start_index; i<end_index; i++) {
|
for (int i=start_index; i<end_index; i++) {
|
||||||
for (int channel=0; channel<samples->audio_params().channel_count(); channel++) {
|
for (int channel=0; channel<samples->audio_params().channel_count(); channel++) {
|
||||||
ExpandMinMax<float>(summed_samples[channel], samples->data(channel)[i]);
|
ExpandMinMax(summed_samples[channel], samples->data(channel)[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return summed_samples;
|
return summed_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> AudioVisualWaveform::ReSumSamples(const SamplePerChannel* samples,
|
AudioVisualWaveform::Sample AudioVisualWaveform::ReSumSamples(const SamplePerChannel* samples,
|
||||||
int nb_samples,
|
int nb_samples,
|
||||||
int nb_channels)
|
int nb_channels)
|
||||||
{
|
{
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> summed_samples(nb_channels);
|
AudioVisualWaveform::Sample summed_samples(nb_channels);
|
||||||
|
|
||||||
for (int i=0;i<nb_samples;i+=nb_channels) {
|
for (int i=0;i<nb_samples;i+=nb_channels) {
|
||||||
for (int j=0;j<nb_channels;j++) {
|
for (int j=0;j<nb_channels;j++) {
|
||||||
@@ -230,16 +265,20 @@ QVector<AudioVisualWaveform::SamplePerChannel> AudioVisualWaveform::ReSumSamples
|
|||||||
return summed_samples;
|
return summed_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioVisualWaveform::DrawSample(QPainter *painter, const QVector<SamplePerChannel>& sample, int x, int y, int height)
|
void AudioVisualWaveform::DrawSample(QPainter *painter, const Sample& sample, int x, int y, int height, bool rectified)
|
||||||
{
|
{
|
||||||
|
if (sample.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int channel_height = height / sample.size();
|
int channel_height = height / sample.size();
|
||||||
int channel_half_height = channel_height / 2;
|
int channel_half_height = channel_height / 2;
|
||||||
|
|
||||||
for (int i=0;i<sample.size();i++) {
|
for (int i=0;i<sample.size();i++) {
|
||||||
qfloat16 max = qMin(sample.at(i).max, static_cast<qfloat16>(1.0f));
|
float max = qMin(sample.at(i).max, 1.0f);
|
||||||
qfloat16 min = qMax(sample.at(i).min, static_cast<qfloat16>(-1.0));
|
float min = qMax(sample.at(i).min, -1.0f);
|
||||||
|
|
||||||
if (Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool()) {
|
if (rectified) {
|
||||||
int channel_bottom = y + channel_height * (i + 1);
|
int channel_bottom = y + channel_height * (i + 1);
|
||||||
|
|
||||||
int diff = qRound((max - min) * channel_half_height);
|
int diff = qRound((max - min) * channel_half_height);
|
||||||
@@ -261,16 +300,26 @@ void AudioVisualWaveform::DrawSample(QPainter *painter, const QVector<SamplePerC
|
|||||||
|
|
||||||
void AudioVisualWaveform::DrawWaveform(QPainter *painter, const QRect& rect, const double& scale, const AudioVisualWaveform &samples, const rational& start_time)
|
void AudioVisualWaveform::DrawWaveform(QPainter *painter, const QRect& rect, const double& scale, const AudioVisualWaveform &samples, const rational& start_time)
|
||||||
{
|
{
|
||||||
int start_sample_index = samples.time_to_samples(start_time);
|
if (samples.mipmapped_data_.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (start_sample_index >= samples.nb_samples()) {
|
auto using_mipmap = samples.GetMipmapForScale(scale);
|
||||||
|
|
||||||
|
rational rate = using_mipmap->first;
|
||||||
|
double rate_dbl = rate.toDouble();
|
||||||
|
const Sample& arr = using_mipmap->second;
|
||||||
|
|
||||||
|
int start_sample_index = samples.time_to_samples(start_time, rate_dbl);
|
||||||
|
|
||||||
|
if (start_sample_index >= arr.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int next_sample_index = start_sample_index;
|
int next_sample_index = start_sample_index;
|
||||||
int sample_index;
|
int sample_index;
|
||||||
|
|
||||||
QVector<SamplePerChannel> summary;
|
Sample summary;
|
||||||
int summary_index = -1;
|
int summary_index = -1;
|
||||||
|
|
||||||
const QRect& viewport = painter->viewport();
|
const QRect& viewport = painter->viewport();
|
||||||
@@ -279,51 +328,54 @@ void AudioVisualWaveform::DrawWaveform(QPainter *painter, const QRect& rect, con
|
|||||||
int start = qMax(rect.x(), -top_left.x());
|
int start = qMax(rect.x(), -top_left.x());
|
||||||
int end = qMin(rect.right(), -top_left.x() + viewport.width());
|
int end = qMin(rect.right(), -top_left.x() + viewport.width());
|
||||||
|
|
||||||
|
bool rectified = Config::Current()[QStringLiteral("RectifiedWaveforms")].toBool();
|
||||||
|
|
||||||
for (int i=start;i<end;i++) {
|
for (int i=start;i<end;i++) {
|
||||||
sample_index = next_sample_index;
|
sample_index = next_sample_index;
|
||||||
|
|
||||||
if (sample_index == samples.nb_samples()) {
|
if (sample_index == arr.size()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_sample_index = qMin(samples.nb_samples(),
|
next_sample_index = qMin(arr.size(),
|
||||||
start_sample_index + qFloor(static_cast<double>(kSumSampleRate) * static_cast<double>(i - rect.x() + 1) / scale) * samples.channel_count());
|
start_sample_index + qFloor(rate_dbl * static_cast<double>(i - rect.x() + 1) / scale) * samples.channel_count());
|
||||||
|
|
||||||
if (summary_index != sample_index) {
|
if (summary_index != sample_index) {
|
||||||
summary = AudioVisualWaveform::ReSumSamples(&samples.data_.at(sample_index),
|
summary = AudioVisualWaveform::ReSumSamples(&arr.at(sample_index),
|
||||||
qMax(samples.channel_count(), next_sample_index - sample_index),
|
qMax(samples.channel_count(), next_sample_index - sample_index),
|
||||||
samples.channel_count());
|
samples.channel_count());
|
||||||
summary_index = sample_index;
|
summary_index = sample_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawSample(painter, summary, i, rect.y(), rect.height());
|
DrawSample(painter, summary, i, rect.y(), rect.height(), rectified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioVisualWaveform::time_to_samples(const rational &time) const
|
int AudioVisualWaveform::time_to_samples(const rational &time, double sample_rate) const
|
||||||
{
|
{
|
||||||
return time_to_samples(time.toDouble());
|
return time_to_samples(time.toDouble(), sample_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioVisualWaveform::time_to_samples(const double &time) const
|
int AudioVisualWaveform::time_to_samples(const double &time, double sample_rate) const
|
||||||
{
|
{
|
||||||
return qFloor(time * kSumSampleRate) * channels_;
|
return qFloor(time * sample_rate) * channels_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
std::map<rational, AudioVisualWaveform::Sample>::const_iterator AudioVisualWaveform::GetMipmapForScale(double scale) const
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> AudioVisualWaveform::SumSamplesInternal(const T *samples, int nb_samples, int nb_channels)
|
|
||||||
{
|
{
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> summed_samples(nb_channels);
|
// Find largest mipmap for this scale (or the largest if we don't find one sufficient)
|
||||||
|
auto using_mipmap = mipmapped_data_.cend();
|
||||||
for (int i=0;i<nb_samples;i++) {
|
using_mipmap--;
|
||||||
ExpandMinMax<T>(summed_samples[i%nb_channels], samples[i]);
|
for (auto it=mipmapped_data_.cbegin(); it!=mipmapped_data_.cend(); it++) {
|
||||||
|
if (it->first.toDouble() >= scale) {
|
||||||
|
using_mipmap = it;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return using_mipmap;
|
||||||
return summed_samples;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
void AudioVisualWaveform::ExpandMinMax(AudioVisualWaveform::SamplePerChannel &sum, float value)
|
||||||
void AudioVisualWaveform::ExpandMinMax(AudioVisualWaveform::SamplePerChannel &sum, T value)
|
|
||||||
{
|
{
|
||||||
if (value < sum.min) {
|
if (value < sum.min) {
|
||||||
sum.min = value;
|
sum.min = value;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#ifndef SUMSAMPLES_H
|
#ifndef SUMSAMPLES_H
|
||||||
#define SUMSAMPLES_H
|
#define SUMSAMPLES_H
|
||||||
|
|
||||||
#include <QFloat16>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
@@ -37,11 +36,11 @@ namespace olive {
|
|||||||
*/
|
*/
|
||||||
class AudioVisualWaveform {
|
class AudioVisualWaveform {
|
||||||
public:
|
public:
|
||||||
AudioVisualWaveform() = default;
|
AudioVisualWaveform();
|
||||||
|
|
||||||
struct SamplePerChannel {
|
struct SamplePerChannel {
|
||||||
qfloat16 min;
|
float min;
|
||||||
qfloat16 max;
|
float max;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Sample = QVector<SamplePerChannel>;
|
using Sample = QVector<SamplePerChannel>;
|
||||||
@@ -56,18 +55,11 @@ public:
|
|||||||
channels_ = channels;
|
channels_ = channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nb_samples() const
|
/**
|
||||||
{
|
* @brief Writes samples into the visual waveform buffer
|
||||||
return data_.size();
|
*
|
||||||
}
|
* Starting at `start`, writes samples over anything in the buffer, expanding it if necessary.
|
||||||
|
*/
|
||||||
const SamplePerChannel* const_data() const
|
|
||||||
{
|
|
||||||
return data_.constData();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddSum(const float* samples, int nb_samples, int nb_channels);
|
|
||||||
|
|
||||||
void OverwriteSamples(SampleBufferPtr samples, int sample_rate, const rational& start = rational());
|
void OverwriteSamples(SampleBufferPtr samples, int sample_rate, const rational& start = rational());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,40 +83,34 @@ public:
|
|||||||
*/
|
*/
|
||||||
void OverwriteSums(const AudioVisualWaveform& sums, const rational& dest, const rational& offset = rational(), const rational &length = rational());
|
void OverwriteSums(const AudioVisualWaveform& sums, const rational& dest, const rational& offset = rational(), const rational &length = rational());
|
||||||
|
|
||||||
AudioVisualWaveform Mid(const rational& time) const;
|
|
||||||
void Append(const AudioVisualWaveform& waveform);
|
|
||||||
void TrimIn(const rational& time);
|
|
||||||
void TrimOut(const rational& time);
|
|
||||||
void PrependSilence(const rational& time);
|
|
||||||
void AppendSilence(const rational& time);
|
|
||||||
void Shift(const rational& from, const rational& to);
|
void Shift(const rational& from, const rational& to);
|
||||||
|
|
||||||
// FIXME: Move to dynamic
|
Sample GetSummaryFromTime(const rational& start, const rational& length) const;
|
||||||
static const int kSumSampleRate;
|
|
||||||
|
|
||||||
static QVector<SamplePerChannel> SumSamples(const float* samples, int nb_samples, int nb_channels);
|
static Sample SumSamples(const float* samples, int nb_samples, int nb_channels);
|
||||||
static QVector<SamplePerChannel> SumSamples(const qfloat16* samples, int nb_samples, int nb_channels);
|
static Sample SumSamples(SampleBufferPtr samples, int start_index, int length);
|
||||||
static QVector<SamplePerChannel> SumSamples(SampleBufferPtr samples, int start_index, int length);
|
|
||||||
|
|
||||||
static QVector<SamplePerChannel> ReSumSamples(const SamplePerChannel *samples, int nb_samples, int nb_channels);
|
static Sample ReSumSamples(const SamplePerChannel *samples, int nb_samples, int nb_channels);
|
||||||
|
|
||||||
static void DrawSample(QPainter* painter, const QVector<SamplePerChannel> &sample, int x, int y, int height);
|
static void DrawSample(QPainter* painter, const Sample &sample, int x, int y, int height, bool rectified);
|
||||||
|
|
||||||
static void DrawWaveform(QPainter* painter, const QRect &rect, const double &scale, const AudioVisualWaveform& samples, const rational &start_time);
|
static void DrawWaveform(QPainter* painter, const QRect &rect, const double &scale, const AudioVisualWaveform& samples, const rational &start_time);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
static void ExpandMinMax(SamplePerChannel &sum, float value);
|
||||||
static QVector<SamplePerChannel> SumSamplesInternal(const T* samples, int nb_samples, int nb_channels);
|
|
||||||
|
|
||||||
template <typename T>
|
void OverwriteSamplesFromBuffer(SampleBufferPtr samples, int sample_rate, const rational& start, double target_rate, Sample &data, int &start_index, int &samples_length);
|
||||||
static void ExpandMinMax(SamplePerChannel &sum, T value);
|
|
||||||
|
|
||||||
int time_to_samples(const rational& time) const;
|
void OverwriteSamplesFromMipmap(const Sample& input, double input_sample_rate, int &input_start, int &input_length, const rational& start, double output_rate, Sample &output_data);
|
||||||
int time_to_samples(const double& time) const;
|
|
||||||
|
|
||||||
int channels_ = 0;
|
int time_to_samples(const rational& time, double sample_rate) const;
|
||||||
|
int time_to_samples(const double& time, double sample_rate) const;
|
||||||
|
|
||||||
QVector<SamplePerChannel> data_;
|
std::map<rational, Sample>::const_iterator GetMipmapForScale(double scale) const;
|
||||||
|
|
||||||
|
int channels_;
|
||||||
|
|
||||||
|
std::map<rational, Sample> mipmapped_data_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -396,9 +396,6 @@ void Core::CreateNewSequence()
|
|||||||
// Create new sequence
|
// Create new sequence
|
||||||
Sequence* new_sequence = CreateNewSequenceForProject(active_project);
|
Sequence* new_sequence = CreateNewSequenceForProject(active_project);
|
||||||
|
|
||||||
// Set all defaults for the sequence
|
|
||||||
new_sequence->set_default_parameters();
|
|
||||||
|
|
||||||
SequenceDialog sd(new_sequence, SequenceDialog::kNew, main_window_);
|
SequenceDialog sd(new_sequence, SequenceDialog::kNew, main_window_);
|
||||||
|
|
||||||
// Make sure SequenceDialog doesn't make an undo command for editing the sequence, since we make an undo command for
|
// Make sure SequenceDialog doesn't make an undo command for editing the sequence, since we make an undo command for
|
||||||
@@ -1091,6 +1088,11 @@ void Core::OpenRecoveryProject(const QString &filename)
|
|||||||
OpenProjectInternal(filename, true);
|
OpenProjectInternal(filename, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core::OpenNodeInViewer(ViewerOutput *viewer)
|
||||||
|
{
|
||||||
|
main_window_->OpenNodeInViewer(viewer);
|
||||||
|
}
|
||||||
|
|
||||||
void Core::CheckForAutoRecoveries()
|
void Core::CheckForAutoRecoveries()
|
||||||
{
|
{
|
||||||
QFile autorecovery_index(GetAutoRecoveryIndexFilename());
|
QFile autorecovery_index(GetAutoRecoveryIndexFilename());
|
||||||
|
|||||||
@@ -300,6 +300,8 @@ public:
|
|||||||
|
|
||||||
void OpenRecoveryProject(const QString& filename);
|
void OpenRecoveryProject(const QString& filename);
|
||||||
|
|
||||||
|
void OpenNodeInViewer(ViewerOutput* viewer);
|
||||||
|
|
||||||
static const uint kProjectVersion;
|
static const uint kProjectVersion;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ PreferencesDiskTab::PreferencesDiskTab()
|
|||||||
cache_behavior_layout->addWidget(new QLabel(tr("Cache Ahead:")), row, 0);
|
cache_behavior_layout->addWidget(new QLabel(tr("Cache Ahead:")), row, 0);
|
||||||
|
|
||||||
cache_ahead_slider_ = new FloatSlider();
|
cache_ahead_slider_ = new FloatSlider();
|
||||||
cache_ahead_slider_->SetFormat(tr("%1 second(s)"));
|
cache_ahead_slider_->SetFormat(tr("%1 seconds"));
|
||||||
cache_ahead_slider_->SetMinimum(0);
|
cache_ahead_slider_->SetMinimum(0);
|
||||||
cache_ahead_slider_->SetValue(Config::Current()["DiskCacheAhead"].value<rational>().toDouble());
|
cache_ahead_slider_->SetValue(Config::Current()["DiskCacheAhead"].value<rational>().toDouble());
|
||||||
cache_behavior_layout->addWidget(cache_ahead_slider_, row, 1);
|
cache_behavior_layout->addWidget(cache_ahead_slider_, row, 1);
|
||||||
@@ -78,7 +78,7 @@ PreferencesDiskTab::PreferencesDiskTab()
|
|||||||
|
|
||||||
cache_behind_slider_ = new FloatSlider();
|
cache_behind_slider_ = new FloatSlider();
|
||||||
cache_behind_slider_->SetMinimum(0);
|
cache_behind_slider_->SetMinimum(0);
|
||||||
cache_behind_slider_->SetFormat(tr("%1 second(s)"));
|
cache_behind_slider_->SetFormat(tr("%1 seconds"));
|
||||||
cache_behind_slider_->SetValue(Config::Current()["DiskCacheBehind"].value<rational>().toDouble());
|
cache_behind_slider_->SetValue(Config::Current()["DiskCacheBehind"].value<rational>().toDouble());
|
||||||
cache_behavior_layout->addWidget(cache_behind_slider_, row, 3);
|
cache_behavior_layout->addWidget(cache_behind_slider_, row, 3);
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ PreferencesGeneralTab::PreferencesGeneralTab()
|
|||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
timeline_layout->addWidget(new QLabel(tr("Auto-Scroll Method:")), row, 0);
|
QLabel* autoscroll_lbl = new QLabel(tr("Auto-Scroll Method:"));
|
||||||
|
autoscroll_lbl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
timeline_layout->addWidget(autoscroll_lbl, row, 0);
|
||||||
|
|
||||||
// ComboBox indices match enum indices
|
// ComboBox indices match enum indices
|
||||||
autoscroll_method_ = new QComboBox();
|
autoscroll_method_ = new QComboBox();
|
||||||
@@ -101,9 +103,17 @@ PreferencesGeneralTab::PreferencesGeneralTab()
|
|||||||
|
|
||||||
default_still_length_ = new FloatSlider();
|
default_still_length_ = new FloatSlider();
|
||||||
default_still_length_->SetMinimum(0.1);
|
default_still_length_->SetMinimum(0.1);
|
||||||
default_still_length_->SetFormat(tr("%1 second(s)"));
|
default_still_length_->SetFormat(tr("%1 seconds"));
|
||||||
default_still_length_->SetValue(Config::Current()["DefaultStillLength"].value<rational>().toDouble());
|
default_still_length_->SetValue(Config::Current()["DefaultStillLength"].value<rational>().toDouble());
|
||||||
timeline_layout->addWidget(default_still_length_);
|
timeline_layout->addWidget(default_still_length_);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
|
||||||
|
timeline_layout->addWidget(new QLabel(tr("Default Sequence Parameters:")), row, 0);
|
||||||
|
|
||||||
|
QPushButton* default_sequence_params_btn = new QPushButton(tr("Edit"));
|
||||||
|
connect(default_sequence_params_btn, &QPushButton::clicked, this, &PreferencesGeneralTab::EditDefaultSequenceSettings);
|
||||||
|
timeline_layout->addWidget(default_sequence_params_btn, row, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -126,7 +136,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
|
|||||||
autorecovery_interval_ = new IntegerSlider();
|
autorecovery_interval_ = new IntegerSlider();
|
||||||
autorecovery_interval_->SetMinimum(1);
|
autorecovery_interval_->SetMinimum(1);
|
||||||
autorecovery_interval_->SetMaximum(60);
|
autorecovery_interval_->SetMaximum(60);
|
||||||
autorecovery_interval_->SetFormat(tr("%1 minute(s)"));
|
autorecovery_interval_->SetFormat(QT_TRANSLATE_N_NOOP("olive::SliderBase", "%n minute(s)"), true);
|
||||||
autorecovery_interval_->SetValue(Config::Current()[QStringLiteral("AutorecoveryInterval")].toLongLong());
|
autorecovery_interval_->SetValue(Config::Current()[QStringLiteral("AutorecoveryInterval")].toLongLong());
|
||||||
autorecovery_layout->addWidget(autorecovery_interval_, row, 1);
|
autorecovery_layout->addWidget(autorecovery_interval_, row, 1);
|
||||||
|
|
||||||
@@ -176,6 +186,17 @@ void PreferencesGeneralTab::Accept(MultiUndoCommand *command)
|
|||||||
Config::Current()[QStringLiteral("AutorecoveryInterval")] = QVariant::fromValue(autorecovery_interval_->GetValue());
|
Config::Current()[QStringLiteral("AutorecoveryInterval")] = QVariant::fromValue(autorecovery_interval_->GetValue());
|
||||||
Config::Current()[QStringLiteral("AutorecoveryMaximum")] = QVariant::fromValue(autorecovery_maximum_->GetValue());
|
Config::Current()[QStringLiteral("AutorecoveryMaximum")] = QVariant::fromValue(autorecovery_maximum_->GetValue());
|
||||||
Core::instance()->SetAutorecoveryInterval(autorecovery_interval_->GetValue());
|
Core::instance()->SetAutorecoveryInterval(autorecovery_interval_->GetValue());
|
||||||
|
|
||||||
|
// Default sequence parameters
|
||||||
|
VideoParams dsvp = default_sequence_.GetVideoParams();
|
||||||
|
AudioParams dsap = default_sequence_.GetAudioParams();
|
||||||
|
Config::Current()[QStringLiteral("DefaultSequenceWidth")] = dsvp.width();
|
||||||
|
Config::Current()[QStringLiteral("DefaultSequenceHeight")] = dsvp.height();
|
||||||
|
Config::Current()[QStringLiteral("DefaultSequencePixelAspect")] = QVariant::fromValue(dsvp.pixel_aspect_ratio());
|
||||||
|
Config::Current()[QStringLiteral("DefaultSequenceFrameRate")] = QVariant::fromValue(dsvp.frame_rate().flipped());
|
||||||
|
Config::Current()[QStringLiteral("DefaultSequenceInterlacing")] = dsvp.interlacing();
|
||||||
|
Config::Current()[QStringLiteral("DefaultSequenceAudioFrequency")] = dsap.sample_rate();
|
||||||
|
Config::Current()[QStringLiteral("DefaultSequenceAudioLayout")] = QVariant::fromValue(dsap.channel_layout());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesGeneralTab::AddLanguage(const QString &locale_name)
|
void PreferencesGeneralTab::AddLanguage(const QString &locale_name)
|
||||||
@@ -185,4 +206,11 @@ void PreferencesGeneralTab::AddLanguage(const QString &locale_name)
|
|||||||
language_combobox_->setItemData(language_combobox_->count() - 1, locale_name);
|
language_combobox_->setItemData(language_combobox_->count() - 1, locale_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesGeneralTab::EditDefaultSequenceSettings()
|
||||||
|
{
|
||||||
|
SequenceDialog sd(&default_sequence_, SequenceDialog::kExisting, this);
|
||||||
|
sd.SetNameIsEditable(false);
|
||||||
|
sd.exec();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ private:
|
|||||||
|
|
||||||
IntegerSlider* autorecovery_maximum_;
|
IntegerSlider* autorecovery_maximum_;
|
||||||
|
|
||||||
|
Sequence default_sequence_;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void EditDefaultSequenceSettings();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include "colormanager.h"
|
#include "colormanager.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFloat16>
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include "common/define.h"
|
#include "common/define.h"
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ void NodeGraph::childEvent(QChildEvent *event)
|
|||||||
connect(node, &Node::ValueChanged, this, &NodeGraph::ValueChanged);
|
connect(node, &Node::ValueChanged, this, &NodeGraph::ValueChanged);
|
||||||
|
|
||||||
emit NodeAdded(node);
|
emit NodeAdded(node);
|
||||||
|
emit node->AddedToGraph(this);
|
||||||
|
|
||||||
} else if (event->type() == QEvent::ChildRemoved) {
|
} else if (event->type() == QEvent::ChildRemoved) {
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ void NodeGraph::childEvent(QChildEvent *event)
|
|||||||
disconnect(node, &Node::ValueChanged, this, &NodeGraph::ValueChanged);
|
disconnect(node, &Node::ValueChanged, this, &NodeGraph::ValueChanged);
|
||||||
|
|
||||||
emit NodeRemoved(node);
|
emit NodeRemoved(node);
|
||||||
|
emit node->RemovedFromGraph(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -1245,7 +1245,7 @@ bool Node::AreLinked(Node *a, Node *b)
|
|||||||
return a->links_.contains(b);
|
return a->links_.contains(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::AddInput(const QString &id, NodeValue::Type type, const QVariant &default_value, Node::InputFlags flags)
|
void Node::InsertInput(const QString &id, NodeValue::Type type, const QVariant &default_value, Node::InputFlags flags, int index)
|
||||||
{
|
{
|
||||||
if (id.isEmpty()) {
|
if (id.isEmpty()) {
|
||||||
qWarning() << "Rejected adding input with an empty ID on node" << this->id();
|
qWarning() << "Rejected adding input with an empty ID on node" << this->id();
|
||||||
@@ -1264,8 +1264,8 @@ void Node::AddInput(const QString &id, NodeValue::Type type, const QVariant &def
|
|||||||
i.flags = flags;
|
i.flags = flags;
|
||||||
i.array_size = 0;
|
i.array_size = 0;
|
||||||
|
|
||||||
input_ids_.append(id);
|
input_ids_.insert(index, id);
|
||||||
input_data_.append(i);
|
input_data_.insert(index, i);
|
||||||
|
|
||||||
if (!standard_immediates_.value(id, nullptr)) {
|
if (!standard_immediates_.value(id, nullptr)) {
|
||||||
standard_immediates_.insert(id, CreateImmediate(id));
|
standard_immediates_.insert(id, CreateImmediate(id));
|
||||||
@@ -2294,7 +2294,7 @@ void NodeSetPositionAndShiftSurroundingsCommand::redo()
|
|||||||
|
|
||||||
// Start moving other nodes
|
// Start moving other nodes
|
||||||
foreach (Node* surrounding, node_->parent()->nodes()) {
|
foreach (Node* surrounding, node_->parent()->nodes()) {
|
||||||
if (bounding_rect.contains(surrounding->GetPosition()) && surrounding != node_) {
|
if (bounding_rect.contains(surrounding->GetPosition()) && surrounding != node_ && surrounding != ignore_node_) {
|
||||||
QPointF new_pos = surrounding->GetPosition();
|
QPointF new_pos = surrounding->GetPosition();
|
||||||
|
|
||||||
qreal move_rate = 0.50;
|
qreal move_rate = 0.50;
|
||||||
@@ -2306,6 +2306,7 @@ void NodeSetPositionAndShiftSurroundingsCommand::redo()
|
|||||||
new_pos.setY(new_pos.y() + move_rate);
|
new_pos.setY(new_pos.y() + move_rate);
|
||||||
|
|
||||||
auto sur_command = new NodeSetPositionAndShiftSurroundingsCommand(surrounding, new_pos, true);
|
auto sur_command = new NodeSetPositionAndShiftSurroundingsCommand(surrounding, new_pos, true);
|
||||||
|
sur_command->SetIgnoreNode(node_);
|
||||||
sur_command->redo();
|
sur_command->redo();
|
||||||
commands_.append(sur_command);
|
commands_.append(sur_command);
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-2
@@ -799,7 +799,23 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal));
|
void InsertInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags, int index);
|
||||||
|
|
||||||
|
void PrependInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal))
|
||||||
|
{
|
||||||
|
InsertInput(id, type, default_value, flags, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrependInput(const QString& id, NodeValue::Type type, InputFlags flags = InputFlags(kInputFlagNormal))
|
||||||
|
{
|
||||||
|
PrependInput(id, type, QVariant(), flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal))
|
||||||
|
{
|
||||||
|
InsertInput(id, type, default_value, flags, input_ids_.size());
|
||||||
|
}
|
||||||
|
|
||||||
void AddInput(const QString& id, NodeValue::Type type, InputFlags flags = InputFlags(kInputFlagNormal))
|
void AddInput(const QString& id, NodeValue::Type type, InputFlags flags = InputFlags(kInputFlagNormal))
|
||||||
{
|
{
|
||||||
AddInput(id, type, QVariant(), flags);
|
AddInput(id, type, QVariant(), flags);
|
||||||
@@ -926,6 +942,10 @@ signals:
|
|||||||
|
|
||||||
void InputDataTypeChanged(const QString& id, NodeValue::Type type);
|
void InputDataTypeChanged(const QString& id, NodeValue::Type type);
|
||||||
|
|
||||||
|
void AddedToGraph(NodeGraph* graph);
|
||||||
|
|
||||||
|
void RemovedFromGraph(NodeGraph* graph);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class ArrayInsertCommand : public UndoCommand
|
class ArrayInsertCommand : public UndoCommand
|
||||||
{
|
{
|
||||||
@@ -1331,7 +1351,8 @@ public:
|
|||||||
NodeSetPositionAndShiftSurroundingsCommand(Node* node, const QPointF& pos, bool move_dependencies_relatively) :
|
NodeSetPositionAndShiftSurroundingsCommand(Node* node, const QPointF& pos, bool move_dependencies_relatively) :
|
||||||
node_(node),
|
node_(node),
|
||||||
position_(pos),
|
position_(pos),
|
||||||
move_dependencies_(move_dependencies_relatively)
|
move_dependencies_(move_dependencies_relatively),
|
||||||
|
ignore_node_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~NodeSetPositionAndShiftSurroundingsCommand() override
|
virtual ~NodeSetPositionAndShiftSurroundingsCommand() override
|
||||||
@@ -1353,6 +1374,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetIgnoreNode(Node* n)
|
||||||
|
{
|
||||||
|
ignore_node_ = n;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Node* node_;
|
Node* node_;
|
||||||
|
|
||||||
@@ -1362,6 +1388,8 @@ private:
|
|||||||
|
|
||||||
QVector<UndoCommand*> commands_;
|
QVector<UndoCommand*> commands_;
|
||||||
|
|
||||||
|
Node* ignore_node_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NodeSetPositionAsChildCommand : public UndoCommand
|
class NodeSetPositionAsChildCommand : public UndoCommand
|
||||||
|
|||||||
@@ -160,13 +160,15 @@ public:
|
|||||||
|
|
||||||
static Type TypeFromString(const QString& s)
|
static Type TypeFromString(const QString& s)
|
||||||
{
|
{
|
||||||
if (s.at(1) == ':') {
|
if (s.size() >= 3) {
|
||||||
if (s.at(0) == 'v') {
|
if (s.at(1) == ':') {
|
||||||
// Video stream
|
if (s.at(0) == 'v') {
|
||||||
return Track::kVideo;
|
// Video stream
|
||||||
} else if (s.at(0) == 'a') {
|
return Track::kVideo;
|
||||||
// Audio stream
|
} else if (s.at(0) == 'a') {
|
||||||
return Track::kAudio;
|
// Audio stream
|
||||||
|
return Track::kAudio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ const uint64_t ViewerOutput::kVideoParamEditMask = VideoParamEdit::kWidthHeight
|
|||||||
ViewerOutput::ViewerOutput(bool create_default_streams) :
|
ViewerOutput::ViewerOutput(bool create_default_streams) :
|
||||||
video_frame_cache_(this),
|
video_frame_cache_(this),
|
||||||
audio_playback_cache_(this),
|
audio_playback_cache_(this),
|
||||||
cache_enabled_(true)
|
video_cache_enabled_(true),
|
||||||
|
audio_cache_enabled_(true)
|
||||||
{
|
{
|
||||||
AddInput(kVideoParamsInput, NodeValue::kVideoParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable | kInputFlagArray));
|
AddInput(kVideoParamsInput, NodeValue::kVideoParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable | kInputFlagArray));
|
||||||
SetInputProperty(kVideoParamsInput, QStringLiteral("mask"), QVariant::fromValue(kVideoParamEditMask));
|
SetInputProperty(kVideoParamsInput, QStringLiteral("mask"), QVariant::fromValue(kVideoParamEditMask));
|
||||||
@@ -54,6 +55,7 @@ ViewerOutput::ViewerOutput(bool create_default_streams) :
|
|||||||
if (create_default_streams) {
|
if (create_default_streams) {
|
||||||
AddStream(Track::kVideo, QVariant());
|
AddStream(Track::kVideo, QVariant());
|
||||||
AddStream(Track::kAudio, QVariant());
|
AddStream(Track::kAudio, QVariant());
|
||||||
|
set_default_parameters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +198,7 @@ void ViewerOutput::set_default_parameters()
|
|||||||
|
|
||||||
void ViewerOutput::ShiftVideoCache(const rational &from, const rational &to)
|
void ViewerOutput::ShiftVideoCache(const rational &from, const rational &to)
|
||||||
{
|
{
|
||||||
if (cache_enabled_) {
|
if (video_cache_enabled_) {
|
||||||
video_frame_cache_.Shift(from, to);
|
video_frame_cache_.Shift(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +207,7 @@ void ViewerOutput::ShiftVideoCache(const rational &from, const rational &to)
|
|||||||
|
|
||||||
void ViewerOutput::ShiftAudioCache(const rational &from, const rational &to)
|
void ViewerOutput::ShiftAudioCache(const rational &from, const rational &to)
|
||||||
{
|
{
|
||||||
if (cache_enabled_) {
|
if (audio_cache_enabled_) {
|
||||||
audio_playback_cache_.Shift(from, to);
|
audio_playback_cache_.Shift(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,18 +224,16 @@ void ViewerOutput::InvalidateCache(const TimeRange& range, const QString& from,
|
|||||||
{
|
{
|
||||||
Q_UNUSED(element)
|
Q_UNUSED(element)
|
||||||
|
|
||||||
if (cache_enabled_) {
|
if ((video_cache_enabled_ && (from == kTextureInput || from == kVideoParamsInput))
|
||||||
if (from == kTextureInput || from == kSamplesInput
|
|| (audio_cache_enabled_ && (from == kSamplesInput || from == kAudioParamsInput))) {
|
||||||
|| from == kVideoParamsInput || from == kAudioParamsInput) {
|
TimeRange invalidated_range(qMax(rational(), range.in()),
|
||||||
TimeRange invalidated_range(qMax(rational(), range.in()),
|
qMin(GetLength(), range.out()));
|
||||||
qMin(GetLength(), range.out()));
|
|
||||||
|
|
||||||
if (invalidated_range.in() != invalidated_range.out()) {
|
if (invalidated_range.in() != invalidated_range.out()) {
|
||||||
if (from == kTextureInput || from == kVideoParamsInput) {
|
if (from == kTextureInput || from == kVideoParamsInput) {
|
||||||
video_frame_cache_.Invalidate(invalidated_range, job_time);
|
video_frame_cache_.Invalidate(invalidated_range, job_time);
|
||||||
} else {
|
} else {
|
||||||
audio_playback_cache_.Invalidate(invalidated_range, job_time);
|
audio_playback_cache_.Invalidate(invalidated_range, job_time);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,11 +257,6 @@ QVector<QString> ViewerOutput::inputs_for_output(const QString &output) const
|
|||||||
return inputs;
|
return inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rational& ViewerOutput::GetLength() const
|
|
||||||
{
|
|
||||||
return last_length_;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<Track::Reference> ViewerOutput::GetEnabledStreamsAsReferences() const
|
QVector<Track::Reference> ViewerOutput::GetEnabledStreamsAsReferences() const
|
||||||
{
|
{
|
||||||
QVector<Track::Reference> refs;
|
QVector<Track::Reference> refs;
|
||||||
@@ -302,41 +297,21 @@ void ViewerOutput::Retranslate()
|
|||||||
|
|
||||||
void ViewerOutput::VerifyLength()
|
void ViewerOutput::VerifyLength()
|
||||||
{
|
{
|
||||||
NodeTraverser traverser;
|
rational subtitle_length;
|
||||||
|
|
||||||
rational video_length, audio_length, subtitle_length;
|
video_length_ = VerifyLengthInternal(Track::kVideo);
|
||||||
|
if (video_cache_enabled_) {
|
||||||
{
|
video_frame_cache_.SetLength(video_length_);
|
||||||
video_length = GetCustomLength(Track::kVideo);
|
|
||||||
|
|
||||||
if (video_length.isNull() && IsInputConnected(kTextureInput)) {
|
|
||||||
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kTextureInput), TimeRange(0, 0));
|
|
||||||
video_length = t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cache_enabled_) {
|
|
||||||
video_frame_cache_.SetLength(video_length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
audio_length_ = VerifyLengthInternal(Track::kAudio);
|
||||||
audio_length = GetCustomLength(Track::kAudio);
|
if (audio_cache_enabled_) {
|
||||||
|
audio_playback_cache_.SetLength(audio_length_);
|
||||||
if (audio_length.isNull() && IsInputConnected(kSamplesInput)) {
|
|
||||||
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kSamplesInput), TimeRange(0, 0));
|
|
||||||
audio_length = t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cache_enabled_) {
|
|
||||||
audio_playback_cache_.SetLength(audio_length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
subtitle_length = VerifyLengthInternal(Track::kSubtitle);
|
||||||
subtitle_length = GetCustomLength(Track::kSubtitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
rational real_length = qMax(subtitle_length, qMax(video_length, audio_length));
|
rational real_length = qMax(subtitle_length, qMax(video_length_, audio_length_));
|
||||||
|
|
||||||
if (real_length != last_length_) {
|
if (real_length != last_length_) {
|
||||||
last_length_ = real_length;
|
last_length_ = real_length;
|
||||||
@@ -362,9 +337,30 @@ void ViewerOutput::InputDisconnectedEvent(const QString &input, int element, con
|
|||||||
super::InputDisconnectedEvent(input, element, output);
|
super::InputDisconnectedEvent(input, element, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
rational ViewerOutput::GetCustomLength(Track::Type type) const
|
rational ViewerOutput::VerifyLengthInternal(Track::Type type) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(type)
|
NodeTraverser traverser;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case Track::kVideo:
|
||||||
|
if (IsInputConnected(kTextureInput)) {
|
||||||
|
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kTextureInput), TimeRange(0, 0));
|
||||||
|
qDebug() << "Got video length:" << t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();
|
||||||
|
return t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Track::kAudio:
|
||||||
|
if (IsInputConnected(kSamplesInput)) {
|
||||||
|
NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kSamplesInput), TimeRange(0, 0));
|
||||||
|
return t.Get(NodeValue::kRational, QStringLiteral("length")).value<rational>();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Track::kNone:
|
||||||
|
case Track::kSubtitle:
|
||||||
|
case Track::kCount:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return rational();
|
return rational();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +399,7 @@ void ViewerOutput::InputValueChangedEvent(const QString &input, int element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (frame_rate_changed) {
|
if (frame_rate_changed) {
|
||||||
if (cache_enabled_) {
|
if (video_cache_enabled_) {
|
||||||
video_frame_cache_.SetTimebase(new_video_params.frame_rate_as_time_base());
|
video_frame_cache_.SetTimebase(new_video_params.frame_rate_as_time_base());
|
||||||
}
|
}
|
||||||
emit FrameRateChanged(new_video_params.frame_rate());
|
emit FrameRateChanged(new_video_params.frame_rate());
|
||||||
@@ -425,7 +421,7 @@ void ViewerOutput::InputValueChangedEvent(const QString &input, int element)
|
|||||||
|
|
||||||
emit AudioParamsChanged();
|
emit AudioParamsChanged();
|
||||||
|
|
||||||
if (cache_enabled_) {
|
if (audio_cache_enabled_) {
|
||||||
audio_playback_cache_.SetParameters(GetAudioParams());
|
audio_playback_cache_.SetParameters(GetAudioParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,11 +525,6 @@ int ViewerOutput::AddStream(Track::Type type, const QVariant& value)
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerOutput::SetViewerCacheEnabled(bool e)
|
|
||||||
{
|
|
||||||
cache_enabled_ = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewerOutput::InputResized(const QString &input, int old_size, int new_size)
|
void ViewerOutput::InputResized(const QString &input, int old_size, int new_size)
|
||||||
{
|
{
|
||||||
if (input == kVideoParamsInput || input == kAudioParamsInput) {
|
if (input == kVideoParamsInput || input == kAudioParamsInput) {
|
||||||
|
|||||||
@@ -72,12 +72,24 @@ public:
|
|||||||
|
|
||||||
VideoParams GetVideoParams(int index = 0) const
|
VideoParams GetVideoParams(int index = 0) const
|
||||||
{
|
{
|
||||||
return GetStandardValue(kVideoParamsInput, index).value<VideoParams>();
|
// This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway),
|
||||||
|
// but it does suppress a warning message that we don't need
|
||||||
|
if (index < InputArraySize(kVideoParamsInput)) {
|
||||||
|
return GetStandardValue(kVideoParamsInput, index).value<VideoParams>();
|
||||||
|
} else {
|
||||||
|
return VideoParams();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioParams GetAudioParams(int index = 0) const
|
AudioParams GetAudioParams(int index = 0) const
|
||||||
{
|
{
|
||||||
return GetStandardValue(kAudioParamsInput, index).value<AudioParams>();
|
// This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway),
|
||||||
|
// but it does suppress a warning message that we don't need
|
||||||
|
if (index < InputArraySize(kAudioParamsInput)) {
|
||||||
|
return GetStandardValue(kAudioParamsInput, index).value<AudioParams>();
|
||||||
|
} else {
|
||||||
|
return AudioParams();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVideoParams(const VideoParams &video, int index = 0)
|
void SetVideoParams(const VideoParams &video, int index = 0)
|
||||||
@@ -111,7 +123,9 @@ public:
|
|||||||
VideoParams GetFirstEnabledVideoStream() const;
|
VideoParams GetFirstEnabledVideoStream() const;
|
||||||
AudioParams GetFirstEnabledAudioStream() const;
|
AudioParams GetFirstEnabledAudioStream() const;
|
||||||
|
|
||||||
const rational &GetLength() const;
|
const rational &GetLength() const { return last_length_; }
|
||||||
|
const rational &GetVideoLength() const { return video_length_; }
|
||||||
|
const rational &GetAudioLength() const { return audio_length_; }
|
||||||
|
|
||||||
FrameHashCache* video_frame_cache()
|
FrameHashCache* video_frame_cache()
|
||||||
{
|
{
|
||||||
@@ -174,7 +188,7 @@ protected:
|
|||||||
|
|
||||||
virtual void InputDisconnectedEvent(const QString &input, int element, const NodeOutput &output) override;
|
virtual void InputDisconnectedEvent(const QString &input, int element, const NodeOutput &output) override;
|
||||||
|
|
||||||
virtual rational GetCustomLength(Track::Type type) const;
|
virtual rational VerifyLengthInternal(Track::Type type) const;
|
||||||
|
|
||||||
virtual void ShiftVideoEvent(const rational &from, const rational &to);
|
virtual void ShiftVideoEvent(const rational &from, const rational &to);
|
||||||
|
|
||||||
@@ -188,10 +202,13 @@ protected:
|
|||||||
|
|
||||||
int AddStream(Track::Type type, const QVariant &value);
|
int AddStream(Track::Type type, const QVariant &value);
|
||||||
|
|
||||||
void SetViewerCacheEnabled(bool e);
|
void SetViewerVideoCacheEnabled(bool e) { video_cache_enabled_ = e; }
|
||||||
|
void SetViewerAudioCacheEnabled(bool e) { audio_cache_enabled_ = e; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rational last_length_;
|
rational last_length_;
|
||||||
|
rational video_length_;
|
||||||
|
rational audio_length_;
|
||||||
|
|
||||||
FrameHashCache video_frame_cache_;
|
FrameHashCache video_frame_cache_;
|
||||||
|
|
||||||
@@ -205,7 +222,8 @@ private:
|
|||||||
|
|
||||||
TimelinePoints timeline_points_;
|
TimelinePoints timeline_points_;
|
||||||
|
|
||||||
bool cache_enabled_;
|
bool video_cache_enabled_;
|
||||||
|
bool audio_cache_enabled_;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void InputResized(const QString& input, int old_size, int new_size);
|
void InputResized(const QString& input, int old_size, int new_size);
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ Footage::Footage(const QString &filename) :
|
|||||||
ViewerOutput(false),
|
ViewerOutput(false),
|
||||||
cancelled_(nullptr)
|
cancelled_(nullptr)
|
||||||
{
|
{
|
||||||
AddInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
SetCacheTextures(true);
|
||||||
|
SetViewerVideoCacheEnabled(false);
|
||||||
|
|
||||||
|
PrependInput(kFilenameInput, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
set_filename(filename);
|
set_filename(filename);
|
||||||
|
|
||||||
SetCacheTextures(true);
|
|
||||||
SetViewerCacheEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Footage::Retranslate()
|
void Footage::Retranslate()
|
||||||
@@ -180,7 +180,7 @@ void Footage::InputValueChangedEvent(const QString &input, int element)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rational Footage::GetCustomLength(Track::Type type) const
|
rational Footage::VerifyLengthInternal(Track::Type type) const
|
||||||
{
|
{
|
||||||
if (type == Track::kVideo) {
|
if (type == Track::kVideo) {
|
||||||
VideoParams first_stream = GetFirstEnabledVideoStream();
|
VideoParams first_stream = GetFirstEnabledVideoStream();
|
||||||
@@ -196,7 +196,7 @@ rational Footage::GetCustomLength(Track::Type type) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super::GetCustomLength(type);
|
return super::VerifyLengthInternal(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Footage::GetColorspaceToUse(const VideoParams ¶ms) const
|
QString Footage::GetColorspaceToUse(const VideoParams ¶ms) const
|
||||||
@@ -295,10 +295,9 @@ QString Footage::DescribeVideoStream(const VideoParams ¶ms)
|
|||||||
|
|
||||||
QString Footage::DescribeAudioStream(const AudioParams ¶ms)
|
QString Footage::DescribeAudioStream(const AudioParams ¶ms)
|
||||||
{
|
{
|
||||||
return tr("%1: Audio - %2 Channel(s), %3Hz")
|
return tr("%1: Audio - %n Channel(s), %2Hz", nullptr, params.channel_count())
|
||||||
.arg(QString::number(params.stream_index()),
|
.arg(QString::number(params.stream_index()),
|
||||||
QString::number(params.channel_count()),
|
QString::number(params.sample_rate()));
|
||||||
QString::number(params.sample_rate()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Footage::Hash(const QString& output, QCryptographicHash &hash, const rational &time) const
|
void Footage::Hash(const QString& output, QCryptographicHash &hash, const rational &time) const
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
virtual QString Name() const override
|
virtual QString Name() const override
|
||||||
{
|
{
|
||||||
return tr("Footage");
|
return tr("Media");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QString id() const override
|
virtual QString id() const override
|
||||||
@@ -195,7 +195,7 @@ protected:
|
|||||||
|
|
||||||
virtual void InputValueChangedEvent(const QString &input, int element) override;
|
virtual void InputValueChangedEvent(const QString &input, int element) override;
|
||||||
|
|
||||||
virtual rational GetCustomLength(Track::Type type) const override;
|
virtual rational VerifyLengthInternal(Track::Type type) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString GetColorspaceToUse(const VideoParams& params) const;
|
QString GetColorspaceToUse(const VideoParams& params) const;
|
||||||
|
|||||||
@@ -430,9 +430,6 @@ void ProjectViewModel::ConnectItem(Node *n)
|
|||||||
connect(f, &Folder::BeginRemoveItem, this, &ProjectViewModel::FolderBeginRemoveItem);
|
connect(f, &Folder::BeginRemoveItem, this, &ProjectViewModel::FolderBeginRemoveItem);
|
||||||
connect(f, &Folder::EndRemoveItem, this, &ProjectViewModel::FolderEndRemoveItem);
|
connect(f, &Folder::EndRemoveItem, this, &ProjectViewModel::FolderEndRemoveItem);
|
||||||
|
|
||||||
connect(f, &Folder::BeginInsertItem, this, &ProjectViewModel::ItemAdded);
|
|
||||||
connect(f, &Folder::BeginRemoveItem, this, &ProjectViewModel::ItemRemoved);
|
|
||||||
|
|
||||||
foreach (Node* c, f->children()) {
|
foreach (Node* c, f->children()) {
|
||||||
ConnectItem(c);
|
ConnectItem(c);
|
||||||
}
|
}
|
||||||
@@ -450,9 +447,6 @@ void ProjectViewModel::DisconnectItem(Node *n)
|
|||||||
disconnect(f, &Folder::BeginRemoveItem, this, &ProjectViewModel::FolderBeginRemoveItem);
|
disconnect(f, &Folder::BeginRemoveItem, this, &ProjectViewModel::FolderBeginRemoveItem);
|
||||||
disconnect(f, &Folder::EndRemoveItem, this, &ProjectViewModel::FolderEndRemoveItem);
|
disconnect(f, &Folder::EndRemoveItem, this, &ProjectViewModel::FolderEndRemoveItem);
|
||||||
|
|
||||||
disconnect(f, &Folder::BeginInsertItem, this, &ProjectViewModel::ItemAdded);
|
|
||||||
disconnect(f, &Folder::BeginRemoveItem, this, &ProjectViewModel::ItemRemoved);
|
|
||||||
|
|
||||||
foreach (Node* c, f->children()) {
|
foreach (Node* c, f->children()) {
|
||||||
DisconnectItem(c);
|
DisconnectItem(c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,11 +104,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
QModelIndex CreateIndexFromItem(Node *item, int column = 0);
|
QModelIndex CreateIndexFromItem(Node *item, int column = 0);
|
||||||
|
|
||||||
signals:
|
|
||||||
void ItemAdded(Node* node);
|
|
||||||
|
|
||||||
void ItemRemoved(Node* node);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Retrieve the index of `item` in its parent
|
* @brief Retrieve the index of `item` in its parent
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ void Sequence::Retranslate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rational Sequence::GetCustomLength(Track::Type type) const
|
rational Sequence::VerifyLengthInternal(Track::Type type) const
|
||||||
{
|
{
|
||||||
if (!track_lists_.isEmpty()) {
|
if (!track_lists_.isEmpty()) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ protected:
|
|||||||
|
|
||||||
virtual void InputDisconnectedEvent(const QString &input, int element, const NodeOutput &output) override;
|
virtual void InputDisconnectedEvent(const QString &input, int element, const NodeOutput &output) override;
|
||||||
|
|
||||||
virtual rational GetCustomLength(Track::Type type) const override;
|
virtual rational VerifyLengthInternal(Track::Type type) const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void TrackAdded(Track* track);
|
void TrackAdded(Track* track);
|
||||||
|
|||||||
+17
-5
@@ -382,14 +382,26 @@ NodeValueTable NodeValueTable::Merge(QList<NodeValueTable> tables)
|
|||||||
NodeValueTable merged_table;
|
NodeValueTable merged_table;
|
||||||
|
|
||||||
// Slipstreams all tables together
|
// Slipstreams all tables together
|
||||||
foreach (const NodeValueTable& t, tables) {
|
while (true) {
|
||||||
if (row >= t.Count()) {
|
bool all_merged = true;
|
||||||
continue;
|
|
||||||
|
foreach (const NodeValueTable& t, tables) {
|
||||||
|
if (row < t.Count()) {
|
||||||
|
all_merged = false;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int row_index = t.Count() - 1 - row;
|
||||||
|
|
||||||
|
merged_table.Prepend(t.at(row_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
int row_index = t.Count() - 1 - row;
|
row++;
|
||||||
|
|
||||||
merged_table.Prepend(t.at(row_index));
|
if (all_merged) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return merged_table;
|
return merged_table;
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ ProjectPanel::ProjectPanel(QWidget *parent) :
|
|||||||
explorer_ = new ProjectExplorer(this);
|
explorer_ = new ProjectExplorer(this);
|
||||||
layout->addWidget(explorer_);
|
layout->addWidget(explorer_);
|
||||||
connect(explorer_, &ProjectExplorer::DoubleClickedItem, this, &ProjectPanel::ItemDoubleClickSlot);
|
connect(explorer_, &ProjectExplorer::DoubleClickedItem, this, &ProjectPanel::ItemDoubleClickSlot);
|
||||||
connect(explorer_, &ProjectExplorer::ItemRemoved, this, &ProjectPanel::ItemRemoved);
|
|
||||||
|
|
||||||
// Set toolbar's view to the explorer's view
|
// Set toolbar's view to the explorer's view
|
||||||
toolbar->SetView(explorer_->view_type());
|
toolbar->SetView(explorer_->view_type());
|
||||||
@@ -233,16 +232,6 @@ void ProjectPanel::SaveConnectedProject()
|
|||||||
Core::instance()->SaveProject(this->project());
|
Core::instance()->SaveProject(this->project());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectPanel::ItemRemoved(Node *item)
|
|
||||||
{
|
|
||||||
// Open this footage in a FootageViewer
|
|
||||||
FootageViewerPanel* panel = PanelManager::instance()->MostRecentlyFocused<FootageViewerPanel>();
|
|
||||||
|
|
||||||
if (panel->GetConnectedViewer() == item) {
|
|
||||||
panel->DisconnectViewerNode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<ViewerOutput *> ProjectPanel::GetSelectedFootage() const
|
QVector<ViewerOutput *> ProjectPanel::GetSelectedFootage() const
|
||||||
{
|
{
|
||||||
QVector<Node*> items = SelectedItems();
|
QVector<Node*> items = SelectedItems();
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ private slots:
|
|||||||
|
|
||||||
void SaveConnectedProject();
|
void SaveConnectedProject();
|
||||||
|
|
||||||
void ItemRemoved(Node* item);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ namespace olive {
|
|||||||
ViewerPanel::ViewerPanel(const QString &object_name, QWidget *parent) :
|
ViewerPanel::ViewerPanel(const QString &object_name, QWidget *parent) :
|
||||||
ViewerPanelBase(object_name, parent)
|
ViewerPanelBase(object_name, parent)
|
||||||
{
|
{
|
||||||
// Set ViewerWidget as the central widget
|
Init();
|
||||||
ViewerWidget* vw = new ViewerWidget();
|
}
|
||||||
connect(vw, &ViewerWidget::RequestScopePanel, this, &ViewerPanel::CreateScopePanel);
|
|
||||||
SetTimeBasedWidget(vw);
|
|
||||||
|
|
||||||
// Set strings
|
ViewerPanel::ViewerPanel(QWidget *parent) :
|
||||||
Retranslate();
|
ViewerPanelBase(QStringLiteral("ViewerPanel"), parent)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerPanel::Retranslate()
|
void ViewerPanel::Retranslate()
|
||||||
@@ -41,4 +41,15 @@ void ViewerPanel::Retranslate()
|
|||||||
SetTitle(tr("Viewer"));
|
SetTitle(tr("Viewer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewerPanel::Init()
|
||||||
|
{
|
||||||
|
// Set ViewerWidget as the central widget
|
||||||
|
ViewerWidget* vw = new ViewerWidget();
|
||||||
|
connect(vw, &ViewerWidget::RequestScopePanel, this, &ViewerPanel::CreateScopePanel);
|
||||||
|
SetTimeBasedWidget(vw);
|
||||||
|
|
||||||
|
// Set strings
|
||||||
|
Retranslate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,14 @@ class ViewerPanel : public ViewerPanelBase {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ViewerPanel(const QString& object_name, QWidget* parent);
|
ViewerPanel(const QString& object_name, QWidget* parent);
|
||||||
|
ViewerPanel(QWidget* parent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Retranslate() override;
|
virtual void Retranslate() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,6 +479,7 @@ qint64 AudioPlaybackCache::PlaybackDevice::readData(char *data, qint64 maxSize)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Failed to read data from segment";
|
qWarning() << "Failed to read data from segment";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,6 +197,11 @@ bool FrameHashCache::SaveCacheFrame(const QByteArray &hash, FramePtr frame) cons
|
|||||||
|
|
||||||
bool FrameHashCache::SaveCacheFrame(const QString &cache_path, const QByteArray &hash, char *data, const VideoParams &vparam, int linesize_bytes)
|
bool FrameHashCache::SaveCacheFrame(const QString &cache_path, const QByteArray &hash, char *data, const VideoParams &vparam, int linesize_bytes)
|
||||||
{
|
{
|
||||||
|
if (cache_path.isEmpty()) {
|
||||||
|
qWarning() << "Failed to save cache frame with empty path";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString fn = CachePathName(cache_path, hash);
|
QString fn = CachePathName(cache_path, hash);
|
||||||
|
|
||||||
if (SaveCacheFrame(fn, data, vparam, linesize_bytes)) {
|
if (SaveCacheFrame(fn, data, vparam, linesize_bytes)) {
|
||||||
@@ -226,6 +231,11 @@ bool FrameHashCache::SaveCacheFrame(const QString &cache_path, const QByteArray
|
|||||||
|
|
||||||
FramePtr FrameHashCache::LoadCacheFrame(const QString &cache_path, const QByteArray &hash)
|
FramePtr FrameHashCache::LoadCacheFrame(const QString &cache_path, const QByteArray &hash)
|
||||||
{
|
{
|
||||||
|
if (cache_path.isEmpty()) {
|
||||||
|
qWarning() << "Failed to save cache frame with empty path";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return LoadCacheFrame(CachePathName(cache_path, hash));
|
return LoadCacheFrame(CachePathName(cache_path, hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -678,10 +678,6 @@ void PreviewAutoCacher::SetViewerNode(ViewerOutput *viewer_node)
|
|||||||
copied_viewer_node_ = static_cast<ViewerOutput*>(copy_map_.value(viewer_node_));
|
copied_viewer_node_ = static_cast<ViewerOutput*>(copy_map_.value(viewer_node_));
|
||||||
copied_color_manager_ = static_cast<ColorManager*>(copy_map_.value(viewer_node_->project()->color_manager()));
|
copied_color_manager_ = static_cast<ColorManager*>(copy_map_.value(viewer_node_->project()->color_manager()));
|
||||||
|
|
||||||
// Copy parameters
|
|
||||||
copied_viewer_node_->SetVideoParams(viewer_node_->GetVideoParams());
|
|
||||||
copied_viewer_node_->SetAudioParams(viewer_node_->GetAudioParams());
|
|
||||||
|
|
||||||
// Add all connections
|
// Add all connections
|
||||||
foreach (Node* node, graph->nodes()) {
|
foreach (Node* node, graph->nodes()) {
|
||||||
for (auto it=node->input_connections().cbegin(); it!=node->input_connections().cend(); it++) {
|
for (auto it=node->input_connections().cbegin(); it!=node->input_connections().cend(); it++) {
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
|
||||||
#include <QFloat16>
|
|
||||||
|
|
||||||
#include "common/ocioutils.h"
|
#include "common/ocioutils.h"
|
||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|||||||
@@ -540,13 +540,17 @@ QVariant RenderProcessor::ProcessFrameGeneration(const Node *node, const Generat
|
|||||||
|
|
||||||
bool RenderProcessor::CanCacheFrames()
|
bool RenderProcessor::CanCacheFrames()
|
||||||
{
|
{
|
||||||
return true;
|
return ticket_->property("type").value<RenderManager::TicketType>() == RenderManager::kTypeVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RenderProcessor::GetCachedTexture(const QByteArray& hash)
|
QVariant RenderProcessor::GetCachedTexture(const QByteArray& hash)
|
||||||
{
|
{
|
||||||
VideoParams video_params = GetCacheVideoParams();
|
|
||||||
QString cache_dir = ticket_->property("cache").toString();
|
QString cache_dir = ticket_->property("cache").toString();
|
||||||
|
if (cache_dir.isEmpty()) {
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoParams video_params = GetCacheVideoParams();
|
||||||
|
|
||||||
FramePtr f = FrameHashCache::LoadCacheFrame(cache_dir, hash);
|
FramePtr f = FrameHashCache::LoadCacheFrame(cache_dir, hash);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ ProjectImportTask::ProjectImportTask(ProjectViewModel *model, Folder *folder, co
|
|||||||
|
|
||||||
file_count_ = Core::CountFilesInFileList(filenames_);
|
file_count_ = Core::CountFilesInFileList(filenames_);
|
||||||
|
|
||||||
SetTitle(tr("Importing %1 file(s)").arg(file_count_));
|
SetTitle(tr("Importing %n file(s)", nullptr, file_count_));
|
||||||
}
|
}
|
||||||
|
|
||||||
const int &ProjectImportTask::GetFileCount() const
|
const int &ProjectImportTask::GetFileCount() const
|
||||||
@@ -139,7 +139,8 @@ void ProjectImportTask::ValidateImageSequence(Footage *footage, QFileInfoList& i
|
|||||||
// By this point we've established that video contains a single still image stream. Now we'll
|
// By this point we've established that video contains a single still image stream. Now we'll
|
||||||
// see if it ends with numbers.
|
// see if it ends with numbers.
|
||||||
if (Decoder::GetImageSequenceDigitCount(footage->filename()) > 0
|
if (Decoder::GetImageSequenceDigitCount(footage->filename()) > 0
|
||||||
&& !image_sequence_ignore_files_.contains(footage->filename())) {
|
&& !image_sequence_ignore_files_.contains(footage->filename())
|
||||||
|
&& footage->InputArraySize(Footage::kVideoParamsInput)) {
|
||||||
VideoParams video_stream = footage->GetVideoParams(0);
|
VideoParams video_stream = footage->GetVideoParams(0);
|
||||||
QSize dim(video_stream.width(), video_stream.height());
|
QSize dim(video_stream.width(), video_stream.height());
|
||||||
|
|
||||||
|
|||||||
+32
-4745
File diff suppressed because it is too large
Load Diff
@@ -36,11 +36,12 @@ const int kMaximumSmoothness = 8;
|
|||||||
AudioMonitor::AudioMonitor(QWidget *parent) :
|
AudioMonitor::AudioMonitor(QWidget *parent) :
|
||||||
QOpenGLWidget(parent),
|
QOpenGLWidget(parent),
|
||||||
file_(nullptr),
|
file_(nullptr),
|
||||||
|
waveform_(nullptr),
|
||||||
cached_channels_(0)
|
cached_channels_(0)
|
||||||
{
|
{
|
||||||
values_.resize(kMaximumSmoothness);
|
values_.resize(kMaximumSmoothness);
|
||||||
|
|
||||||
connect(AudioManager::instance(), &AudioManager::OutputDeviceStarted, this, &AudioMonitor::OutputDeviceSet);
|
connect(AudioManager::instance(), &AudioManager::OutputWaveformStarted, this, &AudioMonitor::OutputAudioVisualWaveformSet);
|
||||||
connect(AudioManager::instance(), &AudioManager::OutputPushed, this, &AudioMonitor::OutputPushed);
|
connect(AudioManager::instance(), &AudioManager::OutputPushed, this, &AudioMonitor::OutputPushed);
|
||||||
connect(AudioManager::instance(), &AudioManager::AudioParamsChanged, this, &AudioMonitor::SetParams);
|
connect(AudioManager::instance(), &AudioManager::AudioParamsChanged, this, &AudioMonitor::SetParams);
|
||||||
connect(AudioManager::instance(), &AudioManager::Stopped, this, &AudioMonitor::Stop);
|
connect(AudioManager::instance(), &AudioManager::Stopped, this, &AudioMonitor::Stop);
|
||||||
@@ -84,6 +85,7 @@ void AudioMonitor::Stop()
|
|||||||
{
|
{
|
||||||
delete file_;
|
delete file_;
|
||||||
file_ = nullptr;
|
file_ = nullptr;
|
||||||
|
waveform_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMonitor::OutputPushed(const QByteArray &d)
|
void AudioMonitor::OutputPushed(const QByteArray &d)
|
||||||
@@ -97,6 +99,20 @@ void AudioMonitor::OutputPushed(const QByteArray &d)
|
|||||||
SetUpdateLoop(true);
|
SetUpdateLoop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioMonitor::OutputAudioVisualWaveformSet(const AudioVisualWaveform *waveform, const rational &start, int playback_speed)
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
|
||||||
|
waveform_ = waveform;
|
||||||
|
waveform_time_ = start;
|
||||||
|
|
||||||
|
playback_speed_ = playback_speed;
|
||||||
|
|
||||||
|
last_time_ = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
|
||||||
|
SetUpdateLoop(true);
|
||||||
|
}
|
||||||
|
|
||||||
void AudioMonitor::SetUpdateLoop(bool e)
|
void AudioMonitor::SetUpdateLoop(bool e)
|
||||||
{
|
{
|
||||||
if (e) {
|
if (e) {
|
||||||
@@ -211,8 +227,24 @@ void AudioMonitor::paintGL()
|
|||||||
|
|
||||||
QVector<double> v(params_.channel_count(), 0);
|
QVector<double> v(params_.channel_count(), 0);
|
||||||
|
|
||||||
if (file_) {
|
if (file_ || waveform_) {
|
||||||
UpdateValuesFromFile(v);
|
// Determines how many milliseconds have passed since last update
|
||||||
|
qint64 current_time = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
qint64 delta_time = current_time - last_time_;
|
||||||
|
int abs_speed = qAbs(playback_speed_);
|
||||||
|
|
||||||
|
// Multiply by speed if the speed is not 1
|
||||||
|
if (abs_speed != 1) {
|
||||||
|
delta_time *= abs_speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_) {
|
||||||
|
UpdateValuesFromFile(v, delta_time);
|
||||||
|
} else if (waveform_) {
|
||||||
|
UpdateValuesFromWaveform(v, delta_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
last_time_ = current_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
PushValue(v);
|
PushValue(v);
|
||||||
@@ -254,7 +286,7 @@ void AudioMonitor::paintGL()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all_zeroes && !file_) {
|
if (all_zeroes && !file_ && !waveform_) {
|
||||||
// Optimize by disabling the update loop
|
// Optimize by disabling the update loop
|
||||||
SetUpdateLoop(false);
|
SetUpdateLoop(false);
|
||||||
}
|
}
|
||||||
@@ -266,20 +298,10 @@ void AudioMonitor::mousePressEvent(QMouseEvent *)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMonitor::UpdateValuesFromFile(QVector<double>& v)
|
void AudioMonitor::UpdateValuesFromFile(QVector<double>& v, qint64 delta_time)
|
||||||
{
|
{
|
||||||
// Determines how many milliseconds have passed since last update
|
|
||||||
qint64 current_time = QDateTime::currentMSecsSinceEpoch();
|
|
||||||
qint64 time_passed = current_time - last_time_;
|
|
||||||
int abs_speed = qAbs(playback_speed_);
|
|
||||||
|
|
||||||
// Multiply by speed if the speed is not 1
|
|
||||||
if (abs_speed != 1) {
|
|
||||||
time_passed *= abs_speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert ms to float seconds and determine how many bytes that is
|
// Convert ms to float seconds and determine how many bytes that is
|
||||||
qint64 bytes_to_read = params_.time_to_bytes(static_cast<double>(time_passed) * 0.001);
|
qint64 bytes_to_read = params_.time_to_bytes(static_cast<double>(delta_time) * 0.001);
|
||||||
|
|
||||||
if (playback_speed_ < 0) {
|
if (playback_speed_ < 0) {
|
||||||
// If reversing, jump back by the amount of bytes we're going to read
|
// If reversing, jump back by the amount of bytes we're going to read
|
||||||
@@ -297,31 +319,35 @@ void AudioMonitor::UpdateValuesFromFile(QVector<double>& v)
|
|||||||
file_->seek(file_->pos() - bytes_to_read);
|
file_->seek(file_->pos() - bytes_to_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If speed is not 1, transform it here
|
BytesToSampleSummary(b, v);
|
||||||
if (abs_speed != 1) {
|
}
|
||||||
int sample_sz = params_.samples_to_bytes(1);
|
|
||||||
int in_nb_samples = params_.bytes_to_samples(b.size());
|
|
||||||
int out_nb_samples = in_nb_samples / abs_speed;
|
|
||||||
QByteArray speed_adjusted(out_nb_samples * sample_sz, Qt::Uninitialized);
|
|
||||||
|
|
||||||
for (int i=0;i<out_nb_samples;i++) {
|
void AudioMonitor::UpdateValuesFromWaveform(QVector<double> &v, qint64 delta_time)
|
||||||
memcpy(speed_adjusted.data() + i * sample_sz,
|
{
|
||||||
b.constData() + i * abs_speed * sample_sz,
|
// Delta time is provided in milliseconds, so we convert to seconds in rational
|
||||||
sample_sz);
|
rational length(delta_time, 1000);
|
||||||
|
|
||||||
|
AudioVisualWaveform::Sample sum = waveform_->GetSummaryFromTime(waveform_time_, length);
|
||||||
|
|
||||||
|
for (int i=0; i<sum.size(); i++) {
|
||||||
|
float max = qMax(qAbs(sum.at(i).min), qAbs(sum.at(i).max));
|
||||||
|
|
||||||
|
int output_index = i%v.size();
|
||||||
|
if (max > v.at(output_index)) {
|
||||||
|
v[output_index] = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
b = speed_adjusted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BytesToSampleSummary(b, v);
|
waveform_time_ += length;
|
||||||
|
|
||||||
last_time_ = current_time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMonitor::PushValue(const QVector<double> &v)
|
void AudioMonitor::PushValue(const QVector<double> &v)
|
||||||
{
|
{
|
||||||
values_.removeFirst();
|
int lim = values_.size()-1;
|
||||||
values_.append(v);
|
for (int i=0; i<lim; i++) {
|
||||||
|
values_[i] = values_[i+1];
|
||||||
|
}
|
||||||
|
values_[lim] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMonitor::BytesToSampleSummary(const QByteArray &b, QVector<double> &v)
|
void AudioMonitor::BytesToSampleSummary(const QByteArray &b, QVector<double> &v)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <QOpenGLWidget>
|
#include <QOpenGLWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include "audio/audiovisualwaveform.h"
|
||||||
#include "common/define.h"
|
#include "common/define.h"
|
||||||
#include "render/audioparams.h"
|
#include "render/audioparams.h"
|
||||||
#include "render/audioplaybackcache.h"
|
#include "render/audioplaybackcache.h"
|
||||||
@@ -46,8 +47,9 @@ public slots:
|
|||||||
|
|
||||||
void OutputPushed(const QByteArray& d);
|
void OutputPushed(const QByteArray& d);
|
||||||
|
|
||||||
|
void OutputAudioVisualWaveformSet(const AudioVisualWaveform *waveform, const rational& start, int playback_speed);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//virtual void paintEvent(QPaintEvent* event) override;
|
|
||||||
virtual void paintGL() override;
|
virtual void paintGL() override;
|
||||||
|
|
||||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||||
@@ -55,7 +57,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void SetUpdateLoop(bool e);
|
void SetUpdateLoop(bool e);
|
||||||
|
|
||||||
void UpdateValuesFromFile(QVector<double> &v);
|
void UpdateValuesFromFile(QVector<double> &v, qint64 delta_time);
|
||||||
|
|
||||||
|
void UpdateValuesFromWaveform(QVector<double> &v, qint64 delta_time);
|
||||||
|
|
||||||
void PushValue(const QVector<double>& v);
|
void PushValue(const QVector<double>& v);
|
||||||
|
|
||||||
@@ -68,6 +72,9 @@ private:
|
|||||||
QIODevice* file_;
|
QIODevice* file_;
|
||||||
qint64 last_time_;
|
qint64 last_time_;
|
||||||
|
|
||||||
|
const AudioVisualWaveform* waveform_;
|
||||||
|
rational waveform_time_;
|
||||||
|
|
||||||
int playback_speed_;
|
int playback_speed_;
|
||||||
|
|
||||||
QVector< QVector<double> > values_;
|
QVector< QVector<double> > values_;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void NodeParamViewArrayWidget::UpdateCounter(const QString& input, int old_size,
|
|||||||
{
|
{
|
||||||
Q_UNUSED(old_size)
|
Q_UNUSED(old_size)
|
||||||
if (input == input_) {
|
if (input == input_) {
|
||||||
count_lbl_->setText(tr("%1 element(s)").arg(new_size));
|
count_lbl_->setText(tr("%n element(s)", nullptr, new_size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ void NodeParamViewItemBody::Retranslate()
|
|||||||
|
|
||||||
if (ic.IsArray() && ic.element() >= 0) {
|
if (ic.IsArray() && ic.element() >= 0) {
|
||||||
// Make the label the array index
|
// Make the label the array index
|
||||||
i.value().main_label->setText(tr("%n:", nullptr, ic.element()));
|
i.value().main_label->setText(tr("%1:").arg(ic.element()));
|
||||||
} else {
|
} else {
|
||||||
// Set to the input's name
|
// Set to the input's name
|
||||||
i.value().main_label->setText(tr("%1:").arg(ic.name()));
|
i.value().main_label->setText(tr("%1:").arg(ic.name()));
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ void NodeParamViewWidgetBridge::InputValueChanged(const NodeInput &input, const
|
|||||||
|
|
||||||
void NodeParamViewWidgetBridge::PropertyChanged(const QString& input, const QString &key, const QVariant &value)
|
void NodeParamViewWidgetBridge::PropertyChanged(const QString& input, const QString &key, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (input != input_.input()) {
|
if (input != input_.input() || (input_.IsArray() && input_.element() == -1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -668,6 +668,13 @@ void NodeView::ShowContextMenu(const QPoint &pos)
|
|||||||
QAction* autopos = m.addAction(tr("Auto-Position"));
|
QAction* autopos = m.addAction(tr("Auto-Position"));
|
||||||
connect(autopos, &QAction::triggered, this, &NodeView::AutoPositionDescendents);
|
connect(autopos, &QAction::triggered, this, &NodeView::AutoPositionDescendents);
|
||||||
|
|
||||||
|
ViewerOutput* viewer = dynamic_cast<ViewerOutput*>(selected.first()->GetNode());
|
||||||
|
if (viewer) {
|
||||||
|
m.addSeparator();
|
||||||
|
QAction* open_in_viewer_action = m.addAction(tr("Open in Viewer"));
|
||||||
|
connect(open_in_viewer_action, &QAction::triggered, this, &NodeView::OpenSelectedNodeInViewer);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
QAction* curved_action = m.addAction(tr("Smooth Edges"));
|
QAction* curved_action = m.addAction(tr("Smooth Edges"));
|
||||||
@@ -756,6 +763,16 @@ void NodeView::ContextMenuFilterChanged(QAction *action)
|
|||||||
Q_UNUSED(action)
|
Q_UNUSED(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeView::OpenSelectedNodeInViewer()
|
||||||
|
{
|
||||||
|
QVector<Node*> selected = scene_.GetSelectedNodes();
|
||||||
|
ViewerOutput* viewer = selected.isEmpty() ? nullptr : dynamic_cast<ViewerOutput*>(selected.first());
|
||||||
|
|
||||||
|
if (viewer) {
|
||||||
|
Core::instance()->OpenNodeInViewer(viewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NodeView::AttachNodesToCursor(const QVector<Node *> &nodes)
|
void NodeView::AttachNodesToCursor(const QVector<Node *> &nodes)
|
||||||
{
|
{
|
||||||
QVector<NodeViewItem*> items(nodes.size());
|
QVector<NodeViewItem*> items(nodes.size());
|
||||||
|
|||||||
@@ -194,6 +194,11 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void ContextMenuFilterChanged(QAction* action);
|
void ContextMenuFilterChanged(QAction* action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Opens the selected node in a Viewer
|
||||||
|
*/
|
||||||
|
void OpenSelectedNodeInViewer();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,8 +95,6 @@ ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
|||||||
connect(tree_view_, &ProjectExplorerTreeView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
connect(tree_view_, &ProjectExplorerTreeView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||||
connect(list_view_, &ProjectExplorerListView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
connect(list_view_, &ProjectExplorerListView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||||
connect(icon_view_, &ProjectExplorerIconView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
connect(icon_view_, &ProjectExplorerIconView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||||
|
|
||||||
connect(&model_, &ProjectViewModel::ItemRemoved, this, &ProjectExplorer::ItemRemoved);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProjectToolbar::ViewType &ProjectExplorer::view_type() const
|
const ProjectToolbar::ViewType &ProjectExplorer::view_type() const
|
||||||
|
|||||||
@@ -100,8 +100,6 @@ signals:
|
|||||||
*/
|
*/
|
||||||
void DoubleClickedItem(Node* item);
|
void DoubleClickedItem(Node* item);
|
||||||
|
|
||||||
void ItemRemoved(Node* node);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Get all the blocks that solely rely on an input node
|
* @brief Get all the blocks that solely rely on an input node
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ SliderBase::SliderBase(Mode mode, QWidget *parent) :
|
|||||||
dragged_diff_(0),
|
dragged_diff_(0),
|
||||||
require_valid_input_(true),
|
require_valid_input_(true),
|
||||||
tristate_(false),
|
tristate_(false),
|
||||||
|
format_plural_(false),
|
||||||
drag_ladder_(nullptr),
|
drag_ladder_(nullptr),
|
||||||
ladder_element_count_(0),
|
ladder_element_count_(0),
|
||||||
dragged_(false)
|
dragged_(false)
|
||||||
@@ -102,9 +103,10 @@ bool SliderBase::IsDragging() const
|
|||||||
return drag_ladder_;
|
return drag_ladder_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderBase::SetFormat(const QString &s)
|
void SliderBase::SetFormat(const QString &s, const bool plural)
|
||||||
{
|
{
|
||||||
custom_format_ = s;
|
custom_format_ = s;
|
||||||
|
format_plural_ = plural;
|
||||||
ForceLabelUpdate();
|
ForceLabelUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +116,11 @@ void SliderBase::ClearFormat()
|
|||||||
ForceLabelUpdate();
|
ForceLabelUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SliderBase::IsFormatPlural() const
|
||||||
|
{
|
||||||
|
return format_plural_;
|
||||||
|
}
|
||||||
|
|
||||||
void SliderBase::ForceLabelUpdate()
|
void SliderBase::ForceLabelUpdate()
|
||||||
{
|
{
|
||||||
UpdateLabel(Value());
|
UpdateLabel(Value());
|
||||||
@@ -228,10 +235,17 @@ QString SliderBase::GetFormat() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SliderBase::UsingLadders() const
|
||||||
|
{
|
||||||
|
return ladder_element_count_ > 0 && Config::Current()[QStringLiteral("UseSliderLadders")].toBool();
|
||||||
|
}
|
||||||
|
|
||||||
void SliderBase::UpdateLabel(const QVariant &v)
|
void SliderBase::UpdateLabel(const QVariant &v)
|
||||||
{
|
{
|
||||||
if (tristate_) {
|
if (tristate_) {
|
||||||
label_->setText("---");
|
label_->setText("---");
|
||||||
|
} else if (format_plural_) {
|
||||||
|
label_->setText(tr(GetFormat().toUtf8().constData(), nullptr, v.toInt()));
|
||||||
} else {
|
} else {
|
||||||
label_->setText(GetFormat().arg(ValueToString(v)));
|
label_->setText(GetFormat().arg(ValueToString(v)));
|
||||||
}
|
}
|
||||||
@@ -322,7 +336,7 @@ void SliderBase::LadderDragged(int value, double multiplier)
|
|||||||
|
|
||||||
drag_ladder_->SetValue(ValueToString(clamped_temp_dragged_value_));
|
drag_ladder_->SetValue(ValueToString(clamped_temp_dragged_value_));
|
||||||
|
|
||||||
if (!Config::Current()[QStringLiteral("UseSliderLadders")].toBool()) {
|
if (!UsingLadders()) {
|
||||||
RepositionLadder();
|
RepositionLadder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,7 +451,7 @@ void SliderBase::ResetValue()
|
|||||||
void SliderBase::RepositionLadder()
|
void SliderBase::RepositionLadder()
|
||||||
{
|
{
|
||||||
if (drag_ladder_) {
|
if (drag_ladder_) {
|
||||||
if (Config::Current()[QStringLiteral("UseSliderLadders")].toBool()) {
|
if (UsingLadders()) {
|
||||||
drag_ladder_->move(QCursor::pos() - QPoint(drag_ladder_->width()/2, drag_ladder_->height()/2));
|
drag_ladder_->move(QCursor::pos() - QPoint(drag_ladder_->width()/2, drag_ladder_->height()/2));
|
||||||
} else {
|
} else {
|
||||||
QPoint label_global_pos = label_->mapToGlobal(label_->pos());
|
QPoint label_global_pos = label_->mapToGlobal(label_->pos());
|
||||||
|
|||||||
@@ -61,9 +61,11 @@ public:
|
|||||||
|
|
||||||
bool IsDragging() const;
|
bool IsDragging() const;
|
||||||
|
|
||||||
void SetFormat(const QString& s);
|
void SetFormat(const QString& s, const bool plural=false);
|
||||||
void ClearFormat();
|
void ClearFormat();
|
||||||
|
|
||||||
|
bool IsFormatPlural() const;
|
||||||
|
|
||||||
void SetLadderElementCount(int b)
|
void SetLadderElementCount(int b)
|
||||||
{
|
{
|
||||||
ladder_element_count_ = b;
|
ladder_element_count_ = b;
|
||||||
@@ -102,6 +104,8 @@ private:
|
|||||||
|
|
||||||
QString GetFormat() const;
|
QString GetFormat() const;
|
||||||
|
|
||||||
|
bool UsingLadders() const;
|
||||||
|
|
||||||
SliderLabel* label_;
|
SliderLabel* label_;
|
||||||
|
|
||||||
FocusableLineEdit* editor_;
|
FocusableLineEdit* editor_;
|
||||||
@@ -130,6 +134,8 @@ private:
|
|||||||
|
|
||||||
QString custom_format_;
|
QString custom_format_;
|
||||||
|
|
||||||
|
bool format_plural_;
|
||||||
|
|
||||||
SliderLadder* drag_ladder_;
|
SliderLadder* drag_ladder_;
|
||||||
|
|
||||||
int ladder_element_count_;
|
int ladder_element_count_;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString
|
|||||||
drag_timer_.setInterval(10);
|
drag_timer_.setInterval(10);
|
||||||
connect(&drag_timer_, &QTimer::timeout, this, &SliderLadder::TimerUpdate);
|
connect(&drag_timer_, &QTimer::timeout, this, &SliderLadder::TimerUpdate);
|
||||||
|
|
||||||
if (Config::Current()[QStringLiteral("UseSliderLadders")].toBool()) {
|
if (UsingLadders()) {
|
||||||
drag_start_x_ = -1;
|
drag_start_x_ = -1;
|
||||||
} else {
|
} else {
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
@@ -95,7 +95,7 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString
|
|||||||
|
|
||||||
SliderLadder::~SliderLadder()
|
SliderLadder::~SliderLadder()
|
||||||
{
|
{
|
||||||
if (Config::Current()[QStringLiteral("UseSliderLadders")].toBool()) {
|
if (UsingLadders()) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
@@ -143,7 +143,7 @@ void SliderLadder::TimerUpdate()
|
|||||||
int ladder_right = this->x() + this->width() - 1;
|
int ladder_right = this->x() + this->width() - 1;
|
||||||
int now_pos = QCursor::pos().x();
|
int now_pos = QCursor::pos().x();
|
||||||
|
|
||||||
if (Config::Current()[QStringLiteral("UseSliderLadders")].toBool()) {
|
if (UsingLadders()) {
|
||||||
|
|
||||||
bool is_under_mouse = (now_pos >= ladder_left && now_pos <= ladder_right);
|
bool is_under_mouse = (now_pos >= ladder_left && now_pos <= ladder_right);
|
||||||
|
|
||||||
@@ -227,7 +227,12 @@ void SliderLadder::TimerUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SliderLadderElement::SliderLadderElement(const double &multiplier, QString width_hint, QWidget *parent) :
|
bool SliderLadder::UsingLadders() const
|
||||||
|
{
|
||||||
|
return elements_.size() > 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SliderLadderElement::SliderLadderElement(const double &multiplier, QString width_hint, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
multiplier_(multiplier),
|
multiplier_(multiplier),
|
||||||
highlighted_(false),
|
highlighted_(false),
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ signals:
|
|||||||
void Released();
|
void Released();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool UsingLadders() const;
|
||||||
|
|
||||||
int drag_start_x_;
|
int drag_start_x_;
|
||||||
int drag_start_y_;
|
int drag_start_y_;
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ void TimeBasedWidget::ConnectViewerNode(ViewerOutput *node)
|
|||||||
|
|
||||||
// Disconnect length changed signal
|
// Disconnect length changed signal
|
||||||
disconnect(viewer_node_, &ViewerOutput::LengthChanged, this, &TimeBasedWidget::UpdateMaximumScroll);
|
disconnect(viewer_node_, &ViewerOutput::LengthChanged, this, &TimeBasedWidget::UpdateMaximumScroll);
|
||||||
|
disconnect(viewer_node_, &ViewerOutput::RemovedFromGraph, this, &TimeBasedWidget::ConnectedNodeRemovedFromGraph);
|
||||||
|
|
||||||
// Disconnect rate change signals if they were connected
|
// Disconnect rate change signals if they were connected
|
||||||
disconnect(viewer_node_, &ViewerOutput::FrameRateChanged, this, &TimeBasedWidget::AutoUpdateTimebase);
|
disconnect(viewer_node_, &ViewerOutput::FrameRateChanged, this, &TimeBasedWidget::AutoUpdateTimebase);
|
||||||
@@ -109,6 +110,7 @@ void TimeBasedWidget::ConnectViewerNode(ViewerOutput *node)
|
|||||||
if (viewer_node_) {
|
if (viewer_node_) {
|
||||||
// Connect length changed signal
|
// Connect length changed signal
|
||||||
connect(viewer_node_, &ViewerOutput::LengthChanged, this, &TimeBasedWidget::UpdateMaximumScroll);
|
connect(viewer_node_, &ViewerOutput::LengthChanged, this, &TimeBasedWidget::UpdateMaximumScroll);
|
||||||
|
connect(viewer_node_, &ViewerOutput::RemovedFromGraph, this, &TimeBasedWidget::ConnectedNodeRemovedFromGraph);
|
||||||
|
|
||||||
// Connect ruler and scrollbar to timeline points
|
// Connect ruler and scrollbar to timeline points
|
||||||
ruler()->ConnectTimelinePoints(viewer_node_->GetTimelinePoints());
|
ruler()->ConnectTimelinePoints(viewer_node_->GetTimelinePoints());
|
||||||
@@ -216,6 +218,11 @@ void TimeBasedWidget::AutoUpdateTimebase()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimeBasedWidget::ConnectedNodeRemovedFromGraph()
|
||||||
|
{
|
||||||
|
ConnectViewerNode(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
TimeRuler *TimeBasedWidget::ruler() const
|
TimeRuler *TimeBasedWidget::ruler() const
|
||||||
{
|
{
|
||||||
return ruler_;
|
return ruler_;
|
||||||
@@ -281,29 +288,27 @@ void TimeBasedWidget::PassWheelEventsToScrollBar(QObject *object)
|
|||||||
|
|
||||||
void TimeBasedWidget::SetTimestamp(int64_t timestamp)
|
void TimeBasedWidget::SetTimestamp(int64_t timestamp)
|
||||||
{
|
{
|
||||||
if (GetTime() != timestamp) {
|
if (UserIsDraggingPlayhead()) {
|
||||||
if (UserIsDraggingPlayhead()) {
|
// If the user is dragging the playhead, we will simply nudge over and not use autoscroll rules.
|
||||||
// If the user is dragging the playhead, we will simply nudge over and not use autoscroll rules.
|
QMetaObject::invokeMethod(this, "CatchUpScrollToPlayhead", Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(this, "CatchUpScrollToPlayhead", Qt::QueuedConnection);
|
} else {
|
||||||
} else {
|
// Otherwise, assume we jumped to this out of nowhere and must now autoscroll
|
||||||
// Otherwise, assume we jumped to this out of nowhere and must now autoscroll
|
switch (static_cast<AutoScroll::Method>(Config::Current()["Autoscroll"].toInt())) {
|
||||||
switch (static_cast<AutoScroll::Method>(Config::Current()["Autoscroll"].toInt())) {
|
case AutoScroll::kNone:
|
||||||
case AutoScroll::kNone:
|
// Do nothing
|
||||||
// Do nothing
|
break;
|
||||||
break;
|
case AutoScroll::kPage:
|
||||||
case AutoScroll::kPage:
|
QMetaObject::invokeMethod(this, "PageScrollToPlayhead", Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(this, "PageScrollToPlayhead", Qt::QueuedConnection);
|
break;
|
||||||
break;
|
case AutoScroll::kSmooth:
|
||||||
case AutoScroll::kSmooth:
|
QMetaObject::invokeMethod(this, "CenterScrollOnPlayhead", Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(this, "CenterScrollOnPlayhead", Qt::QueuedConnection);
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ruler_->SetTime(timestamp);
|
|
||||||
|
|
||||||
TimeChangedEvent(timestamp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ruler_->SetTime(timestamp);
|
||||||
|
|
||||||
|
TimeChangedEvent(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeBasedWidget::SetTimebase(const rational &timebase)
|
void TimeBasedWidget::SetTimebase(const rational &timebase)
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ private slots:
|
|||||||
|
|
||||||
void AutoUpdateTimebase();
|
void AutoUpdateTimebase();
|
||||||
|
|
||||||
|
void ConnectedNodeRemovedFromGraph();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,10 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
|
#define super TimeBasedWidget
|
||||||
|
|
||||||
TimelineWidget::TimelineWidget(QWidget *parent) :
|
TimelineWidget::TimelineWidget(QWidget *parent) :
|
||||||
TimeBasedWidget(true, true, parent),
|
super(true, true, parent),
|
||||||
rubberband_(QRubberBand::Rectangle, this),
|
rubberband_(QRubberBand::Rectangle, this),
|
||||||
active_tool_(nullptr),
|
active_tool_(nullptr),
|
||||||
use_audio_time_units_(false)
|
use_audio_time_units_(false)
|
||||||
@@ -111,8 +113,6 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
|
|||||||
connect(views_.first()->view()->horizontalScrollBar(), &QScrollBar::rangeChanged, scrollbar(), &QScrollBar::setRange);
|
connect(views_.first()->view()->horizontalScrollBar(), &QScrollBar::rangeChanged, scrollbar(), &QScrollBar::setRange);
|
||||||
vert_layout->addWidget(scrollbar());
|
vert_layout->addWidget(scrollbar());
|
||||||
|
|
||||||
connect(ruler(), &TimeRuler::TimeChanged, this, &TimelineWidget::SetViewTimestamp);
|
|
||||||
|
|
||||||
foreach (TimelineAndTrackView* tview, views_) {
|
foreach (TimelineAndTrackView* tview, views_) {
|
||||||
TimelineView* view = tview->view();
|
TimelineView* view = tview->view();
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ void TimelineWidget::Clear()
|
|||||||
|
|
||||||
void TimelineWidget::TimebaseChangedEvent(const rational &timebase)
|
void TimelineWidget::TimebaseChangedEvent(const rational &timebase)
|
||||||
{
|
{
|
||||||
TimeBasedWidget::TimebaseChangedEvent(timebase);
|
super::TimebaseChangedEvent(timebase);
|
||||||
|
|
||||||
timecode_label_->SetTimebase(timebase);
|
timecode_label_->SetTimebase(timebase);
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ void TimelineWidget::TimebaseChangedEvent(const rational &timebase)
|
|||||||
|
|
||||||
void TimelineWidget::resizeEvent(QResizeEvent *event)
|
void TimelineWidget::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
TimeBasedWidget::resizeEvent(event);
|
super::resizeEvent(event);
|
||||||
|
|
||||||
// Update timecode label size
|
// Update timecode label size
|
||||||
UpdateTimecodeWidthFromSplitters(views_.first()->splitter());
|
UpdateTimecodeWidthFromSplitters(views_.first()->splitter());
|
||||||
@@ -206,6 +206,8 @@ void TimelineWidget::resizeEvent(QResizeEvent *event)
|
|||||||
|
|
||||||
void TimelineWidget::TimeChangedEvent(const int64_t& timestamp)
|
void TimelineWidget::TimeChangedEvent(const int64_t& timestamp)
|
||||||
{
|
{
|
||||||
|
super::TimeChangedEvent(timestamp);
|
||||||
|
|
||||||
SetViewTimestamp(timestamp);
|
SetViewTimestamp(timestamp);
|
||||||
|
|
||||||
timecode_label_->SetValue(timestamp);
|
timecode_label_->SetValue(timestamp);
|
||||||
@@ -213,7 +215,7 @@ void TimelineWidget::TimeChangedEvent(const int64_t& timestamp)
|
|||||||
|
|
||||||
void TimelineWidget::ScaleChangedEvent(const double &scale)
|
void TimelineWidget::ScaleChangedEvent(const double &scale)
|
||||||
{
|
{
|
||||||
TimeBasedWidget::ScaleChangedEvent(scale);
|
super::ScaleChangedEvent(scale);
|
||||||
|
|
||||||
foreach (TimelineAndTrackView* view, views_) {
|
foreach (TimelineAndTrackView* view, views_) {
|
||||||
view->view()->SetScale(scale);
|
view->view()->SetScale(scale);
|
||||||
|
|||||||
@@ -180,9 +180,11 @@ void SeekableWidget::SeekToScreenPoint(int screen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTime(timestamp);
|
if (timestamp != GetTime()) {
|
||||||
|
SetTime(timestamp);
|
||||||
|
|
||||||
emit TimeChanged(timestamp);
|
emit TimeChanged(timestamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeekableWidget::DrawTimelinePoints(QPainter* p, int marker_bottom)
|
void SeekableWidget::DrawTimelinePoints(QPainter* p, int marker_bottom)
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ VideoParamEdit::VideoParamEdit(QWidget* parent) :
|
|||||||
|
|
||||||
// FIXME: Replace with rational slider
|
// FIXME: Replace with rational slider
|
||||||
frame_rate_slider_ = new FloatSlider();
|
frame_rate_slider_ = new FloatSlider();
|
||||||
|
frame_rate_slider_->SetMinimum(0);
|
||||||
|
frame_rate_slider_->SetDecimalPlaces(2);
|
||||||
connect(frame_rate_slider_, &FloatSlider::ValueChanged, this, &VideoParamEdit::Changed);
|
connect(frame_rate_slider_, &FloatSlider::ValueChanged, this, &VideoParamEdit::Changed);
|
||||||
layout->addWidget(frame_rate_slider_, row, 1);
|
layout->addWidget(frame_rate_slider_, row, 1);
|
||||||
|
|
||||||
@@ -211,6 +213,8 @@ VideoParamEdit::VideoParamEdit(QWidget* parent) :
|
|||||||
|
|
||||||
void VideoParamEdit::SetParameterMask(uint64_t mask)
|
void VideoParamEdit::SetParameterMask(uint64_t mask)
|
||||||
{
|
{
|
||||||
|
mask_ = mask;
|
||||||
|
|
||||||
width_lbl_->setVisible(mask & kWidthHeight);
|
width_lbl_->setVisible(mask & kWidthHeight);
|
||||||
width_slider_->setVisible(mask & kWidthHeight);
|
width_slider_->setVisible(mask & kWidthHeight);
|
||||||
height_lbl_->setVisible(mask & kWidthHeight);
|
height_lbl_->setVisible(mask & kWidthHeight);
|
||||||
@@ -220,7 +224,7 @@ void VideoParamEdit::SetParameterMask(uint64_t mask)
|
|||||||
depth_slider_->setVisible(mask & kDepth);
|
depth_slider_->setVisible(mask & kDepth);
|
||||||
|
|
||||||
frame_rate_lbl_->setVisible(mask & kFrameRate);
|
frame_rate_lbl_->setVisible(mask & kFrameRate);
|
||||||
frame_rate_combobox_->setVisible((mask & kFrameRate) && (mask & ~kFrameRateIsArbitrary));
|
frame_rate_combobox_->setVisible((mask & kFrameRate) && !(mask & kFrameRateIsArbitrary));
|
||||||
frame_rate_slider_->setVisible((mask & kFrameRate) && (mask & kFrameRateIsArbitrary));
|
frame_rate_slider_->setVisible((mask & kFrameRate) && (mask & kFrameRateIsArbitrary));
|
||||||
|
|
||||||
pixel_aspect_lbl_->setVisible(mask & kPixelAspect);
|
pixel_aspect_lbl_->setVisible(mask & kPixelAspect);
|
||||||
|
|||||||
@@ -30,21 +30,38 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
|
#define super SeekableWidget
|
||||||
|
|
||||||
AudioWaveformView::AudioWaveformView(QWidget *parent) :
|
AudioWaveformView::AudioWaveformView(QWidget *parent) :
|
||||||
SeekableWidget(parent),
|
super(parent),
|
||||||
playback_(nullptr)
|
playback_(nullptr)
|
||||||
{
|
{
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
setBackgroundRole(QPalette::Base);
|
setBackgroundRole(QPalette::Base);
|
||||||
|
}
|
||||||
|
|
||||||
cached_waveform_.resize(QThread::idealThreadCount());
|
AudioVisualWaveform GenerateWaveform(QIODevice* device, AudioParams params, TimeRange range)
|
||||||
|
{
|
||||||
|
device->open(QFile::ReadOnly);
|
||||||
|
device->seek(params.time_to_bytes(range.in()));
|
||||||
|
|
||||||
|
SampleBufferPtr samples = SampleBuffer::CreateFromPackedData(params, device->read(params.time_to_bytes(range.length())));
|
||||||
|
AudioVisualWaveform waveform;
|
||||||
|
waveform.set_channel_count(params.channel_count());
|
||||||
|
waveform.OverwriteSamples(samples, params.sample_rate());
|
||||||
|
device->close();
|
||||||
|
delete device;
|
||||||
|
return waveform;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioWaveformView::SetViewer(AudioPlaybackCache *playback)
|
void AudioWaveformView::SetViewer(AudioPlaybackCache *playback)
|
||||||
{
|
{
|
||||||
if (playback_) {
|
if (playback_) {
|
||||||
disconnect(playback_, &AudioPlaybackCache::Validated, this, &AudioWaveformView::ForceUpdateOfRange);
|
pool_.clear();
|
||||||
disconnect(playback_, &AudioPlaybackCache::ParametersChanged, this, &AudioWaveformView::BackendParamsChanged);
|
pool_.waitForDone();
|
||||||
|
|
||||||
|
disconnect(playback_, &AudioPlaybackCache::Validated, this, &AudioWaveformView::RenderRange);
|
||||||
|
//disconnect(playback_, &AudioPlaybackCache::ParametersChanged, this, &AudioWaveformView::RenderRange);
|
||||||
|
|
||||||
SetTimebase(0);
|
SetTimebase(0);
|
||||||
}
|
}
|
||||||
@@ -52,18 +69,20 @@ void AudioWaveformView::SetViewer(AudioPlaybackCache *playback)
|
|||||||
playback_ = playback;
|
playback_ = playback;
|
||||||
|
|
||||||
if (playback_) {
|
if (playback_) {
|
||||||
connect(playback_, &AudioPlaybackCache::Validated, this, &AudioWaveformView::ForceUpdateOfRange);
|
connect(playback_, &AudioPlaybackCache::Validated, this, &AudioWaveformView::RenderRange);
|
||||||
connect(playback_, &AudioPlaybackCache::ParametersChanged, this, &AudioWaveformView::BackendParamsChanged);
|
//connect(playback_, &AudioPlaybackCache::ParametersChanged, this, &AudioWaveformView::RenderRange);
|
||||||
|
|
||||||
SetTimebase(playback_->GetParameters().sample_rate_as_time_base());
|
SetTimebase(playback_->GetParameters().sample_rate_as_time_base());
|
||||||
}
|
|
||||||
|
|
||||||
ForceUpdate();
|
waveform_.set_channel_count(playback_->GetParameters().channel_count());
|
||||||
|
|
||||||
|
RenderRange(TimeRange(0, playback_->GetLength()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioWaveformView::paintEvent(QPaintEvent *event)
|
void AudioWaveformView::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::paintEvent(event);
|
super::paintEvent(event);
|
||||||
|
|
||||||
if (!playback_) {
|
if (!playback_) {
|
||||||
return;
|
return;
|
||||||
@@ -80,40 +99,9 @@ void AudioWaveformView::paintEvent(QPaintEvent *event)
|
|||||||
// Draw in/out points
|
// Draw in/out points
|
||||||
DrawTimelinePoints(&p);
|
DrawTimelinePoints(&p);
|
||||||
|
|
||||||
CachedWaveformInfo wanted_info = {size(), GetScale(), GetScroll(), params};
|
// Draw waveform
|
||||||
|
p.setPen(QColor(64, 255, 160)); // FIXME: Hardcoded color
|
||||||
for (int i=0; i<cached_waveform_.size(); i++) {
|
AudioVisualWaveform::DrawWaveform(&p, rect(), GetScale(), waveform_, SceneToTime(GetScroll()));
|
||||||
ActiveCache& cache = cached_waveform_[i];
|
|
||||||
|
|
||||||
int slice_start = width()/cached_waveform_.size() * i;
|
|
||||||
|
|
||||||
if (cache.info == wanted_info) {
|
|
||||||
|
|
||||||
// Draw pixmap
|
|
||||||
p.drawPixmap(slice_start, 0, cache.pixmap);
|
|
||||||
|
|
||||||
} else if (cache.caching_info != wanted_info) {
|
|
||||||
|
|
||||||
int slice_end = width()/cached_waveform_.size() * (i+1);
|
|
||||||
|
|
||||||
// Pixmap is obsolete, will need to draw again
|
|
||||||
|
|
||||||
// Delete any existing watcher so we don't receive the signal
|
|
||||||
delete cache.watcher;
|
|
||||||
|
|
||||||
// Queue a new background cache operation
|
|
||||||
cache.caching_info = wanted_info;
|
|
||||||
cache.watcher = new QFutureWatcher<QPixmap>();
|
|
||||||
connect(cache.watcher, &QFutureWatcher<QPixmap>::finished, this, &AudioWaveformView::BackgroundCacheFinished);
|
|
||||||
cache.watcher->setFuture(QtConcurrent::run(this,
|
|
||||||
&AudioWaveformView::DrawWaveform,
|
|
||||||
playback_->CreatePlaybackDevice(),
|
|
||||||
wanted_info,
|
|
||||||
slice_start,
|
|
||||||
slice_end));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw playhead
|
// Draw playhead
|
||||||
p.setPen(PLAYHEAD_COLOR);
|
p.setPen(PLAYHEAD_COLOR);
|
||||||
@@ -122,117 +110,38 @@ void AudioWaveformView::paintEvent(QPaintEvent *event)
|
|||||||
p.drawLine(playhead_x, 0, playhead_x, height());
|
p.drawLine(playhead_x, 0, playhead_x, height());
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap AudioWaveformView::DrawWaveform(QIODevice* fs, CachedWaveformInfo info, int slice_start, int slice_end) const
|
void AudioWaveformView::RenderRange(const TimeRange &range)
|
||||||
{
|
{
|
||||||
QPixmap pixmap(slice_end - slice_start, info.size.height());
|
// Floor to second increments
|
||||||
pixmap.fill(Qt::transparent);
|
int64_t start = qFloor(range.in().toDouble());
|
||||||
|
int64_t end = qCeil(range.out().toDouble());
|
||||||
|
|
||||||
if (fs->open(QFile::ReadOnly)) {
|
for (; start!=end; start++) {
|
||||||
|
TimeRange this_range(start, start+1);
|
||||||
|
|
||||||
QPainter wave_painter(&pixmap);
|
QFutureWatcher<AudioVisualWaveform>* watcher = new QFutureWatcher<AudioVisualWaveform>();
|
||||||
|
connect(watcher, &QFutureWatcher<AudioVisualWaveform>::finished, this, &AudioWaveformView::BackgroundFinished);
|
||||||
|
|
||||||
// FIXME: Hardcoded color
|
jobs_.insert(this_range, watcher);
|
||||||
wave_painter.setPen(QColor(64, 255, 160));
|
|
||||||
|
|
||||||
int drew = 0;
|
|
||||||
|
|
||||||
fs->seek(info.params.samples_to_bytes(ScreenToUnitRounded(slice_start)));
|
|
||||||
|
|
||||||
for (int x=slice_start; x<slice_end && !fs->atEnd(); x++) {
|
|
||||||
int samples_len = ScreenToUnitRounded(x+1) - ScreenToUnitRounded(x);
|
|
||||||
int max_read_size = info.params.samples_to_bytes(samples_len);
|
|
||||||
|
|
||||||
QByteArray read_buffer = fs->read(max_read_size);
|
|
||||||
|
|
||||||
// Detect whether we've reached EOF and recalculate sample count if so
|
|
||||||
if (read_buffer.size() < max_read_size) {
|
|
||||||
samples_len = info.params.bytes_to_samples(read_buffer.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<AudioVisualWaveform::SamplePerChannel> samples = AudioVisualWaveform::SumSamples(reinterpret_cast<const float*>(read_buffer.constData()),
|
|
||||||
samples_len,
|
|
||||||
info.params.channel_count());
|
|
||||||
|
|
||||||
for (int i=0;i<info.params.channel_count();i++) {
|
|
||||||
AudioVisualWaveform::DrawSample(&wave_painter, samples, x - slice_start, 0, info.size.height());
|
|
||||||
|
|
||||||
drew++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fs->close();
|
|
||||||
|
|
||||||
|
watcher->setFuture(QtConcurrent::run(&pool_, GenerateWaveform, playback_->CreatePlaybackDevice(), playback_->GetParameters(), this_range));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fs;
|
|
||||||
|
|
||||||
return pixmap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioWaveformView::BackendParamsChanged()
|
void AudioWaveformView::BackgroundFinished()
|
||||||
{
|
{
|
||||||
SetTimebase(playback_->GetParameters().sample_rate_as_time_base());
|
QFutureWatcher<AudioVisualWaveform>* watcher = static_cast<QFutureWatcher<AudioVisualWaveform>*>(sender());
|
||||||
}
|
|
||||||
|
|
||||||
void AudioWaveformView::ForceUpdate()
|
for (auto it=jobs_.begin(); it!=jobs_.end(); it++) {
|
||||||
{
|
if (it.value() == watcher) {
|
||||||
// Forces the cache to invalidate
|
AudioVisualWaveform rendered = watcher->result();
|
||||||
for (int i=0; i<cached_waveform_.size(); i++) {
|
waveform_.OverwriteSums(rendered, it.key().in());
|
||||||
cached_waveform_[i].info.size = QSize();
|
jobs_.erase(it);
|
||||||
}
|
update();
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioWaveformView::ForceUpdateOfRange(const TimeRange &range)
|
|
||||||
{
|
|
||||||
int in = TimeToScreen(range.in());
|
|
||||||
int out = TimeToScreen(range.out());
|
|
||||||
|
|
||||||
// Don't need to redraw anything
|
|
||||||
if (out < 0 || in >= width()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int start_invalidate = qMax(0, in/cached_waveform_.size());
|
|
||||||
int end_invalidate = qMin(cached_waveform_.size()-1, out/cached_waveform_.size());
|
|
||||||
|
|
||||||
for (int i=start_invalidate; i<=end_invalidate; i++) {
|
|
||||||
// Invalidate these
|
|
||||||
cached_waveform_[i].info.size = QSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioWaveformView::BackgroundCacheFinished()
|
|
||||||
{
|
|
||||||
// Retrieve sender
|
|
||||||
QFutureWatcher<QPixmap>* watcher = static_cast<QFutureWatcher<QPixmap>*>(sender());
|
|
||||||
|
|
||||||
// Determine index
|
|
||||||
int index = -1;
|
|
||||||
for (int i=0; i<cached_waveform_.size(); i++) {
|
|
||||||
if (cached_waveform_.at(i).watcher == watcher) {
|
|
||||||
index = i;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index > -1) {
|
|
||||||
// Store generated pixmap
|
|
||||||
cached_waveform_[index].info = cached_waveform_[index].caching_info;
|
|
||||||
cached_waveform_[index].pixmap = watcher->result();
|
|
||||||
cached_waveform_[index].watcher = nullptr;
|
|
||||||
|
|
||||||
// Reset size
|
|
||||||
cached_waveform_[index].caching_info.size = QSize();
|
|
||||||
|
|
||||||
// Update with new pixmap
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean up
|
|
||||||
delete watcher;
|
delete watcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,51 +41,27 @@ public:
|
|||||||
|
|
||||||
void SetViewer(AudioPlaybackCache *playback);
|
void SetViewer(AudioPlaybackCache *playback);
|
||||||
|
|
||||||
|
const AudioVisualWaveform* waveform() const
|
||||||
|
{
|
||||||
|
return &waveform_;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent* event) override;
|
virtual void paintEvent(QPaintEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CachedWaveformInfo {
|
void RenderRange(const TimeRange& range);
|
||||||
QSize size;
|
|
||||||
double scale;
|
|
||||||
int scroll;
|
|
||||||
AudioParams params;
|
|
||||||
|
|
||||||
bool operator==(const CachedWaveformInfo& rhs) const
|
QThreadPool pool_;
|
||||||
{
|
|
||||||
return size == rhs.size
|
|
||||||
&& qFuzzyCompare(scale, rhs.scale)
|
|
||||||
&& scroll == rhs.scroll
|
|
||||||
&& params == rhs.params;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const CachedWaveformInfo& rhs) const
|
|
||||||
{
|
|
||||||
return !(*this == rhs);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ActiveCache {
|
|
||||||
QPixmap pixmap;
|
|
||||||
CachedWaveformInfo info;
|
|
||||||
CachedWaveformInfo caching_info;
|
|
||||||
QFutureWatcher<QPixmap>* watcher = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
QPixmap DrawWaveform(QIODevice *fs, CachedWaveformInfo info, int slice_start, int slice_end) const;
|
|
||||||
|
|
||||||
AudioPlaybackCache *playback_;
|
AudioPlaybackCache *playback_;
|
||||||
|
|
||||||
QVector<ActiveCache> cached_waveform_;
|
AudioVisualWaveform waveform_;
|
||||||
|
|
||||||
|
QHash<TimeRange, QFutureWatcher<AudioVisualWaveform>*> jobs_;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void BackendParamsChanged();
|
void BackgroundFinished();
|
||||||
|
|
||||||
void ForceUpdate();
|
|
||||||
|
|
||||||
void ForceUpdateOfRange(const TimeRange& range);
|
|
||||||
|
|
||||||
void BackgroundCacheFinished();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
|||||||
|
|
||||||
display_widget_ = new ViewerDisplayWidget();
|
display_widget_ = new ViewerDisplayWidget();
|
||||||
display_widget_->setAcceptDrops(true);
|
display_widget_->setAcceptDrops(true);
|
||||||
|
display_widget_->SetShowWidgetBackground(true);
|
||||||
connect(display_widget_, &ViewerDisplayWidget::customContextMenuRequested, this, &ViewerWidget::ShowContextMenu);
|
connect(display_widget_, &ViewerDisplayWidget::customContextMenuRequested, this, &ViewerWidget::ShowContextMenu);
|
||||||
connect(display_widget_, &ViewerDisplayWidget::CursorColor, this, &ViewerWidget::CursorColor);
|
connect(display_widget_, &ViewerDisplayWidget::CursorColor, this, &ViewerWidget::CursorColor);
|
||||||
connect(display_widget_, &ViewerDisplayWidget::ColorProcessorChanged, this, &ViewerWidget::ColorProcessorChanged);
|
connect(display_widget_, &ViewerDisplayWidget::ColorProcessorChanged, this, &ViewerWidget::ColorProcessorChanged);
|
||||||
@@ -109,6 +110,11 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
|||||||
connect(controls_, &PlaybackControls::TimeChanged, this, &ViewerWidget::SetTimeAndSignal);
|
connect(controls_, &PlaybackControls::TimeChanged, this, &ViewerWidget::SetTimeAndSignal);
|
||||||
layout->addWidget(controls_);
|
layout->addWidget(controls_);
|
||||||
|
|
||||||
|
// If audio is invalidated during playback, we wait some time before starting it again
|
||||||
|
audio_restart_timer_.setInterval(250);
|
||||||
|
audio_restart_timer_.setSingleShot(true);
|
||||||
|
connect(&audio_restart_timer_, &QTimer::timeout, this, &ViewerWidget::StartAudioOutput);
|
||||||
|
|
||||||
// FIXME: Magic number
|
// FIXME: Magic number
|
||||||
SetScale(48.0);
|
SetScale(48.0);
|
||||||
|
|
||||||
@@ -185,6 +191,8 @@ void ViewerWidget::ConnectNodeEvent(ViewerOutput *n)
|
|||||||
connect(n, &ViewerOutput::AudioParamsChanged, this, &ViewerWidget::UpdateRendererAudioParameters);
|
connect(n, &ViewerOutput::AudioParamsChanged, this, &ViewerWidget::UpdateRendererAudioParameters);
|
||||||
connect(n->video_frame_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedVideoRange);
|
connect(n->video_frame_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedVideoRange);
|
||||||
connect(n->video_frame_cache(), &FrameHashCache::Shifted, this, &ViewerWidget::ViewerShiftedRange);
|
connect(n->video_frame_cache(), &FrameHashCache::Shifted, this, &ViewerWidget::ViewerShiftedRange);
|
||||||
|
connect(n->audio_playback_cache(), &AudioPlaybackCache::Invalidated, this, &ViewerWidget::AudioCacheInvalidated);
|
||||||
|
connect(n->audio_playback_cache(), &AudioPlaybackCache::Validated, this, &ViewerWidget::AudioCacheValidated);
|
||||||
connect(n, &ViewerOutput::TextureInputChanged, this, &ViewerWidget::UpdateStack);
|
connect(n, &ViewerOutput::TextureInputChanged, this, &ViewerWidget::UpdateStack);
|
||||||
|
|
||||||
VideoParams vp = n->GetVideoParams();
|
VideoParams vp = n->GetVideoParams();
|
||||||
@@ -229,6 +237,8 @@ void ViewerWidget::DisconnectNodeEvent(ViewerOutput *n)
|
|||||||
disconnect(n, &ViewerOutput::AudioParamsChanged, this, &ViewerWidget::UpdateRendererAudioParameters);
|
disconnect(n, &ViewerOutput::AudioParamsChanged, this, &ViewerWidget::UpdateRendererAudioParameters);
|
||||||
disconnect(n->video_frame_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedVideoRange);
|
disconnect(n->video_frame_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedVideoRange);
|
||||||
disconnect(n->video_frame_cache(), &FrameHashCache::Shifted, this, &ViewerWidget::ViewerShiftedRange);
|
disconnect(n->video_frame_cache(), &FrameHashCache::Shifted, this, &ViewerWidget::ViewerShiftedRange);
|
||||||
|
disconnect(n->audio_playback_cache(), &AudioPlaybackCache::Invalidated, this, &ViewerWidget::AudioCacheInvalidated);
|
||||||
|
disconnect(n->audio_playback_cache(), &AudioPlaybackCache::Validated, this, &ViewerWidget::AudioCacheValidated);
|
||||||
disconnect(n, &ViewerOutput::TextureInputChanged, this, &ViewerWidget::UpdateStack);
|
disconnect(n, &ViewerOutput::TextureInputChanged, this, &ViewerWidget::UpdateStack);
|
||||||
|
|
||||||
ruler()->SetPlaybackCache(nullptr);
|
ruler()->SetPlaybackCache(nullptr);
|
||||||
@@ -390,13 +400,27 @@ void ViewerWidget::DecodeCachedImage(RenderTicketPtr ticket, const QString &fn,
|
|||||||
bool ViewerWidget::ShouldForceWaveform() const
|
bool ViewerWidget::ShouldForceWaveform() const
|
||||||
{
|
{
|
||||||
return GetConnectedNode()
|
return GetConnectedNode()
|
||||||
&& !GetConnectedNode()->IsInputConnected(ViewerOutput::kTextureInput)
|
&& !GetConnectedNode()->GetConnectedTextureOutput().IsValid()
|
||||||
&& GetConnectedNode()->IsInputConnected(ViewerOutput::kSamplesInput);
|
&& GetConnectedNode()->GetConnectedSampleOutput().IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewerWidget::StartAudioOutput()
|
||||||
|
{
|
||||||
|
AudioPlaybackCache* audio_cache = GetConnectedNode()->audio_playback_cache();
|
||||||
|
if (audio_cache->GetParameters().is_valid()) {
|
||||||
|
AudioManager::instance()->SetOutputParams(audio_cache->GetParameters());
|
||||||
|
AudioManager::instance()->StartOutput(audio_cache,
|
||||||
|
audio_cache->GetParameters().time_to_bytes(GetTime()),
|
||||||
|
playback_speed_);
|
||||||
|
emit AudioManager::instance()->OutputWaveformStarted(waveform_view_->waveform(),
|
||||||
|
GetTime(), playback_speed_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerWidget::UpdateTextureFromNode(const rational& time)
|
void ViewerWidget::UpdateTextureFromNode(const rational& time)
|
||||||
{
|
{
|
||||||
bool frame_exists_at_time = FrameExistsAtTime(time);
|
bool frame_exists_at_time = FrameExistsAtTime(time);
|
||||||
|
bool frame_might_be_still = GetConnectedNode() && GetConnectedNode()->GetConnectedTextureOutput().IsValid() && GetConnectedNode()->GetVideoLength().isNull();
|
||||||
|
|
||||||
// Check playback queue for a frame
|
// Check playback queue for a frame
|
||||||
if (IsPlaying()) {
|
if (IsPlaying()) {
|
||||||
@@ -433,24 +457,24 @@ void ViewerWidget::UpdateTextureFromNode(const rational& time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only show warning if frame actually exists
|
// Only show warning if frame actually exists
|
||||||
if (frame_exists_at_time) {
|
if (frame_exists_at_time && !frame_might_be_still) {
|
||||||
qWarning() << "Playback queue failed to keep up";
|
qWarning() << "Playback queue failed to keep up";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!frame_exists_at_time) {
|
if (frame_exists_at_time || frame_might_be_still) {
|
||||||
|
// Frame was not in queue, will require rendering or decoding from cache
|
||||||
|
RenderTicketWatcher* watcher = new RenderTicketWatcher();
|
||||||
|
connect(watcher, &RenderTicketWatcher::Finished, this, &ViewerWidget::RendererGeneratedFrame);
|
||||||
|
nonqueue_watchers_.append(watcher);
|
||||||
|
watcher->SetTicket(GetFrame(time, true));
|
||||||
|
} else {
|
||||||
// There is definitely no frame here, we can immediately flip to showing nothing
|
// There is definitely no frame here, we can immediately flip to showing nothing
|
||||||
nonqueue_watchers_.clear();
|
nonqueue_watchers_.clear();
|
||||||
SetDisplayImage(nullptr, false);
|
SetDisplayImage(nullptr, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frame was not in queue, will require rendering or decoding from cache
|
|
||||||
RenderTicketWatcher* watcher = new RenderTicketWatcher();
|
|
||||||
connect(watcher, &RenderTicketWatcher::Finished, this, &ViewerWidget::RendererGeneratedFrame);
|
|
||||||
nonqueue_watchers_.append(watcher);
|
|
||||||
watcher->SetTicket(GetFrame(time, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerWidget::PlayInternal(int speed, bool in_to_out_only)
|
void ViewerWidget::PlayInternal(int speed, bool in_to_out_only)
|
||||||
@@ -527,6 +551,7 @@ void ViewerWidget::PauseInternal()
|
|||||||
|
|
||||||
playback_queue_.clear();
|
playback_queue_.clear();
|
||||||
playback_backup_timer_.stop();
|
playback_backup_timer_.stop();
|
||||||
|
audio_restart_timer_.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
prequeuing_ = false;
|
prequeuing_ = false;
|
||||||
@@ -593,9 +618,7 @@ QString ViewerWidget::GetCachedFilenameFromTime(const rational &time)
|
|||||||
|
|
||||||
bool ViewerWidget::FrameExistsAtTime(const rational &time)
|
bool ViewerWidget::FrameExistsAtTime(const rational &time)
|
||||||
{
|
{
|
||||||
return GetConnectedNode()
|
return GetConnectedNode() && time >= 0 && time < GetConnectedNode()->GetVideoLength();
|
||||||
&& ((time >= 0 && time < GetConnectedNode()->video_frame_cache()->GetLength())
|
|
||||||
|| GetConnectedNode()->video_frame_cache()->GetLength().isNull());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerWidget::SetDisplayImage(FramePtr frame, bool main_only)
|
void ViewerWidget::SetDisplayImage(FramePtr frame, bool main_only)
|
||||||
@@ -650,13 +673,7 @@ void ViewerWidget::FinishPlayPreprocess()
|
|||||||
{
|
{
|
||||||
int64_t playback_start_time = ruler()->GetTime();
|
int64_t playback_start_time = ruler()->GetTime();
|
||||||
|
|
||||||
AudioPlaybackCache* audio_cache = GetConnectedNode()->audio_playback_cache();
|
StartAudioOutput();
|
||||||
if (audio_cache->GetParameters().is_valid()) {
|
|
||||||
AudioManager::instance()->SetOutputParams(audio_cache->GetParameters());
|
|
||||||
AudioManager::instance()->StartOutput(audio_cache,
|
|
||||||
audio_cache->GetParameters().time_to_bytes(GetTime()),
|
|
||||||
playback_speed_);
|
|
||||||
}
|
|
||||||
|
|
||||||
playback_timer_.Start(playback_start_time, playback_speed_, timebase_dbl());
|
playback_timer_.Start(playback_start_time, playback_speed_, timebase_dbl());
|
||||||
display_widget_->ResetFPSTimer();
|
display_widget_->ResetFPSTimer();
|
||||||
@@ -1263,4 +1280,21 @@ void ViewerWidget::Dropped(QDropEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewerWidget::AudioCacheInvalidated()
|
||||||
|
{
|
||||||
|
if (IsPlaying()) {
|
||||||
|
AudioManager::instance()->StopOutput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewerWidget::AudioCacheValidated()
|
||||||
|
{
|
||||||
|
if (IsPlaying()) {
|
||||||
|
// This timer will restart audio
|
||||||
|
AudioManager::instance()->StopOutput();
|
||||||
|
audio_restart_timer_.stop();
|
||||||
|
audio_restart_timer_.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,6 +245,8 @@ private:
|
|||||||
|
|
||||||
PreviewAutoCacher auto_cacher_;
|
PreviewAutoCacher auto_cacher_;
|
||||||
|
|
||||||
|
QTimer audio_restart_timer_;
|
||||||
|
|
||||||
static QVector<ViewerWidget*> instances_;
|
static QVector<ViewerWidget*> instances_;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -292,6 +294,11 @@ private slots:
|
|||||||
|
|
||||||
void Dropped(QDropEvent* event);
|
void Dropped(QDropEvent* event);
|
||||||
|
|
||||||
|
void AudioCacheInvalidated();
|
||||||
|
void AudioCacheValidated();
|
||||||
|
|
||||||
|
void StartAudioOutput();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent) :
|
|||||||
hand_dragging_(false),
|
hand_dragging_(false),
|
||||||
deinterlace_(false),
|
deinterlace_(false),
|
||||||
show_fps_(false),
|
show_fps_(false),
|
||||||
frames_skipped_(0)
|
frames_skipped_(0),
|
||||||
|
show_widget_background_(false)
|
||||||
{
|
{
|
||||||
connect(Core::instance(), &Core::ToolChanged, this, &ViewerDisplayWidget::UpdateCursor);
|
connect(Core::instance(), &Core::ToolChanged, this, &ViewerDisplayWidget::UpdateCursor);
|
||||||
|
|
||||||
@@ -301,7 +302,7 @@ void ViewerDisplayWidget::dropEvent(QDropEvent *event)
|
|||||||
void ViewerDisplayWidget::OnPaint()
|
void ViewerDisplayWidget::OnPaint()
|
||||||
{
|
{
|
||||||
// Clear background to empty
|
// Clear background to empty
|
||||||
QColor bg_color = palette().window().color();
|
QColor bg_color = show_widget_background_ ? palette().window().color() : Qt::black;
|
||||||
renderer()->ClearDestination(bg_color.redF(), bg_color.greenF(), bg_color.blueF());
|
renderer()->ClearDestination(bg_color.redF(), bg_color.greenF(), bg_color.blueF());
|
||||||
|
|
||||||
// We only draw if we have a pipeline
|
// We only draw if we have a pipeline
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ public:
|
|||||||
void SetVideoParams(const VideoParams ¶ms);
|
void SetVideoParams(const VideoParams ¶ms);
|
||||||
void SetTime(const rational& time);
|
void SetTime(const rational& time);
|
||||||
|
|
||||||
|
void SetShowWidgetBackground(bool e)
|
||||||
|
{
|
||||||
|
show_widget_background_ = e;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
FramePtr last_loaded_buffer() const;
|
FramePtr last_loaded_buffer() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,6 +294,8 @@ private:
|
|||||||
QVector<double> frame_rate_averages_;
|
QVector<double> frame_rate_averages_;
|
||||||
int frame_rate_average_count_;
|
int frame_rate_average_count_;
|
||||||
|
|
||||||
|
bool show_widget_background_;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void EmitColorAtCursor(QMouseEvent* e);
|
void EmitColorAtCursor(QMouseEvent* e);
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void MainStatusBar::UpdateStatus()
|
|||||||
if (manager_->GetTaskCount() == 1) {
|
if (manager_->GetTaskCount() == 1) {
|
||||||
showMessage(t->GetTitle());
|
showMessage(t->GetTitle());
|
||||||
} else {
|
} else {
|
||||||
showMessage(tr("Running %1 background task(s)").arg(manager_->GetTaskCount()));
|
showMessage(tr("Running %n background task(s)", nullptr, manager_->GetTaskCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bar_->setVisible(true);
|
bar_->setVisible(true);
|
||||||
|
|||||||
@@ -261,6 +261,27 @@ ScopePanel *MainWindow::AppendScopePanel()
|
|||||||
return AppendFloatingPanelInternal<ScopePanel>(scope_panels_);
|
return AppendFloatingPanelInternal<ScopePanel>(scope_panels_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::OpenNodeInViewer(ViewerOutput *node)
|
||||||
|
{
|
||||||
|
if (viewer_panels_.contains(node)) {
|
||||||
|
// This node already has a viewer, raise it
|
||||||
|
viewer_panels_.value(node)->raise();
|
||||||
|
} else {
|
||||||
|
// Create a viewer for this node
|
||||||
|
ViewerPanel* viewer = PanelManager::instance()->CreatePanel<ViewerPanel>(this);
|
||||||
|
|
||||||
|
viewer->SetSignalInsteadOfClose(true);
|
||||||
|
viewer->setFloating(true);
|
||||||
|
viewer->setVisible(true);
|
||||||
|
viewer->ConnectViewerNode(node);
|
||||||
|
|
||||||
|
connect(viewer, &ViewerPanel::CloseRequested, this, &MainWindow::ViewerCloseRequested);
|
||||||
|
connect(node, &ViewerOutput::RemovedFromGraph, this, &MainWindow::ViewerWithPanelRemovedFromGraph);
|
||||||
|
|
||||||
|
viewer_panels_.insert(node, viewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::SetFullscreen(bool fullscreen)
|
void MainWindow::SetFullscreen(bool fullscreen)
|
||||||
{
|
{
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
@@ -481,6 +502,22 @@ void MainWindow::ProjectCloseRequested()
|
|||||||
Core::instance()->CloseProject(p, true);
|
Core::instance()->CloseProject(p, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::ViewerCloseRequested()
|
||||||
|
{
|
||||||
|
ViewerPanel* panel = static_cast<ViewerPanel*>(sender());
|
||||||
|
|
||||||
|
viewer_panels_.remove(viewer_panels_.key(panel));
|
||||||
|
|
||||||
|
panel->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ViewerWithPanelRemovedFromGraph()
|
||||||
|
{
|
||||||
|
ViewerOutput* vo = static_cast<ViewerOutput*>(sender());
|
||||||
|
viewer_panels_.take(vo)->deleteLater();
|
||||||
|
disconnect(vo, &ViewerOutput::RemovedFromGraph, this, &MainWindow::ViewerWithPanelRemovedFromGraph);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::FloatingPanelCloseRequested()
|
void MainWindow::FloatingPanelCloseRequested()
|
||||||
{
|
{
|
||||||
PanelWidget* panel = static_cast<PanelWidget*>(sender());
|
PanelWidget* panel = static_cast<PanelWidget*>(sender());
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public:
|
|||||||
|
|
||||||
ScopePanel* AppendScopePanel();
|
ScopePanel* AppendScopePanel();
|
||||||
|
|
||||||
|
void OpenNodeInViewer(ViewerOutput* node);
|
||||||
|
|
||||||
enum ProgressStatus {
|
enum ProgressStatus {
|
||||||
kProgressNone,
|
kProgressNone,
|
||||||
kProgressShow,
|
kProgressShow,
|
||||||
@@ -155,6 +157,7 @@ private:
|
|||||||
PixelSamplerPanel* pixel_sampler_panel_;
|
PixelSamplerPanel* pixel_sampler_panel_;
|
||||||
QList<ScopePanel*> scope_panels_;
|
QList<ScopePanel*> scope_panels_;
|
||||||
NodeTablePanel* table_panel_;
|
NodeTablePanel* table_panel_;
|
||||||
|
QMap<ViewerOutput*, ViewerPanel*> viewer_panels_;
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
unsigned int taskbar_btn_id_;
|
unsigned int taskbar_btn_id_;
|
||||||
@@ -173,6 +176,10 @@ private slots:
|
|||||||
|
|
||||||
void ProjectCloseRequested();
|
void ProjectCloseRequested();
|
||||||
|
|
||||||
|
void ViewerCloseRequested();
|
||||||
|
|
||||||
|
void ViewerWithPanelRemovedFromGraph();
|
||||||
|
|
||||||
void FloatingPanelCloseRequested();
|
void FloatingPanelCloseRequested();
|
||||||
|
|
||||||
void StatusBarDoubleClicked();
|
void StatusBarDoubleClicked();
|
||||||
|
|||||||
Reference in New Issue
Block a user