當前位置: 首頁>>代碼示例>>Java>>正文


Java CameraDevice.createCaptureSession方法代碼示例

本文整理匯總了Java中android.hardware.camera2.CameraDevice.createCaptureSession方法的典型用法代碼示例。如果您正苦於以下問題:Java CameraDevice.createCaptureSession方法的具體用法?Java CameraDevice.createCaptureSession怎麽用?Java CameraDevice.createCaptureSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.camera2.CameraDevice的用法示例。


在下文中一共展示了CameraDevice.createCaptureSession方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onOpened

import android.hardware.camera2.CameraDevice; //導入方法依賴的package包/類
@Override
public void onOpened(CameraDevice camera) {
  checkIsOnCameraThread();

  Logging.d(TAG, "Camera opened.");
  cameraDevice = camera;

  final SurfaceTexture surfaceTexture = surfaceTextureHelper.getSurfaceTexture();
  surfaceTexture.setDefaultBufferSize(captureFormat.width, captureFormat.height);
  surface = new Surface(surfaceTexture);
  List<Surface> surfaces = new ArrayList<Surface>();
  surfaces.add(surface);
  if (mediaRecorderSurface != null) {
    Logging.d(TAG, "Add MediaRecorder surface to capture session.");
    surfaces.add(mediaRecorderSurface);
  }
  try {
    camera.createCaptureSession(surfaces, new CaptureSessionCallback(), cameraThreadHandler);
  } catch (CameraAccessException e) {
    reportError("Failed to create capture session. " + e);
    return;
  }
}
 
開發者ID:Piasy,項目名稱:AppRTC-Android,代碼行數:24,代碼來源:Camera2Session.java

示例2: onOpened

import android.hardware.camera2.CameraDevice; //導入方法依賴的package包/類
@Override
public void onOpened(CameraDevice camera) {
  checkIsOnCameraThread();

  Logging.d(TAG, "Camera opened.");
  cameraDevice = camera;

  final SurfaceTexture surfaceTexture = surfaceTextureHelper.getSurfaceTexture();
  surfaceTexture.setDefaultBufferSize(captureFormat.width, captureFormat.height);
  surface = new Surface(surfaceTexture);
  try {
    camera.createCaptureSession(
        Arrays.asList(surface), new CaptureSessionCallback(), cameraThreadHandler);
  } catch (CameraAccessException e) {
    reportError("Failed to create capture session. " + e);
    return;
  }
}
 
開發者ID:lgyjg,項目名稱:AndroidRTC,代碼行數:19,代碼來源:Camera2Session.java

示例3: onOpened

import android.hardware.camera2.CameraDevice; //導入方法依賴的package包/類
@Override
public void onOpened(CameraDevice cameraDevice) {
    Log.d(TAG, "相機已經打開");
    try {
        mPreViewBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
        SurfaceTexture texture = mTextureView.getSurfaceTexture();
        texture.setDefaultBufferSize(mPreViewSize.getWidth(), mPreViewSize.getHeight());
        surface = new Surface(texture);
        mPreViewBuilder.addTarget(surface);
        cameraDevice.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface
                ()), mSessionStateCallBack, mHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
開發者ID:lupwei,項目名稱:Croprotector,代碼行數:16,代碼來源:Shoot_fragment.java


注:本文中的android.hardware.camera2.CameraDevice.createCaptureSession方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。