package videogen import "context" // VideoBackgroundRemovalRequest asks a video-matting backend (Robust Video // Matting style) to separate the foreground subject from the background of a // clip. Zero values mean "backend default" (ADR-0025). type VideoBackgroundRemovalRequest struct { // Video is the encoded clip to matte. Required. Carried as bytes (never // a URL). Video []byte // MIME is the video MIME type (e.g. "video/mp4"); "" = let the backend // sniff it. MIME string // Filename is the multipart filename hint some backends key their format // detection on; "" derives one from MIME ("video.mp4") or falls back to // "video". Filename string // Output selects the delivery container: "greenscreen_mp4" (subject over // solid green, universally playable) or "alpha_webm" (true transparency, // VP9 alpha channel); "" = backend default. Output string } // VideoBackgroundRemovalOption mutates a VideoBackgroundRemovalRequest // before it is sent. type VideoBackgroundRemovalOption func(*VideoBackgroundRemovalRequest) // WithVideoBackgroundOutput selects the delivery container // ("greenscreen_mp4" or "alpha_webm"). func WithVideoBackgroundOutput(o string) VideoBackgroundRemovalOption { return func(r *VideoBackgroundRemovalRequest) { r.Output = o } } // Apply returns a copy of the request with all options applied. func (r VideoBackgroundRemovalRequest) Apply(opts ...VideoBackgroundRemovalOption) VideoBackgroundRemovalRequest { for _, opt := range opts { opt(&r) } return r } // VideoBackgroundRemover mattes the subject out of video clips — the moving- // picture sibling of imagegen.BackgroundRemover. type VideoBackgroundRemover interface { // RemoveVideoBackground returns the matted clip. Matting is slow // (per-frame inference); bound the call with a context deadline. RemoveVideoBackground(ctx context.Context, req VideoBackgroundRemovalRequest, opts ...VideoBackgroundRemovalOption) (*Result, error) } // VideoBackgroundRemoverModelOption configures a VideoBackgroundRemover at // construction time. Reserved for future per-model settings. type VideoBackgroundRemoverModelOption func(*VideoBackgroundRemoverModelConfig) // VideoBackgroundRemoverModelConfig carries per-model construction settings. type VideoBackgroundRemoverModelConfig struct{} // ApplyVideoBackgroundRemoverModelOptions folds options into a config. func ApplyVideoBackgroundRemoverModelOptions(opts []VideoBackgroundRemoverModelOption) VideoBackgroundRemoverModelConfig { var cfg VideoBackgroundRemoverModelConfig for _, opt := range opts { opt(&cfg) } return cfg } // VideoBackgroundRemovalProvider mints VideoBackgroundRemovers bound to one // backend. type VideoBackgroundRemovalProvider interface { // Name is the registry identifier for the provider. Name() string // VideoBackgroundRemoverModel returns a VideoBackgroundRemover bound to // the given id (passed through to the backend verbatim; no catalog // validation). VideoBackgroundRemoverModel(id string, opts ...VideoBackgroundRemoverModelOption) (VideoBackgroundRemover, error) }