import { RequestDeduplicator } from '../../transcoding/cache/RequestDeduplicator.js';
import { AudioRendition, SegmentTimeRange, VideoRendition } from '../../transcoding/types';
import { SizeAwareLRUCache } from '../../utils/LRUCache.js';
import { EFMedia } from '../EFMedia.js';
export declare const mediaCache: SizeAwareLRUCache<string>;
export declare const globalRequestDeduplicator: RequestDeduplicator;
export declare abstract class BaseMediaEngine {
    protected host: EFMedia;
    constructor(host: EFMedia);
    abstract get videoRendition(): VideoRendition | undefined;
    abstract get audioRendition(): AudioRendition | undefined;
    getVideoRendition(): VideoRendition;
    getAudioRendition(): AudioRendition;
    /**
     * Generate cache key for segment requests
     */
    private getSegmentCacheKey;
    /**
     * Unified fetch method with caching and global deduplication
     * All requests (media, manifest, init segments) go through this method
     */
    protected fetchWithCache(url: string, options: {
        responseType: "arrayBuffer" | "json";
        headers?: Record<string, string>;
        signal?: AbortSignal;
    }): Promise<any>;
    /**
     * Handles abort logic for a cached request without affecting the underlying fetch
     * This allows multiple instances to share the same cached request while each
     * manages their own abort behavior
     */
    private handleAbortForCachedRequest;
    fetchMedia(url: string, signal?: AbortSignal): Promise<ArrayBuffer>;
    fetchManifest(url: string, signal?: AbortSignal): Promise<any>;
    fetchMediaWithHeaders(url: string, headers: Record<string, string>, signal?: AbortSignal): Promise<ArrayBuffer>;
    fetchMediaCache(url: string, signal?: AbortSignal): Promise<ArrayBuffer>;
    fetchManifestCache(url: string, signal?: AbortSignal): Promise<any>;
    fetchMediaCacheWithHeaders(url: string, headers: Record<string, string>, signal?: AbortSignal): Promise<ArrayBuffer>;
    /**
     * Abstract method for actual segment fetching - implemented by subclasses
     */
    abstract fetchMediaSegment(segmentId: number, rendition: {
        trackId: number | undefined;
        src: string;
    }): Promise<ArrayBuffer>;
    /**
     * Fetch media segment with built-in deduplication
     * Now uses global deduplication for all requests
     */
    fetchMediaSegmentWithDeduplication(segmentId: number, rendition: {
        trackId: number | undefined;
        src: string;
    }, _signal?: AbortSignal): Promise<ArrayBuffer>;
    /**
     * Check if a segment is currently being fetched
     */
    isSegmentBeingFetched(segmentId: number, rendition: {
        src: string;
        trackId: number | undefined;
    }): boolean;
    /**
     * Get count of active segment requests (for debugging/monitoring)
     */
    getActiveSegmentRequestCount(): number;
    /**
     * Cancel all active segment requests (for cleanup)
     */
    cancelAllSegmentRequests(): void;
    /**
     * Calculate audio segments needed for a time range
     * Each media engine implements this based on their segment structure
     */
    calculateAudioSegmentRange(fromMs: number, toMs: number, rendition: AudioRendition, durationMs: number): SegmentTimeRange[];
}
