本文整理匯總了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!");
}