Browse Source

重构拍照模块

main
jiangdongguo 7 years ago
parent
commit
8052feae08
  1. 4
      libusbcamera/src/main/java/com/jiangdg/usbcamera/UVCCameraHelper.java
  2. 9
      libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java
  3. 8
      libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandler.java
  4. 10
      libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandlerMultiSurface.java

4
libusbcamera/src/main/java/com/jiangdg/usbcamera/UVCCameraHelper.java

@ -214,9 +214,9 @@ public class UVCCameraHelper {
return mUSBMonitor.getDeviceList(deviceFilters.get(0)); return mUSBMonitor.getDeviceList(deviceFilters.get(0));
} }
public void capturePicture(String savePath) { public void capturePicture(String savePath,AbstractUVCCameraHandler.OnCaptureListener listener) {
if (mCameraHandler != null && mCameraHandler.isOpened()) { if (mCameraHandler != null && mCameraHandler.isOpened()) {
mCameraHandler.captureStill(savePath); mCameraHandler.captureStill(savePath,listener);
} }
} }

9
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) { public void captureStill(final String path,AbstractUVCCameraHandler.OnCaptureListener listener) {
// old method, to get screen size picture AbstractUVCCameraHandler.mCaptureListener = listener;
// AbstractUVCCameraHandler.mCaptureListener = listener; checkReleased();
// checkReleased(); sendMessage(obtainMessage(MSG_CAPTURE_STILL, path));
// sendMessage(obtainMessage(MSG_CAPTURE_STILL, path));
} }
// 开始录制 // 开始录制
@ -788,6 +787,7 @@ public abstract class AbstractUVCCameraHandler extends Handler {
} }
// 捕获图片 // 捕获图片
if(! TextUtils.isEmpty(picPath)) { if(! TextUtils.isEmpty(picPath)) {
picPath = null;
YUVBean bean = new YUVBean(); YUVBean bean = new YUVBean();
bean.setYuvData(yuv); bean.setYuvData(yuv);
bean.setPicPath(picPath); bean.setPicPath(picPath);
@ -799,7 +799,6 @@ public abstract class AbstractUVCCameraHandler extends Handler {
if(mCaptureListener != null) { if(mCaptureListener != null) {
mCaptureListener.onCaptureResult(savePath); mCaptureListener.onCaptureResult(savePath);
} }
picPath = null;
} }
}).execute(); }).execute();
} }

8
libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandler.java

@ -123,10 +123,10 @@ public class UVCCameraHandler extends AbstractUVCCameraHandler {
super.startPreview(surface); super.startPreview(surface);
} }
@Override // @Override
public void captureStill() { // public void captureStill() {
super.captureStill(); // super.captureStill();
} // }
@Override @Override
public void captureStill(final String path,OnCaptureListener listener) { public void captureStill(final String path,OnCaptureListener listener) {

10
libusbcamera/src/main/java/com/serenegiant/usb/common/UVCCameraHandlerMultiSurface.java

@ -156,11 +156,11 @@ public class UVCCameraHandlerMultiSurface extends AbstractUVCCameraHandler {
} }
} }
@Override // @Override
public void captureStill() { // public void captureStill() {
checkReleased(); // checkReleased();
super.captureStill(); // super.captureStill();
} // }
@Override @Override
public void captureStill(final String path,OnCaptureListener listener) { public void captureStill(final String path,OnCaptureListener listener) {

Loading…
Cancel
Save