switched global to unique ptr and renamed olive namespace

This commit is contained in:
itsmattkc
2019-02-16 15:08:33 -08:00
parent 3d0a65c70d
commit e063a5ba8f
65 changed files with 860 additions and 860 deletions
+7 -7
View File
@@ -68,7 +68,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::CurrentConfig.preferred_audio_output : olive::CurrentConfig.preferred_audio_input;
if (!preferred_device.isEmpty()) {
for (int i=0;i<devs.size();i++) {
// try to match available devices with preferred device
@@ -97,7 +97,7 @@ void init_audio() {
stop_audio();
QAudioFormat audio_format;
audio_format.setSampleRate(Olive::CurrentConfig.audio_rate);
audio_format.setSampleRate(olive::CurrentConfig.audio_rate);
audio_format.setChannelCount(2);
audio_format.setSampleSize(16);
audio_format.setCodec("audio/pcm");
@@ -152,7 +152,7 @@ void clear_audio_ibuffer() {
}
int current_audio_freq() {
return audio_rendering ? Olive::ActiveSequence->audio_frequency : audio_output->format().sampleRate();
return audio_rendering ? olive::ActiveSequence->audio_frequency : audio_output->format().sampleRate();
}
qint64 get_buffer_offset_from_frame(double framerate, long frame) {
@@ -323,12 +323,12 @@ void write_wave_trailer(QFile& f) {
}
bool start_recording() {
if (Olive::ActiveSequence == nullptr) {
if (olive::ActiveSequence == nullptr) {
qCritical() << "No active sequence to record into";
return false;
}
QString audio_path = QCoreApplication::translate("Audio", "%1 Audio").arg(Olive::ActiveProjectFilename);
QString audio_path = QCoreApplication::translate("Audio", "%1 Audio").arg(olive::ActiveProjectFilename);
QDir audio_dir(audio_path);
if (!audio_dir.exists() && !audio_dir.mkpath(".")) {
qCritical() << "Failed to create audio directory";
@@ -354,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::CurrentConfig.recording_mode != audio_format.channelCount()) {
audio_format.setChannelCount(olive::CurrentConfig.recording_mode);
}
QAudioDeviceInfo info = get_audio_device(QAudio::AudioInput);
+7 -7
View File
@@ -137,7 +137,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests, int play
}
if (temp_reverse) {
long seq_end = Olive::ActiveSequence->getEndFrame();
long seq_end = olive::ActiveSequence->getEndFrame();
timeline_in = seq_end - timeline_in;
timeline_out = seq_end - timeline_out;
target_frame = seq_end - target_frame;
@@ -743,15 +743,15 @@ void open_clip_worker(Clip* clip) {
clip->max_queue_size = 1;
} else {
clip->max_queue_size = 0;
if (Olive::CurrentConfig.upcoming_queue_type == FRAME_QUEUE_TYPE_FRAMES) {
clip->max_queue_size += qCeil(Olive::CurrentConfig.upcoming_queue_size);
if (olive::CurrentConfig.upcoming_queue_type == FRAME_QUEUE_TYPE_FRAMES) {
clip->max_queue_size += qCeil(olive::CurrentConfig.upcoming_queue_size);
} else {
clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * Olive::CurrentConfig.upcoming_queue_size);
clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * olive::CurrentConfig.upcoming_queue_size);
}
if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) {
clip->max_queue_size += qCeil(Olive::CurrentConfig.previous_queue_size);
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) {
clip->max_queue_size += qCeil(olive::CurrentConfig.previous_queue_size);
} else {
clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * Olive::CurrentConfig.previous_queue_size);
clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * olive::CurrentConfig.previous_queue_size);
}
}
+7 -7
View File
@@ -200,8 +200,8 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
int64_t minimum_ts = target_frame->pts;
int previous_frame_count = 0;
if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) {
minimum_ts -= (second_pts*Olive::CurrentConfig.previous_queue_size);
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) {
minimum_ts -= (second_pts*olive::CurrentConfig.previous_queue_size);
}
//dout << "closest frame was" << closest_frame << "with" << target_frame->pts << "/" << target_pts;
@@ -210,7 +210,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
next_pts = c->queue.at(i)->pts;
}
if (c->queue.at(i) != target_frame && ((c->queue.at(i)->pts > minimum_ts) == c->reverse)) {
if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) {
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) {
//dout << "removed frame at" << i << "because its pts was" << c->queue.at(i)->pts << "compared to" << target_frame->pts;
av_frame_free(&c->queue[i]); // may be a little heavy for the main thread?
c->queue.removeAt(i);
@@ -222,8 +222,8 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
}
}
if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) {
while (previous_frame_count > qCeil(Olive::CurrentConfig.previous_queue_size)) {
if (olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) {
while (previous_frame_count > qCeil(olive::CurrentConfig.previous_queue_size)) {
int smallest = 0;
for (int i=1;i<c->queue.size();i++) {
if (c->queue.at(i)->pts < c->queue.at(smallest)->pts) {
@@ -257,7 +257,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
#ifdef GCF_DEBUG
dout << "GCF ==> RESET" << target_pts << "(" << target_frame->pts << "-" << target_frame->pts+target_frame->pkt_duration << ")";
#endif
if (!Olive::CurrentConfig.fast_seeking) target_frame = nullptr;
if (!olive::CurrentConfig.fast_seeking) target_frame = nullptr;
reset = true;
c->last_invalid_ts = target_pts;
} else {
@@ -453,7 +453,7 @@ bool is_clip_active(Clip* c, long playhead) {
void set_sequence(Sequence* s) {
panel_effect_controls->clear_effects(true);
Olive::ActiveSequence = s;
olive::ActiveSequence = s;
panel_sequence_viewer->set_main_sequence();
panel_timeline->update_sequence();
panel_timeline->setFocus();