Pair and connect with Moonlight-iOS
This commit is contained in:
+10
-2
@@ -168,7 +168,15 @@ void update_id_client(const std::string &uniqueID, std::string &&cert, op_e op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void getservercert(pair_session_t &sess, pt::ptree &tree, const std::string &pin) {
|
void getservercert(pair_session_t &sess, pt::ptree &tree, const std::string &pin) {
|
||||||
auto salt = util::from_hex<std::array<uint8_t, 16>>(sess.async_insert_pin.salt, true);
|
if(sess.async_insert_pin.salt.size() < 32) {
|
||||||
|
tree.put("root.paired", 0);
|
||||||
|
tree.put("root.<xmlattr>.status_code", 400);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string_view salt_view { sess.async_insert_pin.salt.data(), 32 };
|
||||||
|
|
||||||
|
auto salt = util::from_hex<std::array<uint8_t, 16>>(salt_view, true);
|
||||||
|
|
||||||
auto key = crypto::gen_aes_key(*salt, pin);
|
auto key = crypto::gen_aes_key(*salt, pin);
|
||||||
sess.cipher_key = std::make_unique<crypto::aes_t>(key);
|
sess.cipher_key = std::make_unique<crypto::aes_t>(key);
|
||||||
@@ -484,7 +492,7 @@ void serverinfo(std::shared_ptr<typename SimpleWeb::ServerBase<T>::Response> res
|
|||||||
auto current_appid = proc::proc.running();
|
auto current_appid = proc::proc.running();
|
||||||
tree.put("root.PairStatus", pair_status);
|
tree.put("root.PairStatus", pair_status);
|
||||||
tree.put("root.currentgame", current_appid >= 0 ? current_appid + 1 : 0);
|
tree.put("root.currentgame", current_appid >= 0 ? current_appid + 1 : 0);
|
||||||
tree.put("root.state", "_SERVER_BUSY");
|
tree.put("root.state", current_appid >= 0 ? "_SERVER_BUSY" : "_SERVER_FREE");
|
||||||
|
|
||||||
std::ostringstream data;
|
std::ostringstream data;
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -451,7 +451,7 @@ public:
|
|||||||
other._own_ptr = false;
|
other._own_ptr = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wrap_ptr &operator=(wrap_ptr &&other) {
|
wrap_ptr &operator=(wrap_ptr &&other) noexcept {
|
||||||
if(_own_ptr) {
|
if(_own_ptr) {
|
||||||
delete _p;
|
delete _p;
|
||||||
}
|
}
|
||||||
@@ -484,6 +484,14 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~wrap_ptr() {
|
||||||
|
if(_own_ptr) {
|
||||||
|
delete _p;
|
||||||
|
}
|
||||||
|
|
||||||
|
_own_ptr = false;
|
||||||
|
}
|
||||||
|
|
||||||
const reference operator*() const {
|
const reference operator*() const {
|
||||||
return *_p;
|
return *_p;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -545,7 +545,7 @@ std::optional<session_t> make_session(const encoder_t &encoder, const config_t &
|
|||||||
ctx->keyint_min = ctx->gop_size;
|
ctx->keyint_min = ctx->gop_size;
|
||||||
|
|
||||||
if(config.numRefFrames == 0) {
|
if(config.numRefFrames == 0) {
|
||||||
ctx->refs = video_format[encoder_t::REF_FRAMES_AUTOSELECT] ? 0 : 1;
|
ctx->refs = video_format[encoder_t::REF_FRAMES_AUTOSELECT] ? 0 : 16;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Some client decoders have limits on the number of reference frames
|
// Some client decoders have limits on the number of reference frames
|
||||||
@@ -987,6 +987,7 @@ void capture_async(
|
|||||||
|
|
||||||
int frame_nr = 1;
|
int frame_nr = 1;
|
||||||
int key_frame_nr = 1;
|
int key_frame_nr = 1;
|
||||||
|
|
||||||
while(!shutdown_event->peek() && images->running()) {
|
while(!shutdown_event->peek() && images->running()) {
|
||||||
// Wait for the display to be ready
|
// Wait for the display to be ready
|
||||||
std::shared_ptr<platf::display_t> display;
|
std::shared_ptr<platf::display_t> display;
|
||||||
@@ -1028,7 +1029,8 @@ void capture(
|
|||||||
idr_event_t idr_events,
|
idr_event_t idr_events,
|
||||||
config_t config,
|
config_t config,
|
||||||
void *channel_data) {
|
void *channel_data) {
|
||||||
|
|
||||||
|
idr_events->raise(std::make_pair(0, 1));
|
||||||
if(encoders.front().system_memory) {
|
if(encoders.front().system_memory) {
|
||||||
capture_async(shutdown_event, packets, idr_events, config, channel_data);
|
capture_async(shutdown_event, packets, idr_events, config, channel_data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user