testcard

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testcard implements a default gomedia/schema.Source: a generated sine wave tone, suitable as a fallback for a live encoding job when no other source is available. Video (a picture test card) is not implemented yet — only the audio tone.

Index

Constants

View Source
const (
	DefaultFrequency = 1000.0 // 1kHz tone
	DefaultVolume    = -20.0  // dB, a conservative default level

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(*TestCard) error

Opt configures optional TestCard parameters.

func WithFrequency

func WithFrequency(hz float64) Opt

WithFrequency sets the tone's frequency in Hz. Default is 1kHz.

func WithVolume

func WithVolume(db float64) Opt

WithVolume sets the tone's volume in decibels. Default is -20dB.

type TestCard

type TestCard struct {
	// contains filtered or unexported fields
}

TestCard is a Source that generates a mono sine wave tone. It does not pace itself to real time — NextFrame returns as soon as the next chunk is generated. Pacing is the caller's job: it's dictated by the destination (a live streaming job wants real-time pacing, a batch re-encode doesn't), not something a source should assume.

func New

func New(audio *profile.AudioProfile, opts ...Opt) (*TestCard, error)

New creates a test card source generating a sine wave tone shaped by the given audio profile's sample rate, sample format and channel layout. Only mono, float32 profiles are supported for now (e.g. a profile.AudioProfile for "pcm_f32le" with channel_layout "mono").

func (*TestCard) Close

func (t *TestCard) Close() error

Close releases the test card's frame.

func (*TestCard) NextFrame

func (t *TestCard) NextFrame(ctx context.Context) (frame.Frame, error)

NextFrame generates the next chunk of sine wave and returns immediately — it does not pace itself to real time. A caller that wants real-time delivery (e.g. a live streaming job) is responsible for its own pacing based on the returned frame's Pts/SampleRate.

func (*TestCard) Streams

func (t *TestCard) Streams() []profile.Profile

Streams returns the single mono audio stream this test card provides.

Jump to

Keyboard shortcuts

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