diff --git a/libusbcamera/src/main/java/com/jiangdg/usbcamera/UVCCameraHelper.java b/libusbcamera/src/main/java/com/jiangdg/usbcamera/UVCCameraHelper.java index 314101e..8ed2578 100644 --- a/libusbcamera/src/main/java/com/jiangdg/usbcamera/UVCCameraHelper.java +++ b/libusbcamera/src/main/java/com/jiangdg/usbcamera/UVCCameraHelper.java @@ -214,9 +214,9 @@ public class UVCCameraHelper { return mUSBMonitor.getDeviceList(deviceFilters.get(0)); } - public void capturePicture(String savePath) { + public void capturePicture(String savePath,AbstractUVCCameraHandler.OnCaptureListener listener) { if (mCameraHandler != null && mCameraHandler.isOpened()) { - mCameraHandler.captureStill(savePath); + mCameraHandler.captureStill(savePath,listener); } } diff --git a/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java b/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java index c3f44fe..3daef2f 100644 --- a/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java +++ b/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java @@ -217,10 +217,9 @@ public abstract class AbstractUVCCameraHandler extends Handler { } public void captureStill(final String path,AbstractUVCCameraHandler.OnCaptureListener listener) { - // old method, to get screen size picture -// AbstractUVCCameraHandler.mCaptureListener = listener; -// checkReleased(); -// sendMessage(obtainMessage(MSG_CAPTURE_STILL, path)); + AbstractUVCCameraHandler.mCaptureListener = listener; + checkReleased(); + sendMessage(obtainMessage(MSG_CAPTURE_STILL, path)); } // 开始录制 @@ -788,6 +787,7 @@ public abstract class AbstractUVCCameraHandler extends Handler { } // 捕获图片 if(! TextUtils.isEmpty(picPath)) { + picPath = null; YUVBean bean = new YUVBean(); bean.setYuvData(yuv); bean.setPicPath(picPath); @@ -799,7 +799,6 @@ public abstract class AbstractUVCCameraHandler extends Handler { if(mCaptureListener != null) { mCaptureListener.onCaptureResult(savePath); } - picPath = null; } }).execute(); } diff --git a/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandler.java b/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandler.java index 22130f8..2d01f1c 100644 --- a/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandler.java +++ b/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandler.java @@ -123,10 +123,10 @@ public class UVCCameraHandler extends AbstractUVCCameraHandler { super.startPreview(surface); } - @Override - public void captureStill() { - super.captureStill(); - } +// @Override +// public void captureStill() { +// super.captureStill(); +// } @Override public void captureStill(final String path,OnCaptureListener listener) { diff --git a/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandlerMultiSurface.java b/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandlerMultiSurface.java index c50daf0..b85aaa0 100644 --- a/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandlerMultiSurface.java +++ b/libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandlerMultiSurface.java @@ -156,11 +156,11 @@ public class UVCCameraHandlerMultiSurface extends AbstractUVCCameraHandler { } } - @Override - public void captureStill() { - checkReleased(); - super.captureStill(); - } +// @Override +// public void captureStill() { +// checkReleased(); +// super.captureStill(); +// } @Override public void captureStill(final String path,OnCaptureListener listener) {