chore: Move onFrame
into Callback on Android (#2458)
* Separate to onFrame * Restructure FP * Move lib loading into `CameraViewModule`
This commit is contained in:
@@ -14,6 +14,7 @@ import com.mrousavy.camera.core.CameraSession
|
||||
import com.mrousavy.camera.core.CodeScannerFrame
|
||||
import com.mrousavy.camera.core.PreviewView
|
||||
import com.mrousavy.camera.extensions.installHierarchyFitter
|
||||
import com.mrousavy.camera.frameprocessor.Frame
|
||||
import com.mrousavy.camera.frameprocessor.FrameProcessor
|
||||
import com.mrousavy.camera.types.CameraDeviceFormat
|
||||
import com.mrousavy.camera.types.CodeScannerOptions
|
||||
@@ -39,7 +40,7 @@ import kotlinx.coroutines.launch
|
||||
class CameraView(context: Context) :
|
||||
FrameLayout(context),
|
||||
CoroutineScope,
|
||||
CameraSession.CameraSessionCallback {
|
||||
CameraSession.Callback {
|
||||
companion object {
|
||||
const val TAG = "CameraView"
|
||||
}
|
||||
@@ -96,10 +97,6 @@ class CameraView(context: Context) :
|
||||
private var currentConfigureCall: Long = System.currentTimeMillis()
|
||||
|
||||
internal var frameProcessor: FrameProcessor? = null
|
||||
set(value) {
|
||||
field = value
|
||||
cameraSession.frameProcessor = frameProcessor
|
||||
}
|
||||
|
||||
override val coroutineContext: CoroutineContext = CameraQueues.cameraQueue.coroutineDispatcher
|
||||
|
||||
@@ -230,6 +227,10 @@ class CameraView(context: Context) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFrame(frame: Frame) {
|
||||
frameProcessor?.call(frame)
|
||||
}
|
||||
|
||||
override fun onError(error: Throwable) {
|
||||
invokeOnError(error)
|
||||
}
|
||||
|
Reference in New Issue
Block a user