zoukankan      html  css  js  c++  java
  • 如何修改mtk android 默认拍照size

    [DESCRIPTION]
    修改默认拍照size

    [SOLUTION]

    修改默认的capture size,改变camera feature table的FID_CAP_SIZE default值不起作用。 因为camera AP并没有从feature table读取FID_CAP_SIZE的default值。

    下面介绍在AP端修改默认的capture size,分为在初始化时候和restore时候修改。以默认capture size 1600x1200为例。

    修改文件:Camera.java (alpspackagesappscamerasrccomandroidcamera)。

    1、在AP初始化设置参数的时候修改默认的capture size。

    private void updateCameraParametersPreference()方法中,将

                if (pictureSize == null) {

                      CameraSettings.initialCameraPictureSize(this, mParameters, camOri);

                } else {

                      List<Size> supported = mParameters.getSupportedPictureSizes();

                      CameraSettings.setCameraPictureSize(pictureSize, supported,

                                  mParameters, camOri);

                }

    改为:

                if (pictureSize == null) {

                      List<Size> supported = mParameters.getSupportedPictureSizes();

                      if(!(CameraSettings.setCameraPictureSize("1600x1200", supported,

                                  mParameters, camOri)))

                      {

                            CameraSettings.initialCameraPictureSize(this, mParameters, camOri);

                      }

                      else

                      {

                           SharedPreferences.Editor editor = ComboPreferences

                            .get(this).edit();

                           editor.putString(CameraSettings.KEY_PICTURE_SIZE, "1600x1200");

                           editor.apply();               

                      }

                 } else {

                      List<Size> supported = mParameters.getSupportedPictureSizes();

                      CameraSettings.setCameraPictureSize(pictureSize, supported,

                                  mParameters, camOri);

                 }

    2、恢复默认参数的时候,需要添加默认的capture size。

    private void restorePreferences()方法中,

    在CameraSettings.restorePreferences(Camera.this, mPreferences,mParameters);

    之后添加:

    List<Size> supported = mParameters.getSupportedPictureSizes();

    int camOri = CameraHolder.instance().getCameraInfo()[mCameraId].orientation;

                     

    if (LOGI) Log.i(TAG, "supported="+supported+",camOri="+camOri);

    if(camOri!=-1&&supported!=null)

        {

            if (LOGI) Log.i(TAG, "setCameraPictureSize=");

            if(CameraSettings.setCameraPictureSize("1600x1200", supported,mParameters, camOri))

            {

                           SharedPreferences.Editor editor = ComboPreferences

                            .get(this).edit();

                            editor.putString(CameraSettings.KEY_PICTURE_SIZE, "1600x1200");

                            editor.apply();

             }                         

        }

    另外,对于前后摄像头不同要求,根据需要进行判断。

    CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];

    if(info.facing == CameraInfo.CAMERA_FACING_FRONT){

    //sub sensor

    }else{

    //main sensor

    }

  • 相关阅读:
    Tornado输出和响应头
    sqlalchemy 学习(二)scoped session
    04:sqlalchemy操作数据库 不错
    sqlalchemy(二)高级用法
    红黑树
    Minimum Window Substring
    Max Points on a Line
    分治算法
    Maximum Subarray
    Word Break
  • 原文地址:https://www.cnblogs.com/rainey-forrest/p/4989467.html
Copyright © 2011-2022 走看看