JavaCvVideoTexture

class JavaCvVideoTexture(val mediaUrl: String, width: Int, height: Int) : CallbackVideoTexture, VideoPlayback

JVM video texture driven by JavaCV's high-level FFmpegFrameGrabber. A worker thread loops on grabImage(), copies the BGRA frame bytes out, and pushes them to the CallbackVideoTexture base for GL-thread upload.

Compared to the raw FFmpeg path (FFmpegVideoTexture), this is far shorter — the grabber handles demuxing, decoding, and pixel-format conversion. Tradeoff: less control over codec selection, hardware acceleration, and the exact pixel format.

Runtime requirement: FFmpeg natives via org.bytedeco:javacv-platform.

Pacing: the loop sleeps to roughly match the source frame rate. Without it, decode runs at I/O speed and most frames are dropped at the GL upload (which only refreshes once per render tick).

Constructors

Link copied to clipboard
constructor(mediaUrl: String, width: Int, height: Int)

Properties

Link copied to clipboard
Link copied to clipboard
val coordTransform: Matrix3
Link copied to clipboard

Caller opt-out for mipmap generation.

Link copied to clipboard
val height: Int
Link copied to clipboard

Filesystem path or URL to the media.

Link copied to clipboard
val target: Int
Link copied to clipboard
open override val timeMs: Long

Current playback time in milliseconds since playback started.

Link copied to clipboard
val width: Int

Functions

Link copied to clipboard
open override fun bindTexture(dc: DrawContext): Boolean
Link copied to clipboard
fun getTexParameter(name: Int): Int
Link copied to clipboard
fun getTextureName(dc: DrawContext): KglTexture
Link copied to clipboard
open override fun pause()

Pause playback. The current frame stays on the texture; resumable via play.

Link copied to clipboard
open override fun play()

Start (or resume) playback. Re-entrant — calling on an already-running player is a no-op.

Link copied to clipboard
open override fun release(dc: DrawContext)

Frees any resources associated with this instance. After this method returns the rendering resource is invalid, and any associated GL object is deleted.

open override fun release()

Free decoder + native resources. After release the texture is unusable.

Link copied to clipboard
fun setTexParameter(name: Int, param: Int)
Link copied to clipboard
open override fun stop()

Stop playback and rewind to the start.