Skip to content

Convert C macros to strongly-typed C# enums (MacroEnumPostProcessor) #341

@Ruslan-B

Description

@Ruslan-B

Problem

Many FFmpeg constants are defined as C macros (e.g. AV_CODEC_FLAG_*, SWS_*, AV_CH_*). These are generated as individual constants but not grouped into enums, making the API less discoverable and type-unsafe.

Solution

Add a MacroEnumPostProcessor that groups macros by prefix into C# enums:

  • AV_CODEC_FLAG_CodecFlags
  • AV_CODEC_FLAG2_CodecFlags2
  • SWS_SwsFlags (already exists but could be enriched)
  • AV_CH_ChannelFlags
  • AV_PIX_FMT_FLAG_PixFmtFlags
  • 48+ total mappings

Complexity: High

New processor class. Needs careful prefix matching, flag detection, type hints (int vs ulong). Breaking API change — constants become enum members.

Reference: SuRGeoNix/Flyleaf.FFmpeg.Generator MacroEnumPostProcessor.cs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions