diff --git a/compose-app/src/androidMain/kotlin/platform/Camera.android.kt b/compose-app/src/androidMain/kotlin/platform/Camera.android.kt index 02fe0f0..f0698d3 100644 --- a/compose-app/src/androidMain/kotlin/platform/Camera.android.kt +++ b/compose-app/src/androidMain/kotlin/platform/Camera.android.kt @@ -20,7 +20,7 @@ package xyz.xfqlittlefan.fhraise.platform import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job -import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.SharedFlow actual class Camera { actual companion object { @@ -43,7 +43,7 @@ actual class Camera { actual var streamingJob: Job? get() = TODO("Not yet implemented") set(value) {} - actual val frameFlow: StateFlow + actual val frameFlow: SharedFlow get() = TODO("Not yet implemented") actual suspend fun open() { diff --git a/compose-app/src/commonMain/kotlin/platform/Camera.kt b/compose-app/src/commonMain/kotlin/platform/Camera.kt index efbb76c..75b2f9a 100644 --- a/compose-app/src/commonMain/kotlin/platform/Camera.kt +++ b/compose-app/src/commonMain/kotlin/platform/Camera.kt @@ -57,7 +57,29 @@ data class CameraImage( val width: Int, val height: Int, val content: ByteArray, -) +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as CameraImage + + if (format != other.format) return false + if (width != other.width) return false + if (height != other.height) return false + if (!content.contentEquals(other.content)) return false + + return true + } + + override fun hashCode(): Int { + var result = format.hashCode() + result = 31 * result + width + result = 31 * result + height + result = 31 * result + content.contentHashCode() + return result + } +} enum class FrameFormat { AndroidRgba8888, Rgb, Bgr, RgbInt, ArgbInt diff --git a/compose-app/src/wasmJsMain/kotlin/platform/Camera.wasmJs.kt b/compose-app/src/wasmJsMain/kotlin/platform/Camera.wasmJs.kt index 02fe0f0..f0698d3 100644 --- a/compose-app/src/wasmJsMain/kotlin/platform/Camera.wasmJs.kt +++ b/compose-app/src/wasmJsMain/kotlin/platform/Camera.wasmJs.kt @@ -20,7 +20,7 @@ package xyz.xfqlittlefan.fhraise.platform import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job -import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.SharedFlow actual class Camera { actual companion object { @@ -43,7 +43,7 @@ actual class Camera { actual var streamingJob: Job? get() = TODO("Not yet implemented") set(value) {} - actual val frameFlow: StateFlow + actual val frameFlow: SharedFlow get() = TODO("Not yet implemented") actual suspend fun open() {