mildly better threading and fixed redo bug
This commit is contained in:
+3
-1
@@ -253,12 +253,14 @@ void MainWindow::editMenu_About_To_Be_Shown() {
|
|||||||
void MainWindow::on_action_Undo_triggered()
|
void MainWindow::on_action_Undo_triggered()
|
||||||
{
|
{
|
||||||
undo_stack.undo();
|
undo_stack.undo();
|
||||||
|
editMenu_About_To_Be_Shown();
|
||||||
panel_timeline->redraw_all_clips(true);
|
panel_timeline->redraw_all_clips(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_Redo_triggered()
|
void MainWindow::on_action_Redo_triggered()
|
||||||
{
|
{
|
||||||
undo_stack.redo();
|
undo_stack.redo();
|
||||||
|
editMenu_About_To_Be_Shown();
|
||||||
panel_timeline->redraw_all_clips(true);
|
panel_timeline->redraw_all_clips(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,7 +480,7 @@ void MainWindow::on_actionGo_to_Next_Cut_triggered()
|
|||||||
void MainWindow::on_actionPreferences_triggered()
|
void MainWindow::on_actionPreferences_triggered()
|
||||||
{
|
{
|
||||||
PreferencesDialog pd(this);
|
PreferencesDialog pd(this);
|
||||||
pd.setup_kbd_shortcuts(this->menuBar());
|
pd.setup_kbd_shortcuts(menuBar());
|
||||||
pd.exec();
|
pd.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -24,7 +24,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>653</width>
|
<width>653</width>
|
||||||
<height>29</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu_File">
|
<widget class="QMenu" name="menu_File">
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
<string>&Redo</string>
|
<string>&Redo</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+Shift+Z, Ctrl+Y</string>
|
<string>Ctrl+Shift+Z</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionCu_t">
|
<action name="actionCu_t">
|
||||||
|
|||||||
+6
-5
@@ -77,17 +77,18 @@ void Clip::reset() {
|
|||||||
codecCtx = NULL;
|
codecCtx = NULL;
|
||||||
texture = NULL;
|
texture = NULL;
|
||||||
cache_A.frames = NULL;
|
cache_A.frames = NULL;
|
||||||
cache_B.frames = NULL;
|
cache_B.frames = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Clip::~Clip() {
|
Clip::~Clip() {
|
||||||
if (open) {
|
if (open) {
|
||||||
close_clip(this);
|
close_clip(this);
|
||||||
}
|
|
||||||
|
|
||||||
// make sure clip has closed before clip is destroyed
|
// make sure clip has closed before clip is destroyed
|
||||||
open_lock.lock();
|
if (multithreaded) {
|
||||||
open_lock.unlock();
|
cacher->wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (opening_transition != NULL) delete opening_transition;
|
if (opening_transition != NULL) delete opening_transition;
|
||||||
if (closing_transition != NULL) delete closing_transition;
|
if (closing_transition != NULL) delete closing_transition;
|
||||||
|
|||||||
+10
-10
@@ -30,7 +30,6 @@ ViewerWidget::ViewerWidget(QWidget *parent) : QOpenGLWidget(parent) {
|
|||||||
setFormat(format);
|
setFormat(format);
|
||||||
|
|
||||||
// start audio sending thread
|
// start audio sending thread
|
||||||
connect(&audio_sender_thread, SIGNAL(finished()), &audio_sender_thread, SLOT(deleteLater()));
|
|
||||||
audio_sender_thread.start();
|
audio_sender_thread.start();
|
||||||
|
|
||||||
// error handler - retries after 250ms if we couldn't get the entire image
|
// error handler - retries after 250ms if we couldn't get the entire image
|
||||||
@@ -41,8 +40,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) : QOpenGLWidget(parent) {
|
|||||||
ViewerWidget::~ViewerWidget() {
|
ViewerWidget::~ViewerWidget() {
|
||||||
audio_sender_thread.close = true;
|
audio_sender_thread.close = true;
|
||||||
audio_sender_thread.cond.wakeAll();
|
audio_sender_thread.cond.wakeAll();
|
||||||
audio_sender_thread.lock.lock();
|
audio_sender_thread.wait();
|
||||||
audio_sender_thread.lock.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerWidget::deleteFunction() {
|
void ViewerWidget::deleteFunction() {
|
||||||
@@ -234,27 +232,29 @@ void ViewerWidget::paintGL() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AudioSenderThread::AudioSenderThread() : close(false) {
|
AudioSenderThread::AudioSenderThread() : close(false) {
|
||||||
lock.lock();
|
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
||||||
}
|
|
||||||
|
|
||||||
AudioSenderThread::~AudioSenderThread() {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioSenderThread::run() {
|
void AudioSenderThread::run() {
|
||||||
|
lock.lock();
|
||||||
while (true) {
|
while (true) {
|
||||||
cond.wait(&lock);
|
cond.wait(&lock);
|
||||||
if (close) {
|
if (close) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
int written_bytes = 0;
|
||||||
|
|
||||||
int adjusted_read_index = audio_ibuffer_read%audio_ibuffer_size;
|
int adjusted_read_index = audio_ibuffer_read%audio_ibuffer_size;
|
||||||
int max_write = audio_ibuffer_size - adjusted_read_index;
|
int max_write = audio_ibuffer_size - adjusted_read_index;
|
||||||
if (send_audio_to_output(adjusted_read_index, max_write) == max_write) {
|
int actual_write = send_audio_to_output(adjusted_read_index, max_write);
|
||||||
|
written_bytes += actual_write;
|
||||||
|
if (actual_write == max_write) {
|
||||||
// got all the bytes, write again
|
// got all the bytes, write again
|
||||||
send_audio_to_output(0, audio_ibuffer_size);
|
written_bytes += send_audio_to_output(0, audio_ibuffer_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioSenderThread::send_audio_to_output(int offset, int max) {
|
int AudioSenderThread::send_audio_to_output(int offset, int max) {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ struct Sequence;
|
|||||||
class AudioSenderThread : public QThread {
|
class AudioSenderThread : public QThread {
|
||||||
public:
|
public:
|
||||||
AudioSenderThread();
|
AudioSenderThread();
|
||||||
~AudioSenderThread();
|
|
||||||
void run();
|
void run();
|
||||||
QWaitCondition cond;
|
QWaitCondition cond;
|
||||||
bool close;
|
bool close;
|
||||||
|
|||||||
Reference in New Issue
Block a user