diff --git a/camera/common/1.0/default/Android.bp b/camera/common/default/Android.bp similarity index 80% rename from camera/common/1.0/default/Android.bp rename to camera/common/default/Android.bp index 1a4d16b8f9..e8c8f9dba0 100644 --- a/camera/common/1.0/default/Android.bp +++ b/camera/common/default/Android.bp @@ -8,7 +8,7 @@ package { } cc_library_static { - name: "android.hardware.camera.common@1.0-helper", + name: "android.hardware.camera.common-helper", vendor_available: true, defaults: ["hidl_defaults"], srcs: [ @@ -38,3 +38,11 @@ cc_library_static { include_dirs: ["system/media/private/camera/include"], export_include_dirs: ["include"], } + +// NOTE: Deprecated module kept for compatibility reasons. +// Depend on "android.hardware.camera.common-helper" instead +cc_library_static { + name: "android.hardware.camera.common@1.0-helper", + vendor_available: true, + whole_static_libs: ["android.hardware.camera.common-helper"], +} diff --git a/camera/common/1.0/default/CameraMetadata.cpp b/camera/common/default/CameraMetadata.cpp similarity index 74% rename from camera/common/1.0/default/CameraMetadata.cpp rename to camera/common/default/CameraMetadata.cpp index eb1bd1c149..ed5626115d 100644 --- a/camera/common/1.0/default/CameraMetadata.cpp +++ b/camera/common/default/CameraMetadata.cpp @@ -27,44 +27,36 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { -#define ALIGN_TO(val, alignment) \ - (((uintptr_t)(val) + ((alignment) - 1)) & ~((alignment) - 1)) +#define ALIGN_TO(val, alignment) (((uintptr_t)(val) + ((alignment)-1)) & ~((alignment)-1)) -CameraMetadata::CameraMetadata() : - mBuffer(NULL), mLocked(false) { -} +CameraMetadata::CameraMetadata() : mBuffer(NULL), mLocked(false) {} -CameraMetadata::CameraMetadata(size_t entryCapacity, size_t dataCapacity) : - mLocked(false) -{ +CameraMetadata::CameraMetadata(size_t entryCapacity, size_t dataCapacity) : mLocked(false) { mBuffer = allocate_camera_metadata(entryCapacity, dataCapacity); } -CameraMetadata::CameraMetadata(const CameraMetadata &other) : - mLocked(false) { +CameraMetadata::CameraMetadata(const CameraMetadata& other) : mLocked(false) { mBuffer = clone_camera_metadata(other.mBuffer); } -CameraMetadata::CameraMetadata(camera_metadata_t *buffer) : - mBuffer(NULL), mLocked(false) { +CameraMetadata::CameraMetadata(camera_metadata_t* buffer) : mBuffer(NULL), mLocked(false) { acquire(buffer); } -CameraMetadata &CameraMetadata::operator=(const CameraMetadata &other) { +CameraMetadata& CameraMetadata::operator=(const CameraMetadata& other) { return operator=(other.mBuffer); } -CameraMetadata &CameraMetadata::operator=(const camera_metadata_t *buffer) { +CameraMetadata& CameraMetadata::operator=(const camera_metadata_t* buffer) { if (mLocked) { ALOGE("%s: Assignment to a locked CameraMetadata!", __FUNCTION__); return *this; } if (CC_LIKELY(buffer != mBuffer)) { - camera_metadata_t *newBuffer = clone_camera_metadata(buffer); + camera_metadata_t* newBuffer = clone_camera_metadata(buffer); clear(); mBuffer = newBuffer; } @@ -81,14 +73,13 @@ const camera_metadata_t* CameraMetadata::getAndLock() const { return mBuffer; } -status_t CameraMetadata::unlock(const camera_metadata_t *buffer) const { +status_t CameraMetadata::unlock(const camera_metadata_t* buffer) const { if (!mLocked) { ALOGE("%s: Can't unlock a non-locked CameraMetadata!", __FUNCTION__); return INVALID_OPERATION; } if (buffer != mBuffer) { - ALOGE("%s: Can't unlock CameraMetadata with wrong pointer!", - __FUNCTION__); + ALOGE("%s: Can't unlock CameraMetadata with wrong pointer!", __FUNCTION__); return BAD_VALUE; } mLocked = false; @@ -100,7 +91,7 @@ camera_metadata_t* CameraMetadata::release() { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return NULL; } - camera_metadata_t *released = mBuffer; + camera_metadata_t* released = mBuffer; mBuffer = NULL; return released; } @@ -116,7 +107,7 @@ void CameraMetadata::clear() { } } -void CameraMetadata::acquire(camera_metadata_t *buffer) { +void CameraMetadata::acquire(camera_metadata_t* buffer) { if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return; @@ -124,12 +115,11 @@ void CameraMetadata::acquire(camera_metadata_t *buffer) { clear(); mBuffer = buffer; - ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/NULL) != OK, - "%s: Failed to validate metadata structure %p", - __FUNCTION__, buffer); + ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/ NULL) != OK, + "%s: Failed to validate metadata structure %p", __FUNCTION__, buffer); } -void CameraMetadata::acquire(CameraMetadata &other) { +void CameraMetadata::acquire(CameraMetadata& other) { if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return; @@ -137,7 +127,7 @@ void CameraMetadata::acquire(CameraMetadata &other) { acquire(other.release()); } -status_t CameraMetadata::append(const CameraMetadata &other) { +status_t CameraMetadata::append(const CameraMetadata& other) { return append(other.mBuffer); } @@ -154,8 +144,7 @@ status_t CameraMetadata::append(const camera_metadata_t* other) { } size_t CameraMetadata::entryCount() const { - return (mBuffer == NULL) ? 0 : - get_camera_metadata_entry_count(mBuffer); + return (mBuffer == NULL) ? 0 : get_camera_metadata_entry_count(mBuffer); } bool CameraMetadata::isEmpty() const { @@ -172,11 +161,11 @@ status_t CameraMetadata::sort() { status_t CameraMetadata::checkType(uint32_t tag, uint8_t expectedType) { int tagType = get_local_camera_metadata_tag_type(tag, mBuffer); - if ( CC_UNLIKELY(tagType == -1)) { + if (CC_UNLIKELY(tagType == -1)) { ALOGE("Update metadata entry: Unknown tag %d", tag); return INVALID_OPERATION; } - if ( CC_UNLIKELY(tagType != expectedType) ) { + if (CC_UNLIKELY(tagType != expectedType)) { ALOGE("Mismatched tag type when updating entry %s (%d) of type %s; " "got type %s data instead ", get_local_camera_metadata_tag_name(tag, mBuffer), tag, @@ -186,112 +175,105 @@ status_t CameraMetadata::checkType(uint32_t tag, uint8_t expectedType) { return OK; } -status_t CameraMetadata::update(uint32_t tag, - const int32_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const int32_t* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_INT32)) != OK) { + if ((res = checkType(tag, TYPE_INT32)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const uint8_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const uint8_t* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_BYTE)) != OK) { + if ((res = checkType(tag, TYPE_BYTE)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const float *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const float* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_FLOAT)) != OK) { + if ((res = checkType(tag, TYPE_FLOAT)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const int64_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const int64_t* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_INT64)) != OK) { + if ((res = checkType(tag, TYPE_INT64)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const double *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const double* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_DOUBLE)) != OK) { + if ((res = checkType(tag, TYPE_DOUBLE)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const camera_metadata_rational_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const camera_metadata_rational_t* data, + size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_RATIONAL)) != OK) { + if ((res = checkType(tag, TYPE_RATIONAL)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const String8 &string) { +status_t CameraMetadata::update(uint32_t tag, const String8& string) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_BYTE)) != OK) { + if ((res = checkType(tag, TYPE_BYTE)) != OK) { return res; } // string.size() doesn't count the null termination character. return updateImpl(tag, (const void*)string.string(), string.size() + 1); } -status_t CameraMetadata::update(const camera_metadata_ro_entry &entry) { +status_t CameraMetadata::update(const camera_metadata_ro_entry& entry) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(entry.tag, entry.type)) != OK) { + if ((res = checkType(entry.tag, entry.type)) != OK) { return res; } return updateImpl(entry.tag, (const void*)entry.data.u8, entry.count); } -status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, - size_t data_count) { +status_t CameraMetadata::updateImpl(uint32_t tag, const void* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); @@ -308,13 +290,11 @@ status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, uintptr_t bufAddr = reinterpret_cast(mBuffer); uintptr_t dataAddr = reinterpret_cast(data); if (dataAddr > bufAddr && dataAddr < (bufAddr + bufferSize)) { - ALOGE("%s: Update attempted with data from the same metadata buffer!", - __FUNCTION__); + ALOGE("%s: Update attempted with data from the same metadata buffer!", __FUNCTION__); return INVALID_OPERATION; } - size_t data_size = calculate_camera_metadata_entry_data_size(type, - data_count); + size_t data_size = calculate_camera_metadata_entry_data_size(type, data_count); res = resizeIfNeeded(1, data_size); @@ -322,11 +302,9 @@ status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, camera_metadata_entry_t entry; res = find_camera_metadata_entry(mBuffer, tag, &entry); if (res == NAME_NOT_FOUND) { - res = add_camera_metadata_entry(mBuffer, - tag, data, data_count); + res = add_camera_metadata_entry(mBuffer, tag, data, data_count); } else if (res == OK) { - res = update_camera_metadata_entry(mBuffer, - entry.index, data, data_count, NULL); + res = update_camera_metadata_entry(mBuffer, entry.index, data, data_count, NULL); } } @@ -337,11 +315,10 @@ status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, } IF_ALOGV() { - ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/NULL) != - OK, + ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/ NULL) != OK, - "%s: Failed to validate metadata structure after update %p", - __FUNCTION__, mBuffer); + "%s: Failed to validate metadata structure after update %p", __FUNCTION__, + mBuffer); } return res; @@ -361,7 +338,7 @@ camera_metadata_entry_t CameraMetadata::find(uint32_t tag) { return entry; } res = find_camera_metadata_entry(mBuffer, tag, &entry); - if (CC_UNLIKELY( res != OK )) { + if (CC_UNLIKELY(res != OK)) { entry.count = 0; entry.data.u8 = NULL; } @@ -372,7 +349,7 @@ camera_metadata_ro_entry_t CameraMetadata::find(uint32_t tag) const { status_t res; camera_metadata_ro_entry entry; res = find_camera_metadata_ro_entry(mBuffer, tag, &entry); - if (CC_UNLIKELY( res != OK )) { + if (CC_UNLIKELY(res != OK)) { entry.count = 0; entry.data.u8 = NULL; } @@ -418,23 +395,17 @@ status_t CameraMetadata::resizeIfNeeded(size_t extraEntries, size_t extraData) { } else { size_t currentEntryCount = get_camera_metadata_entry_count(mBuffer); size_t currentEntryCap = get_camera_metadata_entry_capacity(mBuffer); - size_t newEntryCount = currentEntryCount + - extraEntries; - newEntryCount = (newEntryCount > currentEntryCap) ? - newEntryCount * 2 : currentEntryCap; + size_t newEntryCount = currentEntryCount + extraEntries; + newEntryCount = (newEntryCount > currentEntryCap) ? newEntryCount * 2 : currentEntryCap; size_t currentDataCount = get_camera_metadata_data_count(mBuffer); size_t currentDataCap = get_camera_metadata_data_capacity(mBuffer); - size_t newDataCount = currentDataCount + - extraData; - newDataCount = (newDataCount > currentDataCap) ? - newDataCount * 2 : currentDataCap; + size_t newDataCount = currentDataCount + extraData; + newDataCount = (newDataCount > currentDataCap) ? newDataCount * 2 : currentDataCap; - if (newEntryCount > currentEntryCap || - newDataCount > currentDataCap) { - camera_metadata_t *oldBuffer = mBuffer; - mBuffer = allocate_camera_metadata(newEntryCount, - newDataCount); + if (newEntryCount > currentEntryCap || newDataCount > currentDataCap) { + camera_metadata_t* oldBuffer = mBuffer; + mBuffer = allocate_camera_metadata(newEntryCount, newDataCount); if (mBuffer == NULL) { ALOGE("%s: Can't allocate larger metadata buffer", __FUNCTION__); return NO_MEMORY; @@ -462,14 +433,13 @@ void CameraMetadata::swap(CameraMetadata& other) { mBuffer = otherBuf; } -status_t CameraMetadata::getTagFromName(const char *name, - const VendorTagDescriptor* vTags, uint32_t *tag) { - +status_t CameraMetadata::getTagFromName(const char* name, const VendorTagDescriptor* vTags, + uint32_t* tag) { if (name == nullptr || tag == nullptr) return BAD_VALUE; size_t nameLength = strlen(name); - const SortedVector *vendorSections; + const SortedVector* vendorSections; size_t vendorSectionCount = 0; if (vTags != NULL) { @@ -478,18 +448,18 @@ status_t CameraMetadata::getTagFromName(const char *name, } // First, find the section by the longest string match - const char *section = NULL; + const char* section = NULL; size_t sectionIndex = 0; size_t sectionLength = 0; size_t totalSectionCount = ANDROID_SECTION_COUNT + vendorSectionCount; for (size_t i = 0; i < totalSectionCount; ++i) { - - const char *str = (i < ANDROID_SECTION_COUNT) ? camera_metadata_section_names[i] : - (*vendorSections)[i - ANDROID_SECTION_COUNT].string(); + const char* str = (i < ANDROID_SECTION_COUNT) + ? camera_metadata_section_names[i] + : (*vendorSections)[i - ANDROID_SECTION_COUNT].string(); ALOGV("%s: Trying to match against section '%s'", __FUNCTION__, str); - if (strstr(name, str) == name) { // name begins with the section name + if (strstr(name, str) == name) { // name begins with the section name size_t strLength = strlen(str); ALOGV("%s: Name begins with section name", __FUNCTION__); @@ -508,12 +478,11 @@ status_t CameraMetadata::getTagFromName(const char *name, if (section == NULL) { return NAME_NOT_FOUND; } else { - ALOGV("%s: Found matched section '%s' (%zu)", - __FUNCTION__, section, sectionIndex); + ALOGV("%s: Found matched section '%s' (%zu)", __FUNCTION__, section, sectionIndex); } // Get the tag name component of the name - const char *nameTagName = name + sectionLength + 1; // x.y.z -> z + const char* nameTagName = name + sectionLength + 1; // x.y.z -> z if (sectionLength + 1 >= nameLength) { return BAD_VALUE; } @@ -522,16 +491,15 @@ status_t CameraMetadata::getTagFromName(const char *name, uint32_t candidateTag = 0; if (sectionIndex < ANDROID_SECTION_COUNT) { // Match built-in tags (typically android.*) - uint32_t tagBegin, tagEnd; // [tagBegin, tagEnd) + uint32_t tagBegin, tagEnd; // [tagBegin, tagEnd) tagBegin = camera_metadata_section_bounds[sectionIndex][0]; tagEnd = camera_metadata_section_bounds[sectionIndex][1]; for (candidateTag = tagBegin; candidateTag < tagEnd; ++candidateTag) { - const char *tagName = get_camera_metadata_tag_name(candidateTag); + const char* tagName = get_camera_metadata_tag_name(candidateTag); if (strcmp(nameTagName, tagName) == 0) { - ALOGV("%s: Found matched tag '%s' (%d)", - __FUNCTION__, tagName, candidateTag); + ALOGV("%s: Found matched tag '%s' (%d)", __FUNCTION__, tagName, candidateTag); break; } } @@ -554,10 +522,8 @@ status_t CameraMetadata::getTagFromName(const char *name, return OK; } - -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/default/CameraModule.cpp similarity index 84% rename from camera/common/1.0/default/CameraModule.cpp rename to camera/common/default/CameraModule.cpp index 16fb85cc64..9960842ead 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/default/CameraModule.cpp @@ -16,7 +16,7 @@ #define LOG_TAG "CamComm1.0-CamModule" #define ATRACE_TAG ATRACE_TAG_CAMERA -//#define LOG_NDEBUG 0 +// #define LOG_NDEBUG 0 #include @@ -26,11 +26,9 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { -void CameraModule::deriveCameraCharacteristicsKeys( - uint32_t deviceVersion, CameraMetadata &chars) { +void CameraModule::deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata& chars) { ATRACE_CALL(); Vector derivedCharKeys; @@ -40,9 +38,9 @@ void CameraModule::deriveCameraCharacteristicsKeys( if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_3) { Vector controlModes; uint8_t data = ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE; - chars.update(ANDROID_CONTROL_AE_LOCK_AVAILABLE, &data, /*count*/1); + chars.update(ANDROID_CONTROL_AE_LOCK_AVAILABLE, &data, /*count*/ 1); data = ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE; - chars.update(ANDROID_CONTROL_AWB_LOCK_AVAILABLE, &data, /*count*/1); + chars.update(ANDROID_CONTROL_AWB_LOCK_AVAILABLE, &data, /*count*/ 1); controlModes.push(ANDROID_CONTROL_MODE_AUTO); camera_metadata_entry entry = chars.find(ANDROID_CONTROL_AVAILABLE_SCENE_MODES); if (entry.count > 1 || entry.data.u8[0] != ANDROID_CONTROL_SCENE_MODE_DISABLED) { @@ -121,14 +119,14 @@ void CameraModule::deriveCameraCharacteristicsKeys( if (entry.count > 0) { Vector highSpeedConfig; for (size_t i = 0; i < entry.count; i += 4) { - highSpeedConfig.add(entry.data.i32[i]); // width - highSpeedConfig.add(entry.data.i32[i + 1]); // height - highSpeedConfig.add(entry.data.i32[i + 2]); // fps_min - highSpeedConfig.add(entry.data.i32[i + 3]); // fps_max - highSpeedConfig.add(1); // batchSize_max. default to 1 for HAL3.2 + highSpeedConfig.add(entry.data.i32[i]); // width + highSpeedConfig.add(entry.data.i32[i + 1]); // height + highSpeedConfig.add(entry.data.i32[i + 2]); // fps_min + highSpeedConfig.add(entry.data.i32[i + 3]); // fps_max + highSpeedConfig.add(1); // batchSize_max. default to 1 for HAL3.2 } chars.update(ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, - highSpeedConfig); + highSpeedConfig); } } @@ -145,25 +143,23 @@ void CameraModule::deriveCameraCharacteristicsKeys( const int STREAM_IS_INPUT_OFFSET = 3; Vector rawOpaqueSizes; - for (size_t i=0; i < entry.count; i += STREAM_CONFIGURATION_SIZE) { + for (size_t i = 0; i < entry.count; i += STREAM_CONFIGURATION_SIZE) { int32_t format = entry.data.i32[i + STREAM_FORMAT_OFFSET]; int32_t width = entry.data.i32[i + STREAM_WIDTH_OFFSET]; int32_t height = entry.data.i32[i + STREAM_HEIGHT_OFFSET]; int32_t isInput = entry.data.i32[i + STREAM_IS_INPUT_OFFSET]; if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - format == HAL_PIXEL_FORMAT_RAW_OPAQUE) { + format == HAL_PIXEL_FORMAT_RAW_OPAQUE) { supportRawOpaque = true; rawOpaqueSizes.push(width); rawOpaqueSizes.push(height); // 2 bytes per pixel. This rough estimation is only used when // HAL does not fill in the opaque raw size - rawOpaqueSizes.push(width * height *2); + rawOpaqueSizes.push(width * height * 2); } if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - (format == HAL_PIXEL_FORMAT_RAW16 || - format == HAL_PIXEL_FORMAT_RAW10 || - format == HAL_PIXEL_FORMAT_RAW12 || - format == HAL_PIXEL_FORMAT_RAW_OPAQUE)) { + (format == HAL_PIXEL_FORMAT_RAW16 || format == HAL_PIXEL_FORMAT_RAW10 || + format == HAL_PIXEL_FORMAT_RAW12 || format == HAL_PIXEL_FORMAT_RAW_OPAQUE)) { supportAnyRaw = true; } } @@ -183,9 +179,7 @@ void CameraModule::deriveCameraCharacteristicsKeys( entry = chars.find(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE); if (entry.count == 0) { // Fill in default value (100, 100) - chars.update( - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE, - defaultRange, 2); + chars.update(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE, defaultRange, 2); derivedCharKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE); // Actual request/results will be derived by camera device. derivedRequestKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST); @@ -197,22 +191,19 @@ void CameraModule::deriveCameraCharacteristicsKeys( // Add those newly added keys to AVAILABLE_CHARACTERISTICS_KEYS // This has to be done at this end of this function. if (derivedCharKeys.size() > 0) { - appendAvailableKeys( - chars, ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, derivedCharKeys); + appendAvailableKeys(chars, ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, derivedCharKeys); } if (derivedRequestKeys.size() > 0) { - appendAvailableKeys( - chars, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, derivedRequestKeys); + appendAvailableKeys(chars, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, derivedRequestKeys); } if (derivedResultKeys.size() > 0) { - appendAvailableKeys( - chars, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, derivedResultKeys); + appendAvailableKeys(chars, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, derivedResultKeys); } return; } -void CameraModule::appendAvailableKeys(CameraMetadata &chars, - int32_t keyTag, const Vector& appendKeys) { +void CameraModule::appendAvailableKeys(CameraMetadata& chars, int32_t keyTag, + const Vector& appendKeys) { camera_metadata_entry entry = chars.find(keyTag); Vector availableKeys; availableKeys.setCapacity(entry.count + appendKeys.size()); @@ -225,7 +216,7 @@ void CameraModule::appendAvailableKeys(CameraMetadata &chars, chars.update(keyTag, availableKeys); } -CameraModule::CameraModule(camera_module_t *module) : mNumberOfCameras(0) { +CameraModule::CameraModule(camera_module_t* module) : mNumberOfCameras(0) { if (module == NULL) { ALOGE("%s: camera hardware module must not be null", __FUNCTION__); assert(0); @@ -233,8 +224,7 @@ CameraModule::CameraModule(camera_module_t *module) : mNumberOfCameras(0) { mModule = module; } -CameraModule::~CameraModule() -{ +CameraModule::~CameraModule() { while (mCameraInfoMap.size() > 0) { camera_info cameraInfo = mCameraInfoMap.editValueAt(0); if (cameraInfo.static_camera_characteristics != NULL) { @@ -256,8 +246,7 @@ CameraModule::~CameraModule() int CameraModule::init() { ATRACE_CALL(); int res = OK; - if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4 && - mModule->init != NULL) { + if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4 && mModule->init != NULL) { ATRACE_BEGIN("camera_module->init"); res = mModule->init(); ATRACE_END(); @@ -267,7 +256,7 @@ int CameraModule::init() { return res; } -int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) { +int CameraModule::getCameraInfo(int cameraId, struct camera_info* info) { ATRACE_CALL(); Mutex::Autolock lock(mCameraInfoLock); if (cameraId < 0) { @@ -318,7 +307,7 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) { return OK; } -int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo) { +int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t** physicalInfo) { ATRACE_CALL(); Mutex::Autolock lock(mCameraInfoLock); if (physicalCameraId < mNumberOfCameras) { @@ -330,7 +319,7 @@ int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t int apiVersion = mModule->common.module_api_version; if (apiVersion < CAMERA_MODULE_API_VERSION_2_5) { ALOGE("%s: Module version must be at least 2.5 to handle getPhysicalCameraInfo", - __FUNCTION__); + __FUNCTION__); return -ENODEV; } if (mModule->get_physical_camera_info == nullptr) { @@ -341,7 +330,7 @@ int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t ssize_t index = mPhysicalCameraInfoMap.indexOfKey(physicalCameraId); if (index == NAME_NOT_FOUND) { // Get physical camera characteristics, and cache it - camera_metadata_t *info = nullptr; + camera_metadata_t* info = nullptr; ATRACE_BEGIN("camera_module->get_physical_camera_info"); int ret = mModule->get_physical_camera_info(physicalCameraId, &info); ATRACE_END(); @@ -396,8 +385,7 @@ bool CameraModule::isOpenLegacyDefined() const { return mModule->open_legacy != NULL; } -int CameraModule::openLegacy( - const char* id, uint32_t halVersion, struct hw_device_t** device) { +int CameraModule::openLegacy(const char* id, uint32_t halVersion, struct hw_device_t** device) { int res; ATRACE_BEGIN("camera_module->open_legacy"); res = mModule->open_legacy(&mModule->common, id, halVersion, device); @@ -413,7 +401,7 @@ int CameraModule::getNumberOfCameras() { return numCameras; } -int CameraModule::setCallbacks(const camera_module_callbacks_t *callbacks) { +int CameraModule::setCallbacks(const camera_module_callbacks_t* callbacks) { int res = OK; ATRACE_BEGIN("camera_module->set_callbacks"); if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_1) { @@ -438,8 +426,7 @@ void CameraModule::getVendorTagOps(vendor_tag_ops_t* ops) { bool CameraModule::isSetTorchModeSupported() const { if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4) { if (mModule->set_torch_mode == NULL) { - ALOGE("%s: Module 2.4 device must support set torch API!", - __FUNCTION__); + ALOGE("%s: Module 2.4 device must support set torch API!", __FUNCTION__); return false; } return true; @@ -457,7 +444,7 @@ int CameraModule::setTorchMode(const char* camera_id, bool enable) { return res; } -int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams) { +int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combination_t* streams) { int res = INVALID_OPERATION; if (mModule->is_stream_combination_supported != NULL) { ATRACE_BEGIN("camera_module->is_stream_combination_supported"); @@ -468,44 +455,41 @@ int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combi } void CameraModule::notifyDeviceStateChange(uint64_t deviceState) { - if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_5 && - mModule->notify_device_state_change != NULL) { - ATRACE_BEGIN("camera_module->notify_device_state_change"); - ALOGI("%s: calling notify_device_state_change with state %" PRId64, __FUNCTION__, - deviceState); - mModule->notify_device_state_change(deviceState); - ATRACE_END(); - } + if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_5 && + mModule->notify_device_state_change != NULL) { + ATRACE_BEGIN("camera_module->notify_device_state_change"); + ALOGI("%s: calling notify_device_state_change with state %" PRId64, __FUNCTION__, + deviceState); + mModule->notify_device_state_change(deviceState); + ATRACE_END(); + } } -bool CameraModule::isLogicalMultiCamera( - const common::V1_0::helper::CameraMetadata& metadata, - std::unordered_set* physicalCameraIds) { +bool CameraModule::isLogicalMultiCamera(const common::helper::CameraMetadata& metadata, + std::unordered_set* physicalCameraIds) { if (physicalCameraIds == nullptr) { ALOGE("%s: physicalCameraIds must not be null", __FUNCTION__); return false; } bool isLogicalMultiCamera = false; - camera_metadata_ro_entry_t capabilities = - metadata.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES); + camera_metadata_ro_entry_t capabilities = metadata.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES); for (size_t i = 0; i < capabilities.count; i++) { if (capabilities.data.u8[i] == - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) { + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) { isLogicalMultiCamera = true; break; } } if (isLogicalMultiCamera) { - camera_metadata_ro_entry_t entry = - metadata.find(ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS); + camera_metadata_ro_entry_t entry = metadata.find(ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS); const uint8_t* ids = entry.data.u8; size_t start = 0; for (size_t i = 0; i < entry.count; ++i) { if (ids[i] == '\0') { if (start != i) { - const char* physicalId = reinterpret_cast(ids+start); + const char* physicalId = reinterpret_cast(ids + start); physicalCameraIds->emplace(physicalId); } start = i + 1; @@ -516,7 +500,7 @@ bool CameraModule::isLogicalMultiCamera( } status_t CameraModule::filterOpenErrorCode(status_t err) { - switch(err) { + switch (err) { case NO_ERROR: case -EBUSY: case -EINVAL: @@ -533,9 +517,9 @@ void CameraModule::removeCamera(int cameraId) { // static_camera_characteristics if (getDeviceVersion(cameraId) >= CAMERA_DEVICE_API_VERSION_3_0) { std::unordered_set physicalIds; - camera_metadata_t *metadata = const_cast( + camera_metadata_t* metadata = const_cast( mCameraInfoMap.valueFor(cameraId).static_camera_characteristics); - common::V1_0::helper::CameraMetadata hidlMetadata(metadata); + common::helper::CameraMetadata hidlMetadata(metadata); if (isLogicalMultiCamera(hidlMetadata, &physicalIds)) { for (const auto& id : physicalIds) { @@ -545,7 +529,7 @@ void CameraModule::removeCamera(int cameraId) { mPhysicalCameraInfoMap.removeItem(idInt); } else { ALOGE("%s: Cannot find corresponding static metadata for physical id %s", - __FUNCTION__, id.c_str()); + __FUNCTION__, id.c_str()); } } } @@ -575,9 +559,8 @@ void* CameraModule::getDso() { return mModule->common.dso; } -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/CameraParameters.cpp b/camera/common/default/CameraParameters.cpp similarity index 77% rename from camera/common/1.0/default/CameraParameters.cpp rename to camera/common/default/CameraParameters.cpp index e707b0855a..37e28a25d1 100644 --- a/camera/common/1.0/default/CameraParameters.cpp +++ b/camera/common/default/CameraParameters.cpp @@ -18,17 +18,16 @@ #define LOG_TAG "CameraParams" #include -#include #include +#include +#include #include #include "CameraParameters.h" -#include namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { // Parameter keys to communicate between camera application and driver. @@ -79,7 +78,8 @@ const char CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP[] = "exposure-compen const char CameraParameters::KEY_AUTO_EXPOSURE_LOCK[] = "auto-exposure-lock"; const char CameraParameters::KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[] = "auto-exposure-lock-supported"; const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK[] = "auto-whitebalance-lock"; -const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[] = "auto-whitebalance-lock-supported"; +const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[] = + "auto-whitebalance-lock-supported"; const char CameraParameters::KEY_MAX_NUM_METERING_AREAS[] = "max-num-metering-areas"; const char CameraParameters::KEY_METERING_AREAS[] = "metering-areas"; const char CameraParameters::KEY_ZOOM[] = "zoom"; @@ -91,7 +91,8 @@ const char CameraParameters::KEY_FOCUS_DISTANCES[] = "focus-distances"; const char CameraParameters::KEY_VIDEO_FRAME_FORMAT[] = "video-frame-format"; const char CameraParameters::KEY_VIDEO_SIZE[] = "video-size"; const char CameraParameters::KEY_SUPPORTED_VIDEO_SIZES[] = "video-size-values"; -const char CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = "preferred-preview-size-for-video"; +const char CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = + "preferred-preview-size-for-video"; const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW[] = "max-num-detected-faces-hw"; const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW[] = "max-num-detected-faces-sw"; const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint"; @@ -160,7 +161,7 @@ const char CameraParameters::SCENE_MODE_HDR[] = "hdr"; const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp"; const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp"; const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv"; -const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p"; +const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p"; const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565"; const char CameraParameters::PIXEL_FORMAT_RGBA8888[] = "rgba8888"; const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg"; @@ -180,17 +181,11 @@ const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-pictu const char CameraParameters::LIGHTFX_LOWLIGHT[] = "low-light"; const char CameraParameters::LIGHTFX_HDR[] = "high-dynamic-range"; -CameraParameters::CameraParameters() - : mMap() -{ -} +CameraParameters::CameraParameters() : mMap() {} -CameraParameters::~CameraParameters() -{ -} +CameraParameters::~CameraParameters() {} -String8 CameraParameters::flatten() const -{ +String8 CameraParameters::flatten() const { String8 flattened(""); size_t size = mMap.size(); @@ -202,31 +197,28 @@ String8 CameraParameters::flatten() const flattened += k; flattened += "="; flattened += v; - if (i != size-1) - flattened += ";"; + if (i != size - 1) flattened += ";"; } return flattened; } -void CameraParameters::unflatten(const String8 ¶ms) -{ - const char *a = params.string(); - const char *b; +void CameraParameters::unflatten(const String8& params) { + const char* a = params.string(); + const char* b; mMap.clear(); for (;;) { // Find the bounds of the key name. b = strchr(a, '='); - if (b == 0) - break; + if (b == 0) break; // Create the key string. - String8 k(a, (size_t)(b-a)); + String8 k(a, (size_t)(b - a)); // Find the value. - a = b+1; + a = b + 1; b = strchr(a, ';'); if (b == 0) { // If there's no semicolon, this is the last item. @@ -235,15 +227,13 @@ void CameraParameters::unflatten(const String8 ¶ms) break; } - String8 v(a, (size_t)(b-a)); + String8 v(a, (size_t)(b - a)); mMap.add(k, v); - a = b+1; + a = b + 1; } } - -void CameraParameters::set(const char *key, const char *value) -{ +void CameraParameters::set(const char* key, const char* value) { // i think i can do this with strspn() if (strchr(key, '=') || strchr(key, ';')) { // ALOGE("Key \"%s\"contains invalid character (= or ;)", key); @@ -258,54 +248,44 @@ void CameraParameters::set(const char *key, const char *value) mMap.replaceValueFor(String8(key), String8(value)); } -void CameraParameters::set(const char *key, int value) -{ +void CameraParameters::set(const char* key, int value) { char str[16]; sprintf(str, "%d", value); set(key, str); } -void CameraParameters::setFloat(const char *key, float value) -{ +void CameraParameters::setFloat(const char* key, float value) { char str[16]; // 14 should be enough. We overestimate to be safe. snprintf(str, sizeof(str), "%g", value); set(key, str); } -const char *CameraParameters::get(const char *key) const -{ +const char* CameraParameters::get(const char* key) const { String8 v = mMap.valueFor(String8(key)); - if (v.length() == 0) - return 0; + if (v.length() == 0) return 0; return v.string(); } -int CameraParameters::getInt(const char *key) const -{ - const char *v = get(key); - if (v == 0) - return -1; +int CameraParameters::getInt(const char* key) const { + const char* v = get(key); + if (v == 0) return -1; return strtol(v, 0, 0); } -float CameraParameters::getFloat(const char *key) const -{ - const char *v = get(key); +float CameraParameters::getFloat(const char* key) const { + const char* v = get(key); if (v == 0) return -1; return strtof(v, 0); } -void CameraParameters::remove(const char *key) -{ +void CameraParameters::remove(const char* key) { mMap.removeItem(String8(key)); } // Parse string like "640x480" or "10000,20000" -static int parse_pair(const char *str, int *first, int *second, char delim, - char **endptr = NULL) -{ +static int parse_pair(const char* str, int* first, int* second, char delim, char** endptr = NULL) { // Find the first integer. - char *end; + char* end; int w = (int)strtol(str, &end, 10); // If a delimeter does not immediately follow, give up. if (*end != delim) { @@ -314,7 +294,7 @@ static int parse_pair(const char *str, int *first, int *second, char delim, } // Find the second integer, immediately after the delimeter. - int h = (int)strtol(end+1, &end, 10); + int h = (int)strtol(end + 1, &end, 10); *first = w; *second = h; @@ -326,18 +306,16 @@ static int parse_pair(const char *str, int *first, int *second, char delim, return 0; } -static void parseSizesList(const char *sizesStr, Vector &sizes) -{ +static void parseSizesList(const char* sizesStr, Vector& sizes) { if (sizesStr == 0) { return; } - char *sizeStartPtr = (char *)sizesStr; + char* sizeStartPtr = (char*)sizesStr; while (true) { int width, height; - int success = parse_pair(sizeStartPtr, &width, &height, 'x', - &sizeStartPtr); + int success = parse_pair(sizeStartPtr, &width, &height, 'x', &sizeStartPtr); if (success == -1 || (*sizeStartPtr != ',' && *sizeStartPtr != '\0')) { ALOGE("Picture sizes string \"%s\" contains invalid character.", sizesStr); return; @@ -351,119 +329,101 @@ static void parseSizesList(const char *sizesStr, Vector &sizes) } } -void CameraParameters::setPreviewSize(int width, int height) -{ +void CameraParameters::setPreviewSize(int width, int height) { char str[32]; sprintf(str, "%dx%d", width, height); set(KEY_PREVIEW_SIZE, str); } -void CameraParameters::getPreviewSize(int *width, int *height) const -{ +void CameraParameters::getPreviewSize(int* width, int* height) const { *width = *height = -1; // Get the current string, if it doesn't exist, leave the -1x-1 - const char *p = get(KEY_PREVIEW_SIZE); - if (p == 0) return; + const char* p = get(KEY_PREVIEW_SIZE); + if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getPreferredPreviewSizeForVideo(int *width, int *height) const -{ +void CameraParameters::getPreferredPreviewSizeForVideo(int* width, int* height) const { *width = *height = -1; - const char *p = get(KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO); - if (p == 0) return; + const char* p = get(KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO); + if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getSupportedPreviewSizes(Vector &sizes) const -{ - const char *previewSizesStr = get(KEY_SUPPORTED_PREVIEW_SIZES); +void CameraParameters::getSupportedPreviewSizes(Vector& sizes) const { + const char* previewSizesStr = get(KEY_SUPPORTED_PREVIEW_SIZES); parseSizesList(previewSizesStr, sizes); } -void CameraParameters::setVideoSize(int width, int height) -{ +void CameraParameters::setVideoSize(int width, int height) { char str[32]; sprintf(str, "%dx%d", width, height); set(KEY_VIDEO_SIZE, str); } -void CameraParameters::getVideoSize(int *width, int *height) const -{ +void CameraParameters::getVideoSize(int* width, int* height) const { *width = *height = -1; - const char *p = get(KEY_VIDEO_SIZE); + const char* p = get(KEY_VIDEO_SIZE); if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getSupportedVideoSizes(Vector &sizes) const -{ - const char *videoSizesStr = get(KEY_SUPPORTED_VIDEO_SIZES); +void CameraParameters::getSupportedVideoSizes(Vector& sizes) const { + const char* videoSizesStr = get(KEY_SUPPORTED_VIDEO_SIZES); parseSizesList(videoSizesStr, sizes); } -void CameraParameters::setPreviewFrameRate(int fps) -{ +void CameraParameters::setPreviewFrameRate(int fps) { set(KEY_PREVIEW_FRAME_RATE, fps); } -int CameraParameters::getPreviewFrameRate() const -{ +int CameraParameters::getPreviewFrameRate() const { return getInt(KEY_PREVIEW_FRAME_RATE); } -void CameraParameters::getPreviewFpsRange(int *min_fps, int *max_fps) const -{ +void CameraParameters::getPreviewFpsRange(int* min_fps, int* max_fps) const { *min_fps = *max_fps = -1; - const char *p = get(KEY_PREVIEW_FPS_RANGE); + const char* p = get(KEY_PREVIEW_FPS_RANGE); if (p == 0) return; parse_pair(p, min_fps, max_fps, ','); } -void CameraParameters::setPreviewFormat(const char *format) -{ +void CameraParameters::setPreviewFormat(const char* format) { set(KEY_PREVIEW_FORMAT, format); } -const char *CameraParameters::getPreviewFormat() const -{ +const char* CameraParameters::getPreviewFormat() const { return get(KEY_PREVIEW_FORMAT); } -void CameraParameters::setPictureSize(int width, int height) -{ +void CameraParameters::setPictureSize(int width, int height) { char str[32]; sprintf(str, "%dx%d", width, height); set(KEY_PICTURE_SIZE, str); } -void CameraParameters::getPictureSize(int *width, int *height) const -{ +void CameraParameters::getPictureSize(int* width, int* height) const { *width = *height = -1; // Get the current string, if it doesn't exist, leave the -1x-1 - const char *p = get(KEY_PICTURE_SIZE); + const char* p = get(KEY_PICTURE_SIZE); if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getSupportedPictureSizes(Vector &sizes) const -{ - const char *pictureSizesStr = get(KEY_SUPPORTED_PICTURE_SIZES); +void CameraParameters::getSupportedPictureSizes(Vector& sizes) const { + const char* pictureSizesStr = get(KEY_SUPPORTED_PICTURE_SIZES); parseSizesList(pictureSizesStr, sizes); } -void CameraParameters::setPictureFormat(const char *format) -{ +void CameraParameters::setPictureFormat(const char* format) { set(KEY_PICTURE_FORMAT, format); } -const char *CameraParameters::getPictureFormat() const -{ +const char* CameraParameters::getPictureFormat() const { return get(KEY_PICTURE_FORMAT); } -void CameraParameters::dump() const -{ +void CameraParameters::dump() const { ALOGD("dump: mMap.size = %zu", mMap.size()); for (size_t i = 0; i < mMap.size(); i++) { String8 k, v; @@ -473,8 +433,7 @@ void CameraParameters::dump() const } } -status_t CameraParameters::dump(int fd, const Vector& /*args*/) const -{ +status_t CameraParameters::dump(int fd, const Vector& /*args*/) const { const size_t SIZE = 256; char buffer[SIZE]; String8 result; @@ -492,8 +451,7 @@ status_t CameraParameters::dump(int fd, const Vector& /*args*/) const } void CameraParameters::getSupportedPreviewFormats(Vector& formats) const { - const char* supportedPreviewFormats = - get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS); + const char* supportedPreviewFormats = get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS); if (supportedPreviewFormats == NULL) { ALOGW("%s: No supported preview formats.", __FUNCTION__); @@ -515,35 +473,31 @@ void CameraParameters::getSupportedPreviewFormats(Vector& formats) const { fmtStr.unlockBuffer(fmtStr.size()); } - int CameraParameters::previewFormatToEnum(const char* format) { - return - !format ? - HAL_PIXEL_FORMAT_YCrCb_420_SP : - !strcmp(format, PIXEL_FORMAT_YUV422SP) ? - HAL_PIXEL_FORMAT_YCbCr_422_SP : // NV16 - !strcmp(format, PIXEL_FORMAT_YUV420SP) ? - HAL_PIXEL_FORMAT_YCrCb_420_SP : // NV21 - !strcmp(format, PIXEL_FORMAT_YUV422I) ? - HAL_PIXEL_FORMAT_YCbCr_422_I : // YUY2 - !strcmp(format, PIXEL_FORMAT_YUV420P) ? - HAL_PIXEL_FORMAT_YV12 : // YV12 - !strcmp(format, PIXEL_FORMAT_RGB565) ? - HAL_PIXEL_FORMAT_RGB_565 : // RGB565 - !strcmp(format, PIXEL_FORMAT_RGBA8888) ? - HAL_PIXEL_FORMAT_RGBA_8888 : // RGB8888 - !strcmp(format, PIXEL_FORMAT_BAYER_RGGB) ? - HAL_PIXEL_FORMAT_RAW16 : // Raw sensor data - -1; + return !format ? HAL_PIXEL_FORMAT_YCrCb_420_SP + : !strcmp(format, PIXEL_FORMAT_YUV422SP) ? HAL_PIXEL_FORMAT_YCbCr_422_SP + : // NV16 + !strcmp(format, PIXEL_FORMAT_YUV420SP) ? HAL_PIXEL_FORMAT_YCrCb_420_SP + : // NV21 + !strcmp(format, PIXEL_FORMAT_YUV422I) ? HAL_PIXEL_FORMAT_YCbCr_422_I + : // YUY2 + !strcmp(format, PIXEL_FORMAT_YUV420P) ? HAL_PIXEL_FORMAT_YV12 + : // YV12 + !strcmp(format, PIXEL_FORMAT_RGB565) ? HAL_PIXEL_FORMAT_RGB_565 + : // RGB565 + !strcmp(format, PIXEL_FORMAT_RGBA8888) ? HAL_PIXEL_FORMAT_RGBA_8888 + : // RGB8888 + !strcmp(format, PIXEL_FORMAT_BAYER_RGGB) ? HAL_PIXEL_FORMAT_RAW16 + : // Raw sensor data + -1; } bool CameraParameters::isEmpty() const { return mMap.isEmpty(); } -}; -}; -}; -}; -}; -}; // namespace android +}; // namespace helper +}; // namespace common +}; // namespace camera +}; // namespace hardware +}; // namespace android diff --git a/camera/common/1.0/default/Exif.cpp b/camera/common/default/Exif.cpp similarity index 83% rename from camera/common/1.0/default/Exif.cpp rename to camera/common/default/Exif.cpp index 413b6bb975..f4b2a3189e 100644 --- a/camera/common/1.0/default/Exif.cpp +++ b/camera/common/default/Exif.cpp @@ -16,7 +16,7 @@ #define LOG_TAG "CamComm1.0-Exif" #define ATRACE_TAG ATRACE_TAG_CAMERA -//#define LOG_NDEBUG 0 +// #define LOG_NDEBUG 0 #include @@ -41,15 +41,12 @@ struct default_delete { } // namespace std - namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { - class ExifUtilsImpl : public ExifUtils { public: ExifUtilsImpl(); @@ -61,8 +58,7 @@ class ExifUtilsImpl : public ExifUtils { virtual bool initialize(); // set all known fields from a metadata structure - virtual bool setFromMetadata(const CameraMetadata& metadata, - const size_t imageWidth, + virtual bool setFromMetadata(const CameraMetadata& metadata, const size_t imageWidth, const size_t imageHeight); // sets the len aperture. @@ -254,7 +250,6 @@ class ExifUtilsImpl : public ExifUtils { // Returns false if memory allocation fails. virtual bool setExifVersion(const std::string& exif_version); - // Resets the pointers and memories. virtual void reset(); @@ -262,8 +257,7 @@ class ExifUtilsImpl : public ExifUtils { // if the tag exists. // Returns the entry of the tag. The reference count of returned ExifEntry is // two. - virtual std::unique_ptr addVariableLengthEntry(ExifIfd ifd, - ExifTag tag, + virtual std::unique_ptr addVariableLengthEntry(ExifIfd ifd, ExifTag tag, ExifFormat format, uint64_t components, unsigned int size); @@ -275,32 +269,17 @@ class ExifUtilsImpl : public ExifUtils { virtual std::unique_ptr addEntry(ExifIfd ifd, ExifTag tag); // Helpe functions to add exif data with different types. - virtual bool setShort(ExifIfd ifd, - ExifTag tag, - uint16_t value, - const std::string& msg); + virtual bool setShort(ExifIfd ifd, ExifTag tag, uint16_t value, const std::string& msg); - virtual bool setLong(ExifIfd ifd, - ExifTag tag, - uint32_t value, - const std::string& msg); + virtual bool setLong(ExifIfd ifd, ExifTag tag, uint32_t value, const std::string& msg); - virtual bool setRational(ExifIfd ifd, - ExifTag tag, - uint32_t numerator, - uint32_t denominator, + virtual bool setRational(ExifIfd ifd, ExifTag tag, uint32_t numerator, uint32_t denominator, const std::string& msg); - virtual bool setSRational(ExifIfd ifd, - ExifTag tag, - int32_t numerator, - int32_t denominator, + virtual bool setSRational(ExifIfd ifd, ExifTag tag, int32_t numerator, int32_t denominator, const std::string& msg); - virtual bool setString(ExifIfd ifd, - ExifTag tag, - ExifFormat format, - const std::string& buffer, + virtual bool setString(ExifIfd ifd, ExifTag tag, ExifFormat format, const std::string& buffer, const std::string& msg); // Destroys the buffer of APP1 segment if exists. @@ -313,37 +292,31 @@ class ExifUtilsImpl : public ExifUtils { uint8_t* app1_buffer_; // The length of |app1_buffer_|. unsigned int app1_length_; - }; -#define SET_SHORT(ifd, tag, value) \ - do { \ - if (setShort(ifd, tag, value, #tag) == false) \ - return false; \ +#define SET_SHORT(ifd, tag, value) \ + do { \ + if (setShort(ifd, tag, value, #tag) == false) return false; \ } while (0); -#define SET_LONG(ifd, tag, value) \ - do { \ - if (setLong(ifd, tag, value, #tag) == false) \ - return false; \ +#define SET_LONG(ifd, tag, value) \ + do { \ + if (setLong(ifd, tag, value, #tag) == false) return false; \ } while (0); -#define SET_RATIONAL(ifd, tag, numerator, denominator) \ - do { \ - if (setRational(ifd, tag, numerator, denominator, #tag) == false) \ - return false; \ +#define SET_RATIONAL(ifd, tag, numerator, denominator) \ + do { \ + if (setRational(ifd, tag, numerator, denominator, #tag) == false) return false; \ } while (0); -#define SET_SRATIONAL(ifd, tag, numerator, denominator) \ - do { \ - if (setSRational(ifd, tag, numerator, denominator, #tag) == false) \ - return false; \ +#define SET_SRATIONAL(ifd, tag, numerator, denominator) \ + do { \ + if (setSRational(ifd, tag, numerator, denominator, #tag) == false) return false; \ } while (0); #define SET_STRING(ifd, tag, format, buffer) \ do { \ - if (setString(ifd, tag, format, buffer, #tag) == false) \ - return false; \ + if (setString(ifd, tag, format, buffer, #tag) == false) return false; \ } while (0); // This comes from the Exif Version 2.2 standard table 6. @@ -353,30 +326,25 @@ static void setLatitudeOrLongitudeData(unsigned char* data, double num) { // Take the integer part of |num|. ExifLong degrees = static_cast(num); ExifLong minutes = static_cast(60 * (num - degrees)); - ExifLong microseconds = - static_cast(3600000000u * (num - degrees - minutes / 60.0)); + ExifLong microseconds = static_cast(3600000000u * (num - degrees - minutes / 60.0)); exif_set_rational(data, EXIF_BYTE_ORDER_INTEL, {degrees, 1}); - exif_set_rational(data + sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, - {minutes, 1}); + exif_set_rational(data + sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, {minutes, 1}); exif_set_rational(data + 2 * sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, - {microseconds, 1000000}); + {microseconds, 1000000}); } -ExifUtils *ExifUtils::create() { +ExifUtils* ExifUtils::create() { return new ExifUtilsImpl(); } -ExifUtils::~ExifUtils() { -} +ExifUtils::~ExifUtils() {} -ExifUtilsImpl::ExifUtilsImpl() - : exif_data_(nullptr), app1_buffer_(nullptr), app1_length_(0) {} +ExifUtilsImpl::ExifUtilsImpl() : exif_data_(nullptr), app1_buffer_(nullptr), app1_length_(0) {} ExifUtilsImpl::~ExifUtilsImpl() { reset(); } - bool ExifUtilsImpl::initialize() { reset(); exif_data_ = exif_data_new(); @@ -403,8 +371,7 @@ bool ExifUtilsImpl::setAperture(uint32_t numerator, uint32_t denominator) { } bool ExifUtilsImpl::setBrightness(int32_t numerator, int32_t denominator) { - SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_BRIGHTNESS_VALUE, numerator, - denominator); + SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_BRIGHTNESS_VALUE, numerator, denominator); return true; } @@ -413,10 +380,9 @@ bool ExifUtilsImpl::setColorSpace(uint16_t color_space) { return true; } -bool ExifUtilsImpl::setComponentsConfiguration( - const std::string& components_configuration) { - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION, - EXIF_FORMAT_UNDEFINED, components_configuration); +bool ExifUtilsImpl::setComponentsConfiguration(const std::string& components_configuration) { + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION, EXIF_FORMAT_UNDEFINED, + components_configuration); return true; } @@ -433,37 +399,31 @@ bool ExifUtilsImpl::setContrast(uint16_t contrast) { bool ExifUtilsImpl::setDateTime(const struct tm& t) { // The length is 20 bytes including NULL for termination in Exif standard. char str[20]; - int result = snprintf(str, sizeof(str), "%04i:%02i:%02i %02i:%02i:%02i", - t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, - t.tm_min, t.tm_sec); + int result = snprintf(str, sizeof(str), "%04i:%02i:%02i %02i:%02i:%02i", t.tm_year + 1900, + t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); if (result != sizeof(str) - 1) { ALOGW("%s: Input time is invalid", __FUNCTION__); return false; } std::string buffer(str); SET_STRING(EXIF_IFD_0, EXIF_TAG_DATE_TIME, EXIF_FORMAT_ASCII, buffer); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, - buffer); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, - buffer); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, buffer); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, buffer); return true; } bool ExifUtilsImpl::setDescription(const std::string& description) { - SET_STRING(EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION, EXIF_FORMAT_ASCII, - description); + SET_STRING(EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION, EXIF_FORMAT_ASCII, description); return true; } bool ExifUtilsImpl::setDigitalZoomRatio(uint32_t numerator, uint32_t denominator) { - SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_DIGITAL_ZOOM_RATIO, numerator, - denominator); + SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_DIGITAL_ZOOM_RATIO, numerator, denominator); return true; } bool ExifUtilsImpl::setExposureBias(int32_t numerator, int32_t denominator) { - SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_BIAS_VALUE, numerator, - denominator); + SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_BIAS_VALUE, numerator, denominator); return true; } @@ -526,7 +486,7 @@ bool ExifUtilsImpl::setGpsAltitude(double altitude) { return false; } exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, - {static_cast(altitude * 1000), 1000}); + {static_cast(altitude * 1000), 1000}); return true; } @@ -588,26 +548,23 @@ bool ExifUtilsImpl::setGpsLongitude(double longitude) { } bool ExifUtilsImpl::setGpsProcessingMethod(const std::string& method) { - std::string buffer = - std::string(gExifAsciiPrefix, sizeof(gExifAsciiPrefix)) + method; + std::string buffer = std::string(gExifAsciiPrefix, sizeof(gExifAsciiPrefix)) + method; SET_STRING(EXIF_IFD_GPS, static_cast(EXIF_TAG_GPS_PROCESSING_METHOD), - EXIF_FORMAT_UNDEFINED, buffer); + EXIF_FORMAT_UNDEFINED, buffer); return true; } bool ExifUtilsImpl::setGpsTimestamp(const struct tm& t) { const ExifTag dateTag = static_cast(EXIF_TAG_GPS_DATE_STAMP); const size_t kGpsDateStampSize = 11; - std::unique_ptr entry = - addVariableLengthEntry(EXIF_IFD_GPS, dateTag, EXIF_FORMAT_ASCII, - kGpsDateStampSize, kGpsDateStampSize); + std::unique_ptr entry = addVariableLengthEntry( + EXIF_IFD_GPS, dateTag, EXIF_FORMAT_ASCII, kGpsDateStampSize, kGpsDateStampSize); if (!entry) { ALOGE("%s: Adding GPSDateStamp exif entry failed", __FUNCTION__); return false; } - int result = - snprintf(reinterpret_cast(entry->data), kGpsDateStampSize, - "%04i:%02i:%02i", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday); + int result = snprintf(reinterpret_cast(entry->data), kGpsDateStampSize, "%04i:%02i:%02i", + t.tm_year + 1900, t.tm_mon + 1, t.tm_mday); if (result != kGpsDateStampSize - 1) { ALOGW("%s: Input time is invalid", __FUNCTION__); return false; @@ -615,18 +572,16 @@ bool ExifUtilsImpl::setGpsTimestamp(const struct tm& t) { const ExifTag timeTag = static_cast(EXIF_TAG_GPS_TIME_STAMP); entry = addVariableLengthEntry(EXIF_IFD_GPS, timeTag, EXIF_FORMAT_RATIONAL, 3, - 3 * sizeof(ExifRational)); + 3 * sizeof(ExifRational)); if (!entry) { ALOGE("%s: Adding GPSTimeStamp exif entry failed", __FUNCTION__); return false; } - exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, - {static_cast(t.tm_hour), 1}); + exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, {static_cast(t.tm_hour), 1}); exif_set_rational(entry->data + sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, - {static_cast(t.tm_min), 1}); - exif_set_rational(entry->data + 2 * sizeof(ExifRational), - EXIF_BYTE_ORDER_INTEL, - {static_cast(t.tm_sec), 1}); + {static_cast(t.tm_min), 1}); + exif_set_rational(entry->data + 2 * sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, + {static_cast(t.tm_sec), 1}); return true; } @@ -654,8 +609,7 @@ bool ExifUtilsImpl::setLightSource(uint16_t light_source) { } bool ExifUtilsImpl::setMaxAperture(uint32_t numerator, uint32_t denominator) { - SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_MAX_APERTURE_VALUE, numerator, - denominator); + SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_MAX_APERTURE_VALUE, numerator, denominator); return true; } @@ -714,24 +668,19 @@ bool ExifUtilsImpl::setSharpness(uint16_t sharpness) { } bool ExifUtilsImpl::setShutterSpeed(int32_t numerator, int32_t denominator) { - SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SHUTTER_SPEED_VALUE, numerator, - denominator); + SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SHUTTER_SPEED_VALUE, numerator, denominator); return true; } bool ExifUtilsImpl::setSubjectDistance(uint32_t numerator, uint32_t denominator) { - SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_DISTANCE, numerator, - denominator); + SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_DISTANCE, numerator, denominator); return true; } bool ExifUtilsImpl::setSubsecTime(const std::string& subsec_time) { - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME, EXIF_FORMAT_ASCII, - subsec_time); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_ORIGINAL, EXIF_FORMAT_ASCII, - subsec_time); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_DIGITIZED, EXIF_FORMAT_ASCII, - subsec_time); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME, EXIF_FORMAT_ASCII, subsec_time); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_ORIGINAL, EXIF_FORMAT_ASCII, subsec_time); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_DIGITIZED, EXIF_FORMAT_ASCII, subsec_time); return true; } @@ -816,8 +765,7 @@ void ExifUtilsImpl::reset() { } } -std::unique_ptr ExifUtilsImpl::addVariableLengthEntry(ExifIfd ifd, - ExifTag tag, +std::unique_ptr ExifUtilsImpl::addVariableLengthEntry(ExifIfd ifd, ExifTag tag, ExifFormat format, uint64_t components, unsigned int size) { @@ -872,10 +820,7 @@ std::unique_ptr ExifUtilsImpl::addEntry(ExifIfd ifd, ExifTag tag) { return entry; } -bool ExifUtilsImpl::setShort(ExifIfd ifd, - ExifTag tag, - uint16_t value, - const std::string& msg) { +bool ExifUtilsImpl::setShort(ExifIfd ifd, ExifTag tag, uint16_t value, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); @@ -885,10 +830,7 @@ bool ExifUtilsImpl::setShort(ExifIfd ifd, return true; } -bool ExifUtilsImpl::setLong(ExifIfd ifd, - ExifTag tag, - uint32_t value, - const std::string& msg) { +bool ExifUtilsImpl::setLong(ExifIfd ifd, ExifTag tag, uint32_t value, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); @@ -898,41 +840,30 @@ bool ExifUtilsImpl::setLong(ExifIfd ifd, return true; } -bool ExifUtilsImpl::setRational(ExifIfd ifd, - ExifTag tag, - uint32_t numerator, - uint32_t denominator, +bool ExifUtilsImpl::setRational(ExifIfd ifd, ExifTag tag, uint32_t numerator, uint32_t denominator, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); return false; } - exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, - {numerator, denominator}); + exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, {numerator, denominator}); return true; } -bool ExifUtilsImpl::setSRational(ExifIfd ifd, - ExifTag tag, - int32_t numerator, - int32_t denominator, +bool ExifUtilsImpl::setSRational(ExifIfd ifd, ExifTag tag, int32_t numerator, int32_t denominator, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); return false; } - exif_set_srational(entry->data, EXIF_BYTE_ORDER_INTEL, - {numerator, denominator}); + exif_set_srational(entry->data, EXIF_BYTE_ORDER_INTEL, {numerator, denominator}); return true; } -bool ExifUtilsImpl::setString(ExifIfd ifd, - ExifTag tag, - ExifFormat format, - const std::string& buffer, - const std::string& msg) { +bool ExifUtilsImpl::setString(ExifIfd ifd, ExifTag tag, ExifFormat format, + const std::string& buffer, const std::string& msg) { size_t entry_size = buffer.length(); // Since the exif format is undefined, NULL termination is not necessary. if (format == EXIF_FORMAT_ASCII) { @@ -959,13 +890,11 @@ void ExifUtilsImpl::destroyApp1() { app1_length_ = 0; } -bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, - const size_t imageWidth, +bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, const size_t imageWidth, const size_t imageHeight) { // How precise the float-to-rational conversion for EXIF tags would be. constexpr int kRationalPrecision = 10000; - if (!setImageWidth(imageWidth) || - !setImageHeight(imageHeight)) { + if (!setImageWidth(imageWidth) || !setImageHeight(imageHeight)) { ALOGE("%s: setting image resolution failed.", __FUNCTION__); return false; } @@ -984,9 +913,8 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, if (entry.count) { focal_length = entry.data.f[0]; - if (!setFocalLength( - static_cast(focal_length * kRationalPrecision), - kRationalPrecision)) { + if (!setFocalLength(static_cast(focal_length * kRationalPrecision), + kRationalPrecision)) { ALOGE("%s: setting focal length failed.", __FUNCTION__); return false; } @@ -1048,7 +976,7 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, if (metadata.exists(ANDROID_SENSOR_EXPOSURE_TIME)) { entry = metadata.find(ANDROID_SENSOR_EXPOSURE_TIME); // int64_t of nanoseconds - if (!setExposureTime(entry.data.i64[0],1000000000u)) { + if (!setExposureTime(entry.data.i64[0], 1000000000u)) { ALOGE("%s: setting exposure time failed.", __FUNCTION__); return false; } @@ -1057,8 +985,7 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, if (metadata.exists(ANDROID_LENS_APERTURE)) { const int kAperturePrecision = 10000; entry = metadata.find(ANDROID_LENS_APERTURE); - if (!setFNumber(entry.data.f[0] * kAperturePrecision, - kAperturePrecision)) { + if (!setFNumber(entry.data.f[0] * kAperturePrecision, kAperturePrecision)) { ALOGE("%s: setting F number failed.", __FUNCTION__); return false; } @@ -1073,7 +1000,7 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, return false; } } else { - ALOGE("%s: Unsupported flash info: %d",__FUNCTION__, entry.data.u8[0]); + ALOGE("%s: Unsupported flash info: %d", __FUNCTION__, entry.data.u8[0]); return false; } } @@ -1107,9 +1034,8 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, return true; } -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/HandleImporter.cpp b/camera/common/default/HandleImporter.cpp similarity index 74% rename from camera/common/1.0/default/HandleImporter.cpp rename to camera/common/default/HandleImporter.cpp index d2fdf02457..1145baa5f1 100644 --- a/camera/common/1.0/default/HandleImporter.cpp +++ b/camera/common/default/HandleImporter.cpp @@ -18,14 +18,13 @@ #include "HandleImporter.h" #include -#include "aidl/android/hardware/graphics/common/Smpte2086.h" #include +#include "aidl/android/hardware/graphics/common/Smpte2086.h" namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { using aidl::android::hardware::graphics::common::PlaneLayout; @@ -75,20 +74,18 @@ void HandleImporter::cleanup() { mInitialized = false; } -template +template bool HandleImporter::importBufferInternal(const sp mapper, buffer_handle_t& handle) { E error; buffer_handle_t importedHandle; auto ret = mapper->importBuffer( - hidl_handle(handle), - [&](const auto& tmpError, const auto& tmpBufferHandle) { - error = tmpError; - importedHandle = static_cast(tmpBufferHandle); - }); + hidl_handle(handle), [&](const auto& tmpError, const auto& tmpBufferHandle) { + error = tmpError; + importedHandle = static_cast(tmpBufferHandle); + }); if (!ret.isOk()) { - ALOGE("%s: mapper importBuffer failed: %s", - __FUNCTION__, ret.description().c_str()); + ALOGE("%s: mapper importBuffer failed: %s", __FUNCTION__, ret.description().c_str()); return false; } @@ -100,61 +97,62 @@ bool HandleImporter::importBufferInternal(const sp mapper, buffer_handle_t& h return true; } -template +template YCbCrLayout HandleImporter::lockYCbCrInternal(const sp mapper, buffer_handle_t& buf, - uint64_t cpuUsage, const IMapper::Rect& accessRegion) { + uint64_t cpuUsage, + const IMapper::Rect& accessRegion) { hidl_handle acquireFenceHandle; auto buffer = const_cast(buf); YCbCrLayout layout = {}; - typename M::Rect accessRegionCopy = {accessRegion.left, accessRegion.top, - accessRegion.width, accessRegion.height}; + typename M::Rect accessRegionCopy = {accessRegion.left, accessRegion.top, accessRegion.width, + accessRegion.height}; mapper->lockYCbCr(buffer, cpuUsage, accessRegionCopy, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpLayout) { - if (tmpError == E::NONE) { - // Member by member copy from different versions of YCbCrLayout. - layout.y = tmpLayout.y; - layout.cb = tmpLayout.cb; - layout.cr = tmpLayout.cr; - layout.yStride = tmpLayout.yStride; - layout.cStride = tmpLayout.cStride; - layout.chromaStep = tmpLayout.chromaStep; - } else { - ALOGE("%s: failed to lockYCbCr error %d!", __FUNCTION__, tmpError); - } - }); + [&](const auto& tmpError, const auto& tmpLayout) { + if (tmpError == E::NONE) { + // Member by member copy from different versions of YCbCrLayout. + layout.y = tmpLayout.y; + layout.cb = tmpLayout.cb; + layout.cr = tmpLayout.cr; + layout.yStride = tmpLayout.yStride; + layout.cStride = tmpLayout.cStride; + layout.chromaStep = tmpLayout.chromaStep; + } else { + ALOGE("%s: failed to lockYCbCr error %d!", __FUNCTION__, tmpError); + } + }); return layout; } bool isMetadataPesent(const sp mapper, const buffer_handle_t& buf, - MetadataType metadataType) { + MetadataType metadataType) { auto buffer = const_cast(buf); bool ret = false; hidl_vec vec; - mapper->get(buffer, metadataType, [&] (const auto& tmpError, - const auto& tmpMetadata) { - if (tmpError == MapperErrorV4::NONE) { - vec = tmpMetadata; - } else { - ALOGE("%s: failed to get metadata %d!", __FUNCTION__, tmpError); - }}); + mapper->get(buffer, metadataType, [&](const auto& tmpError, const auto& tmpMetadata) { + if (tmpError == MapperErrorV4::NONE) { + vec = tmpMetadata; + } else { + ALOGE("%s: failed to get metadata %d!", __FUNCTION__, tmpError); + } + }); if (vec.size() > 0) { - if (metadataType == gralloc4::MetadataType_Smpte2086){ - std::optional realSmpte2086; - gralloc4::decodeSmpte2086(vec, &realSmpte2086); - ret = realSmpte2086.has_value(); - } else if (metadataType == gralloc4::MetadataType_Smpte2094_10) { - std::optional> realSmpte2094_10; - gralloc4::decodeSmpte2094_10(vec, &realSmpte2094_10); - ret = realSmpte2094_10.has_value(); - } else if (metadataType == gralloc4::MetadataType_Smpte2094_40) { - std::optional> realSmpte2094_40; - gralloc4::decodeSmpte2094_40(vec, &realSmpte2094_40); - ret = realSmpte2094_40.has_value(); - } else { - ALOGE("%s: Unknown metadata type!", __FUNCTION__); - } + if (metadataType == gralloc4::MetadataType_Smpte2086) { + std::optional realSmpte2086; + gralloc4::decodeSmpte2086(vec, &realSmpte2086); + ret = realSmpte2086.has_value(); + } else if (metadataType == gralloc4::MetadataType_Smpte2094_10) { + std::optional> realSmpte2094_10; + gralloc4::decodeSmpte2094_10(vec, &realSmpte2094_10); + ret = realSmpte2094_10.has_value(); + } else if (metadataType == gralloc4::MetadataType_Smpte2094_40) { + std::optional> realSmpte2094_40; + gralloc4::decodeSmpte2094_40(vec, &realSmpte2094_40); + ret = realSmpte2094_40.has_value(); + } else { + ALOGE("%s: Unknown metadata type!", __FUNCTION__); + } } return ret; @@ -239,31 +237,29 @@ YCbCrLayout HandleImporter::lockYCbCrInternal( return layout; } -template +template int HandleImporter::unlockInternal(const sp mapper, buffer_handle_t& buf) { int releaseFence = -1; auto buffer = const_cast(buf); - mapper->unlock( - buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) { - if (tmpError == E::NONE) { - auto fenceHandle = tmpReleaseFence.getNativeHandle(); - if (fenceHandle) { - if (fenceHandle->numInts != 0 || fenceHandle->numFds != 1) { - ALOGE("%s: bad release fence numInts %d numFds %d", - __FUNCTION__, fenceHandle->numInts, fenceHandle->numFds); - return; - } - releaseFence = dup(fenceHandle->data[0]); - if (releaseFence < 0) { - ALOGE("%s: bad release fence FD %d", - __FUNCTION__, releaseFence); - } + mapper->unlock(buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) { + if (tmpError == E::NONE) { + auto fenceHandle = tmpReleaseFence.getNativeHandle(); + if (fenceHandle) { + if (fenceHandle->numInts != 0 || fenceHandle->numFds != 1) { + ALOGE("%s: bad release fence numInts %d numFds %d", __FUNCTION__, + fenceHandle->numInts, fenceHandle->numFds); + return; + } + releaseFence = dup(fenceHandle->data[0]); + if (releaseFence < 0) { + ALOGE("%s: bad release fence FD %d", __FUNCTION__, releaseFence); } - } else { - ALOGE("%s: failed to unlock error %d!", __FUNCTION__, tmpError); } - }); + } else { + ALOGE("%s: failed to unlock error %d!", __FUNCTION__, tmpError); + } + }); return releaseFence; } @@ -315,14 +311,12 @@ void HandleImporter::freeBuffer(buffer_handle_t handle) { } else if (mMapperV3 != nullptr) { auto ret = mMapperV3->freeBuffer(const_cast(handle)); if (!ret.isOk()) { - ALOGE("%s: mapper freeBuffer failed: %s", - __FUNCTION__, ret.description().c_str()); + ALOGE("%s: mapper freeBuffer failed: %s", __FUNCTION__, ret.description().c_str()); } } else { auto ret = mMapperV2->freeBuffer(const_cast(handle)); if (!ret.isOk()) { - ALOGE("%s: mapper freeBuffer failed: %s", - __FUNCTION__, ret.description().c_str()); + ALOGE("%s: mapper freeBuffer failed: %s", __FUNCTION__, ret.description().c_str()); } } } @@ -337,8 +331,7 @@ bool HandleImporter::importFence(const native_handle_t* handle, int& fd) const { return false; } } else { - ALOGE("invalid fence handle with %d file descriptors", - handle->numFds); + ALOGE("invalid fence handle with %d file descriptors", handle->numFds); return false; } @@ -351,8 +344,7 @@ void HandleImporter::closeFence(int fd) const { } } -void* HandleImporter::lock( - buffer_handle_t& buf, uint64_t cpuUsage, size_t size) { +void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, size_t size) { IMapper::Rect accessRegion{0, 0, static_cast(size), 1}; return lock(buf, cpuUsage, accessRegion); } @@ -401,13 +393,13 @@ void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, }); } else { mMapperV2->lock(buffer, cpuUsage, accessRegion, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpPtr) { - if (tmpError == MapperErrorV2::NONE) { - ret = tmpPtr; - } else { - ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); - } - }); + [&](const auto& tmpError, const auto& tmpPtr) { + if (tmpError == MapperErrorV2::NONE) { + ret = tmpPtr; + } else { + ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); + } + }); } ALOGV("%s: ptr %p accessRegion.top: %d accessRegion.left: %d accessRegion.width: %d " @@ -417,9 +409,8 @@ void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, return ret; } -YCbCrLayout HandleImporter::lockYCbCr( - buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion) { +YCbCrLayout HandleImporter::lockYCbCr(buffer_handle_t& buf, uint64_t cpuUsage, + const IMapper::Rect& accessRegion) { Mutex::Autolock lock(mLock); if (!mInitialized) { @@ -431,20 +422,18 @@ YCbCrLayout HandleImporter::lockYCbCr( } if (mMapperV3 != nullptr) { - return lockYCbCrInternal( - mMapperV3, buf, cpuUsage, accessRegion); + return lockYCbCrInternal(mMapperV3, buf, cpuUsage, accessRegion); } if (mMapperV2 != nullptr) { - return lockYCbCrInternal( - mMapperV2, buf, cpuUsage, accessRegion); + return lockYCbCrInternal(mMapperV2, buf, cpuUsage, accessRegion); } ALOGE("%s: mMapperV4, mMapperV3 and mMapperV2 are all null!", __FUNCTION__); return {}; } -status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t &buf, uint32_t *stride /*out*/) { +status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t& buf, uint32_t* stride /*out*/) { if (stride == nullptr) { return BAD_VALUE; } @@ -458,7 +447,7 @@ status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t &buf, uint32_t if (mMapperV4 != nullptr) { std::vector planeLayouts = getPlaneLayouts(mMapperV4, buf); if (planeLayouts.size() != 1) { - ALOGE("%s: Unexpected number of planes %zu!", __FUNCTION__, planeLayouts.size()); + ALOGE("%s: Unexpected number of planes %zu!", __FUNCTION__, planeLayouts.size()); return BAD_VALUE; } @@ -534,10 +523,8 @@ bool HandleImporter::isSmpte2094_40Present(const buffer_handle_t& buf) { return false; } - -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/OWNERS b/camera/common/default/OWNERS similarity index 100% rename from camera/common/1.0/default/OWNERS rename to camera/common/default/OWNERS diff --git a/camera/common/1.0/default/SimpleThread.cpp b/camera/common/default/SimpleThread.cpp similarity index 100% rename from camera/common/1.0/default/SimpleThread.cpp rename to camera/common/default/SimpleThread.cpp diff --git a/camera/common/1.0/default/VendorTagDescriptor.cpp b/camera/common/default/VendorTagDescriptor.cpp similarity index 91% rename from camera/common/1.0/default/VendorTagDescriptor.cpp rename to camera/common/default/VendorTagDescriptor.cpp index d2bee85daf..1282bd0ccb 100644 --- a/camera/common/1.0/default/VendorTagDescriptor.cpp +++ b/camera/common/default/VendorTagDescriptor.cpp @@ -16,9 +16,9 @@ #define LOG_TAG "CamComm1.0-VTDesc" +#include #include #include -#include #include #include #include @@ -36,15 +36,12 @@ namespace params { VendorTagDescriptor::~VendorTagDescriptor() { size_t len = mReverseMapping.size(); - for (size_t i = 0; i < len; ++i) { + for (size_t i = 0; i < len; ++i) { delete mReverseMapping[i]; } } -VendorTagDescriptor::VendorTagDescriptor() : - mTagCount(0), - mVendorOps() { -} +VendorTagDescriptor::VendorTagDescriptor() : mTagCount(0), mVendorOps() {} VendorTagDescriptor::VendorTagDescriptor(const VendorTagDescriptor& src) { copyFrom(src); @@ -127,7 +124,8 @@ const SortedVector* VendorTagDescriptor::getAllSectionNames() const { return &mSections; } -status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const { +status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& section, + /*out*/ uint32_t* tag) const { ssize_t index = mReverseMapping.indexOfKey(section); if (index < 0) { ALOGE("%s: Section '%s' does not exist.", __FUNCTION__, section.string()); @@ -147,18 +145,16 @@ status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& sect } void VendorTagDescriptor::dump(int fd, int verbosity, int indentation) const { - size_t size = mTagToNameMap.size(); if (size == 0) { - dprintf(fd, "%*sDumping configured vendor tag descriptors: None set\n", - indentation, ""); + dprintf(fd, "%*sDumping configured vendor tag descriptors: None set\n", indentation, ""); return; } - dprintf(fd, "%*sDumping configured vendor tag descriptors: %zu entries\n", - indentation, "", size); + dprintf(fd, "%*sDumping configured vendor tag descriptors: %zu entries\n", indentation, "", + size); for (size_t i = 0; i < size; ++i) { - uint32_t tag = mTagToNameMap.keyAt(i); + uint32_t tag = mTagToNameMap.keyAt(i); if (verbosity < 1) { dprintf(fd, "%*s0x%x\n", indentation + 2, "", tag); @@ -168,12 +164,11 @@ void VendorTagDescriptor::dump(int fd, int verbosity, int indentation) const { uint32_t sectionId = mTagToSectionMap.valueFor(tag); String8 sectionName = mSections[sectionId]; int type = mTagToTypeMap.at(tag); - const char* typeName = (type >= 0 && type < NUM_TYPES) ? - camera_metadata_type_names[type] : "UNKNOWN"; - dprintf(fd, "%*s0x%x (%s) with type %d (%s) defined in section %s\n", indentation + 2, - "", tag, name.string(), type, typeName, sectionName.string()); + const char* typeName = + (type >= 0 && type < NUM_TYPES) ? camera_metadata_type_names[type] : "UNKNOWN"; + dprintf(fd, "%*s0x%x (%s) with type %d (%s) defined in section %s\n", indentation + 2, "", + tag, name.string(), type, typeName, sectionName.string()); } - } int VendorTagDescriptorCache::getTagCount(metadata_vendor_id_t id) const { @@ -240,7 +235,7 @@ void VendorTagDescriptorCache::dump(int fd, int verbosity, int indentation) cons } int32_t VendorTagDescriptorCache::addVendorDescriptor( - metadata_vendor_id_t id, sp desc) { + metadata_vendor_id_t id, sp desc) { auto entry = mVendorMap.find(id); if (entry != mVendorMap.end()) { ALOGE("%s: Vendor descriptor with same id already present!", __func__); @@ -252,8 +247,8 @@ int32_t VendorTagDescriptorCache::addVendorDescriptor( } int32_t VendorTagDescriptorCache::getVendorTagDescriptor( - metadata_vendor_id_t id, - sp* desc /*out*/) { + metadata_vendor_id_t id, + sp* desc /*out*/) { auto entry = mVendorMap.find(id); if (entry == mVendorMap.end()) { return NAME_NOT_FOUND; @@ -263,12 +258,11 @@ int32_t VendorTagDescriptorCache::getVendorTagDescriptor( return NO_ERROR; } -} // namespace params -} // namespace camera2 +} // namespace params +} // namespace camera2 namespace camera { namespace common { -namespace V1_0 { namespace helper { extern "C" { @@ -292,8 +286,8 @@ static sp sGlobalVendorTagDescriptor; static sp sGlobalVendorTagDescriptorCache; status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vOps, - /*out*/ - sp& descriptor) { + /*out*/ + sp& descriptor) { if (vOps == NULL) { ALOGE("%s: vendor_tag_ops argument was NULL.", __FUNCTION__); return BAD_VALUE; @@ -307,9 +301,9 @@ status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vO Vector tagArray; LOG_ALWAYS_FATAL_IF(tagArray.resize(tagCount) != tagCount, - "%s: too many (%u) vendor tags defined.", __FUNCTION__, tagCount); + "%s: too many (%u) vendor tags defined.", __FUNCTION__, tagCount); - vOps->get_all_tags(vOps, /*out*/tagArray.editArray()); + vOps->get_all_tags(vOps, /*out*/ tagArray.editArray()); sp desc = new VendorTagDescriptor(); desc->mTagCount = tagCount; @@ -323,13 +317,13 @@ status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vO ALOGE("%s: vendor tag %d not in vendor tag section.", __FUNCTION__, tag); return BAD_VALUE; } - const char *tagName = vOps->get_tag_name(vOps, tag); + const char* tagName = vOps->get_tag_name(vOps, tag); if (tagName == NULL) { ALOGE("%s: no tag name defined for vendor tag %d.", __FUNCTION__, tag); return BAD_VALUE; } desc->mTagToNameMap.add(tag, String8(tagName)); - const char *sectionName = vOps->get_section_name(vOps, tag); + const char* sectionName = vOps->get_section_name(vOps, tag); if (sectionName == NULL) { ALOGE("%s: no section name defined for vendor tag %d.", __FUNCTION__, tag); return BAD_VALUE; @@ -386,9 +380,9 @@ status_t VendorTagDescriptor::setAsGlobalVendorTagDescriptor(const spget_tag_name = vendor_tag_descriptor_get_tag_name; opsPtr->get_tag_type = vendor_tag_descriptor_get_tag_type; } - if((res = set_camera_metadata_vendor_ops(opsPtr)) != OK) { - ALOGE("%s: Could not set vendor tag descriptor, received error %s (%d)." - , __FUNCTION__, strerror(-res), res); + if ((res = set_camera_metadata_vendor_ops(opsPtr)) != OK) { + ALOGE("%s: Could not set vendor tag descriptor, received error %s (%d).", __FUNCTION__, + strerror(-res), res); } return res; } @@ -405,7 +399,7 @@ sp VendorTagDescriptor::getGlobalVendorTagDescriptor() { } status_t VendorTagDescriptorCache::setAsGlobalVendorTagCache( - const sp& cache) { + const sp& cache) { status_t res = OK; Mutex::Autolock al(sLock); sGlobalVendorTagDescriptorCache = cache; @@ -530,9 +524,8 @@ int vendor_tag_descriptor_cache_get_tag_type(uint32_t tag, metadata_vendor_id_t } /* extern "C" */ -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/include/CameraMetadata.h b/camera/common/default/include/CameraMetadata.h similarity index 76% rename from camera/common/1.0/default/include/CameraMetadata.h rename to camera/common/default/include/CameraMetadata.h index d5e4d5691d..b67914ea45 100644 --- a/camera/common/1.0/default/include/CameraMetadata.h +++ b/camera/common/default/include/CameraMetadata.h @@ -26,7 +26,6 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { class VendorTagDescriptor; @@ -46,15 +45,15 @@ class CameraMetadata { ~CameraMetadata(); /** Takes ownership of passed-in buffer */ - CameraMetadata(camera_metadata_t *buffer); + CameraMetadata(camera_metadata_t* buffer); /** Clones the metadata */ - CameraMetadata(const CameraMetadata &other); + CameraMetadata(const CameraMetadata& other); /** * Assignment clones metadata buffer. */ - CameraMetadata &operator=(const CameraMetadata &other); - CameraMetadata &operator=(const camera_metadata_t *buffer); + CameraMetadata& operator=(const CameraMetadata& other); + CameraMetadata& operator=(const camera_metadata_t* buffer); /** * Get reference to the underlying metadata buffer. Ownership remains with @@ -71,7 +70,7 @@ class CameraMetadata { * from getAndLock must be provided to guarantee that the right object is * being unlocked. */ - status_t unlock(const camera_metadata_t *buffer) const; + status_t unlock(const camera_metadata_t* buffer) const; /** * Release a raw metadata buffer to the caller. After this call, @@ -98,12 +97,12 @@ class CameraMetadata { * Acquires raw buffer from other CameraMetadata object. After the call, the argument * object no longer has any metadata. */ - void acquire(CameraMetadata &other); + void acquire(CameraMetadata& other); /** * Append metadata from another CameraMetadata object. */ - status_t append(const CameraMetadata &other); + status_t append(const CameraMetadata& other); /** * Append metadata from a raw camera_metadata buffer @@ -130,24 +129,16 @@ class CameraMetadata { * will reallocate the buffer if insufficient space exists. Overloaded for * the various types of valid data. */ - status_t update(uint32_t tag, - const uint8_t *data, size_t data_count); - status_t update(uint32_t tag, - const int32_t *data, size_t data_count); - status_t update(uint32_t tag, - const float *data, size_t data_count); - status_t update(uint32_t tag, - const int64_t *data, size_t data_count); - status_t update(uint32_t tag, - const double *data, size_t data_count); - status_t update(uint32_t tag, - const camera_metadata_rational_t *data, size_t data_count); - status_t update(uint32_t tag, - const String8 &string); - status_t update(const camera_metadata_ro_entry &entry); + status_t update(uint32_t tag, const uint8_t* data, size_t data_count); + status_t update(uint32_t tag, const int32_t* data, size_t data_count); + status_t update(uint32_t tag, const float* data, size_t data_count); + status_t update(uint32_t tag, const int64_t* data, size_t data_count); + status_t update(uint32_t tag, const double* data, size_t data_count); + status_t update(uint32_t tag, const camera_metadata_rational_t* data, size_t data_count); + status_t update(uint32_t tag, const String8& string); + status_t update(const camera_metadata_ro_entry& entry); - - template + template status_t update(uint32_t tag, Vector data) { return update(tag, data.array(), data.size()); } @@ -177,7 +168,7 @@ class CameraMetadata { * Swap the underlying camera metadata between this and the other * metadata object. */ - void swap(CameraMetadata &other); + void swap(CameraMetadata& other); /** * Dump contents into FD for debugging. The verbosity levels are @@ -196,12 +187,12 @@ class CameraMetadata { * * This is a slow method. */ - static status_t getTagFromName(const char *name, - const VendorTagDescriptor* vTags, uint32_t *tag); + static status_t getTagFromName(const char* name, const VendorTagDescriptor* vTags, + uint32_t* tag); private: - camera_metadata_t *mBuffer; - mutable bool mLocked; + camera_metadata_t* mBuffer; + mutable bool mLocked; /** * Check if tag has a given type @@ -211,20 +202,25 @@ class CameraMetadata { /** * Base update entry method */ - status_t updateImpl(uint32_t tag, const void *data, size_t data_count); + status_t updateImpl(uint32_t tag, const void* data, size_t data_count); /** * Resize metadata buffer if needed by reallocating it and copying it over. */ status_t resizeIfNeeded(size_t extraEntries, size_t extraData); - }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used. +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::CameraMetadata CameraMetadata; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif diff --git a/camera/common/1.0/default/include/CameraModule.h b/camera/common/default/include/CameraModule.h similarity index 72% rename from camera/common/1.0/default/include/CameraModule.h rename to camera/common/default/include/CameraModule.h index c89e934655..5c1f8ec848 100644 --- a/camera/common/1.0/default/include/CameraModule.h +++ b/camera/common/default/include/CameraModule.h @@ -21,8 +21,8 @@ #include #include -#include #include +#include #include #include "CameraMetadata.h" @@ -31,7 +31,6 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { /** * A wrapper class for HAL camera module. @@ -41,21 +40,21 @@ namespace helper { * camera characteristics keys defined in newer HAL version on an older HAL. */ class CameraModule : public RefBase { -public: - explicit CameraModule(camera_module_t *module); + public: + explicit CameraModule(camera_module_t* module); virtual ~CameraModule(); // Must be called after construction // Returns OK on success, NO_INIT on failure int init(); - int getCameraInfo(int cameraId, struct camera_info *info); + int getCameraInfo(int cameraId, struct camera_info* info); int getDeviceVersion(int cameraId); int getNumberOfCameras(void); int open(const char* id, struct hw_device_t** device); bool isOpenLegacyDefined() const; int openLegacy(const char* id, uint32_t halVersion, struct hw_device_t** device); - int setCallbacks(const camera_module_callbacks_t *callbacks); + int setCallbacks(const camera_module_callbacks_t* callbacks); bool isVendorTagDefined() const; void getVendorTagOps(vendor_tag_ops_t* ops); bool isSetTorchModeSupported() const; @@ -65,25 +64,24 @@ public: uint16_t getHalApiVersion() const; const char* getModuleAuthor() const; // Only used by CameraModuleFixture native test. Do NOT use elsewhere. - void *getDso(); + void* getDso(); // Only used by CameraProvider void removeCamera(int cameraId); - int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo); - int isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams); + int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t** physicalInfo); + int isStreamCombinationSupported(int cameraId, camera_stream_combination_t* streams); void notifyDeviceStateChange(uint64_t deviceState); - static bool isLogicalMultiCamera( - const common::V1_0::helper::CameraMetadata& metadata, - std::unordered_set* physicalCameraIds); + static bool isLogicalMultiCamera(const common::helper::CameraMetadata& metadata, + std::unordered_set* physicalCameraIds); -private: + private: // Derive camera characteristics keys defined after HAL device version - static void deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata &chars); + static void deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata& chars); // Helper function to append available[request|result|chars]Keys - static void appendAvailableKeys(CameraMetadata &chars, - int32_t keyTag, const Vector& appendKeys); + static void appendAvailableKeys(CameraMetadata& chars, int32_t keyTag, + const Vector& appendKeys); status_t filterOpenErrorCode(status_t err); - camera_module_t *mModule; + camera_module_t* mModule; int mNumberOfCameras; KeyedVector mCameraInfoMap; KeyedVector mDeviceVersionMap; @@ -91,11 +89,17 @@ private: Mutex mCameraInfoLock; }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::CameraModule CameraModule; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif diff --git a/camera/common/1.0/default/include/CameraParameters.h b/camera/common/default/include/CameraParameters.h similarity index 94% rename from camera/common/1.0/default/include/CameraParameters.h rename to camera/common/default/include/CameraParameters.h index e4ff6f21c3..d2b5075f43 100644 --- a/camera/common/1.0/default/include/CameraParameters.h +++ b/camera/common/default/include/CameraParameters.h @@ -24,7 +24,6 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { struct Size { @@ -42,28 +41,27 @@ struct Size { } }; -class CameraParameters -{ -public: +class CameraParameters { + public: CameraParameters(); - CameraParameters(const String8 ¶ms) { unflatten(params); } + CameraParameters(const String8& params) { unflatten(params); } ~CameraParameters(); String8 flatten() const; - void unflatten(const String8 ¶ms); + void unflatten(const String8& params); - void set(const char *key, const char *value); - void set(const char *key, int value); - void setFloat(const char *key, float value); - const char *get(const char *key) const; - int getInt(const char *key) const; - float getFloat(const char *key) const; + void set(const char* key, const char* value); + void set(const char* key, int value); + void setFloat(const char* key, float value); + const char* get(const char* key) const; + int getInt(const char* key) const; + float getFloat(const char* key) const; - void remove(const char *key); + void remove(const char* key); void setPreviewSize(int width, int height); - void getPreviewSize(int *width, int *height) const; - void getSupportedPreviewSizes(Vector &sizes) const; + void getPreviewSize(int* width, int* height) const; + void getSupportedPreviewSizes(Vector& sizes) const; // Set the dimensions in pixels to the given width and height // for video frames. The given width and height must be one @@ -76,14 +74,14 @@ public: // supported dimensions returned from getSupportedVideoSizes(). // Must not be called if getSupportedVideoSizes() returns an // empty Vector of Size. - void getVideoSize(int *width, int *height) const; + void getVideoSize(int* width, int* height) const; // Retrieve a Vector of supported dimensions (width and height) // in pixels for video frames. If sizes returned from the method // is empty, the camera does not support calls to setVideoSize() // or getVideoSize(). In adddition, it also indicates that // the camera only has a single output, and does not have // separate output for video frames and preview frame. - void getSupportedVideoSizes(Vector &sizes) const; + void getSupportedVideoSizes(Vector& sizes) const; // Retrieve the preferred preview size (width and height) in pixels // for video recording. The given width and height must be one of // supported preview sizes returned from getSupportedPreviewSizes(). @@ -91,18 +89,18 @@ public: // Vector of Size. If getSupportedVideoSizes() returns an empty // Vector of Size, the width and height returned from this method // is invalid, and is "-1x-1". - void getPreferredPreviewSizeForVideo(int *width, int *height) const; + void getPreferredPreviewSizeForVideo(int* width, int* height) const; void setPreviewFrameRate(int fps); int getPreviewFrameRate() const; - void getPreviewFpsRange(int *min_fps, int *max_fps) const; - void setPreviewFormat(const char *format); - const char *getPreviewFormat() const; + void getPreviewFpsRange(int* min_fps, int* max_fps) const; + void setPreviewFormat(const char* format); + const char* getPreviewFormat() const; void setPictureSize(int width, int height); - void getPictureSize(int *width, int *height) const; - void getSupportedPictureSizes(Vector &sizes) const; - void setPictureFormat(const char *format); - const char *getPictureFormat() const; + void getPictureSize(int* width, int* height) const; + void getSupportedPictureSizes(Vector& sizes) const; + void setPictureFormat(const char* format); + const char* getPictureFormat() const; void dump() const; status_t dump(int fd, const Vector& args) const; @@ -619,9 +617,9 @@ public: // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT, // and KEY_VIDEO_FRAME_FORMAT static const char PIXEL_FORMAT_YUV422SP[]; - static const char PIXEL_FORMAT_YUV420SP[]; // NV21 - static const char PIXEL_FORMAT_YUV422I[]; // YUY2 - static const char PIXEL_FORMAT_YUV420P[]; // YV12 + static const char PIXEL_FORMAT_YUV420SP[]; // NV21 + static const char PIXEL_FORMAT_YUV422I[]; // YUY2 + static const char PIXEL_FORMAT_YUV420P[]; // YV12 static const char PIXEL_FORMAT_RGB565[]; static const char PIXEL_FORMAT_RGBA8888[]; static const char PIXEL_FORMAT_JPEG[]; @@ -695,15 +693,22 @@ public: */ static int previewFormatToEnum(const char* format); -private: - DefaultKeyedVector mMap; + private: + DefaultKeyedVector mMap; }; -}; -}; -}; -}; -}; -}; // namespace +}; // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::CameraParameters CameraParameters; +typedef android::hardware::camera::common::helper::Size Size; +} // namespace V1_0::helper + +}; // namespace common +}; // namespace camera +}; // namespace hardware +}; // namespace android #endif diff --git a/camera/common/1.0/default/include/Exif.h b/camera/common/default/include/Exif.h similarity index 95% rename from camera/common/1.0/default/include/Exif.h rename to camera/common/default/include/Exif.h index dc31679a67..6974b8ea30 100644 --- a/camera/common/1.0/default/include/Exif.h +++ b/camera/common/default/include/Exif.h @@ -23,10 +23,8 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { - // This is based on the original ChromeOS ARC implementation of a V4L2 HAL // ExifUtils can generate APP1 segment with tags which caller set. ExifUtils can @@ -44,8 +42,7 @@ namespace helper { // uint8_t* app1Buffer = new uint8_t[app1Length]; // memcpy(app1Buffer, utils->GetApp1Buffer(), app1Length); class ExifUtils { - - public: + public: virtual ~ExifUtils(); static ExifUtils* create(); @@ -55,8 +52,7 @@ class ExifUtils { virtual bool initialize() = 0; // Set all known fields from a metadata structure - virtual bool setFromMetadata(const CameraMetadata& metadata, - const size_t imageWidth, + virtual bool setFromMetadata(const CameraMetadata& metadata, const size_t imageWidth, const size_t imageHeight) = 0; // Sets the len aperture. @@ -244,13 +240,17 @@ class ExifUtils { virtual unsigned int getApp1Length() = 0; }; +} // namespace helper -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::ExifUtils ExifUtils; +} // namespace V1_0::helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif // ANDROID_HARDWARE_INTERFACES_CAMERA_COMMON_1_0_EXIF_H diff --git a/camera/common/1.0/default/include/HandleImporter.h b/camera/common/default/include/HandleImporter.h similarity index 80% rename from camera/common/1.0/default/include/HandleImporter.h rename to camera/common/default/include/HandleImporter.h index 83fa755c99..5408ba92e6 100644 --- a/camera/common/1.0/default/include/HandleImporter.h +++ b/camera/common/default/include/HandleImporter.h @@ -30,12 +30,11 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { // Borrowed from graphics HAL. Use this until gralloc mapper HAL is working class HandleImporter { -public: + public: HandleImporter(); // In IComposer, any buffer_handle_t is owned by the caller and we need to @@ -59,23 +58,23 @@ public: // Query the stride of the first plane in bytes. status_t getMonoPlanarStrideBytes(buffer_handle_t& buf, uint32_t* stride /*out*/); - int unlock(buffer_handle_t& buf); // returns release fence + int unlock(buffer_handle_t& buf); // returns release fence // Query Gralloc4 metadata bool isSmpte2086Present(const buffer_handle_t& buf); bool isSmpte2094_10Present(const buffer_handle_t& buf); bool isSmpte2094_40Present(const buffer_handle_t& buf); -private: + private: void initializeLocked(); void cleanup(); - template + template bool importBufferInternal(const sp mapper, buffer_handle_t& handle); - template + template YCbCrLayout lockYCbCrInternal(const sp mapper, buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion); - template + const IMapper::Rect& accessRegion); + template int unlockInternal(const sp mapper, buffer_handle_t& buf); Mutex mLock; @@ -85,11 +84,17 @@ private: sp mMapperV4; }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper -#endif // CAMERA_COMMON_1_0_HANDLEIMPORTED_H +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::HandleImporter HandleImporter; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // CAMERA_COMMON_1_0_HANDLEIMPORTED_H diff --git a/camera/common/1.0/default/include/SimpleThread.h b/camera/common/default/include/SimpleThread.h similarity index 100% rename from camera/common/1.0/default/include/SimpleThread.h rename to camera/common/default/include/SimpleThread.h diff --git a/camera/common/1.0/default/include/VendorTagDescriptor.h b/camera/common/default/include/VendorTagDescriptor.h similarity index 60% rename from camera/common/1.0/default/include/VendorTagDescriptor.h rename to camera/common/default/include/VendorTagDescriptor.h index 0f54db52d1..3133c26e00 100644 --- a/camera/common/1.0/default/include/VendorTagDescriptor.h +++ b/camera/common/default/include/VendorTagDescriptor.h @@ -17,11 +17,11 @@ #ifndef CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H #define CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include @@ -37,78 +37,77 @@ namespace params { * information enumerated by the HAL to clients of the camera service. */ class VendorTagDescriptor { - public: - virtual ~VendorTagDescriptor(); + public: + virtual ~VendorTagDescriptor(); - VendorTagDescriptor(); - VendorTagDescriptor(const VendorTagDescriptor& src); - VendorTagDescriptor& operator=(const VendorTagDescriptor& rhs); + VendorTagDescriptor(); + VendorTagDescriptor(const VendorTagDescriptor& src); + VendorTagDescriptor& operator=(const VendorTagDescriptor& rhs); - void copyFrom(const VendorTagDescriptor& src); + void copyFrom(const VendorTagDescriptor& src); - /** - * The following 'get*' methods implement the corresponding - * functions defined in - * system/media/camera/include/system/camera_vendor_tags.h - */ + /** + * The following 'get*' methods implement the corresponding + * functions defined in + * system/media/camera/include/system/camera_vendor_tags.h + */ - // Returns the number of vendor tags defined. - int getTagCount() const; + // Returns the number of vendor tags defined. + int getTagCount() const; - // Returns an array containing the id's of vendor tags defined. - void getTagArray(uint32_t* tagArray) const; + // Returns an array containing the id's of vendor tags defined. + void getTagArray(uint32_t* tagArray) const; - // Returns the section name string for a given vendor tag id. - const char* getSectionName(uint32_t tag) const; + // Returns the section name string for a given vendor tag id. + const char* getSectionName(uint32_t tag) const; - // Returns the index in section vectors returned in getAllSectionNames() - // for a given vendor tag id. -1 if input tag does not exist. - ssize_t getSectionIndex(uint32_t tag) const; + // Returns the index in section vectors returned in getAllSectionNames() + // for a given vendor tag id. -1 if input tag does not exist. + ssize_t getSectionIndex(uint32_t tag) const; - // Returns the tag name string for a given vendor tag id. - const char* getTagName(uint32_t tag) const; + // Returns the tag name string for a given vendor tag id. + const char* getTagName(uint32_t tag) const; - // Returns the tag type for a given vendor tag id. - int getTagType(uint32_t tag) const; + // Returns the tag type for a given vendor tag id. + int getTagType(uint32_t tag) const; - /** - * Convenience method to get a vector containing all vendor tag - * sections, or an empty vector if none are defined. - * The pointer is valid for the lifetime of the VendorTagDescriptor, - * or until copyFrom is invoked. - */ - const SortedVector* getAllSectionNames() const; + /** + * Convenience method to get a vector containing all vendor tag + * sections, or an empty vector if none are defined. + * The pointer is valid for the lifetime of the VendorTagDescriptor, + * or until copyFrom is invoked. + */ + const SortedVector* getAllSectionNames() const; - /** - * Lookup the tag id for a given tag name and section. - * - * Returns OK on success, or a negative error code. - */ - status_t lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const; + /** + * Lookup the tag id for a given tag name and section. + * + * Returns OK on success, or a negative error code. + */ + status_t lookupTag(const String8& name, const String8& section, /*out*/ uint32_t* tag) const; - /** - * Dump the currently configured vendor tags to a file descriptor. - */ - void dump(int fd, int verbosity, int indentation) const; + /** + * Dump the currently configured vendor tags to a file descriptor. + */ + void dump(int fd, int verbosity, int indentation) const; - protected: - KeyedVector*> mReverseMapping; - KeyedVector mTagToNameMap; - KeyedVector mTagToSectionMap; // Value is offset in mSections + protected: + KeyedVector*> mReverseMapping; + KeyedVector mTagToNameMap; + KeyedVector mTagToSectionMap; // Value is offset in mSections - std::unordered_map mTagToTypeMap; - SortedVector mSections; - // must be int32_t to be compatible with Parcel::writeInt32 - int32_t mTagCount; + std::unordered_map mTagToTypeMap; + SortedVector mSections; + // must be int32_t to be compatible with Parcel::writeInt32 + int32_t mTagCount; - vendor_tag_ops mVendorOps; + vendor_tag_ops mVendorOps; }; } /* namespace params */ } /* namespace camera2 */ namespace camera { namespace common { -namespace V1_0 { namespace helper { /** @@ -119,12 +118,9 @@ namespace helper { * Parcelable objects cannot require being kept in an sp<> and still work with auto-generated AIDL * interface implementations. */ -class VendorTagDescriptor : - public ::android::hardware::camera2::params::VendorTagDescriptor, - public LightRefBase { - +class VendorTagDescriptor : public ::android::hardware::camera2::params::VendorTagDescriptor, + public LightRefBase { public: - /** * Create a VendorTagDescriptor object from the given vendor_tag_ops_t * struct. @@ -132,8 +128,8 @@ class VendorTagDescriptor : * Returns OK on success, or a negative error code. */ static status_t createDescriptorFromOps(const vendor_tag_ops_t* vOps, - /*out*/ - sp& descriptor); + /*out*/ + sp& descriptor); /** * Sets the global vendor tag descriptor to use for this process. @@ -154,11 +150,9 @@ class VendorTagDescriptor : * Clears the global vendor tag descriptor used by this process. */ static void clearGlobalVendorTagDescriptor(); - }; } /* namespace helper */ -} /* namespace V1_0 */ } /* namespace common */ } /* namespace camera */ @@ -166,9 +160,8 @@ namespace camera2 { namespace params { class VendorTagDescriptorCache { - public: - typedef android::hardware::camera::common::V1_0::helper::VendorTagDescriptor - VendorTagDescriptor; + public: + typedef android::hardware::camera::common::helper::VendorTagDescriptor VendorTagDescriptor; VendorTagDescriptorCache(){}; int32_t addVendorDescriptor(metadata_vendor_id_t id, sp desc); @@ -194,7 +187,7 @@ class VendorTagDescriptorCache { */ void dump(int fd, int verbosity, int indentation) const; - protected: + protected: std::unordered_map> mVendorMap; struct vendor_tag_cache_ops mVendorCacheOps; }; @@ -204,13 +197,12 @@ class VendorTagDescriptorCache { namespace camera { namespace common { -namespace V1_0 { namespace helper { class VendorTagDescriptorCache : public ::android::hardware::camera2::params::VendorTagDescriptorCache, public LightRefBase { - public: + public: /** * Sets the global vendor tag descriptor cache to use for this process. * Camera metadata operations that access vendor tags will use the @@ -232,11 +224,19 @@ class VendorTagDescriptorCache static void clearGlobalVendorTagCache(); }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::VendorTagDescriptor VendorTagDescriptor; +typedef android::hardware::camera::common::helper::VendorTagDescriptorCache + VendorTagDescriptorCache; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif /* CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H */