Skip to content

Add Property Observation (Flow), Primitive Overloads, and VideoSurface Lifecycle Controls #4

@BitFable

Description

@BitFable

While this exposes events to the Mpv class

private val _events = MutableSharedFlow<Event>(extraBufferCapacity = 4)
val events = _events.asSharedFlow()

There is no way to register a property to be observed. So bindings for mpv_observe_property and mpv_unobserve_property needs to be added.

Also getProperty and setProperty are hardcoded to wrap everything inside a heavy Format.Node. Which is fine for properties you call only a few times but if observeProperty gets added then these are polled at a very high rate and can cause performance issues from marshalling full Node structs at 60 fps. So some functions should bypass Node entirely and return simple primitive overloads.

fun observePropertyDouble(name: String): Result<Double>
fun observePropertyLong(name: String): Result<Long>
fun observetPropertyBoolean(name: String): Result<Boolean>

attachSurface() and detachSurface() for VideoSurface since I've seen mpv get detached from that composable after some form of recomposition.

For heavy initiations steps in compose they should be done in a remember block since recompositions on those cause a lot of lag. Like rememberRenderer() and then you pass the renderer to the VideoSurface along with Mpv.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions