|
问题一:不能打开USB摄像头
原因:摄像头不支持驱动固定的预览分辨率
解决:设置固定拍照预览分辨率
- hardware/rockchip/camera/CameraHal/CameraUSBAdapter.cpp
- @@ -135,7 +135,7 @@ void CameraUSBAdapter::initDefaultParameters(int camFd)
- params.set(KEY_PREVIEW_W_FORCE,"0");
- params.set(KEY_PREVIEW_H_FORCE,"0");
- params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, parameterString.string());
- - params.setPreviewSize(640,480);
- + params.setPreviewSize(320,240);
- /*picture size setting*/
- params.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, parameterString.string());
- params.setPictureSize(mCamDriverFrmWidthMax, mCamDriverFrmHeightMax);
复制代码
问题二:打开相机后,不能拍照
原因:摄像头不支持驱动固定的拍照分辨率
解决:设置固定拍照分辨率
- hardware/rockchip/camera/CameraHal/CameraAdapter.cpp
- @@ -168,7 +168,8 @@ bool CameraAdapter::getFlashStatus()
- }
- status_t CameraAdapter::startPreview(int preview_w,int preview_h,int w, int h, int fmt,bool is_capture)
- {
- -
- + w = 640;
- + h = 480;
- //create buffer
- LOG_FUNCTION_NAME
- unsigned int frame_size = 0,i;
复制代码
问题三:不能录像
原因:摄像头不支持驱动固定的录像分辨率
解决:设置录像分辨率
- frameworks/av/media/libstagefright/CameraSource.cpp
- @@ -493,6 +493,10 @@ status_t CameraSource::init(
- int32_t frameRate,
- bool storeMetaDataInVideoBuffers) {
-
- + videoSize.width = 640;
- + videoSize.height = 480;
- + frameRate = 15;
- +
- ALOGV("init");
- status_t err = OK;
- int64_t token = IPCThreadState::self()->clearCallingIdentity();
复制代码
问题四:摄像头方向不对
解决:修改摄像头方向
- hardware/rockchip/camera/CameraHal/CameraHal_Module.cpp
- @@ -781,7 +781,7 @@ int camera_get_number_of_cameras(void)
- ptr++;
- camInfoTmp[cam_cnt].facing_info.orientation = atoi(ptr);
- } else {
- - camInfoTmp[cam_cnt].facing_info.orientation = 0;
- + camInfoTmp[cam_cnt].facing_info.orientation = 180;
- }
复制代码
问题五:预览镜像
解决:前后置调换(修改后预览不镜像,但是照片还是镜像)
- frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp
- @@ -654,7 +656,7 @@ status_t CameraClient::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) {
-
- if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) {
- // Mirror the preview if the camera is front-facing.
- - orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT);
- + orientation = getOrientation(arg1, mCameraFacing == !CAMERA_FACING_FRONT);
- if (orientation == -1) return BAD_VALUE;
-
- if (mOrientation != orientation) {
复制代码
|
|