【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  }
相关推荐
河铃旅鹿1 小时前
Android开发-java版:SQLite数据库
android·数据库·笔记·学习·sqlite
旋律逍遥2 小时前
《Framework 开发》3、开发工具及命令行知识装备
android
啦啦9117142 小时前
安卓手机/平板/TV版 Rotation强制横屏显示工具!免ROOT可用!再推荐突破手机限制的3款神器
android·智能手机·电脑
汤面不加鱼丸3 小时前
flutter实践:混合app在部分android旧机型上显示异常
android·flutter
_李小白4 小时前
【Android FrameWork】延伸阅读:ActivityManagerService启动Activity
android
用户41659673693554 小时前
Android 媒体库高效扫描器:基于协程与 `ContentObserver` 的 `FileScanner`
android
Arenaschi4 小时前
Android中的release下面的包有什么左右和debug 的包有什么区别
android
stevenzqzq4 小时前
android recyclerview缓存2_四级缓存机制
android·spring boot·缓存
用户69371750013845 小时前
Kotlin 函数详解:命名参数与默认参数值
android·后端·kotlin
卓修武K5 小时前
Android系统BUG:修改线程名目标错乱问题探究
android