Qt: Disallow opening the context twice
Jeffrey Pfau jeffrey@endrift.com
Wed, 12 Nov 2014 01:35:51 -0800
3 files changed,
7 insertions(+),
2 deletions(-)
M
src/platform/ffmpeg/ffmpeg-encoder.c
→
src/platform/ffmpeg/ffmpeg-encoder.c
@@ -282,6 +282,10 @@ avformat_free_context(encoder->context);
encoder->context = 0; } +bool FFmpegEncoderIsOpen(struct FFmpegEncoder* encoder) { + return !!encoder->context; +} + void _ffmpegPostAudioFrame(struct GBAAVStream* stream, int32_t left, int32_t right) { struct FFmpegEncoder* encoder = (struct FFmpegEncoder*) stream; if (!encoder->context) {
M
src/platform/ffmpeg/ffmpeg-encoder.h
→
src/platform/ffmpeg/ffmpeg-encoder.h
@@ -50,5 +50,6 @@ void FFmpegEncoderSetDimensions(struct FFmpegEncoder*, int width, int height);
bool FFmpegEncoderVerifyContainer(struct FFmpegEncoder*); bool FFmpegEncoderOpen(struct FFmpegEncoder*, const char* outfile); void FFmpegEncoderClose(struct FFmpegEncoder*); +bool FFmpegEncoderIsOpen(struct FFmpegEncoder*); #endif
M
src/platform/qt/VideoView.cpp
→
src/platform/qt/VideoView.cpp
@@ -274,7 +274,7 @@ m_ui.advancedBox->setVisible(show);
} bool VideoView::validateSettings() { - bool valid = true; + bool valid = !m_filename.isNull() && !FFmpegEncoderIsOpen(&m_encoder); if (!m_audioCodecCstr) { valid = false; m_ui.audio->setStyleSheet("QComboBox { color: red; }");@@ -302,7 +302,7 @@ if (valid && !FFmpegEncoderVerifyContainer(&m_encoder)) {
valid = false; } - m_ui.start->setEnabled(valid && !m_filename.isNull()); + m_ui.start->setEnabled(valid); return valid; }