digest

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package digest is used to create mathematical hashes of VCS output. The two implementations of the Digest interface also implement the television.PixelRenderer and television.AudioMixer interfaces.

The digest.Video type is used to capture video output while digest.Audio is used to capture audio output.

The hashes produced by these types are used from regression tests and for verification of playback scripts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	*television.Television
	// contains filtered or unexported fields
}

Audio is an implementation of the television.AudioMixer interface with an embedded television for convenience. It periodically generates a SHA-1 value of the audio stream.

Note that the use of SHA-1 is fine for this application because this is not a cryptographic task.

func NewAudio

func NewAudio(tv *television.Television) (*Audio, error)

NewAudio is the preferred method of initialisation for the Audio2Wav type.

func (*Audio) EndMixing

func (dig *Audio) EndMixing() error

EndMixing implements the protocol.AudioMixer interface.

func (Audio) Hash

func (dig Audio) Hash() string

Hash implements digest.Digest interface.

func (*Audio) Reset added in v0.8.0

func (dig *Audio) Reset()

Reset implements the protocol.AudioMixer interface.

func (*Audio) ResetDigest

func (dig *Audio) ResetDigest()

ResetDigest implements digest.Digest interface.

func (*Audio) SetAudio

func (dig *Audio) SetAudio(sig []signal.SignalAttributes) error

SetAudio implements the protocol.AudioMixer interface.

type Digest

type Digest interface {
	Hash() string
	ResetDigest()
}

Digest implementations compute a mathematical hash, retreivable with the Hash() function.

type Video

type Video struct {
	*television.Television
	// contains filtered or unexported fields
}

Video is an implementation of the television.PixelRenderer interface with an embedded television for convenience. It generates a SHA-1 value of the image every frame. it does not display the image anywhere.

Note that the use of SHA-1 is fine for this application because this is not a cryptographic task.

func NewVideo

func NewVideo(tv *television.Television) (*Video, error)

NewVideo initialises a new instance of DigestTV. For convenience, the television argument can be nil, in which case an instance of StellaTelevision will be created.

func (*Video) EndRendering

func (dig *Video) EndRendering() error

EndRendering implements television.PixelRenderer interface.

func (Video) Hash

func (dig Video) Hash() string

Hash implements digest.Digest interface.

func (*Video) NewFrame

func (dig *Video) NewFrame(_ television.FrameInfo) error

NewFrame implements television.PixelRenderer interface.

func (*Video) NewScanline

func (dig *Video) NewScanline(scanline int) error

NewScanline implements television.PixelRenderer interface.

func (*Video) Reset added in v0.7.1

func (dig *Video) Reset()

Reset implements television.PixelRenderer interface.

func (*Video) ResetDigest

func (dig *Video) ResetDigest()

ResetDigest implements digest.Digest interface.

func (*Video) Resize

func (dig *Video) Resize(current television.FrameInfo) error

Resize implements television.PixelRenderer interface

In this implementation we only handle specification changes. This means the digest is immune from changes to the frame resizing method used by the television implementation. Changes to how the specification is flipped might cause comparison failures however.

func (*Video) SetPixels added in v0.12.1

func (dig *Video) SetPixels(sig []signal.SignalAttributes, current bool) error

SetPixels implements television.PixelRenderer interface.

Jump to

Keyboard shortcuts

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