Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace audio {
while (auto sample = samples->pop()) {
buffer_t packet {1400};

int bytes = opus_multistream_encode_float(opus.get(), sample->data(), frame_size, std::begin(packet), packet.size());
int bytes = opus_multistream_encode_float(opus.get(), sample->data(), frame_size, std::begin(packet), (opus_int32) packet.size());
if (bytes < 0) {
BOOST_LOG(error) << "Couldn't encode audio: "sv << opus_strerror(bytes);
packets->stop();
Expand Down
4 changes: 2 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ namespace config {
if (val.size() >= 2 && val.substr(0, 2) == "0x"sv) {
input = util::from_hex<int>(val.substr(2));
} else {
input = util::from_view(val);
input = (int) util::from_view(val);
}

vars.erase(it);
Expand Down Expand Up @@ -979,7 +979,7 @@ namespace config {
if (val.size() >= 2 && val.substr(0, 2) == "0x"sv) {
tmp = util::from_hex<int>(val.substr(2));
} else {
tmp = util::from_view(val);
tmp = (int) util::from_view(val);
}
input.emplace_back(tmp);
}
Expand Down
2 changes: 1 addition & 1 deletion src/confighttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ namespace confighttp {
auto &rawAuth = auth->second;
auto authData = SimpleWeb::Crypto::Base64::decode(rawAuth.substr("Basic "sv.length()));

int index = authData.find(':');
auto index = (int) authData.find(':');
if (index >= authData.size() - 1) {
return false;
}
Expand Down
24 changes: 12 additions & 12 deletions src/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace crypto {
return -1;
}

if (EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_GCM_SET_IVLEN, iv->size(), nullptr) != 1) {
if (EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_GCM_SET_IVLEN, (int) iv->size(), nullptr) != 1) {
return -1;
}

Expand All @@ -120,7 +120,7 @@ namespace crypto {
return -1;
}

if (EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_GCM_SET_IVLEN, iv->size(), nullptr) != 1) {
if (EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_GCM_SET_IVLEN, (int) iv->size(), nullptr) != 1) {
return -1;
}

Expand Down Expand Up @@ -163,11 +163,11 @@ namespace crypto {

int update_outlen, final_outlen;

if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), cipher.size()) != 1) {
if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) {
return -1;
}

if (EVP_CIPHER_CTX_ctrl(decrypt_ctx.get(), EVP_CTRL_GCM_SET_TAG, tag.size(), const_cast<char *>(tag.data())) != 1) {
if (EVP_CIPHER_CTX_ctrl(decrypt_ctx.get(), EVP_CTRL_GCM_SET_TAG, (int) tag.size(), const_cast<char *>(tag.data())) != 1) {
return -1;
}

Expand Down Expand Up @@ -198,7 +198,7 @@ namespace crypto {
int update_outlen, final_outlen;

// Encrypt into the caller's buffer
if (EVP_EncryptUpdate(encrypt_ctx.get(), ciphertext, &update_outlen, (const std::uint8_t *) plaintext.data(), plaintext.size()) != 1) {
if (EVP_EncryptUpdate(encrypt_ctx.get(), ciphertext, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
return -1;
}

Expand Down Expand Up @@ -234,7 +234,7 @@ namespace crypto {

int update_outlen, final_outlen;

if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), cipher.size()) != 1) {
if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) {
return -1;
}

Expand Down Expand Up @@ -262,7 +262,7 @@ namespace crypto {
int update_outlen, final_outlen;

// Encrypt into the caller's buffer
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher.data(), &update_outlen, (const std::uint8_t *) plaintext.data(), plaintext.size()) != 1) {
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher.data(), &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
return -1;
}

Expand Down Expand Up @@ -293,7 +293,7 @@ namespace crypto {
int update_outlen, final_outlen;

// Encrypt into the caller's buffer
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher, &update_outlen, (const std::uint8_t *) plaintext.data(), plaintext.size()) != 1) {
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
return -1;
}

Expand Down Expand Up @@ -343,7 +343,7 @@ namespace crypto {
x509_t x509(const std::string_view &x) {
bio_t io {BIO_new(BIO_s_mem())};

BIO_write(io.get(), x.data(), x.size());
BIO_write(io.get(), x.data(), (int) x.size());

x509_t p;
PEM_read_bio_X509(io.get(), &p, nullptr, nullptr);
Expand All @@ -354,7 +354,7 @@ namespace crypto {
pkey_t pkey(const std::string_view &k) {
bio_t io {BIO_new(BIO_s_mem())};

BIO_write(io.get(), k.data(), k.size());
BIO_write(io.get(), k.data(), (int) k.size());

pkey_t p = nullptr;
PEM_read_bio_PrivateKey(io.get(), &p, nullptr, nullptr);
Expand Down Expand Up @@ -395,7 +395,7 @@ namespace crypto {
std::string r;
r.resize(bytes);

RAND_bytes((uint8_t *) r.data(), r.size());
RAND_bytes((uint8_t *) r.data(), (int) r.size());

return r;
}
Expand Down Expand Up @@ -459,7 +459,7 @@ namespace crypto {
X509_set_pubkey(x509.get(), pkey.get());

auto name = X509_get_subject_name(x509.get());
X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (const std::uint8_t *) cn.data(), cn.size(), -1, 0);
X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (const std::uint8_t *) cn.data(), (int) cn.size(), -1, 0);

X509_set_issuer_name(x509.get(), name);
X509_sign(x509.get(), pkey.get(), EVP_sha256());
Expand Down
2 changes: 1 addition & 1 deletion src/display_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace display_device {
if (result > std::numeric_limits<unsigned int>::max()) {
throw std::out_of_range("stou");
}
return result;
return (int) result;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ namespace input {
return;
}

auto size = util::endian::big(packet->header.size) - sizeof(packet->header.magic);
int size = util::endian::big(packet->header.size) - sizeof(packet->header.magic);
platf::unicode(platf_input, packet->text, size);
}

Expand Down
2 changes: 1 addition & 1 deletion src/nvenc/nvenc_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace nvenc {
};

std::vector<GUID> encode_guids(encode_guid_count);
if (nvenc_failed(nvenc->nvEncGetEncodeGUIDs(encoder, encode_guids.data(), encode_guids.size(), &encode_guid_count))) {
if (nvenc_failed(nvenc->nvEncGetEncodeGUIDs(encoder, encode_guids.data(), (uint32_t) encode_guids.size(), &encode_guid_count))) {
BOOST_LOG(error) << "NvEnc: NvEncGetEncodeGUIDs() failed: " << last_nvenc_error_string;
return false;
}
Expand Down
12 changes: 6 additions & 6 deletions src/nvhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ namespace nvhttp {
x++;
}
launch_session->unique_id = (get_arg(args, "uniqueid", "unknown"));
launch_session->appid = util::from_view(get_arg(args, "appid", "unknown"));
launch_session->appid = (int) util::from_view(get_arg(args, "appid", "unknown"));
launch_session->enable_sops = util::from_view(get_arg(args, "sops", "0"));
launch_session->surround_info = util::from_view(get_arg(args, "surroundAudioInfo", "196610"));
launch_session->surround_info = (int) util::from_view(get_arg(args, "surroundAudioInfo", "196610"));
launch_session->surround_params = (get_arg(args, "surroundParams", ""));
launch_session->continuous_audio = util::from_view(get_arg(args, "continuousAudio", "0"));
launch_session->gcmap = util::from_view(get_arg(args, "gcmap", "0"));
launch_session->gcmap = (int) util::from_view(get_arg(args, "gcmap", "0"));
launch_session->enable_hdr = util::from_view(get_arg(args, "hdrMode", "0"));

// Encrypted RTSP is enabled with client reported corever >= 1
Expand All @@ -331,7 +331,7 @@ namespace nvhttp {
RAND_bytes((unsigned char *) &launch_session->control_connect_data, sizeof(launch_session->control_connect_data));

launch_session->iv.resize(16);
uint32_t prepend_iv = util::endian::big<uint32_t>(util::from_view(get_arg(args, "rikeyid")));
uint32_t prepend_iv = util::endian::big<uint32_t>((int) util::from_view(get_arg(args, "rikeyid")));
auto prepend_iv_p = (uint8_t *) &prepend_iv;
std::copy(prepend_iv_p, prepend_iv_p + sizeof(prepend_iv), std::begin(launch_session->iv));
return launch_session;
Expand Down Expand Up @@ -893,7 +893,7 @@ namespace nvhttp {
}

if (appid > 0) {
auto err = proc::proc.execute(appid, launch_session);
auto err = proc::proc.execute((int) appid, launch_session);
if (err) {
tree.put("root.<xmlattr>.status_code", err);
tree.put("root.<xmlattr>.status_message", "Failed to start the specified application");
Expand Down Expand Up @@ -1041,7 +1041,7 @@ namespace nvhttp {
print_req<SunshineHTTPS>(request);

auto args = request->parse_query_string();
auto app_image = proc::proc.get_app_image(util::from_view(get_arg(args, "appid")));
auto app_image = proc::proc.get_app_image((int) util::from_view(get_arg(args, "appid")));

std::ifstream in(app_image, std::ios::binary);
SimpleWeb::CaseInsensitiveMultimap headers;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/macos/microphone.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ capture_e sample(std::vector<float> &sample_in) override {

std::copy_n(std::begin(vectorBuffer), sample_size, std::begin(sample_in));

TPCircularBufferConsume(&av_audio_capture->audioSampleBuffer, sample_size * sizeof(float));
TPCircularBufferConsume(&av_audio_capture->audioSampleBuffer, (uint32_t) sample_size * sizeof(float));

return capture_e::ok;
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/macos/misc.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

using namespace std::literals;
namespace fs = std::filesystem;
namespace bp = boost::process;
namespace bp = boost::process::v1;

namespace platf {

Expand Down
54 changes: 27 additions & 27 deletions src/rtsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ namespace rtsp_stream {
}

msg_t req {new msg_t::element_type {}};
if (auto status = parseRtspMessage(req.get(), (char *) plaintext.data(), plaintext.size())) {
if (auto status = parseRtspMessage(req.get(), (char *) plaintext.data(), (int) plaintext.size())) {
BOOST_LOG(error) << "Malformed RTSP message: ["sv << status << ']';

respond(socket->sock, *socket->session, nullptr, 400, "BAD REQUEST", 0, {});
Expand Down Expand Up @@ -290,7 +290,7 @@ namespace rtsp_stream {

auto end = socket->begin + bytes;
msg_t req {new msg_t::element_type {}};
if (auto status = parseRtspMessage(req.get(), socket->msg_buf.data(), (std::size_t) (end - socket->msg_buf.data()))) {
if (auto status = parseRtspMessage(req.get(), socket->msg_buf.data(), (int) (end - socket->msg_buf.data()))) {
BOOST_LOG(error) << "Malformed RTSP message: ["sv << status << ']';

respond(socket->sock, *socket->session, nullptr, 400, "BAD REQUEST", 0, {});
Expand All @@ -315,7 +315,7 @@ namespace rtsp_stream {
return (bool) std::isdigit(ch);
});

content_length = util::from_chars(begin, std::end(content));
content_length = (int) util::from_chars(begin, std::end(content));
break;
}
}
Expand Down Expand Up @@ -541,7 +541,7 @@ namespace rtsp_stream {
*/
int session_count() {
auto lg = _session_slots.lock();
return _session_slots->size();
return (int) _session_slots->size();
}

safe::event_t<std::shared_ptr<launch_session_t>> launch_event;
Expand Down Expand Up @@ -966,38 +966,38 @@ namespace rtsp_stream {
std::int64_t configuredBitrateKbps;
config.audio.flags[audio::config_t::HOST_AUDIO] = session.host_audio;
try {
config.audio.channels = util::from_view(args.at("x-nv-audio.surround.numChannels"sv));
config.audio.mask = util::from_view(args.at("x-nv-audio.surround.channelMask"sv));
config.audio.packetDuration = util::from_view(args.at("x-nv-aqos.packetDuration"sv));
config.audio.channels = (int) util::from_view(args.at("x-nv-audio.surround.numChannels"sv));
config.audio.mask = (int) util::from_view(args.at("x-nv-audio.surround.channelMask"sv));
config.audio.packetDuration = (int) util::from_view(args.at("x-nv-aqos.packetDuration"sv));

config.audio.flags[audio::config_t::HIGH_QUALITY] =
util::from_view(args.at("x-nv-audio.surround.AudioQuality"sv));

config.controlProtocolType = util::from_view(args.at("x-nv-general.useReliableUdp"sv));
config.packetsize = util::from_view(args.at("x-nv-video[0].packetSize"sv));
config.minRequiredFecPackets = util::from_view(args.at("x-nv-vqos[0].fec.minRequiredFecPackets"sv));
config.mlFeatureFlags = util::from_view(args.at("x-ml-general.featureFlags"sv));
config.audioQosType = util::from_view(args.at("x-nv-aqos.qosTrafficType"sv));
config.videoQosType = util::from_view(args.at("x-nv-vqos[0].qosTrafficType"sv));
config.encryptionFlagsEnabled = util::from_view(args.at("x-ss-general.encryptionEnabled"sv));
config.controlProtocolType = (int) util::from_view(args.at("x-nv-general.useReliableUdp"sv));
config.packetsize = (int) util::from_view(args.at("x-nv-video[0].packetSize"sv));
config.minRequiredFecPackets = (int) util::from_view(args.at("x-nv-vqos[0].fec.minRequiredFecPackets"sv));
config.mlFeatureFlags = (int) util::from_view(args.at("x-ml-general.featureFlags"sv));
config.audioQosType = (int) util::from_view(args.at("x-nv-aqos.qosTrafficType"sv));
config.videoQosType = (int) util::from_view(args.at("x-nv-vqos[0].qosTrafficType"sv));
config.encryptionFlagsEnabled = (uint32_t) util::from_view(args.at("x-ss-general.encryptionEnabled"sv));

// Legacy clients use nvFeatureFlags to indicate support for audio encryption
if (util::from_view(args.at("x-nv-general.featureFlags"sv)) & 0x20) {
config.encryptionFlagsEnabled |= SS_ENC_AUDIO;
}

config.monitor.height = util::from_view(args.at("x-nv-video[0].clientViewportHt"sv));
config.monitor.width = util::from_view(args.at("x-nv-video[0].clientViewportWd"sv));
config.monitor.framerate = util::from_view(args.at("x-nv-video[0].maxFPS"sv));
config.monitor.framerateX100 = util::from_view(args.at("x-nv-video[0].clientRefreshRateX100"sv));
config.monitor.bitrate = util::from_view(args.at("x-nv-vqos[0].bw.maximumBitrateKbps"sv));
config.monitor.slicesPerFrame = util::from_view(args.at("x-nv-video[0].videoEncoderSlicesPerFrame"sv));
config.monitor.numRefFrames = util::from_view(args.at("x-nv-video[0].maxNumReferenceFrames"sv));
config.monitor.encoderCscMode = util::from_view(args.at("x-nv-video[0].encoderCscMode"sv));
config.monitor.videoFormat = util::from_view(args.at("x-nv-vqos[0].bitStreamFormat"sv));
config.monitor.dynamicRange = util::from_view(args.at("x-nv-video[0].dynamicRangeMode"sv));
config.monitor.chromaSamplingType = util::from_view(args.at("x-ss-video[0].chromaSamplingType"sv));
config.monitor.enableIntraRefresh = util::from_view(args.at("x-ss-video[0].intraRefresh"sv));
config.monitor.height = (int) util::from_view(args.at("x-nv-video[0].clientViewportHt"sv));
config.monitor.width = (int) util::from_view(args.at("x-nv-video[0].clientViewportWd"sv));
config.monitor.framerate = (int) util::from_view(args.at("x-nv-video[0].maxFPS"sv));
config.monitor.framerateX100 = (int) util::from_view(args.at("x-nv-video[0].clientRefreshRateX100"sv));
config.monitor.bitrate = (int) util::from_view(args.at("x-nv-vqos[0].bw.maximumBitrateKbps"sv));
config.monitor.slicesPerFrame = (int) util::from_view(args.at("x-nv-video[0].videoEncoderSlicesPerFrame"sv));
config.monitor.numRefFrames = (int) util::from_view(args.at("x-nv-video[0].maxNumReferenceFrames"sv));
config.monitor.encoderCscMode = (int) util::from_view(args.at("x-nv-video[0].encoderCscMode"sv));
config.monitor.videoFormat = (int) util::from_view(args.at("x-nv-vqos[0].bitStreamFormat"sv));
config.monitor.dynamicRange = (int) util::from_view(args.at("x-nv-video[0].dynamicRangeMode"sv));
config.monitor.chromaSamplingType = (int) util::from_view(args.at("x-ss-video[0].chromaSamplingType"sv));
config.monitor.enableIntraRefresh = (int) util::from_view(args.at("x-ss-video[0].intraRefresh"sv));

configuredBitrateKbps = util::from_view(args.at("x-ml-video.configuredBitrateKbps"sv));
} catch (std::out_of_range &) {
Expand Down Expand Up @@ -1067,7 +1067,7 @@ namespace rtsp_stream {
configuredBitrateKbps -= std::min((std::int64_t) 500, configuredBitrateKbps / 10);

BOOST_LOG(debug) << "Final adjusted video encoding bitrate is "sv << configuredBitrateKbps << " Kbps"sv;
config.monitor.bitrate = configuredBitrateKbps;
config.monitor.bitrate = (int) configuredBitrateKbps;
}

if (config.monitor.videoFormat == 1 && video::active_hevc_mode == 1) {
Expand Down
Loading
Loading