import type { AVPixelFormat, AVSampleFormat, FilterOptionsMap } from '../constants/index.js';
import type { HardwareContext } from './hardware.js';
/**
 * Hardware filter capabilities for different platforms.
 * Maps hardware types to their supported filter operations.
 * Each capability indicates whether a specific filter operation is supported
 * by the hardware acceleration type.
 *
 * Support varies significantly between hardware types:
 * - CUDA: Comprehensive filter support with custom kernels
 * - VAAPI: Good Linux support with Intel/AMD GPUs
 * - QSV: Intel Quick Sync with basic filtering
 * - VideoToolbox: macOS/iOS with CoreImage filters
 * - Vulkan: Cross-platform with growing filter support
 * - OpenCL: Cross-platform compute-based filtering
 */
export interface FilterSupport {
    scale: boolean;
    overlay: boolean;
    transpose: boolean;
    tonemap: boolean;
    deinterlace: boolean;
    denoise: boolean;
    flip: boolean;
    blur: boolean;
    sharpen: boolean;
    sobel: boolean;
    chromakey: boolean;
    colorspace: boolean;
    pad: boolean;
    stack: boolean;
}
/**
 * Filter preset builder for composing filter chains.
 * Supports both software and hardware-accelerated filters.
 * Automatically selects appropriate filter implementations based on hardware context.
 * Uses fluent interface pattern for chaining multiple filters.
 *
 * @example
 * ```typescript
 * // Software filter chain
 * const filter = FilterPreset.chain()
 *   .scale(1920, 1080)
 *   .filter('fps', { fps: 30 })
 *   .filter('fade', { type: 'in', start_time: 0, duration: 2 })
 *   .build();
 *
 * // Hardware-accelerated filter chain
 * const hw = HardwareContext.auto();
 * const hwFilter = FilterPreset.chain(hw)
 *   .scale(1920, 1080)
 *   .blur('gaussian', 5)
 *   .build();
 * ```
 */
