render

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package render probes FFmpeg DVD menu capability and decodes exact-coordinate menu background frames selected by the pure-Go engine.

Index

Constants

View Source
const (
	// MaxDiagnosticBytes bounds retained FFmpeg diagnostic output.
	MaxDiagnosticBytes = 64 << 10
	// MaxFrameBytes bounds retained lossless frame output.
	MaxFrameBytes = 64 << 20
	// MaxFrameWidth is the largest accepted decoded frame width.
	MaxFrameWidth = 4096
	// MaxFrameHeight is the largest accepted decoded frame height.
	MaxFrameHeight = 4096
	// MaxFramePixels bounds decoded frame allocation.
	MaxFramePixels = 16 << 20
)

Variables

View Source
var (
	// ErrCapability identifies missing or unusable FFmpeg dvdvideo support.
	ErrCapability = errors.New("FFmpeg lacks required DVD menu capability")
	// ErrFrame identifies invalid requests or failed DVD menu frame decoding.
	ErrFrame = errors.New("FFmpeg DVD menu frame decode failed")
)

Functions

func BuildArgs

func BuildArgs(request FrameRequest) ([]string, error)

BuildArgs returns FFmpeg arguments with every dvdvideo input option before -i and no shell-built command string.

func DecodeFrame

func DecodeFrame(ctx context.Context, runner Runner, executable string, request FrameRequest) (image.Image, error)

DecodeFrame invokes FFmpeg and decodes one lossless background image.

Types

type Capability

type Capability struct {
	// Available reports that the dvdvideo demuxer and all required options were found.
	Available bool
	// Version is a bounded first line from FFmpeg's version output.
	Version string
	// Options contains the required dvdvideo options observed by the probe.
	Options []string
}

Capability is safe engine diagnostic metadata without local paths.

func Probe

func Probe(ctx context.Context, runner Runner, executable string) (Capability, error)

Probe verifies the dvdvideo demuxer and every exact-coordinate menu option.

type ExecRunner

type ExecRunner struct{}

ExecRunner is the production os/exec implementation.

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, executable string, args []string, stdoutLimit int) (Output, error)

Run resolves executable on PATH, invokes it without a shell, and retains bounded stdout and stderr. Context cancellation terminates the child process.

type FrameRequest

type FrameRequest struct {
	// SourcePath is the host filesystem path of the extracted VIDEO_TS directory.
	SourcePath string
	// VTS selects zero for the manager domain or 1 through 99 for a title set.
	VTS int
	// LanguageUnit is the one-based FFmpeg dvdvideo language-unit index.
	LanguageUnit int
	// PGC is the one-based menu program-chain index.
	PGC int
	// Program is the one-based program index within PGC.
	Program int
	// Target is the non-negative seek offset within the selected program.
	Target time.Duration
	// Deinterlace enables FFmpeg's bwdif filter before frame extraction.
	Deinterlace bool
}

FrameRequest contains inventory-validated FFmpeg dvdvideo coordinates.

type Output

type Output struct {
	// Stdout contains retained output up to the requested limit.
	Stdout []byte
	// Stderr contains retained diagnostics up to MaxDiagnosticBytes.
	Stderr []byte
}

Output is bounded command output.

type Runner

type Runner interface {
	// Run invokes executable directly with discrete args and bounded output.
	Run(ctx context.Context, executable string, args []string, stdoutLimit int) (Output, error)
}

Runner executes FFmpeg without shell interpolation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL