commit before undo overhaul
This commit is contained in:
@@ -231,7 +231,7 @@ void ExportDialog::on_formatCombobox_currentIndexChanged(int index)
|
||||
format_acodecs.append(AV_CODEC_ID_OPUS);
|
||||
format_acodecs.append(AV_CODEC_ID_VORBIS);
|
||||
|
||||
default_acodec = AV_CODEC_ID_VORBIS;
|
||||
default_acodec = 1;
|
||||
break;
|
||||
case FORMAT_MOV:
|
||||
format_vcodecs.append(AV_CODEC_ID_QTRLE);
|
||||
@@ -356,6 +356,7 @@ void ExportDialog::on_pushButton_clicked()
|
||||
// ext = "";
|
||||
// ext is determined from codec, but we prevent the switch from going to 'default' here
|
||||
qDebug() << "[INFO] Image export not implemented yet";
|
||||
QMessageBox::information(this, "Image sequence support coming soon", "Sorry, image sequence exporting is currently unsupported. Check back soon (or hound GitHub issue #83).", QMessageBox::Ok);
|
||||
return;
|
||||
break;
|
||||
case FORMAT_MP3:
|
||||
|
||||
+6
-2
@@ -190,8 +190,12 @@ void MainWindow::on_actionTimeline_Track_Lines_toggled(bool e)
|
||||
|
||||
void MainWindow::on_actionExport_triggered()
|
||||
{
|
||||
ExportDialog e(this);
|
||||
e.exec();
|
||||
if (sequence == NULL) {
|
||||
QMessageBox::information(this, "No active sequence", "Please open the sequence you wish to export.", QMessageBox::Ok);
|
||||
} else {
|
||||
ExportDialog e(this);
|
||||
e.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionProject_2_toggled(bool arg1)
|
||||
|
||||
@@ -58,7 +58,8 @@ SOURCES += \
|
||||
dialogs/preferencesdialog.cpp \
|
||||
effects/transition.cpp \
|
||||
effects/crossdissolvetransition.cpp \
|
||||
ui/audiomonitor.cpp
|
||||
ui/audiomonitor.cpp \
|
||||
project/undo.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@@ -91,7 +92,8 @@ HEADERS += \
|
||||
ui/labelslider.h \
|
||||
dialogs/preferencesdialog.h \
|
||||
effects/transition.h \
|
||||
ui/audiomonitor.h
|
||||
ui/audiomonitor.h \
|
||||
project/undo.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
|
||||
+15
-7
@@ -18,6 +18,14 @@ extern "C" {
|
||||
#include <QtMath>
|
||||
#include <math.h>
|
||||
|
||||
void apply_audio_effects(Clip* c, AVFrame* frame, int nb_bytes) {
|
||||
// perform all audio effects
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j);
|
||||
if (e->is_enabled()) e->process_audio(frame->data[0], nb_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_audio_worker(Clip* c) {
|
||||
int written = 0;
|
||||
int max_write = 16384;
|
||||
@@ -29,6 +37,7 @@ void cache_audio_worker(Clip* c) {
|
||||
// no more audio left in frame, get a new one
|
||||
if (!c->reached_end) {
|
||||
retrieve_next_frame_raw_data(c, frame);
|
||||
apply_audio_effects(c, frame, av_samples_get_buffer_size(NULL, frame->channels, frame->nb_samples, static_cast<AVSampleFormat>(frame->format), 1));
|
||||
} else {
|
||||
// set by retrieve_next_frame_raw_data indicating no more frames in file,
|
||||
// but there still may be samples in swresample
|
||||
@@ -55,13 +64,6 @@ void cache_audio_worker(Clip* c) {
|
||||
} else {
|
||||
c->frame_sample_index = 0;
|
||||
}
|
||||
|
||||
// perform all audio effects
|
||||
int nb_bytes = av_samples_get_buffer_size(NULL, frame->channels, frame->nb_samples, static_cast<AVSampleFormat>(frame->format), 1);
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j);
|
||||
if (e->is_enabled()) e->process_audio(frame->data[0], nb_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
if (frame->nb_samples == 0) {
|
||||
@@ -78,9 +80,11 @@ void cache_audio_worker(Clip* c) {
|
||||
c->frame_sample_index += offset;
|
||||
}
|
||||
}
|
||||
bool apply_effects = false;
|
||||
while (c->frame_sample_index > nb_bytes) {
|
||||
// get new frame
|
||||
retrieve_next_frame_raw_data(c, frame);
|
||||
apply_effects = true;
|
||||
nb_bytes = av_samples_get_buffer_size(NULL, frame->channels, frame->nb_samples, static_cast<AVSampleFormat>(frame->format), 1);
|
||||
c->frame_sample_index -= nb_bytes;
|
||||
|
||||
@@ -91,6 +95,10 @@ void cache_audio_worker(Clip* c) {
|
||||
c->frame_sample_index += offset;
|
||||
}
|
||||
}
|
||||
if (apply_effects) {
|
||||
apply_audio_effects(c, frame, nb_bytes);
|
||||
}
|
||||
|
||||
while (c->frame_sample_index < nb_bytes) {
|
||||
if (c->audio_buffer_write >= audio_ibuffer_read+half_buffer || c->audio_buffer_write >= get_buffer_offset_from_frame(c->timeline_out)) {
|
||||
written = max_write;
|
||||
|
||||
+31
-29
@@ -30,6 +30,10 @@ struct ClipCache {
|
||||
QMutex mutex;
|
||||
};
|
||||
|
||||
/*struct ClipPlayback {
|
||||
|
||||
};*/
|
||||
|
||||
struct Clip
|
||||
{
|
||||
Clip();
|
||||
@@ -51,9 +55,7 @@ struct Clip
|
||||
quint8 color_r;
|
||||
quint8 color_g;
|
||||
quint8 color_b;
|
||||
long getLength();
|
||||
|
||||
// inherited information (should be set to the same references in copy())
|
||||
long getLength();
|
||||
Media* media; // attached media
|
||||
MediaStream* media_stream;
|
||||
Sequence* sequence;
|
||||
@@ -64,39 +66,39 @@ struct Clip
|
||||
Transition* opening_transition;
|
||||
Transition* closing_transition;
|
||||
|
||||
// media handling
|
||||
AVFormatContext* formatCtx;
|
||||
AVStream* stream;
|
||||
AVCodec* codec;
|
||||
AVCodecContext* codecCtx;
|
||||
AVPacket* pkt;
|
||||
AVFrame* frame;
|
||||
bool pkt_written;
|
||||
bool reached_end;
|
||||
bool open;
|
||||
// media handling
|
||||
AVFormatContext* formatCtx;
|
||||
AVStream* stream;
|
||||
AVCodec* codec;
|
||||
AVCodecContext* codecCtx;
|
||||
AVPacket* pkt;
|
||||
AVFrame* frame;
|
||||
bool pkt_written;
|
||||
bool reached_end;
|
||||
bool open;
|
||||
bool finished_opening;
|
||||
|
||||
// caching functions
|
||||
bool multithreaded;
|
||||
Cacher* cacher;
|
||||
QWaitCondition can_cache;
|
||||
// caching functions
|
||||
bool multithreaded;
|
||||
Cacher* cacher;
|
||||
QWaitCondition can_cache;
|
||||
quint16 cache_size;
|
||||
ClipCache cache_A;
|
||||
ClipCache cache_B;
|
||||
QMutex lock;
|
||||
QMutex open_lock;
|
||||
ClipCache cache_A;
|
||||
ClipCache cache_B;
|
||||
QMutex lock;
|
||||
QMutex open_lock;
|
||||
|
||||
// video playback variables
|
||||
SwsContext* sws_ctx;
|
||||
QOpenGLTexture* texture;
|
||||
long texture_frame;
|
||||
// video playback variables
|
||||
SwsContext* sws_ctx;
|
||||
QOpenGLTexture* texture;
|
||||
long texture_frame;
|
||||
|
||||
// audio playback variables
|
||||
SwrContext* swr_ctx;
|
||||
// audio playback variables
|
||||
SwrContext* swr_ctx;
|
||||
bool need_new_audio_frame;
|
||||
int frame_sample_index;
|
||||
int frame_sample_index;
|
||||
int audio_buffer_write;
|
||||
bool reset_audio;
|
||||
bool reset_audio;
|
||||
bool audio_just_reset;
|
||||
long audio_target_frame;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "undo.h"
|
||||
|
||||
QUndoStack undo_stack;
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef UNDO_H
|
||||
#define UNDO_H
|
||||
|
||||
#include <QUndoStack>
|
||||
#include <QUndoCommand>
|
||||
#include <QVector>
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "project/sequence.h"
|
||||
|
||||
extern QUndoStack undo_stack;
|
||||
|
||||
#endif // UNDO_H
|
||||
Reference in New Issue
Block a user