all repos — mgba @ b0fdbab77ec897331ae79b01a4d805764d654d9a

mGBA Game Boy Advance Emulator

src/platform/qt/VideoView.h (view raw)

  1#ifndef QGBA_VIDEO_VIEW
  2#define QGBA_VIDEO_VIEW
  3
  4#ifdef USE_FFMPEG
  5
  6#include <QWidget>
  7
  8#include "ui_VideoView.h"
  9
 10extern "C" {
 11#include "platform/ffmpeg/ffmpeg-encoder.h"
 12}
 13
 14namespace QGBA {
 15
 16class VideoView : public QWidget {
 17Q_OBJECT
 18
 19public:
 20	struct Preset {
 21		QString container;
 22		QString vcodec;
 23		QString acodec;
 24		int vbr;
 25		int abr;
 26		int width;
 27		int height;
 28
 29		bool compatible(const Preset&) const;
 30	};
 31
 32	VideoView(QWidget* parent = nullptr);
 33	virtual ~VideoView();
 34
 35	GBAAVStream* getStream() { return &m_encoder.d; }
 36
 37public slots:
 38	void startRecording();
 39	void stopRecording();
 40
 41signals:
 42	void recordingStarted(GBAAVStream*);
 43	void recordingStopped();
 44
 45private slots:
 46	void selectFile();
 47	void setFilename(const QString&);
 48	void setAudioCodec(const QString&, bool manual = true);
 49	void setVideoCodec(const QString&, bool manual = true);
 50	void setContainer(const QString&, bool manual = true);
 51
 52	void setAudioBitrate(int, bool manual = true);
 53	void setVideoBitrate(int, bool manual = true);
 54
 55	void setWidth(int, bool manual = true);
 56	void setHeight(int, bool manual = true);
 57
 58	void showAdvanced(bool);
 59
 60	void uncheckIncompatible();
 61
 62private:
 63	bool validateSettings();
 64	static QString sanitizeCodec(const QString&, const QMap<QString, QString>& mapping);
 65	static void safelyCheck(QAbstractButton*, bool set = true);
 66	static void safelySet(QSpinBox*, int value);
 67	static void safelySet(QComboBox*, const QString& value);
 68
 69	void addPreset(QAbstractButton*, const Preset&);
 70	void setPreset(const Preset&);
 71
 72	Ui::VideoView m_ui;
 73
 74	FFmpegEncoder m_encoder;
 75
 76	QString m_filename;
 77	QString m_audioCodec;
 78	QString m_videoCodec;
 79	QString m_container;
 80	char* m_audioCodecCstr;
 81	char* m_videoCodecCstr;
 82	char* m_containerCstr;
 83
 84	int m_abr;
 85	int m_vbr;
 86
 87	int m_width;
 88	int m_height;
 89
 90	QMap<QAbstractButton*, Preset> m_presets;
 91
 92	static QMap<QString, QString> s_acodecMap;
 93	static QMap<QString, QString> s_vcodecMap;
 94	static QMap<QString, QString> s_containerMap;
 95};
 96
 97}
 98
 99#endif
100
101#endif