MCPcopy Create free account
hub / github.com/ctoth/claudio / Decoder

Interface Decoder

internal/audio/malgo/decoder.go:39–49  ·  view source on GitHub ↗

Decoder interface for audio format decoding. Decode takes a context.Context as its first argument so callers can cancel a long-running or stalled decode (e.g. an MP3 source whose underlying reader has hung). The MP3 decoder polls ctx between read chunks; WAV and AIFF check ctx at entry (they alread

Source from the content-addressed store, hash-verified

37// The interface is internal to package audio — there are no external
38// importers — so adding the parameter is safe.
39type Decoder interface {
40 // Decode reads audio data from reader and returns decoded PCM data.
41 // If ctx is cancelled, Decode returns ctx.Err().
42 Decode(ctx context.Context, reader io.Reader) (*AudioData, error)
43
44 // CanDecode checks if this decoder can handle the given filename
45 CanDecode(filename string) bool
46
47 // FormatName returns the name of the format this decoder handles
48 FormatName() string
49}

Implementers 4

Mp3Decoderinternal/audio/malgo/mp3_decoder.go
WavDecoderinternal/audio/malgo/wav_decoder.go
AiffDecoderinternal/audio/malgo/aiff_decoder.go
MockDecoderinternal/audio/malgo/decoder_test.go

Calls

no outgoing calls

Tested by

no test coverage detected