原因:
jpg的EXIF信息出错, 为了简单, 不写入 EXIF即可
#if (CAM_WRITE_JPEG_THUMB_EXIF_EN > 0)
if (mMsgEnabled & CAMERA_MSG_COMPRESSED_IMAGE) {
camera_memory_t *ExifHeap =
mGetMemoryCb(-1, EXIF_FILE_SIZE + mThumbSize, 1, 0);
int JpegExifSize = mSecCamera->getExif((unsigned char *)ExifHeap->data,
(unsigned char *)mThumbnailHeap->base(),
mThumbSize);
LOGV("JpegExifSize=%d", JpegExifSize);
if (JpegExifSize < 0) {
ret = UNKNOWN_ERROR;
goto out;
}
int mJpegHeapSize_out = JpegImageSize + JpegExifSize;
camera_memory_t *JpegHeap_out = mGetMemoryCb(-1, mJpegHeapSize_out, 1, 0);
unsigned char *ExifStart = (unsigned char *)JpegHeap_out->data + 2;
unsigned char *ImageStart = ExifStart + JpegExifSize;
memcpy(JpegHeap_out->data, JpegHeap->data, 2);
memcpy(ExifStart, ExifHeap->data, JpegExifSize);
memcpy(ImageStart, JpegHeap->data + 2, JpegImageSize - 2);
mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, JpegHeap_out, 0, NULL, mCallbackCookie);
if (ExifHeap) {
ExifHeap->release(ExifHeap);
ExifHeap = 0;
}
if (JpegHeap_out) {
JpegHeap_out->release(JpegHeap_out);
JpegHeap_out = 0;
}
}
#else
/*
在预览图片时底部显示异常, 但是真正打开时是显示正常的,
经查实发现是 EXIF 的信息造成的问题, 现在为了简单解决, 不写入 EXIT 信息
*/
if (mMsgEnabled & CAMERA_MSG_COMPRESSED_IMAGE) {
camera_memory_t *ExifHeap = NULL;
//mGetMemoryCb(-1, EXIF_FILE_SIZE + mThumbSize, 1, 0);
int JpegExifSize = 0;//mSecCamera->getExif((unsigned char *)ExifHeap->data,
// (unsigned char *)mThumbnailHeap->base(),
// mThumbSize);
LOGV("JpegExifSize=%d", JpegExifSize);
if (JpegExifSize < 0) {
ret = UNKNOWN_ERROR;
goto out;
}
int mJpegHeapSize_out = JpegImageSize + JpegExifSize;
camera_memory_t *JpegHeap_out = mGetMemoryCb(-1, mJpegHeapSize_out, 1, 0);
//unsigned char *ExifStart = (unsigned char *)JpegHeap_out->data + 2;
//unsigned char *ImageStart = ExifStart + JpegExifSize;
//memcpy(JpegHeap_out->data, JpegHeap->data, 2);
//memcpy(ExifStart, ExifHeap->data, JpegExifSize);
//memcpy(ImageStart, JpegHeap->data + 2, JpegImageSize - 2);
//memcpy(ImageStart, JpegHeap->data, JpegImageSize);
memcpy((unsigned char *)JpegHeap_out->data, JpegHeap->data, JpegImageSize);
mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, JpegHeap_out, 0, NULL, mCallbackCookie);
if (ExifHeap) {
ExifHeap->release(ExifHeap);
ExifHeap = 0;
}
if (JpegHeap_out) {
JpegHeap_out->release(JpegHeap_out);
JpegHeap_out = 0;
}
}
#endif
如果需要iBeacon基站开发, 请看这里 http://cc2540.taobao.com/ , 这里能提供基于cc2540或cc2541的蓝牙4.0BLE开发的详细硬件和软件资料, QQ2045315160, 阿莫单片机论坛 www.amoMCU.com 提供技术支持。