ffmpegtest

package
v0.10.0-dev.64 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package ffmpegtest lets a test binary stand in for ffmpeg and ffprobe. A TestMain calling Main acts as the child env names when it is set; Path is the binary a test's Runner runs, and OnPath puts it on PATH.

Index

Constants

View Source
const FloodBytes = 1 << 30

FloodBytes is how much "stderr-flood" writes to stderr.

Variables

This section is empty.

Functions

func Calls

func Calls(t testing.TB) func(call Call) int

Calls records every child t starts from now on and returns a count of those making call.

func FloodAt

func FloodAt(i int64) byte

FloodAt is the byte "stderr-flood" writes at offset i, so a test can rebuild any part of the stream.

func FromVideoCalls

func FromVideoCalls(dir string, call Call) (int, error)

FromVideoCalls counts the calls of kind call that "from-video" logged in dir.

func Main

func Main(m *testing.M)

Main runs the tests, or acts as the child when Use or UseFor set a behaviour: its call's, else the one for every call.

func OnPath

func OnPath(t testing.TB, names ...string)

OnPath sets PATH to a directory holding this test binary under each of names ("ffmpeg", "ffprobe") and nothing else, for code running a zero Runner; with no names, no binary resolves.

func Path

func Path() string

Path is the binary to run as ffmpeg and ffprobe: this test binary.

func Use

func Use(t testing.TB, b string)

Use makes the children t starts act as b, a behaviours entry. A child given a file: argument other than the runner's fd 3 exits 2.

func UseFor

func UseFor(t testing.TB, call Call, b string)

UseFor makes the children t starts for call act as b, whatever Use set.

func UseSpeech

func UseSpeech(t testing.TB, spans []subsync.Span, durationMs int64)

UseSpeech makes the PCM children t starts answer WriteSpeech's audio.

func WriteSpeech

func WriteSpeech(path string, spans []subsync.Span, durationMs int64) error

WriteSpeech writes 8 kHz s16le audio of durationMs to path: a voiced sound over spans, sorted by start, and faint noise elsewhere, which the voice detector tells apart.

Types

type Call

type Call string

Call is one kind of runner call, told apart by its arguments.

const (
	Probe   Call = "probe"
	Extract Call = "extract"
	PCM     Call = "pcm"
	Preview Call = "preview"
)

The calls a Runner makes.

Jump to

Keyboard shortcuts

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