コード例 #1
0
ファイル: CameraManager.java プロジェクト: fuhongliang/art
 /**
  * A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
  * in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
  * respectively.
  *
  * @param handler The handler to send the message to.
  * @param message The what field of the message to be sent.
  */
 public void requestPreviewFrame(Handler handler, int message) {
   Camera theCamera = camera;
   if (theCamera != null && previewing) {
     previewCallback.setHandler(handler, message);
     theCamera.setOneShotPreviewCallback(previewCallback);
   }
 }
コード例 #2
0
ファイル: CameraManager.java プロジェクト: NemesisAW/Edible
 /**
  * A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
  * in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
  * respectively.
  *
  * @param handler The handler to send the message to.
  * @param message The what field of the message to be sent.
  */
 public synchronized void requestOcrDecode(Handler handler, int message) {
   Camera theCamera = camera;
   if (theCamera != null && previewing) {
     previewCallback.setHandler(handler, message);
     theCamera.setOneShotPreviewCallback(previewCallback);
   }
 }
コード例 #3
0
  /**
   * executes <br>
   * <code>camera.setOneShotPreviewCallback(callback)</code> if <br>
   * <code>camera != null</code>
   *
   * @param callback callback to provide
   */
  public synchronized void requestNextFrame(Camera.PreviewCallback callback) {
    try {
      if (camera != null) {
        camera.setOneShotPreviewCallback(callback);
      }
    } catch (Exception e) {

    }
  }
コード例 #4
0
ファイル: CameraManager.java プロジェクト: himon/ChunSunRE
  /**
   * A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
   * in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
   * respectively. <br>
   * 两个绑定操作:<br>
   * 1:将handler与回调函数绑定;<br>
   * 2:将相机与回调函数绑定<br>
   * 综上,该函数的作用是当相机的预览界面准备就绪后就会调用hander向其发送传入的message
   *
   * @param handler The handler to send the message to.
   * @param message The what field of the message to be sent.
   */
  public synchronized void requestPreviewFrame(Handler handler, int message) {
    Camera theCamera = camera;
    if (theCamera != null && previewing) {
      previewCallback.setHandler(handler, message);

      // 绑定相机回调函数,当预览界面准备就绪后会回调Camera.PreviewCallback.onPreviewFrame
      theCamera.setOneShotPreviewCallback(previewCallback);
    }
  }
コード例 #5
0
 /**
  * A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
  * in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
  * respectively.
  *
  * @param handler The handler to send the message to.
  * @param message The what field of the message to be sent.
  */
 public void requestPreviewFrame(Handler handler, int message) {
   if (camera != null && previewing) {
     previewCallback.setHandler(handler, message);
     if (useOneShotPreviewCallback) {
       camera.setOneShotPreviewCallback(previewCallback);
     } else {
       camera.setPreviewCallback(previewCallback);
     }
   }
 }
コード例 #6
0
 public void stopCameraPreview() {
   if (mCamera != null) {
     try {
       mPreviewing = false;
       mCamera.cancelAutoFocus();
       mCamera.setOneShotPreviewCallback(null);
       mCamera.stopPreview();
     } catch (Exception e) {
       Log.e(TAG, e.toString(), e);
     }
   }
 }
コード例 #7
0
 public void showCameraPreview() {
   if (mCamera != null) {
     try {
       mPreviewing = true;
       setupCameraParameters();
       mCamera.setPreviewDisplay(getHolder());
       mCamera.setDisplayOrientation(getDisplayOrientation());
       mCamera.setOneShotPreviewCallback(mPreviewCallback);
       mCamera.startPreview();
       if (mAutoFocus) {
         if (mSurfaceCreated) { // check if surface created before using autofocus
           safeAutoFocus();
         } else {
           scheduleAutoFocus(); // wait 1 sec and then do check again
         }
       }
     } catch (Exception e) {
       Log.e(TAG, e.toString(), e);
     }
   }
 }
コード例 #8
0
ファイル: CameraView.java プロジェクト: beansen/MobSys
 public void setOneShotPreviewCallback(PreviewCallback callback) {
   if (camera != null) {
     camera.setOneShotPreviewCallback(callback);
   }
 }
コード例 #9
0
 public void requestPreviewFrame(final PreviewCallback callback) {
   camera.setOneShotPreviewCallback(callback);
 }
コード例 #10
0
 @Override
 public void setOneShotPreviewCallback(Camera.PreviewCallback cb) {
   camera.setOneShotPreviewCallback(cb);
 }