Expression options get their own type, and Expression arithmetic now produces
expressions FFmpeg evaluates correctly. Every package is republished because the
generated bindings changed in all of v5–v9.
Added
Exprtype for expression options (#1184). FFmpeg declares options such
asdrawbox'sx,y,width,heightandthicknessas plain strings,
so they were typedString. The codegen now scans FFmpeg's libavfilter
source for string options that are evaluated withav_expr_parse(directly,
through helper functions, or through token-pasting macros) and types those as
Expr: 156/158/175/175/175 parameters in v5/v6/v7/v8/v9.Expraccepts the
same values asString(str | int | float | Default | LazyValue | None),
so existing code keeps type-checking. Plain-text options such ascolorstay
String
Changed
- Numeric defaults in generated signatures are rendered unquoted, e.g.
x: Expr = Default(0)instead ofx: String = Default("0").Defaultis a
strsubclass, so the runtime value is unchanged, and defaults are still
omitted from the command line - The v5–v7 generated bindings are now formatted with ruff like v8 and v9
Fixed
-
Expressionoperators ignored FFmpeg's precedence rules. Composed
expressions are now parenthesised as needed:(Expression("iw") - "w") / 2gaveiw-w/2; it now gives(iw-w)/2iw / (ih * 2)gaveiw/ih*2; it now givesiw/(ih*2)2 * Expression("iw")gaveiwiw(string repetition); it now gives2*iw10 - Expression("iw")raisedTypeError; reflected operators now workx - (-3)gavex--3, which FFmpeg cannot parse; it now givesx-(-3)x % 5gavex%5, but FFmpeg has no%operator; it now gives
mod(x,5)
Expressions that were already correct, such as
iw+ih,-x,x^2and
function calls, produce the same output as before -
CI on
main: snapshots regenerated for syrupy 6 and vitest 5, the playground
jest-dom matchers typed for vitest, and the TypeScript workflow moved to
Node 22 after npm 10.8 crashed resolving workspace peers