import { AudioRendition, VideoRendition } from '../../../transcoding/types';
/**
 * State interface for media buffering - orchestration only, no data storage
 */
export interface MediaBufferState {
    currentSeekTimeMs: number;
    requestedSegments: Set<number>;
    activeRequests: Set<number>;
    requestQueue: number[];
}
/**
 * Configuration interface for media buffering - generic for both audio and video
 */
export interface MediaBufferConfig {
    bufferDurationMs: number;
    maxParallelFetches: number;
    enableBuffering: boolean;
    enableContinuousBuffering?: boolean;
}
/**
 * Dependencies interface for media buffering - integrates with BaseMediaEngine
 */
export interface MediaBufferDependencies<T extends AudioRendition | VideoRendition> {
    computeSegmentId: (timeMs: number, rendition: T) => Promise<number | undefined>;
    prefetchSegment: (segmentId: number, rendition: T) => Promise<void>;
    isSegmentCached: (segmentId: number, rendition: T) => boolean;
    getRendition: () => Promise<T>;
    logError: (message: string, error: any) => void;
}
/**
 * Compute segment range for a time window
 * Pure function - determines which segments are needed for a time range
 */
export declare const computeSegmentRange: <T extends AudioRendition | VideoRendition>(startTimeMs: number, endTimeMs: number, rendition: T, computeSegmentId: (timeMs: number, rendition: T) => number | undefined) => number[];
/**
 * Async version of computeSegmentRange for when computeSegmentId is async
 */
export declare const computeSegmentRangeAsync: <T extends AudioRendition | VideoRendition>(startTimeMs: number, endTimeMs: number, durationMs: number, rendition: T, computeSegmentId: (timeMs: number, rendition: T) => Promise<number | undefined>) => Promise<number[]>;
/**
 * Compute buffer queue based on desired segments and what we've already requested
 * Pure function - determines what new segments should be prefetched
 */
export declare const computeBufferQueue: (desiredSegments: number[], requestedSegments: Set<number>) => number[];
/**
 * Handle seek time change and recompute buffer queue
 * Pure function - computes new queue when seek time changes
 */
export declare const handleSeekTimeChange: <T extends AudioRendition | VideoRendition>(newSeekTimeMs: number, bufferDurationMs: number, rendition: T, currentState: MediaBufferState, computeSegmentId: (timeMs: number, rendition: T) => number | undefined) => {
    newQueue: number[];
    overlappingRequests: number[];
};
/**
 * Check if a segment has been requested for buffering
 * Pure function for checking buffer orchestration state
 */
export declare const isSegmentRequested: (segmentId: number, bufferState: MediaBufferState | undefined) => boolean;
/**
 * Get requested segments from a list of segment IDs
 * Pure function that returns which segments have been requested for buffering
 */
export declare const getRequestedSegments: (segmentIds: number[], bufferState: MediaBufferState | undefined) => Set<number>;
/**
 * Get unrequested segments from a list of segment IDs
 * Pure function that returns which segments haven't been requested yet
 */
export declare const getUnrequestedSegments: (segmentIds: number[], bufferState: MediaBufferState | undefined) => number[];
/**
 * Core media buffering orchestration logic - prefetch only, no data storage
 * Integrates with BaseMediaEngine's existing caching and request deduplication
 */
export declare const manageMediaBuffer: <T extends AudioRendition | VideoRendition>(seekTimeMs: number, config: MediaBufferConfig, currentState: MediaBufferState, durationMs: number, signal: AbortSignal, deps: MediaBufferDependencies<T>) => Promise<MediaBufferState>;
