Files
go-mxl-player/internal/playback/video.go
T
Dmitry Sergeev a8d277ee3d stats window
2026-09-01 22:59:09 +03:00

44 lines
1.2 KiB
Go

package playback
import "context"
// VideoFrame contains metadata and borrowed source payload.
//
// Payload is valid only until the next VideoReader.ReadVideo call or until the
// reader is closed. Consumers must finish reading Payload before returning
// control to the worker
type VideoFrame struct {
Index uint64
Width uint32
Height uint32
Stride uint32
Size uint32
Invalid bool
Label string
FrameRateNumerator int64
FrameRateDenominator int64
Payload []byte
}
// VideoReader reads frames from a video source.
//
// ReadVideo must not be called again until the previous frame's payload has
// been consumed.
type VideoReader interface {
ReadVideo(context.Context) (VideoFrame, error)
Close() error
}
// VideoReaderFactory opens a reader for the configured video feed.
type VideoReaderFactory interface {
OpenVideo(context.Context, FeedConfig) (VideoReader, error)
}
// VideoSink consumes a borrowed video frame.
//
// ConsumeVideo must finish using frame.Payload before returning and must never
// retain it for asynchronous use.
type VideoSink interface {
ConsumeVideo(context.Context, VideoFrame) error
}