image_ffmpeg_decode_image_rgba function

  1. @Native<Int32 Function(Pointer<Uint8>, Uint32, Uint32, Uint32, Pointer<image_ffmpeg_image>)>(ffi.Pointer<ffi.Uint8>, ffi.Uint32, ffi.Uint32, ffi.Uint32, ffi.Pointer<image_ffmpeg_image>)>()
int image_ffmpeg_decode_image_rgba(
  1. Pointer<Uint8> input,
  2. int input_length,
  3. int max_width,
  4. int max_height,
  5. Pointer<image_ffmpeg_image> output,
)

Probes arbitrary encoded bytes as an image, decodes the first frame, and returns tightly packed RGBA8888. A zero maximum preserves that axis. If both maxima are non-zero, aspect ratio is preserved and the image fits within the requested box without upscaling.

This coarse operation is intentional: one boundary crossing owns probing, decode, scale, pixel conversion, and allocation on native and WebAssembly.

Implementation

@ffi.Native<
  ffi.Int32 Function(
    ffi.Pointer<ffi.Uint8>,
    ffi.Uint32,
    ffi.Uint32,
    ffi.Uint32,
    ffi.Pointer<image_ffmpeg_image>,
  )
>()
external int image_ffmpeg_decode_image_rgba(
  ffi.Pointer<ffi.Uint8> input,
  int input_length,
  int max_width,
  int max_height,
  ffi.Pointer<image_ffmpeg_image> output,
);