Merge RegistKey and Auth

This commit is contained in:
Florian Märkl 2019-08-15 22:56:02 +02:00
commit 73ccfb6f22
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
7 changed files with 62 additions and 51 deletions

View file

@ -46,9 +46,7 @@ struct StreamSessionConnectInfo
uint32_t log_level_mask;
QString log_file;
QString host;
QString registkey;
QString ostype;
QString auth;
QString regist_key;
QString morning;
QString did;
ChiakiConnectVideoProfile video_profile;

View file

@ -72,12 +72,6 @@ int main(int argc, char *argv[])
QCommandLineOption regist_key_option("registkey", "", "registkey");
parser.addOption(regist_key_option);
QCommandLineOption ostype_option("ostype", "", "ostype", "Win10.0.0");
parser.addOption(ostype_option);
QCommandLineOption auth_option("auth", "", "auth");
parser.addOption(auth_option);
QCommandLineOption morning_option("morning", "", "morning");
parser.addOption(morning_option);
@ -104,9 +98,7 @@ int main(int argc, char *argv[])
connect_info.log_file = CreateLogFilename();
connect_info.host = host;
connect_info.registkey = parser.value(regist_key_option);
connect_info.ostype = parser.value(ostype_option);
connect_info.auth = parser.value(auth_option);
connect_info.regist_key = parser.value(regist_key_option);
connect_info.morning = parser.value(morning_option);
connect_info.did = parser.value(did_option);
@ -114,7 +106,7 @@ int main(int argc, char *argv[])
CHIAKI_VIDEO_RESOLUTION_PRESET_720p,
CHIAKI_VIDEO_FPS_PRESET_30);
if(connect_info.registkey.isEmpty() || connect_info.ostype.isEmpty() || connect_info.auth.isEmpty() || connect_info.morning.isEmpty() || connect_info.did.isEmpty())
if(connect_info.regist_key.isEmpty() || connect_info.morning.isEmpty() || connect_info.did.isEmpty())
parser.showHelp(1);
return RunStream(app, connect_info);

View file

@ -45,22 +45,18 @@ StreamSession::StreamSession(const StreamSessionConnectInfo &connect_info, QObje
audio_io(nullptr)
{
QByteArray host_str = connect_info.host.toUtf8();
QByteArray registkey_str = connect_info.registkey.toUtf8();
QByteArray ostype_str = connect_info.ostype.toUtf8();
ChiakiConnectInfo chiaki_connect_info;
chiaki_connect_info.host = host_str.constData();
chiaki_connect_info.regist_key = registkey_str.constData();
chiaki_connect_info.ostype = ostype_str.constData();
chiaki_connect_info.video_profile = connect_info.video_profile;
QByteArray auth_str = connect_info.auth.toUtf8();
QByteArray auth_str = connect_info.regist_key.toUtf8();
size_t auth_len = auth_str.length();
if(auth_len > sizeof(chiaki_connect_info.auth))
auth_len = sizeof(chiaki_connect_info.auth);
memcpy(chiaki_connect_info.auth, auth_str.constData(), auth_len);
if(auth_len < sizeof(chiaki_connect_info.auth))
memset(chiaki_connect_info.auth + auth_len, 0, sizeof(chiaki_connect_info.auth) - auth_len);
if(auth_len > sizeof(chiaki_connect_info.regist_key))
auth_len = sizeof(chiaki_connect_info.regist_key);
memcpy(chiaki_connect_info.regist_key, auth_str.constData(), auth_len);
if(auth_len < sizeof(chiaki_connect_info.regist_key))
memset(chiaki_connect_info.regist_key + auth_len, 0, sizeof(chiaki_connect_info.regist_key) - auth_len);
size_t morning_size = sizeof(chiaki_connect_info.morning);
QByteArray morning_str = connect_info.morning.toUtf8();