zt
08/02/2024, 12:49 AM// much shorter than actual, its like 100 entries long
public enum class AVPixelFormat(public val value: Int) {
AV_PIX_FMT_NONE(-1),
AV_PIX_FMT_YUV420P(0),
}
// then when I pass it to the native C function I pass the value field
It works but I don't really like it, especially cause kotlin enum would need every value assigned. in C it just adds to the previous value
Other idea is
// not typesafe but no need to have value field
object AVPixelFormat {
const val AV_PIX_FMT_NONE = -1
const val AV_PIX_FMT_YUV420P = 0
}
The other idea I had is
@JvmInline
public value class AVPixelFormat2(public val value: Int) {
public companion object {
public val AV_PIX_FMT_NONE: AVPixelFormat2 = AVPixelFormat2(-1)
public val AV_PIX_FMT_YUV420P: AVPixelFormat2 = AVPixelFormat2(0)
}
}
Is there something else that might be better for this kind of use? I wanna keep it typesafe and efficient