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));
}
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);
}
}

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) {
// 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();
}

8
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) {

10
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) {

Loading…
Cancel
Save