【android 更改三方相机配流size】

前言

强制修改三方相机配流size, 拍照和预览都可以

声明:

本帖用的是安卓开源代码:
http://aospxref.com/android-14.0.0_r2/xref/frameworks/av/services/camera/libcameraservice/api2/CameraDeviceClient.cpp#867

修改方案

cpp 复制代码
867  binder::Status CameraDeviceClient::createStream(
868          const hardware::camera2::params::OutputConfiguration &outputConfiguration,
869          /*out*/
870          int32_t* newStreamId) {
871      ATRACE_CALL();
872  
     ... ...
917      OutputStreamInfo streamInfo;//用这个对象可以修改配流size
918      bool isStreamInfoValid = false;
919      const std::vector<int32_t> &sensorPixelModesUsed =
920              outputConfiguration.getSensorPixelModesUsed();
921      for (auto& bufferProducer : bufferProducers) {
922          // Don't create multiple streams for the same target surface
923          sp<IBinder> binder = IInterface::asBinder(bufferProducer);
924          ssize_t index = mStreamMap.indexOfKey(binder);
925          if (index != NAME_NOT_FOUND) {
926              String8 msg = String8::format("Camera %s: Surface already has a stream created for it "
927                      "(ID %zd)", mCameraIdStr.string(), index);
928              ALOGW("%s: %s", __FUNCTION__, msg.string());
929              return STATUS_ERROR(CameraService::ERROR_ALREADY_EXISTS, msg.string());
930          }
     ... ...
983      } else {
            //if(String8(mClientPackageName) == "com.xxx.xxx")
            //{
            //   直接修改streamInfo.width 、streamInfo.height即可
            //}
984          err = mDevice->createStream(surfaces, deferredConsumer, streamInfo.width,
985                  streamInfo.height, streamInfo.format, streamInfo.dataSpace,
986                  static_cast<camera_stream_rotation_t>
     ... ...
1031  
1032      return res;
1033  }
相关推荐
敲上瘾16 分钟前
磁盘到 inode:深入理解 Linux ext 文件系统底层原理
android·linux·运维·文件系统
hewence125 分钟前
Kotlin CoroutineScope解密
android·开发语言·kotlin
遇雪长安1 小时前
高通安卓设备DIAG端口启用指南
android·adb·usb·dm·qpst·diag·qxdm
华章酱1 小时前
MySQL EXPLAIN 完全解读:从执行计划到索引优化
android·数据库·mysql
2501_915921431 小时前
Fastlane 结合 AppUploader 来实现 CI 集成自动化上架
android·运维·ci/cd·小程序·uni-app·自动化·iphone
贤泽1 小时前
Android 15 AOSP Notification分析
android
特立独行的猫a2 小时前
腾讯Kuikly多端框架(KMP)实战:轮播图的完整实现
android·harmonyos·轮播图·jetpack compose·kuikly
2501_915921432 小时前
iOS 抓包怎么绕过 SSL Pinning 证书限制,抓取app上的包
android·网络协议·ios·小程序·uni-app·iphone·ssl
陈健平2 小时前
用 Kimi 2.5 Agent 从 0 搭建「宇宙吞噬,ps:和球球大作战这种差不多」对抗小游戏(Canvas 粒子特效 + AI Bot + 排行榜)
android·人工智能·agent·kimi2.5
hewence12 小时前
重构千行Callback:Android异步回调无损迁移协程Suspend完全指南
android·重构·kotlin