当前位置:   article > 正文

Android系统Camera参数设置_failed to set preview size

failed to set preview size

一、应用程序

1.Camera应用使用的参数对象

frameworks/base/core/java/android/hardware/Camera.java
  1. public class Parameters {
  2. }

2.使用

Camera拍照预览:

packages/apps/Camera/src/com/android/camera/CameraModule.java

  1. mInitialParams = mCameraDevice.getParameters();
  2. mInitialParams.getSupportedPreviewSizes();
  3. mInitialParams.setPreviewSize(maxSize.width,maxSize.height);
Camera拍照:

  1. mInitialParams.setPictureSize(maxSize.width,maxSize.height);
  2. mCameraDevice.setParameters(mInitialParams);
Camera录像预览:

packages/apps/Camera/src/com/android/camera/VideoModule.java

  1. InitialParams = vCameraDevice.getParameters();
  2. vInitialParams.getSupportedVideoSizes();
  3. mParameters.setPreviewSize();
  4. vCameraDevice.setParameters(mParameters);

二、MediaRecorder

1.CameraSource使用的参数对象

frameworks/av/camera/CameraParameters.cpp

  1. void CameraParameters::getVideoSize(int *width, int *height) const{
  2. }

2.使用

frameworks/av/media/libstagefright/CameraSource.cpp

  1. status_t CameraSource::checkVideoSize(
  2. const CameraParameters& params,
  3. int32_t width, int32_t height) {
  4. params.getVideoSize(&frameWidthActual, &frameHeightActual);
  5. if (frameWidthActual != width || frameHeightActual != height) {
  6. ALOGE("Failed to set video frame size to %dx%d. " "The actual video size is %dx%d ", width, height, frameWidthActual, frameHeightActual);
  7. }
  8. }
三、CameraHAL

1.CameraHAL使用的参数对象

frameworks/av/camera/CameraParameters.cpp

2.使用

hardware/amlogic/camera/CameraHal.cpp

  1. int CameraHal::setParameters(const CameraParameters& params){
  2. //add by tank for CameraSource video recorder
  3. mParameters.setVideoSize(w,h);
  4. //end tan 2013-12-3
  5. // Handle RECORDING_HINT to Set/Reset Video Mode Parameters
  6. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/102901
推荐阅读
相关标签
  

闽ICP备14008679号