android.hardware.Camera.setPreviewCallbackWithBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(212)

本文整理了Java中android.hardware.Camera.setPreviewCallbackWithBuffer()方法的一些代码示例,展示了Camera.setPreviewCallbackWithBuffer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Camera.setPreviewCallbackWithBuffer()方法的具体详情如下:
包路径:android.hardware.Camera
类名称:Camera
方法名:setPreviewCallbackWithBuffer

Camera.setPreviewCallbackWithBuffer介绍

暂无

代码示例

代码示例来源:origin: googlesamples/android-vision

mCamera.setPreviewCallbackWithBuffer(null);
try {

代码示例来源:origin: googlesamples/android-vision

camera.setPreviewCallbackWithBuffer(null);
try {

代码示例来源:origin: googlesamples/android-vision

mCamera.setPreviewCallbackWithBuffer(null);
try {

代码示例来源:origin: daniulive/SmarterStreaming

mCamera.setPreviewCallbackWithBuffer(this);
try {
  mCamera.setPreviewDisplay(holder);

代码示例来源:origin: daniulive/SmarterStreaming

pushCamera.setPreviewCallbackWithBuffer(this);  
try {  
  pushCamera.setPreviewDisplay(holder);

代码示例来源:origin: daniulive/SmarterStreaming

mCamera.setPreviewCallbackWithBuffer(this);
try {
  mCamera.setPreviewDisplay(holder);

代码示例来源:origin: robolectric/robolectric

@Test
public void testPreviewCallbacksWithBuffers() throws Exception {
 TestPreviewCallback callback = new TestPreviewCallback();
 assertThat(callback.camera).isNull();
 assertThat(callback.data).isNull();
 camera.setPreviewCallbackWithBuffer(callback);
 shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
 assertThat(callback.camera).isSameAs(camera);
 assertThat(callback.data).isEqualTo("foobar".getBytes(UTF_8));
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testClearPreviewCallback() throws Exception {
 TestPreviewCallback callback = new TestPreviewCallback();
 assertThat(callback.camera).isNull();
 assertThat(callback.data).isNull();
 camera.setPreviewCallback(callback);
 camera.setPreviewCallback(null);
 shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
 assertThat(callback.camera).isNull();
 assertThat(callback.data).isNull();
 camera.setOneShotPreviewCallback(callback);
 camera.setOneShotPreviewCallback(null);
 shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
 assertThat(callback.camera).isNull();
 assertThat(callback.data).isNull();
 camera.setPreviewCallbackWithBuffer(callback);
 camera.setPreviewCallbackWithBuffer(null);
 shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
 assertThat(callback.camera).isNull();
 assertThat(callback.data).isNull();
}

代码示例来源:origin: googlesamples/android-vision

camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback());
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));

代码示例来源:origin: googlesamples/android-vision

camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback());
camera.addCallbackBuffer(createPreviewBuffer(previewSize));
camera.addCallbackBuffer(createPreviewBuffer(previewSize));

代码示例来源:origin: googlesamples/android-vision

camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback());
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));
camera.addCallbackBuffer(createPreviewBuffer(mPreviewSize));

代码示例来源:origin: doggycoder/AndroidOpenGLDemo

public void setOnPreviewFrameCallbackWithBuffer(final AiyaCamera.PreviewFrameCallback callback) {
  if(mCamera!=null){
    Log.e("wuwang","Camera set CallbackWithBuffer");
    mCamera.setPreviewCallbackWithBuffer(new Camera.PreviewCallback() {
      @Override
      public void onPreviewFrame(byte[] data, Camera camera) {
        callback.onPreviewFrame(data,mPreSize.x,mPreSize.y);
      }
    });
  }
}

代码示例来源:origin: doggycoder/AndroidOpenGLDemo

public void setOnPreviewFrameCallbackWithBuffer(final PreviewFrameCallback callback) {
  if(mCamera!=null){
    Log.e("wuwang","Camera set CallbackWithBuffer");
    mCamera.setPreviewCallbackWithBuffer(new Camera.PreviewCallback() {
      @Override
      public void onPreviewFrame(byte[] data, Camera camera) {
        callback.onPreviewFrame(data,mPreSize.x,mPreSize.y);
      }
    });
  }
}

代码示例来源:origin: gqjjqg/android-extend

public boolean stopPreview() {
  mCamera.setPreviewCallbackWithBuffer(null);
  mCamera.stopPreview();
  return true;
}

代码示例来源:origin: jiangdongguo/OkCamera

private void stopPreview() {
  if (mCamera == null)
    return;
  try {
    mCamera.stopPreview();
    mCamera.setPreviewDisplay(null);
    mCamera.setPreviewCallbackWithBuffer(null);
  } catch (IOException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

public void stop() {
 if (camera != null) {
  camera.stopPreview();
  camera.setPreviewCallback(null);
  camera.setPreviewCallbackWithBuffer(null);
  camera.release();
  camera = null;
 }
 running = false;
}

代码示例来源:origin: Affectiva/android-sdk-samples

synchronized public void setPreviewCallbackWithBuffer(Camera.PreviewCallback callback) {
  checkTaken();
  camera.setPreviewCallbackWithBuffer(callback);
}

代码示例来源:origin: betri28/FaceDetectCamera

@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
  mCamera.setPreviewCallbackWithBuffer(null);
  mCamera.setErrorCallback(null);
  mCamera.release();
  mCamera = null;
}

代码示例来源:origin: betri28/FaceDetectCamera

@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
  mCamera.setPreviewCallbackWithBuffer(null);
  mCamera.setErrorCallback(null);
  mCamera.release();
  mCamera = null;
}

代码示例来源:origin: gqjjqg/android-extend

public boolean startPreview() {
  Size imageSize = mCamera.getParameters().getPreviewSize();
  int lineBytes = imageSize.width * ImageFormat.getBitsPerPixel(mCamera.getParameters().getPreviewFormat()) / 8;
  mCamera.setPreviewCallbackWithBuffer(this);
  mCamera.addCallbackBuffer(new byte[lineBytes * imageSize.height]);
  mCamera.addCallbackBuffer(new byte[lineBytes * imageSize.height]);
  mCamera.addCallbackBuffer(new byte[lineBytes * imageSize.height]);
  mCamera.startPreview();
  return true;
}

相关文章