Rearchitected transcoding to treat codecs and encoders as separate concepts.
ActivityPub Tests / federation-test (push) Failing after 4s
ActivityPub Tests / chat-sanitization-test (push) Failing after 3s
ActivityPub Tests / follower-validation-test (push) Failing after 4s
Extract Default Translations / extract-and-commit (push) Successful in 4m21s
Automated API tests / test (push) Has been cancelled
Browser Tests / cypress-run (push) Has been cancelled
Chromatic / chromatic-deployment (push) Has been cancelled
CSS Lint and Formatting / css-lint (push) Has been cancelled
javascript-packages / Generate API Documentation (push) Has been cancelled
Lint / Go linter (push) Has been cancelled
Go Tests / test (push) Has been cancelled
Go Tests / test-bsds (map[name:freebsd version:12.2]) (push) Has been cancelled
Go Tests / test-bsds (map[name:openbsd version:6.8]) (push) Has been cancelled
HLS tests / tests (push) Has been cancelled

This commit is contained in:
2026-04-04 14:11:49 -04:00
parent e699bef636
commit 50e14adac2
33 changed files with 1239 additions and 696 deletions
+42
View File
@@ -0,0 +1,42 @@
package transcoder
const audioCodecAAC = "aac"
// aacFFmpegEncoder happens to match audioCodecAAC, but represents the ffmpeg
// encoder name, which could be "libfdk_aac" or another AAC encoder instead.
const aacFFmpegEncoder = "aac"
// AudioCodec represents an audio compression format (e.g., AAC, Opus).
type AudioCodec interface {
Name() string
DisplayName() string
FFmpegEncoderName() string
}
// AACCodec implements AudioCodec for AAC audio.
type AACCodec struct{}
func (c *AACCodec) Name() string {
return audioCodecAAC
}
func (c *AACCodec) DisplayName() string {
return "AAC"
}
// FFmpegEncoderName returns the ffmpeg encoder to use. We use the built-in
// "aac" encoder rather than "libfdk_aac" since it is universally available.
func (c *AACCodec) FFmpegEncoderName() string {
return aacFFmpegEncoder
}
var audioCodecRegistry = map[string]AudioCodec{
audioCodecAAC: &AACCodec{},
}
func getAudioCodec(name string) AudioCodec {
if codec, ok := audioCodecRegistry[name]; ok {
return codec
}
return &AACCodec{}
}