citra, citra_qt: Add video dumping config read/write

The default values are VP9/libvorbis just like before. The default configuration is provided for VP9
This commit is contained in:
zhupengfei 2020-01-29 14:57:16 +08:00
parent 016f8be0b8
commit 834da14329
No known key found for this signature in database
GPG key ID: DD129E108BD09378
4 changed files with 127 additions and 0 deletions

View file

@ -264,6 +264,33 @@ void Config::ReadValues() {
sdl2_config->GetString("WebService", "web_api_url", "https://api.citra-emu.org");
Settings::values.citra_username = sdl2_config->GetString("WebService", "citra_username", "");
Settings::values.citra_token = sdl2_config->GetString("WebService", "citra_token", "");
// Video Dumping
Settings::values.output_format =
sdl2_config->GetString("Video Dumping", "output_format", "webm");
Settings::values.format_options = sdl2_config->GetString("Video Dumping", "format_options", "");
Settings::values.video_encoder =
sdl2_config->GetString("Video Dumping", "video_encoder", "libvpx-vp9");
// Options for variable bit rate live streaming taken from here:
// https://developers.google.com/media/vp9/live-encoding
std::string default_video_options;
if (Settings::values.video_encoder == "libvpx-vp9") {
default_video_options =
"quality:realtime,speed:6,tile-columns:4,frame-parallel:1,threads:8,row-mt:1";
}
Settings::values.video_encoder_options =
sdl2_config->GetString("Video Dumping", "video_encoder_options", default_video_options);
Settings::values.video_bitrate =
sdl2_config->GetInteger("Video Dumping", "video_bitrate", 2500000);
Settings::values.audio_encoder =
sdl2_config->GetString("Video Dumping", "audio_encoder", "libvorbis");
Settings::values.audio_encoder_options =
sdl2_config->GetString("Video Dumping", "audio_encoder_options", "");
Settings::values.audio_bitrate =
sdl2_config->GetInteger("Video Dumping", "audio_bitrate", 64000);
}
void Config::Reload() {

View file

@ -295,5 +295,31 @@ web_api_url = https://api.citra-emu.org
# See https://profile.citra-emu.org/ for more info
citra_username =
citra_token =
[Video Dumping]
# Format of the video to output, default: webm
output_format =
# Options passed to the muxer (optional)
# This is a param package, format: [key1]:[value1],[key2]:[value2],...
format_options =
# Video encoder used, default: libvpx-vp9
video_encoder =
# Options passed to the video codec (optional)
video_encoder_options =
# Video bitrate, default: 2500000
video_bitrate =
# Audio encoder used, default: libvorbis
audio_encoder =
# Options passed to the audio codec (optional)
audio_encoder_options =
# Audio bitrate, default: 64000
audio_bitrate =
)";
}

View file

@ -93,6 +93,7 @@ void Config::ReadValues() {
ReadMiscellaneousValues();
ReadDebuggingValues();
ReadWebServiceValues();
ReadVideoDumpingValues();
ReadUIValues();
ReadUtilityValues();
}
@ -485,6 +486,49 @@ void Config::ReadSystemValues() {
qt_config->endGroup();
}
// Options for variable bit rate live streaming taken from here:
// https://developers.google.com/media/vp9/live-encoding
const QString DEFAULT_VIDEO_ENCODER_OPTIONS =
QStringLiteral("quality:realtime,speed:6,tile-columns:4,frame-parallel:1,threads:8,row-mt:1");
const QString DEFAULT_AUDIO_ENCODER_OPTIONS = QString{};
void Config::ReadVideoDumpingValues() {
qt_config->beginGroup(QStringLiteral("VideoDumping"));
Settings::values.output_format =
ReadSetting(QStringLiteral("output_format"), QStringLiteral("webm"))
.toString()
.toStdString();
Settings::values.format_options =
ReadSetting(QStringLiteral("format_options")).toString().toStdString();
Settings::values.video_encoder =
ReadSetting(QStringLiteral("video_encoder"), QStringLiteral("libvpx-vp9"))
.toString()
.toStdString();
Settings::values.video_encoder_options =
ReadSetting(QStringLiteral("video_encoder_options"), DEFAULT_VIDEO_ENCODER_OPTIONS)
.toString()
.toStdString();
Settings::values.video_bitrate =
ReadSetting(QStringLiteral("video_bitrate"), 2500000).toULongLong();
Settings::values.audio_encoder =
ReadSetting(QStringLiteral("audio_encoder"), QStringLiteral("libvorbis"))
.toString()
.toStdString();
Settings::values.audio_encoder_options =
ReadSetting(QStringLiteral("audio_encoder_options"), DEFAULT_AUDIO_ENCODER_OPTIONS)
.toString()
.toStdString();
Settings::values.audio_bitrate =
ReadSetting(QStringLiteral("audio_bitrate"), 64000).toULongLong();
qt_config->endGroup();
}
void Config::ReadUIValues() {
qt_config->beginGroup(QStringLiteral("UI"));
@ -617,6 +661,7 @@ void Config::SaveValues() {
SaveMiscellaneousValues();
SaveDebuggingValues();
SaveWebServiceValues();
SaveVideoDumpingValues();
SaveUIValues();
SaveUtilityValues();
}
@ -915,6 +960,33 @@ void Config::SaveSystemValues() {
qt_config->endGroup();
}
void Config::SaveVideoDumpingValues() {
qt_config->beginGroup(QStringLiteral("VideoDumping"));
WriteSetting(QStringLiteral("output_format"),
QString::fromStdString(Settings::values.output_format), QStringLiteral("webm"));
WriteSetting(QStringLiteral("format_options"),
QString::fromStdString(Settings::values.format_options));
WriteSetting(QStringLiteral("video_encoder"),
QString::fromStdString(Settings::values.video_encoder),
QStringLiteral("libvpx-vp9"));
WriteSetting(QStringLiteral("video_encoder_options"),
QString::fromStdString(Settings::values.video_encoder_options),
DEFAULT_VIDEO_ENCODER_OPTIONS);
WriteSetting(QStringLiteral("video_bitrate"),
static_cast<unsigned long long>(Settings::values.video_bitrate), 2500000);
WriteSetting(QStringLiteral("audio_encoder"),
QString::fromStdString(Settings::values.audio_encoder),
QStringLiteral("libvorbis"));
WriteSetting(QStringLiteral("audio_encoder_options"),
QString::fromStdString(Settings::values.audio_encoder_options),
DEFAULT_AUDIO_ENCODER_OPTIONS);
WriteSetting(QStringLiteral("audio_bitrate"),
static_cast<unsigned long long>(Settings::values.audio_bitrate), 64000);
qt_config->endGroup();
}
void Config::SaveUIValues() {
qt_config->beginGroup(QStringLiteral("UI"));

View file

@ -44,6 +44,7 @@ private:
void ReadUpdaterValues();
void ReadUtilityValues();
void ReadWebServiceValues();
void ReadVideoDumpingValues();
void SaveValues();
void SaveAudioValues();
@ -65,6 +66,7 @@ private:
void SaveUpdaterValues();
void SaveUtilityValues();
void SaveWebServiceValues();
void SaveVideoDumpingValues();
QVariant ReadSetting(const QString& name) const;
QVariant ReadSetting(const QString& name, const QVariant& default_value) const;