本文整理汇总了Java中android.hardware.camera2.CaptureRequest.getTag方法的典型用法代码示例。如果您正苦于以下问题:Java CaptureRequest.getTag方法的具体用法?Java CaptureRequest.getTag怎么用?Java CaptureRequest.getTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.hardware.camera2.CaptureRequest
的用法示例。
在下文中一共展示了CaptureRequest.getTag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCaptureCompleted
import android.hardware.camera2.CaptureRequest; //导入方法依赖的package包/类
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
if(request.getTag() == ("FOCUS_TAG")) {
//The focus trigger is complete!
//Resume repeating request, clear AF trigger.
mAutoFocusCallback.onAutoFocus(true);
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, null);
mPreviewRequestBuilder.setTag("");
mPreviewRequest = mPreviewRequestBuilder.build();
try {
mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);
} catch(CameraAccessException ex) {
Log.d(TAG, "AUTO FOCUS FAILURE: "+ex);
}
} else {
process(result);
}
}
示例2: onCaptureStarted
import android.hardware.camera2.CaptureRequest; //导入方法依赖的package包/类
@Override
public void onCaptureStarted(CameraCaptureSession session, CaptureRequest request,
long timestamp, long frameNumber) {
String currentDateTime = Utils.generateTimestamp();
File rawFile = new File(Environment.
getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),
"RAW_" + currentDateTime + ".dng");
File jpegFile = new File(Environment.
getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),
"JPEG_" + currentDateTime + ".jpg");
// Look up the ImageSaverBuilder for this request and update it with the file name
// based on the capture start time.
ImageSaver.ImageSaverBuilder jpegBuilder;
ImageSaver.ImageSaverBuilder rawBuilder;
int requestId = (int) request.getTag();
synchronized (mCameraStateLock) {
jpegBuilder = mJpegResultQueue.get(requestId);
rawBuilder = mRawResultQueue.get(requestId);
}
if (jpegBuilder != null) jpegBuilder.setFile(jpegFile);
if (rawBuilder != null) rawBuilder.setFile(rawFile);
}
示例3: onCaptureFailed
import android.hardware.camera2.CaptureRequest; //导入方法依赖的package包/类
@Override
public void onCaptureFailed(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull CaptureFailure failure) {
if(request.getTag() == "FOCUS_TAG") {
Log.d(TAG, "Manual AF failure: "+failure);
mAutoFocusCallback.onAutoFocus(false);
}
}
示例4: onCaptureCompleted
import android.hardware.camera2.CaptureRequest; //导入方法依赖的package包/类
@Override
public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request,
TotalCaptureResult result) {
int requestId = (int) request.getTag();
ImageSaver.ImageSaverBuilder jpegBuilder;
ImageSaver.ImageSaverBuilder rawBuilder;
StringBuilder sb = new StringBuilder();
// Look up the ImageSaverBuilder for this request and update it with the CaptureResult
synchronized (mCameraStateLock) {
jpegBuilder = mJpegResultQueue.get(requestId);
rawBuilder = mRawResultQueue.get(requestId);
if (jpegBuilder != null) {
jpegBuilder.setResult(result);
sb.append("Saving JPEG as: ");
sb.append(jpegBuilder.getSaveLocation());
}
if (rawBuilder != null) {
rawBuilder.setResult(result);
if (jpegBuilder != null) sb.append(", ");
sb.append("Saving RAW as: ");
sb.append(rawBuilder.getSaveLocation());
}
// If we have all the results necessary, save the image to a file in the background.
handleCompletionLocked(requestId, jpegBuilder, mJpegResultQueue);
handleCompletionLocked(requestId, rawBuilder, mRawResultQueue);
finishedCaptureLocked();
}
showToast(sb.toString());
}
示例5: onCaptureFailed
import android.hardware.camera2.CaptureRequest; //导入方法依赖的package包/类
@Override
public void onCaptureFailed(CameraCaptureSession session, CaptureRequest request,
CaptureFailure failure) {
int requestId = (int) request.getTag();
synchronized (mCameraStateLock) {
mJpegResultQueue.remove(requestId);
mRawResultQueue.remove(requestId);
finishedCaptureLocked();
}
showToast("Capture failed!");
}