修复编译错误

TempBranch
Matthew 8 months ago
parent 0dd32ce9d3
commit 370e89f802

@ -40,7 +40,7 @@ android {
// cppFlags '-std=c++17 -Wno-error=format-security' // cppFlags '-std=c++17 -Wno-error=format-security'
// arguments "-DANDROID_STL=c++_shared" // arguments "-DANDROID_STL=c++_shared"
arguments "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot arguments "-DNCNN_DISABLE_EXCEPTION=OFF", "-DTERM_CORE_ROOT=" + coreroot, "-DOpenCV_DIR=" + opencvsdk + "/sdk/native/jni", "-DHDRPLUS_ROOT=" + hdrplusroot, "-DNCNN_ROOT=" + ncnnroot
// abiFilters 'arm64-v8a', 'armeabi-v7a' abiFilters 'arm64-v8a', 'armeabi-v7a'
// setAbiFilters(['arm64-v8a']) // setAbiFilters(['arm64-v8a'])
} }
} }

@ -694,19 +694,19 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
else if (it->first == PROP_MODEL) else if (it->first == PROP_MODEL)
{ {
__system_property_get("ro.product.model", value); __system_property_get("ro.product.model", value);
it->second = value; it->second = std::string(value);
} }
else if (it->first == PROP_BS_MANU) else if (it->first == PROP_BS_MANU)
{ {
__system_property_get("ro.product.manufacturer", value); __system_property_get("ro.product.manufacturer", value);
it->second = value; it->second = std::string(value);
} }
else if (it->first == PROP_VERSION) else if (it->first == PROP_VERSION)
{ {
// FOR Protocol // FOR Protocol
snprintf(value, sizeof(value), "%u.%03u", (mVersionCode / 1000), (mVersionCode % 1000)); snprintf(value, sizeof(value), "%u.%03u", (mVersionCode / 1000), (mVersionCode % 1000));
// __system_property_get("ro.build.version.release", value); // __system_property_get("ro.build.version.release", value);
it->second = value; it->second = std::string(value);
} }
else if (it->first == (PROP_VERSION_ABBR)) else if (it->first == (PROP_VERSION_ABBR))
{ {
@ -724,19 +724,19 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
else if (it->first == PROP_PROD_DATE) else if (it->first == PROP_PROD_DATE)
{ {
__system_property_get("ro.build.date.utc", value); __system_property_get("ro.build.date.utc", value);
it->second = value; it->second = std::string(value);
} }
else if (it->first == PROP_SN || it->first == PROP_BS_ID) else if (it->first == PROP_SN || it->first == PROP_BS_ID)
{ {
__system_property_get("ro.serialno", value); __system_property_get("ro.serialno", value);
it->second = value; it->second = std::string(value);
} }
else if (it->first == PROP_IMEI) else if (it->first == PROP_IMEI)
{ {
if (m_simcard.empty()) if (m_simcard.empty())
{ {
__system_property_get("phone.imei", value); __system_property_get("phone.imei", value);
it->second = value; it->second = std::string(value);
} }
else else
{ {
@ -756,9 +756,8 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
{ {
fs::space_info si = fs::space("/data"); fs::space_info si = fs::space("/data");
double fr = ((double)si.available * 100.0f) / ((double)si.capacity); double fr = ((double)si.available * 100.0f) / ((double)si.capacity);
char buf[12] = { 0 }; snprintf(value, sizeof(value), "%d%%", (int)fr);
snprintf(buf, sizeof(buf), "%d%%", (int)fr); it->second = std::string(value);
it->second = buf;
} }
else if (it->first == PROP_TOTAL_ROM) else if (it->first == PROP_TOTAL_ROM)
{ {
@ -774,9 +773,8 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
long fm = android_os_Process_getFreeMemory(); long fm = android_os_Process_getFreeMemory();
long tm = android_os_Process_getTotalMemory(); long tm = android_os_Process_getTotalMemory();
double fmp = ((double)fm * 100.0f) / ((double)tm); double fmp = ((double)fm * 100.0f) / ((double)tm);
char buf[12] = { 0 }; snprintf(value, sizeof(value), "%d%%", (int)fmp);
snprintf(buf, sizeof(buf), "%d%%", (int)fmp); it->second = std::string(value); // Unit: M
it->second = buf; // Unit: M
} }
else if (it->first == PROP_TOTAL_MEMORY) else if (it->first == PROP_TOTAL_MEMORY)
{ {
@ -807,7 +805,7 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
continue; continue;
} }
snprintf(str, sizeof(str), "%.1f", (val / 1000.0)); snprintf(str, sizeof(str), "%.1f", (val / 1000.0));
it->second = str; it->second = std::string(str);
break; break;
} }
} }
@ -821,9 +819,8 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
if (val > 0) if (val > 0)
{ {
bv = val; bv = val;
char str[32] = { 0 }; snprintf(value, sizeof(value), "%.1f", val / 1000.0);
snprintf(str, sizeof(str), "%.1f", val / 1000.0); it->second = std::string(value);
it->second = str;
} }
else else
{ {
@ -865,7 +862,7 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
char str[32] = { 0 }; char str[32] = { 0 };
float batteryCurrent = STANDARD_CURRENT_64V / ((float)bv / 1000.0f / STANDARD_VOLTAGE_64V); float batteryCurrent = STANDARD_CURRENT_64V / ((float)bv / 1000.0f / STANDARD_VOLTAGE_64V);
snprintf(str, sizeof(str), "%d", (int)batteryCurrent); snprintf(str, sizeof(str), "%d", (int)batteryCurrent);
it->second = str; it->second = std::string(str);
} }
} }
// __system_property_get("ro.telephony.default_network", value); // __system_property_get("ro.telephony.default_network", value);
@ -1515,7 +1512,9 @@ void DrawOutlineText(cv::Ptr<cv::ft::FreeType2> ft2, cv::Mat& mat, const std::st
} }
} }
bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristics, std::vector<std::shared_ptr<ACameraMetadata> >& results, uint32_t ldr, std::vector<std::shared_ptr<AImage> >& frames) bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristics,
std::vector<std::shared_ptr<ACameraMetadata> >& results,
uint32_t ldr, std::vector<std::shared_ptr<AImage> >& frames)
{ {
time_t takingTime = time(NULL); time_t takingTime = time(NULL);
if (mPhotoInfo.remedy != 0) if (mPhotoInfo.remedy != 0)
@ -1533,7 +1532,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
std::string path; std::string path;
path.swap(mPath); path.swap(mPath);
std::string tmpPath = m_appPath + (APP_DIR_TMP DIR_SEP_STR) + std::to_string(photoInfo.photoId); std::string tmpPath = m_appPath + std::string(APP_DIR_TMP DIR_SEP_STR) + std::to_string(photoInfo.photoId);
acamera_metadata_enum_android_lens_facing_t facing = ACAMERA_LENS_FACING_FRONT; acamera_metadata_enum_android_lens_facing_t facing = ACAMERA_LENS_FACING_FRONT;
ACameraMetadata_const_entry e = { 0 }; ACameraMetadata_const_entry e = { 0 };
@ -1583,11 +1582,11 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
media_status_t status = AImage_getNumberOfPlanes(spImage.get(), &planeCount); media_status_t status = AImage_getNumberOfPlanes(spImage.get(), &planeCount);
AASSERT(status == AMEDIA_OK && planeCount == 1, "Error: getNumberOfPlanes() planeCount = %d", planeCount); AASSERT(status == AMEDIA_OK && planeCount == 1, "Error: getNumberOfPlanes() planeCount = %d", planeCount);
uint8_t *data = nullptr; uint8_t *planeData = NULL;
int len = 0; int planeDataLen = 0;
mstatus = AImage_getPlaneData(spImage.get(), 0, &data, &len); mstatus = AImage_getPlaneData(spImage.get(), 0, &planeData, &planeDataLen);
DngCreator dngCreator(characteristics.get(), result.get()); DngCreator dngCreator(characteristics.get(), result.get());
dngCreator.writeInputBuffer(*it, data, len, width, height, 0); dngCreator.writeInputBuffer(*it, planeData, planeDataLen, width, height, 0);
} }
} }
else else
@ -1617,7 +1616,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
} }
int32_t format; int32_t format;
media_status_t mstatus = AImage_getFormat(frame.get(), &format); mstatus = AImage_getFormat(frame.get(), &format);
if (format == AIMAGE_FORMAT_YUV_420_888) if (format == AIMAGE_FORMAT_YUV_420_888)
{ {
@ -1759,7 +1758,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
std::vector<std::string> rawFilePaths; std::vector<std::string> rawFilePaths;
for (auto it = rawFiles.cbegin(); it != rawFiles.cend(); ++it) for (auto it = rawFiles.cbegin(); it != rawFiles.cend(); ++it)
{ {
std::string dngFilePath = tmpPath + "-" + std::to_string(std::distance(rawFiles.cbegin(), it)) + ".dng"; std::string dngFilePath = tmpPath + std::string("-") + std::to_string(std::distance(rawFiles.cbegin(), it)) + std::string(".dng");
#ifdef _DEBUG #ifdef _DEBUG
char log[256] = { 0 }; char log[256] = { 0 };
strcpy(log, dngFilePath.c_str()); strcpy(log, dngFilePath.c_str());
@ -1768,7 +1767,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
if (file) { if (file) {
if (!(*it).empty()) if (!(*it).empty())
{ {
fwrite(&((*it)[0]), 1, (*it).size(), file); fwrite((const void*)(&((*it)[0])), 1, (*it).size(), file);
} }
fclose(file); fclose(file);
rawFilePaths.push_back(dngFilePath); rawFilePaths.push_back(dngFilePath);
@ -1781,7 +1780,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
XYLOG(XYLOG_SEVERITY_ERROR, "Finish HDR CH=%u IMGID=%u", (uint32_t)mPhotoInfo.channel, (uint32_t)mPhotoInfo.photoId); XYLOG(XYLOG_SEVERITY_ERROR, "Finish HDR CH=%u IMGID=%u", (uint32_t)mPhotoInfo.channel, (uint32_t)mPhotoInfo.photoId);
#ifdef NDEBUG #ifdef NDEBUG
for (auto it = rawFilePaths.cbegin(); it != rawFiles.cend(); ++it) for (auto it = rawFilePaths.cbegin(); it != rawFilePaths.cend(); ++it)
{ {
std::remove((*it).c_str()); std::remove((*it).c_str());
} }

@ -1316,7 +1316,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
for (int idx = 1; idx < mCaptureRequests.size(); idx++) for (int idx = 1; idx < mCaptureRequests.size(); idx++)
{ {
CopyPreviewRequest(mCaptureRequests[idx]->request, result); // CopyPreviewRequest(mCaptureRequests[idx]->request, result);
requests.push_back(mCaptureRequests[idx]->request); requests.push_back(mCaptureRequests[idx]->request);
} }

Loading…
Cancel
Save