export declare class FilterPreset {
    private hardware?;
    private filters;
    private support;
    private constructor();
    /**
     * Checks if a filter is hardware-accelerated.
     *
     * @param filterName - Name of the filter to check
     *
     * @returns True if the filter uses hardware acceleration
     *
     * @example
     * ```typescript
     * if (FilterPreset.isHardwareFilter('scale_cuda')) {
     *   console.log('Hardware accelerated scaling');
     * }
     * ```
     */
    static isHardwareFilter(filterName: string): boolean;
    /**
     * Creates a new filter chain builder.
     *
     * @param hardware - Optional hardware context for hardware-accelerated filters
     *
     * @returns A new FilterPreset instance for chaining
     *
     * @example
     * ```typescript
     * // Software filter chain
     * const filter = FilterPreset.chain()
     *   .scale(1280, 720)
     *   .filter('fps', { fps: 30 })
     *   .build();
     * ```
     *
     * @example
     * ```typescript
     * // Hardware filter chain
     * const hw = HardwareContext.auto();
     * const filter = FilterPreset.chain(hw)
     *   .scale(1280, 720)
     *   .deinterlace()
     *   .build();
     * ```
     */
    static chain(hardware?: HardwareContext | null): FilterPreset;
    /**
     * Adds a custom filter string to the chain.
     *
     * @param filter - Custom filter string
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * chain.custom('myfilter=param1:param2')
     * ```
     */
    custom(filter?: string): this;
    /**
     * Adds any FFmpeg filter to the chain with type-safe options.
     *
     * Provides autocomplete for every available filter name and its options
     * (generated from FFmpeg's AVOption metadata). Prefer the dedicated methods
     * (e.g. {@link scale}) when hardware-aware selection or automatic mapping is
     * needed; use {@link custom} for raw filter strings.
     *
     * @param name - Filter name (autocompleted from all available filters)
     *
     * @param options - Filter-specific options, typed to the chosen filter
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * chain
     *   .filter('drawtext', { text: 'hello', fontsize: 24 })
     *   .filter('hue', { s: 0 });
     * // "drawtext=text=hello:fontsize=24,hue=s=0"
     * ```
     */
    filter<N extends keyof FilterOptionsMap>(name: N, options?: FilterOptionsMap[N]): this;
    /**
     * Builds the final filter string.
     *
     * @param separator - Separator between filters (default: ',')
     *
     * @returns Combined filter string
     *
     * @example
     * ```typescript
     * const filterString = chain.build()  // "scale=1920:1080,fps=30"
     * ```
     */
    build(separator?: string): string;
    /**
     * Returns the filters as an array.
     *
     * @returns Array of filter strings
     *
     * @example
     * ```typescript
     * const filters = chain.toArray()  // ["scale=1920:1080", "fps=30"]
     * ```
     */
    toArray(): string[];
    /**
     * Adds a scale filter to the chain.
     * Automatically selects hardware-specific scaler if hardware context is set.
     *
     * @param width - Target width in pixels
     *
     * @param height - Target height in pixels
     *
     * @param options - Additional scaling options (e.g., flags for algorithm)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * chain.scale(1920, 1080)  // Scale to Full HD
     * chain.scale(640, 480, { flags: 'lanczos' })  // With specific algorithm
     * ```
     *
     * @example
     * ```typescript
     * // Hardware crop + scale (VAAPI, CUDA, QSV, VideoToolbox)
     * chain.crop(100, 100, 50, 50)  // Sets AVFrame crop fields
     *   .scale(1920, 1080)          // Hardware scaler reads crop fields
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#scale | FFmpeg scale filter}
     */
    scale(width: number, height: number, options?: Record<string, any>): FilterPreset;
    /**
     * Adds a GPU format conversion filter without scaling.
     * Only available for hardware contexts. Uses hardware-specific scale filter with format parameter.
     *
     * @param format - Target pixel format (e.g., 'nv12', 'p010')
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * // Convert to NV12 on GPU without scaling
     * chain.scaleFormat('nv12')
     * // Generates: scale_vt=format=nv12 (VideoToolbox)
     * //         or: scale_cuda=format=nv12 (CUDA)
     * //         or: scale_opencl=format=nv12 (OpenCL)
     * ```
     *
     * @example
     * ```typescript
     * // Convert P010 → NV12 on GPU
     * const hw = await HardwareContext.auto();
     * const filter = FilterPreset.chain(hw)
     *   .scaleFormat('nv12')
     *   .build();
     * ```
     *
     * @example
     * ```typescript
     * // Scale then convert format (two separate GPU operations)
     * chain.scale(1920, 1080)
     *   .scaleFormat('p010')
     * // Generates: scale_vt=1920:1080,scale_vt=format=p010
     * ```
     */
    scaleFormat(format: string | AVPixelFormat): FilterPreset;
    /**
     * Adds a crop filter to the chain.
     *
     * @param width - Width of the cropped area
     *
     * @param height - Height of the cropped area
     *
     * @param x - X coordinate of top-left corner (default: 0)
     *
     * @param y - Y coordinate of top-left corner (default: 0)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * chain.crop(640, 480, 100, 100)  // Crop 640x480 area starting at (100,100)
     * chain.crop(1280, 720)  // Crop from top-left corner
     * ```
     *
     * @example
     * ```typescript
     * // Hardware crop + scale
     * chain.crop(100, 100, 50, 50)
     *   .scale(1920, 1080)
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#crop | FFmpeg crop filter}
     */
    crop(width: number, height: number, x?: number, y?: number): FilterPreset;
    /**
     * Adds a blur filter to the chain (hardware-specific).
     * Only available for hardware presets that support blur
     *
     * @param type - Blur type (default: 'avg')
     *
     * @param radius - Blur radius (optional)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .blur('gaussian', 5)
     *   .build();
     * ```
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .blur('box')
     *   .build();
     * ```
     */
    blur(type?: 'avg' | 'gaussian' | 'box', radius?: number): FilterPreset;
    /**
     * Adds a sharpen filter to the chain (hardware-specific).
     * Only available for hardware presets that support sharpening
     *
     * @param amount - Sharpen amount (optional)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .sharpen(1.5)
     *   .build();
     * ```
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .sharpen()
     *   .build();
     * ```
     */
    sharpen(amount?: number): FilterPreset;
    /**
     * Adds a Sobel edge detection filter.
     *
     * Applies Sobel operator to detect edges in images.
     * Supports hardware acceleration with OpenCL.
     * Useful for computer vision and artistic effects.
     *
     * @param planes - Planes to process (1-15, default: 15 for all)
     *
     * @param scale - Scale factor for result (default: 1.0)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .sobel()
     *   .build();
     * ```
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .sobel(15, 2.0)  // All planes, 2x scale
     *   .build();
     * ```
     */
    sobel(planes?: number, scale?: number): FilterPreset;
    /**
     * Adds a format filter to convert pixel format.
     *
     * @param pixelFormat - Target pixel format(s) - AVPixelFormat enum, or array
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * // Single format
     * chain.format(AV_PIX_FMT_YUV420P);
     *
     * // Multiple formats (tries formats in order)
     * chain.format([AV_PIX_FMT_YUV420P, AV_PIX_FMT_RGB24]);
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#format | FFmpeg format filter}
     */
    format(pixelFormat: AVPixelFormat | AVPixelFormat[]): FilterPreset;
    /**
     * Adds a flip filter to the chain (hardware-specific).
     * Falls back to hflip/vflip if hardware flip not available
     *
     * @param direction - Flip direction ('h' or 'v')
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .flip('h')
     *   .build();
     * ```
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .flip('v')
     *   .build();
     * ```
     */
    flip(direction: 'h' | 'v'): FilterPreset;
    /**
     * Adds a stack filter to the chain (hardware-specific).
     * Only available for hardware presets that support stacking
     *
     * @param type - Stack type ('h' for horizontal, 'v' for vertical, 'x' for grid)
     *
     * @param inputs - Number of inputs (default: 2)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .stack('h', 2)
     *   .build();
     * ```
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .stack('x', 4)
     *   .build();
     * ```
     */
    stack(type: 'h' | 'v' | 'x', inputs?: number): FilterPreset;
    /**
     * Creates a tonemap filter.
     * Used for HDR to SDR conversion with hardware acceleration.
     *
     * @param alg - Tonemapping algorithm (e.g., 'hable', 'reinhard', 'mobius', etc.)
     *
     * @param options - Tonemapping options
     *
     * @returns Hardware tonemap filter string or null if not supported
     *
     * @example
     * ```typescript
     * const filter = hwPresets.tonemap();
     * ```
     *
     * @example
     * ```typescript
     * const filter = hwPresets.tonemap({ tonemap: 'hable', desat: '0' });
     * ```
     */
    tonemap(alg: string, options: Record<string, string | number>): FilterPreset;
    /**
     * Creates an overlay filter string to composite two video streams.
     *
     * @param x - X position for overlay (default: 0)
     *
     * @param y - Y position for overlay (default: 0)
     *
     * @param options - Additional overlay options
     *
     * @returns Filter string or null if not supported
     *
     * @example
     * ```typescript
     * // Basic overlay at position
     * presets.overlay(100, 50);
     *
     * // With additional options
     * presets.overlay(0, 0, { format: 'yuv420' });
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#overlay | FFmpeg overlay filter}
     */
    overlay(x?: number, y?: number, options?: Record<string, string>): FilterPreset;
    /**
     * Creates an audio format filter string.
     *
     * @param sampleFormat - Target sample format (e.g., 's16', 'fltp')
     *
     * @param sampleRate - Target sample rate in Hz (optional)
     *
     * @param channelLayout - Target channel layout (optional)
     *
     * @returns Filter string or null if not supported
     *
     * @example
     * ```typescript
     * // Change sample format only
     * presets.aformat('s16');
     *
     * // Change format and sample rate
     * presets.aformat('fltp', 48000);
     *
     * // Full conversion
     * presets.aformat('s16', 44100, 'stereo');
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#aformat | FFmpeg aformat filter}
     */
    aformat(sampleFormat: AVSampleFormat | AVSampleFormat[], sampleRate?: number, channelLayout?: string): FilterPreset;
    /**
     * Adds a pad filter to add padding to video.
     * Essential for aspect ratio adjustments and letterboxing.
     *
     * @param width - Output width (can use expressions like 'iw+100')
     *
     * @param height - Output height (can use expressions like 'ih+100')
     *
     * @param x - X position of input video (default: '(ow-iw)/2' for center)
     *
     * @param y - Y position of input video (default: '(oh-ih)/2' for center)
     *
     * @param color - Padding color (default: 'black')
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * // Add black bars for 16:9 aspect ratio
     * chain.pad('iw', 'iw*9/16');
     *
     * // Add 50px padding on all sides
     * chain.pad('iw+100', 'ih+100');
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#pad | FFmpeg pad filter}
     */
    pad(width: string | number, height: string | number, x?: string, y?: string, color?: string): FilterPreset;
    /**
     * Creates a transpose filter string for rotation/flipping.
     * More efficient than rotate for 90-degree rotations.
     *
     * @param mode - Transpose mode (0-3, or named constants)
     *
     * @returns Filter string or null if not supported
     *
     * @example
     * ```typescript
     * presets.transpose(1)  // Rotate 90 degrees clockwise
     * presets.transpose('cclock')  // Rotate 90 degrees counter-clockwise
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#transpose | FFmpeg transpose filter}
     */
    transpose(mode: number | 'clock' | 'cclock' | 'clock_flip' | 'cclock_flip'): FilterPreset;
    /**
     * Creates a deinterlace filter string.
     * Essential for processing interlaced content.
     *
     * @param mode - Deinterlace mode (default: 'yadif')
     *
     * @param options - Additional options for the filter
     *
     * @returns Filter string or null if not supported
     *
     * @example
     * ```typescript
     * presets.deinterlace('yadif')  // Standard deinterlacing
     * presets.deinterlace('bwdif')  // Bob Weaver deinterlacing
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#yadif | FFmpeg yadif filter}
     */
    deinterlace(mode?: 'yadif' | 'bwdif' | 'w3fdif', options?: Record<string, any>): FilterPreset;
    /**
     * Adds a whisper filter for audio transcription using whisper.cpp.
     * Transcribes audio and adds metadata to frames (lavfi.whisper.text, lavfi.whisper.duration).
     *
     * @param options - Whisper transcription options
     *
     * @param options.model - Path to whisper.cpp model file
     *
     * @param options.language - Language for transcription (default: 'auto')
     *
     * @param options.queue - Audio queue size in seconds (default: 3)
     *
     * @param options.useGpu - Use GPU for processing (default: true)
     *
     * @param options.gpuDevice - GPU device to use (default: 0)
     *
     * @param options.destination - Output destination for transcripts
     *
     * @param options.format - Output format: text|srt|json (default: 'text')
     *
     * @param options.vadModel - Path to VAD model file (optional)
     *
     * @param options.vadThreshold - VAD threshold 0.0-1.0 (default: 0.5)
     *
     * @param options.vadMinSpeechDuration - Minimum speech duration for VAD in seconds (default: 0.1)
     *
     * @param options.vadMinSilenceDuration - Minimum silence duration for VAD in seconds (default: 0.5)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * // Basic transcription
     * chain.whisper({
     *   model: '/path/to/ggml-base.bin'
     * });
     *
     * // With language and output
     * chain.whisper({
     *   model: '/path/to/ggml-base.bin',
     *   language: 'en',
     *   destination: 'output.srt',
     *   format: 'srt'
     * });
     *
     * // With VAD model
     * chain.whisper({
     *   model: '/path/to/ggml-base.bin',
     *   vadModel: '/path/to/ggml-silero-v5.1.2.bin',
     *   vadThreshold: 0.5
     * });
     * ```
     *
     * @see {@link https://ffmpeg.org/ffmpeg-filters.html#whisper | FFmpeg whisper filter}
     */
    whisper(options: {
        model: string;
        language?: string;
        queue?: number;
        useGpu?: boolean;
        gpuDevice?: number;
        destination?: string;
        format?: 'text' | 'srt' | 'json';
        vadModel?: string;
        vadThreshold?: number;
        vadMinSpeechDuration?: number;
        vadMinSilenceDuration?: number;
    }): FilterPreset;
    /**
     * Adds a hwupload filter to upload frames to hardware.
     * Only applied if hardware acceleration is configured.
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .hwupload()
     *   .scale(1920, 1080)
     *   .build();
     * ```
     */
    hwupload(): FilterPreset;
    /**
     * Adds a hwdownload filter to download frames from hardware.
     * Only applied if hardware acceleration is configured.
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * const chain = FilterPresets.chain()
     *   .scale(1920, 1080)
     *   .hwdownload()
     *   .build();
     * ```
     */
    hwdownload(): FilterPreset;
    /**
     * Adds a filter to the chain.
     *
     * @param filter - Filter string to add (ignored if null/undefined)
     *
     * @param unshift - If true, adds to the start instead of the end (default: false)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * chain.add('scale=1920:1080')
     * ```
     *
     * @internal
     */
    private add;
    /**
     * Determines filter support for the hardware type.
     *
     * @returns Hardware filter support configuration
     *
     * @internal
     */
    private getSupport;
}
/**
 * Label specification for a filter-complex chain (input or output pads).
 *
 * A single label like `'0:v'` or `'out'`, or several labels. Labels are wrapped
 * in `[...]` automatically when the graph string is built.
 */
