1
0
mirror of https://github.com/coalaura/ffwebp.git synced 2025-09-09 06:19:55 +00:00

input-only codecs

This commit is contained in:
2025-08-11 03:15:29 +02:00
parent 8b224d7dbe
commit 881b3455cb
11 changed files with 46 additions and 1 deletions

View File

@@ -78,6 +78,10 @@ func Detect(output, override string) (Codec, error) {
return nil, fmt.Errorf("unsupported output codec: %q", override)
}
if !codec.CanEncode() {
return nil, fmt.Errorf("decode-only output codec: %q", override)
}
return codec, nil
}
@@ -93,6 +97,10 @@ func Detect(output, override string) (Codec, error) {
for _, codec := range codecs {
for _, alias := range codec.Extensions() {
if ext == strings.ToLower(alias) {
if !codec.CanEncode() {
return nil, fmt.Errorf("decode-only output codec: %q", override)
}
return codec, nil
}
}