feat: add codec options

This commit is contained in:
rankun 2020-07-08 11:55:15 +08:00
parent dbbf7cf3e1
commit c7a5b8a403
4 changed files with 18 additions and 1 deletions

View file

@ -161,7 +161,7 @@ bool Server::execute()
// code option
// https://github.com/Genymobile/scrcpy/commit/080a4ee3654a9b7e96c8ffe37474b5c21c02852a
// <https://d.android.com/reference/android/media/MediaFormat>
args << "-";
args << Config::getInstance().getCodecOptions();
#ifdef SERVER_DEBUGGER
qInfo("Server debugger waiting for a client on device port " SERVER_DEBUGGER_PORT "...");

View file

@ -37,6 +37,9 @@
#define COMMON_LOG_LEVEL_KEY "LogLevel"
#define COMMON_LOG_LEVEL_DEF "info"
#define COMMON_CODEC_OPTIONS_KEY "CodecOptions"
#define COMMON_CODEC_OPTIONS_DEF "-"
// user data
#define COMMON_RECORD_KEY "RecordPath"
#define COMMON_RECORD_DEF ""
@ -277,6 +280,15 @@ QString Config::getLogLevel()
return logLevel;
}
QString Config::getCodecOptions()
{
QString codecOptions;
m_settings->beginGroup(GROUP_COMMON);
codecOptions = m_settings->value(COMMON_CODEC_OPTIONS_KEY, COMMON_CODEC_OPTIONS_DEF).toString();
m_settings->endGroup();
return codecOptions;
}
QString Config::getTitle()
{
QString title;

View file

@ -22,6 +22,7 @@ public:
QString getServerPath();
QString getAdbPath();
QString getLogLevel();
QString getCodecOptions();
// user data
QString getRecordPath();

View file

@ -15,6 +15,10 @@ ServerVersion=1.14
ServerPath=/data/local/tmp/scrcpy-server.jar
# 自定义adb路径例如D:/android/tools/adb.exe
AdbPath=
# 编码选项 "-"表示默认
# 例如 CodecOptions="profile=1,level=2"
# 更多编码选项参考 https://d.android.com/reference/android/media/MediaFormat
CodecOptions="-"
# Set the log level (debug, info, warn, error)
LogLevel=info