mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 13:09:39 -07:00
Finish new LaunchSpec
This commit is contained in:
parent
d4e1aa3b60
commit
e2d1c11064
3 changed files with 26 additions and 9 deletions
|
@ -204,11 +204,12 @@ void Settings::SetAudioBufferSize(unsigned int size)
|
|||
|
||||
ChiakiConnectVideoProfile Settings::GetVideoProfile()
|
||||
{
|
||||
ChiakiConnectVideoProfile profile;
|
||||
ChiakiConnectVideoProfile profile = {};
|
||||
chiaki_connect_video_profile_preset(&profile, GetResolution(), GetFPS());
|
||||
unsigned int bitrate = GetBitrate();
|
||||
if(bitrate)
|
||||
profile.bitrate = bitrate;
|
||||
profile.codec = CHIAKI_CODEC_H264; // TODO: add a setting
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,16 @@ typedef enum
|
|||
CHIAKI_CODEC_H265_HDR
|
||||
} ChiakiCodec;
|
||||
|
||||
static inline bool chiaki_codec_is_h265(ChiakiCodec codec)
|
||||
{
|
||||
return codec == CHIAKI_CODEC_H265 || codec == CHIAKI_CODEC_H265_HDR;
|
||||
}
|
||||
|
||||
static inline bool chiaki_codec_is_hdr(ChiakiCodec codec)
|
||||
{
|
||||
return codec == CHIAKI_CODEC_H265_HDR;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,8 @@ static const char launchspec_fmt[] =
|
|||
"\"connectedControllers\":[\"xinput\",\"ds3\",\"ds4\"],"
|
||||
"\"yuvCoefficient\":\"bt601\","
|
||||
"\"videoEncoderProfile\":\"hw4.1\","
|
||||
"\"audioEncoderProfile\":\"audio1\""
|
||||
"\"audioEncoderProfile\":\"audio1\"" // 6
|
||||
"%s"
|
||||
"},"
|
||||
"\"userProfile\":{"
|
||||
"\"onlineId\":\"psnId\","
|
||||
|
@ -58,9 +59,9 @@ static const char launchspec_fmt[] =
|
|||
"\"region\":\"US\","
|
||||
"\"languagesUsed\":[\"en\",\"jp\"]"
|
||||
"},"
|
||||
"%s" // 6
|
||||
"%s" // 7
|
||||
"\"handshakeKey\":\"%s\"" // 8
|
||||
"%s" // 8
|
||||
"\"handshakeKey\":\"%s\"" // 9
|
||||
"}";
|
||||
|
||||
CHIAKI_EXPORT int chiaki_launchspec_format(char *buf, size_t buf_size, ChiakiLaunchSpec *launch_spec)
|
||||
|
@ -70,19 +71,24 @@ CHIAKI_EXPORT int chiaki_launchspec_format(char *buf, size_t buf_size, ChiakiLau
|
|||
if(err != CHIAKI_ERR_SUCCESS)
|
||||
return -1;
|
||||
|
||||
char *extras[2];
|
||||
char *extras[3];
|
||||
if(chiaki_target_is_ps5(launch_spec->target)) // TODO: probably also for ps4, but only 12
|
||||
{
|
||||
extras[0] = "\"videoCodec\":\"avc\","; // TODO: hevc too
|
||||
extras[1] = "\"dynamicRange\":\"SDR\","; // TODO: HDR too
|
||||
extras[0] = ",\"adaptiveStreamMode\": \"resize\"";
|
||||
extras[1] = chiaki_codec_is_h265(launch_spec->codec)
|
||||
? "\"videoCodec\":\"hevc\","
|
||||
: "\"videoCodec\":\"avc\",";
|
||||
extras[2] = chiaki_codec_is_hdr(launch_spec->codec)
|
||||
? "\"dynamicRange\":\"HDR\","
|
||||
: "\"dynamicRange\":\"SDR\",";
|
||||
}
|
||||
else
|
||||
extras[0] = extras[1] = "";
|
||||
extras[0] = extras[1] = extras[2] = "";
|
||||
|
||||
int written = snprintf(buf, buf_size, launchspec_fmt,
|
||||
launch_spec->width, launch_spec->height, launch_spec->max_fps,
|
||||
launch_spec->bw_kbps_sent, launch_spec->mtu, launch_spec->rtt,
|
||||
extras[0], extras[1], handshake_key_b64);
|
||||
extras[0], extras[1], extras[2], handshake_key_b64);
|
||||
if(written < 0 || written >= buf_size)
|
||||
return -1;
|
||||
return written;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue