当前位置: 首页>>代码示例>>C++>>正文


C++ CameraParameters::dump方法代码示例

本文整理汇总了C++中CameraParameters::dump方法的典型用法代码示例。如果您正苦于以下问题:C++ CameraParameters::dump方法的具体用法?C++ CameraParameters::dump怎么用?C++ CameraParameters::dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CameraParameters的用法示例。


在下文中一共展示了CameraParameters::dump方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initThreadCamera

/**
 * Thread function that initializes the camera
 */
status_t CaptureCommand::initThreadCamera() {
  // Setup the camera
  int cameraId = 0;
  mCamera = Camera::connect(cameraId, String16(CAMERA_NAME),
      Camera::USE_CALLING_UID);
  if (mCamera == NULL) {
    ALOGE("Unable to connect to camera");
    return -1;
  }
  mRemote = mCamera->remote();

  FaceDetection faces(&mChannel);
  mCamera->setListener(&faces);

  {
    char previewSize[80];
    snprintf(previewSize, sizeof(previewSize), "%dx%d", sVideoSize.width, sVideoSize.height);
    CameraParameters params = mCamera->getParameters();
    params.set(CameraParameters::KEY_PREVIEW_SIZE, previewSize);
    params.set(CameraParameters::KEY_PREVIEW_FORMAT, "yuv420sp");
    status_t err = mCamera->setParameters(params.flatten());
    CHECK(err == 0);
    params = mCamera->getParameters();
    params.dump();
  }

  sOpenCVCameraCapture->setPreviewProducerListener(this);
  CHECK(setPreviewTarget() == 0);

  //CHECK(mCamera->sendCommand(CAMERA_CMD_START_FACE_DETECTION, CAMERA_FACE_DETECTION_SW, 0) == 0);
  CHECK(mCamera->sendCommand(CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG, 1, 0) == 0);

  mCameraSource = CameraSource::CreateFromCamera(mRemote, mCamera->getRecordingProxy(), cameraId,
      String16(CAMERA_NAME, strlen(CAMERA_NAME)), Camera::USE_CALLING_UID,
      sVideoSize, sFPS,
      NULL, sUseMetaDataMode);
  CHECK_EQ(mCameraSource->initCheck(), ::OK);

  if (sInitCameraVideo) {
    mLooper = new ALooper;
    mLooper->setName("capture-looper");
    mLooper->start();

    sp<MediaSource> videoEncoder = prepareVideoEncoder(mLooper, mCameraSource);

    sp<MediaSource> audioSource(
      new AudioSource(
        AUDIO_SOURCE_MIC,
#ifdef TARGET_GE_MARSHMALLOW
        String16("silk-capture"),
#endif
        sAudioSampleRate,
        sAudioChannels
      )
    );
    sp<MediaSource> audioSourceEmitter =
      new AudioSourceEmitter(&mChannel, audioSource);
    sp<MediaSource> audioMutter =
      new AudioMutter(audioSourceEmitter);
    sp<MediaSource> audioEncoder =
      prepareAudioEncoder(mLooper, audioMutter);

    mSegmenter = new MPEG4SegmenterDASH(videoEncoder, audioEncoder, &mChannel);
    mSegmenter->run();

    mHardwareActive = true;
    notifyCameraEvent("initialized");

    // Block this thread while camera is running
    mSegmenter->join();
  } else {
    pthread_create(&mAudioThread, NULL, initThreadAudioOnlyWrapper, this);

    CHECK_EQ(mCameraSource->start(), ::OK);
    MediaSourceNullPuller cameraPuller(mCameraSource, "camera");
    if (!cameraPuller.loop()) {
      notifyCameraEvent("error");
    }
  }

  sOpenCVCameraCapture->setPreviewProducerListener(NULL);
  return 0;
}
开发者ID:kumarrishav,项目名称:silk,代码行数:86,代码来源:Capture.cpp


注:本文中的CameraParameters::dump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。