fix: pair front camera analysis with a local drained preview surface
This commit is contained in:
@@ -1,4 +1,16 @@
|
||||
package android.graphics
|
||||
class SurfaceTexture(val texture: Int) {
|
||||
fun interface OnFrameAvailableListener {fun onFrameAvailable(surface: SurfaceTexture)}
|
||||
var released=false;var updates=0;var throwUpdate=false
|
||||
var width=0;var height=0
|
||||
private var listener: OnFrameAvailableListener?=null;private var handler: android.os.Handler?=null
|
||||
init {check(texture in android.opengl.GLES20.liveTextures)}
|
||||
fun setDefaultBufferSize(w: Int,h: Int) {width=w;height=h}
|
||||
fun setOnFrameAvailableListener(l: OnFrameAvailableListener?,h: android.os.Handler?=null) {listener=l;handler=h}
|
||||
fun frame() {val cb=listener ?: return;handler!!.post {cb.onFrameAvailable(this)}}
|
||||
fun updateTexImage() {check(!released);if(throwUpdate) error("synthetic_update_failure");updates++}
|
||||
fun release() {check(!released);released=true}
|
||||
}
|
||||
object ImageFormat {const val YUV_420_888=35}
|
||||
class Matrix {fun postRotate(f: Float) {}}
|
||||
class Rect(val left: Int,val top: Int,val right: Int,val bottom: Int) {fun width()=right-left;fun height()=bottom-top}
|
||||
|
||||
Reference in New Issue
Block a user