int CdrCamera::initCamera(unsigned int width, unsigned int height, unsigned int preview_sz_w, unsigned int preview_sz_h) { HerbCamera::Parameters params; v4l2_queryctrl ctrl; if (!mHC) { return -1; } mHC->getParameters(¶ms); //params.dump(); params.setPreviewSize(preview_sz_w, preview_sz_h); //isp small size params.setVideoSize(width, height); //real sensor size ALOGD("(f:%s, l:%d) setPreviewSize[%dx%d], VideoSize[%dx%d]", __FUNCTION__, __LINE__, preview_sz_w, preview_sz_h, width, height); params.setPreviewFrameRate(FRONT_CAM_FRAMERATE); params.setPreviewFlip(mPreviewFlip); params.setPictureMode(CameraParameters::AWEXTEND_PICTURE_MODE_FAST); params.setPictureSizeMode(CameraParameters::AWEXTEND_PICTURE_SIZE_MODE::UseParameterPictureSize); #ifndef SENSOR_DEBUG if(mId == CAM_CSI) { params.setContrastValue(ctrl.default_value); params.setBrightnessValue(ctrl.default_value); params.setSaturationValue(ctrl.default_value); params.setHueValue(ctrl.default_value); } #endif mHC->setParameters(¶ms); mHC->setPreviewDisplay(mHlay); mCD->setBottom(); mHC->setErrorCallback(this); return 0; }
void CdrCamera::setCameraFlip(bool flip) { db_msg(" flip=%d",flip); if (flip) { mPreviewFlip = HerbCamera::Parameters::PREVIEW_FLIP::LeftRightFlip; } else { mPreviewFlip = HerbCamera::Parameters::PREVIEW_FLIP::NoFlip; } if (mHC) { HerbCamera::Parameters params; mHC->getParameters(¶ms); params.setPreviewFlip(mPreviewFlip); mHC->setParameters(¶ms); } }