Camera2中 CameraContext 分析

1.CameraContext 实现了interface ICameraContext
2.同步了CameraActivity 生命周期
3.几个关键的变量,是camera 逻辑处理类获取类

  @Override
    public void create(IApp app, Activity activity) {
        mActivity = activity;
        mSoundPlayback = new SoundPlaybackImpl(activity);
        mLocationManager = new LocationManager(activity);
        mMediaSaver = new MediaSaver(activity);
        mDataStore = new DataStore(activity);
        mStatusMonitorFactory = new StatusMonitorFactory();
        mFeatureProvider = new FeatureProvider(app);

        mCameraDeviceManagerFactory = CameraDeviceManagerFactory.getInstance();
        mSettingManagerFactory = new SettingManagerFactory(app, this);
        mStorageService = new StorageServiceImpl(app, this);
        mThermalThrottle = new ThermalThrottle(app);
    }

mSoundPlayback = new SoundPlaybackImpl(activity);
负责播放拍照提示音,录像提示音等

mLocationManager = new LocationManager(activity);
位置信息管理类,可以打开或者关闭 获取位置信息。

public class LocationManager {

    LocationProvider mLocationProvider;

    /**
     * init LocationManager, get location provider.
     * @param context the activity context.
     */
    public LocationManager(Context context) {
        mLocationProvider = new LocationProvider(context);
    }

    /**
     * Start/stop location recording.
     * @param recordLocation true to start record location.
     *                       false to stop record location.
     */
    public void recordLocation(boolean recordLocation) {
        mLocationProvider.recordLocation(recordLocation);
    }

    /**
     * Returns the current location from the location provider or null, if
     * location could not be determined or is switched off.
     * @return the location info.
     */
    public Location getCurrentLocation() {
        return mLocationProvider.getCurrentLocation();
    }
}

mMediaSaver = new MediaSaver(activity);
处理相机拍照,录像后,媒体文件的保存工作

mDataStore = new DataStore(activity);
处理设置项的保存,读取工作
mFeatureProvider = new FeatureProvider(app);
相机中feature的加载,读取

mCameraDeviceManagerFactory = CameraDeviceManagerFactory.getInstance();
device 管理工厂类,可以通过CameraDeviceManager getCameraDeviceManager(Context context, CameraApi api) 获取对应的

mSettingManagerFactory = new SettingManagerFactory(app, this);
获取settingManager,负责feature 的加载,以及camera parameter处理

mStorageService = new StorageServiceImpl(app, this);
获取存储空间的信息,主要MediaSaver 用的比较多

mThermalThrottle = new ThermalThrottle(app);
高温警告

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值