forked from saki4510t/UVCCamera
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85fc35a
commit 19f6ef0
Showing
9 changed files
with
304 additions
and
2 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...id/src/main/java/org/uvccamera/flutter/UvcCameraDevicePermissionRequestResultHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
flutter/android/src/main/java/org/uvccamera/flutter/UvcCameraTakePictureFrameCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.uvccamera.flutter; | ||
|
||
import android.util.Log; | ||
|
||
import com.serenegiant.usb.IFrameCallback; | ||
|
||
import java.io.File; | ||
import java.nio.ByteBuffer; | ||
|
||
/* package-private */ class UvcCameraTakePictureFrameCallback implements IFrameCallback { | ||
|
||
/** | ||
* Log tag | ||
*/ | ||
private static final String TAG = UvcCameraTakePictureFrameCallback.class.getCanonicalName(); | ||
|
||
/** | ||
* The UVC camera platform | ||
*/ | ||
private final UvcCameraPlatform uvcCameraPlatform; | ||
|
||
/** | ||
* The camera ID | ||
*/ | ||
private final int cameraId; | ||
|
||
/** | ||
* Output file to which the picture is saved. | ||
*/ | ||
private final File outputFile; | ||
|
||
/** | ||
* The result handler | ||
*/ | ||
private final UvcCameraTakePictureResultHandler resultHandler; | ||
|
||
/** | ||
* Creates a new instance of {@link UvcCameraTakePictureFrameCallback}. | ||
* | ||
* @param uvcCameraPlatform the UVC camera platform | ||
* @param cameraId the camera ID | ||
* @param outputFile the output file | ||
* @param resultHandler the result handler | ||
*/ | ||
public UvcCameraTakePictureFrameCallback( | ||
final UvcCameraPlatform uvcCameraPlatform, | ||
final int cameraId, | ||
final File outputFile, | ||
final UvcCameraTakePictureResultHandler resultHandler | ||
) { | ||
this.uvcCameraPlatform = uvcCameraPlatform; | ||
this.cameraId = cameraId; | ||
this.outputFile = outputFile; | ||
this.resultHandler = resultHandler; | ||
} | ||
|
||
@Override | ||
public void onFrame(ByteBuffer frame) { | ||
Log.v(TAG, "onFrame" | ||
+ ": frame=" + frame | ||
); | ||
|
||
uvcCameraPlatform.handleTakenPicture(cameraId, outputFile, frame, resultHandler); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
flutter/android/src/main/java/org/uvccamera/flutter/UvcCameraTakePictureResultHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.uvccamera.flutter; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* Handler to be notified when the take-picture result is available. | ||
*/ | ||
@FunctionalInterface | ||
/* package-private */ interface UvcCameraTakePictureResultHandler { | ||
|
||
/** | ||
* Called when the take-picture result is available | ||
* | ||
* @param outputFile the output file to which the picture is saved | ||
* or null if the picture could not be taken | ||
* @param error the error that occurred while taking the picture | ||
*/ | ||
void onResult(File outputFile, Exception error); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters