Begin setting up video recording UI
Jeffrey Pfau jeffrey@endrift.com
Sun, 26 Oct 2014 18:27:53 -0700
6 files changed,
345 insertions(+),
3 deletions(-)
M
src/platform/qt/CMakeLists.txt
→
src/platform/qt/CMakeLists.txt
@@ -38,11 +38,13 @@ LoadSaveState.cpp
LogView.cpp SavestateButton.cpp Window.cpp - VFileDevice.cpp) + VFileDevice.cpp + VideoView.cpp) qt5_wrap_ui(UI_FILES LoadSaveState.ui - LogView.ui) + LogView.ui + VideoView.ui) if(USE_GDB_STUB) set(SOURCE_FILES ${PLATFORM_SRC} ${SOURCE_FILES} GDBController.cpp GDBWindow.cpp)
A
src/platform/qt/VideoView.cpp
@@ -0,0 +1,15 @@
+#include "VideoView.h" + +#ifdef USE_FFMPEG + +using namespace QGBA; + +VideoView::VideoView(QWidget* parent) + : QWidget(parent) +{ + m_ui.setupUi(this); + + connect(m_ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); +} + +#endif
A
src/platform/qt/VideoView.h
@@ -0,0 +1,30 @@
+#ifndef QGBA_VIDEO_VIEW +#define QGBA_VIDEO_VIEW + +#ifdef USE_FFMPEG + +#include <QWidget> + +#include "ui_VideoView.h" + +struct FFmpegEncoder; + +namespace QGBA { + +class VideoView : public QWidget { +Q_OBJECT + +public: + VideoView(QWidget* parent = nullptr); + +private: + Ui::VideoView m_ui; + + FFmpegEncoder* m_encoder; +}; + +} + +#endif + +#endif
A
src/platform/qt/VideoView.ui
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>VideoView</class> + <widget class="QWidget" name="VideoView"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>462</width> + <height>194</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Record Video</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <item row="0" column="0" rowspan="2"> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Format</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QComboBox" name="container"> + <property name="editable"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>MKV</string> + </property> + </item> + <item> + <property name="text"> + <string>AVI</string> + </property> + </item> + <item> + <property name="text"> + <string>MP4</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QComboBox" name="video"> + <property name="editable"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>PNG</string> + </property> + </item> + <item> + <property name="text"> + <string>h.264</string> + </property> + </item> + <item> + <property name="text"> + <string>Xvid</string> + </property> + </item> + <item> + <property name="text"> + <string>Uncompressed</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QComboBox" name="audio"> + <property name="editable"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>FLAC</string> + </property> + </item> + <item> + <property name="text"> + <string>Vorbis</string> + </property> + </item> + <item> + <property name="text"> + <string>MP3</string> + </property> + </item> + <item> + <property name="text"> + <string>AAC</string> + </property> + </item> + <item> + <property name="text"> + <string>Uncompressed</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="1"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string> Bitrate</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Video</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>vbr</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="vbr"> + <property name="suffix"> + <string/> + </property> + <property name="minimum"> + <number>200</number> + </property> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>800</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Audio</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>abr</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="abr"> + <property name="minimum"> + <number>16</number> + </property> + <property name="maximum"> + <number>320</number> + </property> + <property name="value"> + <number>192</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="0"> + <widget class="QPushButton" name="start"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Start</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="stop"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Stop</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="selectFile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Select File</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> + <widget class="QLineEdit" name="filename"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Close</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>filename</tabstop> + <tabstop>start</tabstop> + <tabstop>stop</tabstop> + <tabstop>selectFile</tabstop> + <tabstop>container</tabstop> + <tabstop>video</tabstop> + <tabstop>audio</tabstop> + <tabstop>vbr</tabstop> + <tabstop>abr</tabstop> + </tabstops> + <resources/> + <connections/> +</ui>
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -11,6 +11,7 @@ #include "GDBController.h"
#include "GDBWindow.h" #include "LoadSaveState.h" #include "LogView.h" +#include "VideoView.h" extern "C" { #include "platform/commandline.h"@@ -24,6 +25,9 @@ , m_logView(new LogView())
, m_stateWindow(nullptr) , m_screenWidget(new WindowBackground()) , m_logo(":/res/mgba-1024.png") +#ifdef USE_FFMPEG + , m_videoView(nullptr) +#endif #ifdef USE_GDB_STUB , m_gdbController(nullptr) #endif@@ -57,6 +61,7 @@ }
Window::~Window() { delete m_logView; + delete m_videoView; } GBAKey Window::mapKey(int qtKey) {@@ -138,6 +143,15 @@ if (!filename.isEmpty()) {
m_controller->loadPatch(filename); } } + +#ifdef USE_FFMPEG +void Window::openVideoWindow() { + if (!m_videoView) { + m_videoView = new VideoView(); + } + m_videoView->show(); +} +#endif #ifdef USE_GDB_STUB void Window::gdbOpen() {@@ -291,13 +305,24 @@ m_gameActions.append(quickSave);
quickSaveMenu->addAction(quickSave); } +#if defined(USE_PNG) || defined(USE_FFMPEG) + fileMenu->addSeparator(); +#endif + #ifdef USE_PNG - fileMenu->addSeparator(); QAction* screenshot = new QAction(tr("Take &screenshot"), fileMenu); screenshot->setShortcut(tr("F12")); connect(screenshot, SIGNAL(triggered()), m_display, SLOT(screenshot())); m_gameActions.append(screenshot); fileMenu->addAction(screenshot); +#endif + +#ifdef USE_FFMPEG + QAction* recordOutput = new QAction(tr("Record output..."), fileMenu); + recordOutput->setShortcut(tr("F11")); + connect(recordOutput, SIGNAL(triggered()), this, SLOT(openVideoWindow())); + m_gameActions.append(recordOutput); + fileMenu->addAction(recordOutput); #endif #ifndef Q_OS_MAC
M
src/platform/qt/Window.h
→
src/platform/qt/Window.h
@@ -18,6 +18,7 @@ namespace QGBA {
class GameController; class LogView; +class VideoView; class WindowBackground; class Window : public QMainWindow {@@ -44,6 +45,10 @@ void selectROM();
void selectBIOS(); void selectPatch(); void toggleFullScreen(); + +#ifdef USE_FFMPEG + void openVideoWindow(); +#endif #ifdef USE_GDB_STUB void gdbOpen();@@ -74,6 +79,10 @@ LogView* m_logView;
LoadSaveState* m_stateWindow; WindowBackground* m_screenWidget; QPixmap m_logo; + +#ifdef USE_FFMPEG + VideoView* m_videoView; +#endif #ifdef USE_GDB_STUB GDBController* m_gdbController;