export type FilterComplexLabels = string | string[];
/**
 * Type-safe builder for `filter_complex` graph strings.
 *
 * Composes one or more labeled filter chains - each with optional input/output
 * pad labels and a sequence of type-safe {@link FilterPreset.filter} calls - and
 * renders them to the description string consumed by
 * {@link FilterComplexAPI.create}. Provides the same autocomplete and enum
 * validation as {@link FilterPreset}, but for multi-input/output graphs.
 *
 * @example
 * ```typescript
 * const graph = FilterComplexGraph.create()
 *   .chain({ inputs: ['0:v', '1:v'], outputs: 'tmp' }, (c) => c.filter('overlay', { x: 100, y: 50 }))
 *   .chain({ inputs: 'tmp', outputs: 'out' }, (c) => c.filter('hue', { s: 0 }))
 *   .build();
 * // "[0:v][1:v]overlay=x=100:y=50[tmp];[tmp]hue=s=0[out]"
 *
 * using complex = FilterComplexAPI.create(graph, {
 *   inputs: [{ label: '0:v' }, { label: '1:v' }],
 *   outputs: [{ label: 'out' }],
 * });
 * ```
 */
export declare class FilterComplexGraph {
    private chains;
    /**
     * Create a new filter-complex graph builder.
     *
     * @returns A new builder instance
     *
     * @example
     * ```typescript
     * const graph = FilterComplexGraph.create();
     * ```
     */
    static create(): FilterComplexGraph;
    /**
     * Add a labeled filter chain to the graph.
     *
     * The chain's filters are built via a callback that receives a
     * {@link FilterPreset} for type-safe `filter()` composition.
     *
     * @param labels - Optional input and output pad labels
     *
     * @param labels.inputs - Input pad label(s) prepended to the chain
     *
     * @param labels.outputs - Output pad label(s) appended to the chain
     *
     * @param build - Callback composing the chain's filters
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * graph.chain({ inputs: ['0:v', '1:v'], outputs: 'out' }, (c) =>
     *   c.filter('overlay', { x: 0, y: 0 }).filter('hue', { s: 0 }),
     * );
     * ```
     */
    chain(labels: {
        inputs?: FilterComplexLabels;
        outputs?: FilterComplexLabels;
    }, build: (chain: FilterPreset) => FilterPreset): this;
    /**
     * Add a raw chain segment to the graph.
     *
     * Escape hatch for graph syntax not expressible through {@link chain}.
     *
     * @param segment - Raw chain string (e.g. `'[0:v]split[a][b]'`)
     *
     * @returns This instance for chaining
     *
     * @example
     * ```typescript
     * graph.custom('[0:v]split[a][b]');
     * ```
     */
    custom(segment: string): this;
    /**
     * Build the final filter-complex description string.
     *
     * @returns The graph description (chains joined by `;`)
     *
     * @example
     * ```typescript
     * const description = graph.build();
     * ```
     */
    build(): string;
    /**
     * Wrap pad labels in `[...]`.
     *
     * @param labels - A single label, an array of labels, or undefined
     *
     * @returns The bracketed label string (empty when no labels)
     *
     * @internal
     */
    private renderLabels;
}
