rewrite nearly complete
This commit is contained in:
+6
-7
@@ -69,7 +69,7 @@ QAudioDeviceInfo get_audio_device(QAudio::Mode mode) {
|
||||
QList<QAudioDeviceInfo> devs = QAudioDeviceInfo::availableDevices(mode);
|
||||
|
||||
// try to retrieve preferred device from config
|
||||
QString preferred_device = (mode == QAudio::AudioOutput) ? olive::CurrentConfig.preferred_audio_output : olive::CurrentConfig.preferred_audio_input;
|
||||
QString preferred_device = (mode == QAudio::AudioOutput) ? olive::config.preferred_audio_output : olive::config.preferred_audio_input;
|
||||
if (!preferred_device.isEmpty()) {
|
||||
for (int i=0;i<devs.size();i++) {
|
||||
// try to match available devices with preferred device
|
||||
@@ -98,7 +98,7 @@ void init_audio() {
|
||||
stop_audio();
|
||||
|
||||
QAudioFormat audio_format;
|
||||
audio_format.setSampleRate(olive::CurrentConfig.audio_rate);
|
||||
audio_format.setSampleRate(olive::config.audio_rate);
|
||||
audio_format.setChannelCount(2);
|
||||
audio_format.setSampleSize(16);
|
||||
audio_format.setCodec("audio/pcm");
|
||||
@@ -232,7 +232,7 @@ int AudioSenderThread::send_audio_to_output(qint64 offset, int max) {
|
||||
averages[i] = log_volume(1.0-(averages[i]));
|
||||
}
|
||||
|
||||
panel_timeline->audio_monitor->set_value(averages);
|
||||
panel_timeline.first()->audio_monitor->set_value(averages);
|
||||
}
|
||||
|
||||
memset(audio_ibuffer+offset, 0, actual_write);
|
||||
@@ -324,8 +324,7 @@ void write_wave_trailer(QFile& f) {
|
||||
}
|
||||
|
||||
bool start_recording() {
|
||||
if (olive::ActiveSequence == nullptr) {
|
||||
qCritical() << "No active sequence to record into";
|
||||
if (!olive::Global->CheckForActiveSequence(true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -355,8 +354,8 @@ bool start_recording() {
|
||||
}
|
||||
|
||||
QAudioFormat audio_format = audio_output->format();
|
||||
if (olive::CurrentConfig.recording_mode != audio_format.channelCount()) {
|
||||
audio_format.setChannelCount(olive::CurrentConfig.recording_mode);
|
||||
if (olive::config.recording_mode != audio_format.channelCount()) {
|
||||
audio_format.setChannelCount(olive::config.recording_mode);
|
||||
}
|
||||
|
||||
QAudioDeviceInfo info = get_audio_device(QAudio::AudioInput);
|
||||
|
||||
+32
-31
@@ -65,8 +65,8 @@ void apply_audio_effects(Clip* clip, double timecode_start, AVFrame* frame, int
|
||||
}
|
||||
if (clip->opening_transition != nullptr) {
|
||||
if (clip->media() != nullptr && clip->media()->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
double transition_start = (clip->clip_in(true) / clip->sequence->frame_rate);
|
||||
double transition_end = (clip->clip_in(true) + clip->opening_transition->get_length()) / clip->sequence->frame_rate;
|
||||
double transition_start = (clip->clip_in(true) / clip->track()->sequence()->frame_rate);
|
||||
double transition_end = (clip->clip_in(true) + clip->opening_transition->get_length()) / clip->track()->sequence()->frame_rate;
|
||||
if (timecode_end < transition_end) {
|
||||
double adjustment = transition_end - transition_start;
|
||||
double adjusted_range_start = (timecode_start - transition_start) / adjustment;
|
||||
@@ -78,8 +78,8 @@ void apply_audio_effects(Clip* clip, double timecode_start, AVFrame* frame, int
|
||||
if (clip->closing_transition != nullptr) {
|
||||
if (clip->media() != nullptr && clip->media()->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
long length_with_transitions = clip->timeline_out(true) - clip->timeline_in(true);
|
||||
double transition_start = (clip->clip_in(true) + length_with_transitions - clip->closing_transition->get_length()) / clip->sequence->frame_rate;
|
||||
double transition_end = (clip->clip_in(true) + length_with_transitions) / clip->sequence->frame_rate;
|
||||
double transition_start = (clip->clip_in(true) + length_with_transitions - clip->closing_transition->get_length()) / clip->track()->sequence()->frame_rate;
|
||||
double transition_end = (clip->clip_in(true) + length_with_transitions) / clip->track()->sequence()->frame_rate;
|
||||
if (timecode_start > transition_start) {
|
||||
double adjustment = transition_end - transition_start;
|
||||
double adjusted_range_start = (timecode_start - transition_start) / adjustment;
|
||||
@@ -93,7 +93,7 @@ void apply_audio_effects(Clip* clip, double timecode_start, AVFrame* frame, int
|
||||
Clip* next_nest = nests.last();
|
||||
nests.removeLast();
|
||||
apply_audio_effects(next_nest,
|
||||
timecode_start + (double(clip->timeline_in(true)-clip->clip_in(true))/clip->sequence->frame_rate),
|
||||
timecode_start + (double(clip->timeline_in(true)-clip->clip_in(true))/clip->track()->sequence()->frame_rate),
|
||||
frame,
|
||||
nb_bytes,
|
||||
nests);
|
||||
@@ -122,16 +122,16 @@ void Cacher::CacheAudioWorker() {
|
||||
bool reverse_audio = IsReversed();
|
||||
|
||||
long frame_skip = 0;
|
||||
double last_fr = clip->sequence->frame_rate;
|
||||
double last_fr = clip->track()->sequence()->frame_rate;
|
||||
if (!nests_.isEmpty()) {
|
||||
for (int i=nests_.size()-1;i>=0;i--) {
|
||||
timeline_in = rescale_frame_number(timeline_in, last_fr, nests_.at(i)->sequence->frame_rate) + nests_.at(i)->timeline_in(true) - nests_.at(i)->clip_in(true);
|
||||
timeline_out = rescale_frame_number(timeline_out, last_fr, nests_.at(i)->sequence->frame_rate) + nests_.at(i)->timeline_in(true) - nests_.at(i)->clip_in(true);
|
||||
target_frame = rescale_frame_number(target_frame, last_fr, nests_.at(i)->sequence->frame_rate) + nests_.at(i)->timeline_in(true) - nests_.at(i)->clip_in(true);
|
||||
timeline_in = rescale_frame_number(timeline_in, last_fr, nests_.at(i)->track()->sequence()->frame_rate) + nests_.at(i)->timeline_in(true) - nests_.at(i)->clip_in(true);
|
||||
timeline_out = rescale_frame_number(timeline_out, last_fr, nests_.at(i)->track()->sequence()->frame_rate) + nests_.at(i)->timeline_in(true) - nests_.at(i)->clip_in(true);
|
||||
target_frame = rescale_frame_number(target_frame, last_fr, nests_.at(i)->track()->sequence()->frame_rate) + nests_.at(i)->timeline_in(true) - nests_.at(i)->clip_in(true);
|
||||
|
||||
timeline_out = qMin(timeline_out, nests_.at(i)->timeline_out(true));
|
||||
|
||||
frame_skip = rescale_frame_number(frame_skip, last_fr, nests_.at(i)->sequence->frame_rate);
|
||||
frame_skip = rescale_frame_number(frame_skip, last_fr, nests_.at(i)->track()->sequence()->frame_rate);
|
||||
|
||||
long validator = nests_.at(i)->timeline_in(true) - timeline_in;
|
||||
if (validator > 0) {
|
||||
@@ -139,12 +139,13 @@ void Cacher::CacheAudioWorker() {
|
||||
//timeline_in = nests_.at(i)->timeline_in(true);
|
||||
}
|
||||
|
||||
last_fr = nests_.at(i)->sequence->frame_rate;
|
||||
last_fr = nests_.at(i)->track()->sequence()->frame_rate;
|
||||
}
|
||||
}
|
||||
|
||||
if (temp_reverse) {
|
||||
long seq_end = olive::ActiveSequence->GetEndFrame();
|
||||
// FIXME breakable?
|
||||
long seq_end = Timeline::GetTopSequence()->GetEndFrame();
|
||||
timeline_in = seq_end - timeline_in;
|
||||
timeline_out = seq_end - timeline_out;
|
||||
target_frame = seq_end - target_frame;
|
||||
@@ -394,7 +395,7 @@ void Cacher::CacheAudioWorker() {
|
||||
// apply any audio effects to the data
|
||||
if (nb_bytes == INT_MAX) nb_bytes = frame->nb_samples * av_get_bytes_per_sample(static_cast<AVSampleFormat>(frame->format)) * frame->channels;
|
||||
if (new_frame) {
|
||||
apply_audio_effects(clip, bytes_to_seconds(audio_buffer_write, 2, current_audio_freq()) + audio_ibuffer_timecode + ((double)clip->clip_in(true)/clip->sequence->frame_rate) - ((double)timeline_in/last_fr), frame, nb_bytes, nests_);
|
||||
apply_audio_effects(clip, bytes_to_seconds(audio_buffer_write, 2, current_audio_freq()) + audio_ibuffer_timecode + ((double)clip->clip_in(true)/clip->track()->sequence()->frame_rate) - ((double)timeline_in/last_fr), frame, nb_bytes, nests_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +403,7 @@ void Cacher::CacheAudioWorker() {
|
||||
if (frame->nb_samples == 0) {
|
||||
break;
|
||||
} else {
|
||||
qint64 buffer_timeline_out = get_buffer_offset_from_frame(clip->sequence->frame_rate, timeline_out);
|
||||
qint64 buffer_timeline_out = get_buffer_offset_from_frame(clip->track()->sequence()->frame_rate, timeline_out);
|
||||
|
||||
audio_write_lock.lock();
|
||||
|
||||
@@ -597,15 +598,15 @@ void Cacher::CacheVideoWorker() {
|
||||
// For reversed playback, we flip the queue stats as "upcoming" frames are going to be played before the "previous"
|
||||
// frames now
|
||||
if (reversed) {
|
||||
previous_queue_type = olive::CurrentConfig.upcoming_queue_type;
|
||||
previous_queue_size = olive::CurrentConfig.upcoming_queue_size;
|
||||
upcoming_queue_type = olive::CurrentConfig.previous_queue_type;
|
||||
upcoming_queue_size = olive::CurrentConfig.previous_queue_size;
|
||||
previous_queue_type = olive::config.upcoming_queue_type;
|
||||
previous_queue_size = olive::config.upcoming_queue_size;
|
||||
upcoming_queue_type = olive::config.previous_queue_type;
|
||||
upcoming_queue_size = olive::config.previous_queue_size;
|
||||
} else {
|
||||
previous_queue_type = olive::CurrentConfig.previous_queue_type;
|
||||
previous_queue_size = olive::CurrentConfig.previous_queue_size;
|
||||
upcoming_queue_type = olive::CurrentConfig.upcoming_queue_type;
|
||||
upcoming_queue_size = olive::CurrentConfig.upcoming_queue_size;
|
||||
previous_queue_type = olive::config.previous_queue_type;
|
||||
previous_queue_size = olive::config.previous_queue_size;
|
||||
upcoming_queue_type = olive::config.upcoming_queue_type;
|
||||
upcoming_queue_size = olive::config.upcoming_queue_size;
|
||||
}
|
||||
|
||||
// Determine "previous" queue statistics
|
||||
@@ -794,7 +795,7 @@ void Cacher::CacheVideoWorker() {
|
||||
void Cacher::Reset() {
|
||||
// if we seek to a whole other place in the timeline, we'll need to reset the cache with new values
|
||||
if (clip->media() == nullptr) {
|
||||
if (clip->track() >= 0) {
|
||||
if (clip->type() == Track::kTypeAudio) {
|
||||
// a null-media audio clip is usually an auto-generated sound clip such as Tone or Noise
|
||||
reached_end = false;
|
||||
audio_target_frame = playhead_;
|
||||
@@ -860,7 +861,7 @@ Cacher::Cacher(Clip* c) :
|
||||
|
||||
void Cacher::OpenWorker() {
|
||||
// set some defaults for the audio cacher
|
||||
if (clip->track() >= 0) {
|
||||
if (clip->type() == Track::kTypeAudio) {
|
||||
audio_reset_ = false;
|
||||
frame_sample_index_ = -1;
|
||||
audio_buffer_write = 0;
|
||||
@@ -868,10 +869,10 @@ void Cacher::OpenWorker() {
|
||||
reached_end = false;
|
||||
|
||||
if (clip->media() == nullptr) {
|
||||
if (clip->track() >= 0) {
|
||||
if (clip->type() == Track::kTypeAudio) {
|
||||
frame_ = av_frame_alloc();
|
||||
frame_->format = kDestSampleFmt;
|
||||
frame_->channel_layout = clip->sequence->audio_layout;
|
||||
frame_->channel_layout = clip->track()->sequence()->audio_layout;
|
||||
frame_->channels = av_get_channel_layout_nb_channels(frame_->channel_layout);
|
||||
frame_->sample_rate = current_audio_freq();
|
||||
frame_->nb_samples = 2048;
|
||||
@@ -889,7 +890,7 @@ void Cacher::OpenWorker() {
|
||||
QByteArray ba;
|
||||
|
||||
// do we have a proxy?
|
||||
if ((!olive::Global->is_exporting() || !olive::CurrentConfig.dont_use_proxies_on_export)
|
||||
if ((!olive::Global->is_exporting() || !olive::config.dont_use_proxies_on_export)
|
||||
&& m->proxy
|
||||
&& !m->proxy_path.isEmpty()
|
||||
&& QFileInfo::exists(m->proxy_path)) {
|
||||
@@ -1029,8 +1030,8 @@ void Cacher::OpenWorker() {
|
||||
|
||||
reverse_frame->format = kDestSampleFmt;
|
||||
reverse_frame->nb_samples = current_audio_freq()*10;
|
||||
reverse_frame->channel_layout = clip->sequence->audio_layout;
|
||||
reverse_frame->channels = av_get_channel_layout_nb_channels(clip->sequence->audio_layout);
|
||||
reverse_frame->channel_layout = clip->track()->sequence()->audio_layout;
|
||||
reverse_frame->channels = av_get_channel_layout_nb_channels(clip->track()->sequence()->audio_layout);
|
||||
av_frame_get_buffer(reverse_frame, 0);
|
||||
|
||||
queue_.append(reverse_frame);
|
||||
@@ -1116,7 +1117,7 @@ void Cacher::OpenWorker() {
|
||||
}
|
||||
|
||||
void Cacher::CacheWorker() {
|
||||
if (clip->track() < 0) {
|
||||
if (clip->type() == Track::kTypeVideo) {
|
||||
// clip is a video track, start caching video
|
||||
CacheVideoWorker();
|
||||
} else {
|
||||
@@ -1207,7 +1208,7 @@ void Cacher::Open()
|
||||
caching_ = true;
|
||||
queued_ = false;
|
||||
|
||||
start((clip->track() < 0) ? QThread::HighPriority : QThread::TimeCriticalPriority);
|
||||
start((clip->type() == Track::kTypeVideo) ? QThread::HighPriority : QThread::TimeCriticalPriority);
|
||||
}
|
||||
|
||||
void Cacher::Cache(long playhead, bool scrubbing, QVector<Clip*>& nests, int playback_speed)
|
||||
|
||||
+12
-13
@@ -34,7 +34,6 @@ extern "C" {
|
||||
#include <QtMath>
|
||||
|
||||
#include "global/global.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "panels/panels.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "rendering/renderthread.h"
|
||||
@@ -192,16 +191,16 @@ bool ExportThread::SetupVideo() {
|
||||
video_frame = av_frame_alloc();
|
||||
av_frame_make_writable(video_frame);
|
||||
video_frame->format = AV_PIX_FMT_RGBA;
|
||||
video_frame->width = olive::ActiveSequence->width;
|
||||
video_frame->height = olive::ActiveSequence->height;
|
||||
video_frame->width = params_.sequence->width;
|
||||
video_frame->height = params_.sequence->height;
|
||||
av_frame_get_buffer(video_frame, 0);
|
||||
|
||||
av_init_packet(&video_pkt);
|
||||
|
||||
// Set up conversion context
|
||||
sws_ctx = sws_getContext(
|
||||
olive::ActiveSequence->width,
|
||||
olive::ActiveSequence->height,
|
||||
params_.sequence->width,
|
||||
params_.sequence->height,
|
||||
AV_PIX_FMT_RGBA,
|
||||
params_.video_width,
|
||||
params_.video_height,
|
||||
@@ -288,7 +287,7 @@ bool ExportThread::SetupAudio() {
|
||||
acodec_ctx->channel_layout,
|
||||
acodec_ctx->sample_fmt,
|
||||
acodec_ctx->sample_rate,
|
||||
olive::ActiveSequence->audio_layout,
|
||||
params_.sequence->audio_layout,
|
||||
AV_SAMPLE_FMT_S16,
|
||||
acodec_ctx->sample_rate,
|
||||
0,
|
||||
@@ -417,7 +416,7 @@ void ExportThread::Export()
|
||||
mutex.lock();
|
||||
|
||||
// Loop from now (set to the beginning frame earlier) to the end of the frame
|
||||
while (olive::ActiveSequence->playhead <= params_.end_frame && !interrupt_) {
|
||||
while (params_.sequence->playhead <= params_.end_frame && !interrupt_) {
|
||||
|
||||
// Start timing how long this frame will take
|
||||
frame_start_time = QDateTime::currentMSecsSinceEpoch();
|
||||
@@ -426,14 +425,14 @@ void ExportThread::Export()
|
||||
if (params_.audio_enabled) {
|
||||
waiting_for_audio_ = true;
|
||||
SetAudioWakeObject(this);
|
||||
olive::rendering::compose_audio(nullptr, olive::ActiveSequence.get(), 1, true);
|
||||
olive::rendering::compose_audio(nullptr, params_.sequence, 1, true);
|
||||
}
|
||||
|
||||
// If we're exporting video, trigger a render on the RenderThread
|
||||
if (params_.video_enabled) {
|
||||
do {
|
||||
// TODO optimize by rendering the next frame while encoding the last
|
||||
renderer->start_render(nullptr, olive::ActiveSequence.get(), 1, nullptr, video_frame->data[0], video_frame->linesize[0]/4);
|
||||
renderer->start_render(nullptr, params_.sequence, 1, nullptr, video_frame->data[0], video_frame->linesize[0]/4);
|
||||
|
||||
// Wait for RenderThread to return
|
||||
waitCond.wait(&mutex);
|
||||
@@ -452,7 +451,7 @@ void ExportThread::Export()
|
||||
}
|
||||
|
||||
// Get the current sequence playhead in seconds (used for timestamp calculations later on)
|
||||
double timecode_secs = double(olive::ActiveSequence->playhead - params_.start_frame) / olive::ActiveSequence->frame_rate;
|
||||
double timecode_secs = double(params_.sequence->playhead - params_.start_frame) / params_.sequence->frame_rate;
|
||||
|
||||
// If we're exporting video, construct an AVFrame in the destination codec's pixel format to convert the raw RGBA
|
||||
// OpenGL buffer to
|
||||
@@ -538,15 +537,15 @@ void ExportThread::Export()
|
||||
// Generating encoding statistics (e.g. the time it took to encode this frame/estimated remaining time)
|
||||
frame_time = (QDateTime::currentMSecsSinceEpoch()-frame_start_time);
|
||||
total_time += frame_time;
|
||||
remaining_frames = (params_.end_frame - olive::ActiveSequence->playhead);
|
||||
remaining_frames = (params_.end_frame - params_.sequence->playhead);
|
||||
avg_time = (total_time/frame_count);
|
||||
eta = (remaining_frames*avg_time);
|
||||
|
||||
// Emit a signal for the percent of the sequence that's been encoded so far
|
||||
emit ProgressChanged(qRound((double(olive::ActiveSequence->playhead - params_.start_frame) / double(params_.end_frame - params_.start_frame)) * 100.0), eta);
|
||||
emit ProgressChanged(qRound((double(params_.sequence->playhead - params_.start_frame) / double(params_.end_frame - params_.start_frame)) * 100.0), eta);
|
||||
|
||||
// Increment sequence playhead
|
||||
olive::ActiveSequence->playhead++;
|
||||
params_.sequence->playhead++;
|
||||
|
||||
// Increment frame count (used for generating encoding statistics above)
|
||||
frame_count++;
|
||||
|
||||
@@ -21,11 +21,17 @@
|
||||
#ifndef EXPORTTHREAD_H
|
||||
#define EXPORTTHREAD_H
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
#include <QThread>
|
||||
#include <QOffscreenSurface>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include "timeline/sequence.h"
|
||||
|
||||
struct AVFormatContext;
|
||||
struct AVCodecContext;
|
||||
struct AVFrame;
|
||||
@@ -35,19 +41,19 @@ struct AVCodec;
|
||||
struct SwsContext;
|
||||
struct SwrContext;
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
#define COMPRESSION_TYPE_CBR 0
|
||||
#define COMPRESSION_TYPE_CFR 1
|
||||
#define COMPRESSION_TYPE_TARGETSIZE 2
|
||||
#define COMPRESSION_TYPE_TARGETBR 3
|
||||
enum CompressionType {
|
||||
COMPRESSION_TYPE_CBR,
|
||||
COMPRESSION_TYPE_CFR,
|
||||
COMPRESSION_TYPE_TARGETSIZE,
|
||||
COMPRESSION_TYPE_TARGETBR
|
||||
};
|
||||
|
||||
// structs that store parameters passed from the export dialogs to this thread
|
||||
|
||||
struct ExportParams {
|
||||
|
||||
// export parameters
|
||||
Sequence* sequence;
|
||||
QString filename;
|
||||
bool video_enabled;
|
||||
int video_codec;
|
||||
|
||||
@@ -68,8 +68,8 @@ void FramebufferObject::Create(QOpenGLContext *ctx, int width, int height)
|
||||
|
||||
// allocate storage for texture
|
||||
const olive::PixelFormatInfo& bit_depth = olive::pixel_formats.at(olive::Global->is_exporting() ?
|
||||
olive::CurrentConfig.export_bit_depth :
|
||||
olive::CurrentConfig.playback_bit_depth);
|
||||
olive::config.export_bit_depth :
|
||||
olive::config.playback_bit_depth);
|
||||
|
||||
ctx->functions()->glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
|
||||
@@ -187,7 +187,7 @@ void process_effect(QOpenGLContext* ctx,
|
||||
if (e->Flags() & Effect::CoordsFlag) {
|
||||
e->process_coords(timecode, coords, data);
|
||||
}
|
||||
bool can_process_shaders = ((e->Flags() & Effect::ShaderFlag) && olive::CurrentRuntimeConfig.shaders_are_enabled);
|
||||
bool can_process_shaders = ((e->Flags() & Effect::ShaderFlag) && olive::runtime_config.shaders_are_enabled);
|
||||
if (can_process_shaders || (e->Flags() & Effect::SuperimposeFlag)) {
|
||||
|
||||
if (!e->is_open()) {
|
||||
@@ -227,7 +227,7 @@ void process_effect(QOpenGLContext* ctx,
|
||||
}
|
||||
|
||||
GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
GLuint final_fbo = params.video ? params.main_buffer->buffer() : 0;
|
||||
GLuint final_fbo = params.type == Track::kTypeVideo ? params.main_buffer->buffer() : 0;
|
||||
|
||||
Sequence* s = params.seq;
|
||||
long playhead = s->playhead;
|
||||
@@ -237,10 +237,10 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
for (int i=0;i<params.nests.size();i++) {
|
||||
s = params.nests.at(i)->media()->to_sequence().get();
|
||||
playhead += params.nests.at(i)->clip_in(true) - params.nests.at(i)->timeline_in(true);
|
||||
playhead = rescale_frame_number(playhead, params.nests.at(i)->sequence->frame_rate, s->frame_rate);
|
||||
playhead = rescale_frame_number(playhead, params.nests.at(i)->track()->sequence()->frame_rate, s->frame_rate);
|
||||
}
|
||||
|
||||
if (params.video && !params.nests.last()->fbo.isEmpty()) {
|
||||
if (params.type == Track::kTypeVideo && !params.nests.last()->fbo.isEmpty()) {
|
||||
params.nests.last()->fbo.at(0).BindBuffer();
|
||||
params.ctx->functions()->glClear(GL_COLOR_BUFFER_BIT);
|
||||
final_fbo = params.nests.last()->fbo.at(0).buffer();
|
||||
@@ -253,14 +253,15 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
QVector<Clip*> current_clips;
|
||||
|
||||
// loop through clips, find currently active, and sort by track
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
QVector<Clip*> sequence_clips = s->GetAllClips();
|
||||
for (int i=0;i<sequence_clips.size();i++) {
|
||||
|
||||
Clip* c = s->clips.at(i).get();
|
||||
Clip* c = sequence_clips.at(i);
|
||||
|
||||
if (c != nullptr) {
|
||||
|
||||
// if clip is video and we're processing video
|
||||
if ((c->track() < 0) == params.video) {
|
||||
if (c->type() == params.type) {
|
||||
|
||||
bool clip_is_active = false;
|
||||
|
||||
@@ -269,7 +270,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
Footage* m = c->media()->to_footage();
|
||||
|
||||
// does the clip have a valid media source?
|
||||
if (!m->invalid && !(c->track() >= 0 && !is_audio_device_set())) {
|
||||
if (!m->invalid && !(c->type() == Track::kTypeAudio && !is_audio_device_set())) {
|
||||
|
||||
// is the media process and ready?
|
||||
if (m->ready) {
|
||||
@@ -286,7 +287,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
clip_is_active = true;
|
||||
|
||||
// increment audio track count
|
||||
if (c->track() >= 0) audio_track_count++;
|
||||
if (c->type() == Track::kTypeAudio) audio_track_count++;
|
||||
|
||||
} else if (c->IsOpen()) {
|
||||
|
||||
@@ -320,7 +321,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
// track sorting is only necessary for video clips
|
||||
// audio clips are mixed equally, so we skip sorting for those
|
||||
if (params.video) {
|
||||
if (params.type == Track::kTypeVideo) {
|
||||
|
||||
// insertion sort by track
|
||||
for (int j=0;j<current_clips.size();j++) {
|
||||
@@ -343,7 +344,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
QMatrix4x4 projection;
|
||||
|
||||
if (params.video) {
|
||||
if (params.type == Track::kTypeVideo) {
|
||||
// set default coordinates based on the sequence, with 0 in the direct center
|
||||
|
||||
params.ctx->functions()->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -444,7 +445,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
} else if (c->media()->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
|
||||
// Convert frame from source to linear colorspace
|
||||
if (olive::CurrentConfig.enable_color_management)
|
||||
if (olive::config.enable_color_management)
|
||||
{
|
||||
|
||||
// Convert texture to sequence's internal format
|
||||
@@ -794,7 +795,7 @@ void olive::rendering::compose_audio(Viewer* viewer, Sequence* seq, int playback
|
||||
params.viewer = viewer;
|
||||
params.ctx = nullptr;
|
||||
params.seq = seq;
|
||||
params.video = false;
|
||||
params.type = Track::kTypeAudio;
|
||||
params.gizmos = nullptr;
|
||||
params.wait_for_mutexes = wait_for_mutexes;
|
||||
params.playback_speed = playback_speed;
|
||||
|
||||
@@ -80,9 +80,9 @@ struct ComposeSequenceParams {
|
||||
/**
|
||||
* @brief Set compose mode to video or audio
|
||||
*
|
||||
* **TRUE** if this function should render video, **FALSE** if this function should render audio.
|
||||
* Accepts Track::kTypeVideo to render video, Track::kTypeAudio if this function should render audio.
|
||||
*/
|
||||
bool video;
|
||||
Track::Type type;
|
||||
|
||||
/**
|
||||
* @brief Set to the Effect whose gizmos were chosen to be drawn on screen
|
||||
|
||||
@@ -116,7 +116,7 @@ void RenderThread::run() {
|
||||
}
|
||||
|
||||
// If there's no OpenColorIO shader or the configuration has changed, (re-)create it now
|
||||
if (olive::CurrentConfig.enable_color_management && ocio_shader == nullptr) {
|
||||
if (olive::config.enable_color_management && ocio_shader == nullptr) {
|
||||
destroy_ocio();
|
||||
|
||||
set_up_ocio();
|
||||
@@ -155,12 +155,12 @@ void RenderThread::set_up_ocio()
|
||||
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
|
||||
|
||||
// Get current OCIO display from Config (or defaults if there is no setting)
|
||||
QString display = olive::CurrentConfig.ocio_display;
|
||||
QString display = olive::config.ocio_display;
|
||||
if (display.isEmpty()) {
|
||||
display = config->getDefaultDisplay();
|
||||
}
|
||||
|
||||
QString view = olive::CurrentConfig.ocio_view;
|
||||
QString view = olive::config.ocio_view;
|
||||
if (view.isEmpty()) {
|
||||
view = config->getDefaultView(display.toUtf8());
|
||||
}
|
||||
@@ -171,8 +171,8 @@ void RenderThread::set_up_ocio()
|
||||
transform->setDisplay(display.toUtf8());
|
||||
transform->setView(view.toUtf8());
|
||||
|
||||
if (!olive::CurrentConfig.ocio_look.isEmpty()) {
|
||||
transform->setLooksOverride(olive::CurrentConfig.ocio_look.toUtf8());
|
||||
if (!olive::config.ocio_look.isEmpty()) {
|
||||
transform->setLooksOverride(olive::config.ocio_look.toUtf8());
|
||||
transform->setLooksOverrideEnabled(true);
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ void RenderThread::paint() {
|
||||
params.viewer = nullptr;
|
||||
params.ctx = ctx;
|
||||
params.seq = seq;
|
||||
params.video = true;
|
||||
params.type = Track::kTypeVideo;
|
||||
params.texture_failed = false;
|
||||
params.wait_for_mutexes = true;
|
||||
params.playback_speed = playback_speed_;
|
||||
@@ -244,7 +244,7 @@ void RenderThread::paint() {
|
||||
// Blit the composite buffer to one of the front buffers
|
||||
|
||||
// If we're color managing, conver the linear composited frame to display color space
|
||||
if (olive::CurrentConfig.enable_color_management && ocio_shader != nullptr) {
|
||||
if (olive::config.enable_color_management && ocio_shader != nullptr) {
|
||||
|
||||
olive::rendering::OCIOBlit(ocio_shader.get(),
|
||||
ocio_lut_texture,
|
||||
|
||||
Reference in New Issue
Block a user