Expose common bitstream inspection and actual format checks to Android

This commit is contained in:
evgeny committed 2026-10-14 23:10:12 +02:00
1 parent 68e5905d9e
commit 5e15fc0d3f
2 files changed
+29 -6

No files matched your search

@@ -2,6 +2,7 @@ package com.utun.chat.data
/** Тот же C port, что у desktop: один TX mailbox, ограниченный RX, идентификатор звонка в каждой операции. */
internal object CallVideoNative {
init { System.loadLibrary("utun") }
external fun open(id: Long, caps: ByteArray): Boolean
external fun close(id: Long)
external fun peer(id: Long): ByteArray?
@@ -13,12 +14,14 @@ internal object CallVideoNative {
external fun pull(id: Long, meta: LongArray): ByteArray?
external fun requestKey(id: Long)
external fun range(id: Long, minimum: Int, maximum: Int): Boolean
external fun inspect(codec: Int, bytes: ByteArray): LongArray?
external fun supported(local: ByteArray, peer: ByteArray, format: LongArray): Boolean
}
internal data class CallVideoFormat(val generation: Long, val width: Int, val height: Int, val fps: Int = 30,
val rotation: Int = 0, val codec: Int = 0, val level: Int = 0, val maximum: Int = 4_000_000, val vbv: Int = 1_000_000) {
val rotation: Int = 0, val codec: Int = 0, val level: Int = 0, val maximum: Int = 4_000_000, val profile: Int = 0) {
fun array() = longArrayOf(generation, width.toLong(), height.toLong(), fps.toLong(), rotation.toLong(), codec.toLong(),
level.toLong(), maximum.toLong(), vbv.toLong())
level.toLong(), maximum.toLong(), profile.toLong())
companion object {
fun from(a: LongArray) = CallVideoFormat(a[0], a[1].toInt(), a[2].toInt(), a[3].toInt(), a[4].toInt(),
a[5].toInt(), a[6].toInt(), a[7].toInt(), a[8].toInt())