如何获取Surface上渲染内容的字节流?我能够得到连续帧数和它的属性。我需要将字节流传递给我的库函数。
CameraCaptureSession.StateCallback cameraCaptureSessionStateCallback = new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(CameraCaptureSession session) {
try {
session.setRepeatingRequest(mRequestBuilder.build(), cameraCaptureSessionCallback, new Handler());
} catch (CameraAccessException e) {
Log.e("Camera Exception", e.getMessage());
}
}
@Override
public void onConfigureFailed(CameraCaptureSession session) {
}
};
private CameraCaptureSession.CaptureCallback cameraCaptureSessionCallback = new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureStarted(CameraCaptureSession session, CaptureRequest request, long timestamp, long frameNumber) {
super.onCaptureStarted(session, request, timestamp, frameNumber);
Log.d("FRAME",String.valueOf(timestamp)+" "+String.valueOf(frameNumber));
}
@Override
public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) {
super.onCaptureCompleted(session, request, result);
Integer iso = result.get(CaptureResult.SENSOR_SENSITIVITY);
long timeExposure = result.get(CaptureResult.SENSOR_EXPOSURE_TIME);
Log.d("FRAME",String.valueOf("ISO :"+iso)+" "+String.valueOf("EXPOSURE :"+timeExposure));
//byte [] yuvBytes =
faceRate.StoreFaceRating(yuvBytes, mSizes[2].getWidth(), mSizes[2].getHeight(), 270);
}
@Override
public void onCaptureFailed(CameraCaptureSession session, CaptureRequest request, CaptureFailure failure) {
super.onCaptureFailed(session, request, failure);
}
};