From 9b6607fc48b7d9a4fe5411a5f8171b369b468057 Mon Sep 17 00:00:00 2001 From: Dmitry Sergeev Date: Fri, 28 Aug 2026 23:11:20 +0300 Subject: [PATCH] define synchronized playback contracts --- internal/playback/sync.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 internal/playback/sync.go diff --git a/internal/playback/sync.go b/internal/playback/sync.go new file mode 100644 index 0000000..4d5a9fa --- /dev/null +++ b/internal/playback/sync.go @@ -0,0 +1,34 @@ +package playback + +import "context" + +// SyncFrame contains one video frame and its corresponding audio batch. +// +// Both payloads may borrow reader-owned memory and are valid only until the +// next ReadSync call or until the reader is closed. +type SyncFrame struct { + Video VideoFrame + Audio AudioFrame +} + +// SyncReader reads synchronized audio/video pairs. +// +// ReadSync must not be called again until both frame payloads have been +// consumed. +type SyncReader interface { + ReadSync(context.Context) (SyncFrame, error) + Close() error +} + +// SyncReaderFactory opens one synchronized reader for two configured feeds. +// +// Native MXL implementations may require the feeds to use the same domain. +// Future manual synchronization may support different domains behind another +// implementation of this interface. +type SyncReaderFactory interface { + OpenSync( + context.Context, + FeedConfig, + FeedConfig, + ) (SyncReader, error) +}