We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@OverRide public void onDeviceOpen(UsbDevice device, UsbControlBlock ctrlBlock, boolean createNew) { executor.execute(() -> { try {
uvcCamera = new UVCCamera(null); List<Size> supportedSizes = uvcCamera.getSupportedSizeList(); for (Size size : supportedSizes) { Log.d(TAG, "Supported size: " + size.width + "x" + size.height); } int result = uvcCamera.open(ctrlBlock); if (result == 0) { Log.d(TAG, "UVC camera opened successfully."); } else { Log.e(TAG, "Failed to open UVC camera. Error code: " + result); return; } uvcCamera.setPreviewSize(previewWidth, previewHeight, UVCCamera.UVC_VS_FORMAT_MJPEG); uvcCamera.setPreviewDisplay(svVideoRender.getHolder()); uvcCamera.startPreview(); uvcCamera.setFrameCallback(frame -> { try { byte[] mjpegData = frame.array(); Bitmap bitmap = BitmapFactory.decodeByteArray(mjpegData, 0, mjpegData.length); byte[] nv21Data = convertBitmapToNV21(bitmap, previewWidth, previewHeight); NV21Buffer nv21Buffer = new NV21Buffer(nv21Data, previewWidth, previewHeight, null); VideoFrame videoFrame = new VideoFrame(nv21Buffer, 0, System.nanoTime()); capturerObserver.onFrameCaptured(videoFrame); nv21Buffer.release(); } catch (Exception e) { Log.e(TAG, "Failed to process MJPEG frame: " + e.getMessage()); } }, UVCCamera.UVC_VS_FORMAT_MJPEG); Log.d(TAG, "UVC camera started successfully."); } catch (Exception e) { Log.e(TAG, "Failed to start UVC camera: " + e.getMessage()); } }); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
@OverRide
public void onDeviceOpen(UsbDevice device, UsbControlBlock ctrlBlock, boolean createNew) {
executor.execute(() -> {
try {
The text was updated successfully, but these errors were encountered: