all repos — mgba @ 61cfdbaccba2aaef410def9a392bfff877102333

mGBA Game Boy Advance Emulator

Qt: Disallow opening the context twice
Jeffrey Pfau jeffrey@endrift.com
Wed, 12 Nov 2014 01:35:51 -0800
commit

61cfdbaccba2aaef410def9a392bfff877102333

parent

b0fdbab77ec897331ae79b01a4d805764d654d9a

M src/platform/ffmpeg/ffmpeg-encoder.csrc/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.hsrc/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.cppsrc/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; }