MediaBackend

interface MediaBackend

Everything needed to read and decode one media item, from one place.

A backend is asked to open a media item and answers with a BackendSession: the packet cursor plus the decoder factories that go with it. The engine never assembles those pieces itself, and that is the whole point of this interface.

The shape it replaces was a bag of independent factories. It could not build a generic session, because it had no audio decoder factory and no subtitle decoder factory, so the one working pipeline in the repository reached the decoders by downcasting the source to the FFmpeg implementation. A downcast in the engine is a backend the engine cannot replace.

Nothing is discovered. Kotlin/Native has no classpath service lookup, so there is no such thing as "the platform default found on the classpath": whoever creates the player passes a backend in, or the pipeline cannot be built and says so.

Functions

Link copied to clipboard

One line for the diagnostics dump: the backend's name and whatever configuration it carries that a bug report would want. The default is the class name; a backend that takes options overrides this to echo them, which is how its option pairs, as configured, reach the dump without the engine knowing any backend's shape.

Link copied to clipboard
abstract suspend fun open(media: MediaItem): BackendSession

Opens media and returns the session that reads and decodes it.

Link copied to clipboard

The parser for external subtitle FILES, or null when this backend brings none.