import { Fetcher, FetchParamsWithUrl, Priority, RepresentationFetchResult } from '../../../../../providers/DashProviderVirtual/lib/fetcher';
import { CommonInit, ContainerParser, Representation, Segment, StreamKind } from '../../../../../providers/utils/parsers/types';
import { ITuningConfig } from '../../../../../utils/tuningConfig';
import { Byte, IError, IRange, ISubject, IValueSubject, Milliseconds, Seconds, Subscription } from '@vkontakte/videoplayer-shared';
import { NativeBufferManager } from '../../../../../providers/DashProviderVirtual/lib/buffer/nativeBufferManager';
import { Dependencies, IBufferPlaybackQueueItem, ISomeDataLoadedCallbackParams, IVirtualBufferManager } from '../../../../../providers/DashProviderVirtual/lib/buffer/types';
export declare abstract class BaseVirtualBufferManager<T extends Segment> implements IVirtualBufferManager {
    error$: ISubject<IError>;
    playingRepresentation$: IValueSubject<Representation['id'] | undefined>;
    playingRepresentationInit$: IValueSubject<CommonInit | undefined>;
    currentSegmentLength$: IValueSubject<number>;
    onLastSegment$: IValueSubject<boolean>;
    fullyBuffered$: IValueSubject<boolean>;
    protected readonly kind: StreamKind;
    protected readonly nativeBufferManager: NativeBufferManager;
    protected readonly fetcher: Fetcher;
    protected readonly tuning: ITuningConfig;
    protected representations: Map<Representation['id'], Representation>;
    protected playingRepresentationId: Representation['id'] | undefined;
    protected downloadingRepresentationId: Representation['id'] | undefined;
    protected switchingRepresentationId: Representation['id'] | null;
    protected initData: Map<Representation['id'], ArrayBuffer>;
    protected initDataPromises: Map<Representation['id'], Promise<RepresentationFetchResult<T> | null | undefined>>;
    protected idleCallbacks: Map<Representation['id'], number>;
    protected parsedInitData: Map<Representation['id'], CommonInit>;
    protected segments: Map<Representation['id'], T[]>;
    protected containerParser: ContainerParser;
    protected bufferPlaybackQueue: IBufferPlaybackQueueItem<T>[];
    protected downloadingBufferItems: IBufferPlaybackQueueItem<T>[];
    protected preloadOnly: boolean;
    protected forwardBufferTarget: Milliseconds;
    protected failedDownloads: number;
    protected lastDataObtainedTimestampMs: Milliseconds;
    protected loadByteRangeSegmentsTimeoutId: number;
    protected currentVirtualBufferSize: Byte;
    private baseUrls;
    private baseUrlsIndex;
    protected maintainPlaybackBufferMutex: boolean;
    protected maintainNativeBufferMutex: boolean;
    protected bufferClearingMutex: boolean;
    protected abortNativeBufferMutex: boolean;
    protected switchMutex: boolean;
    protected destroyAbortController: AbortController;
    protected downloadAbortController: AbortController;
    protected subscription: Subscription;
    protected readonly getCurrentPosition: () => Milliseconds | undefined;
    protected readonly getCurrentStallDuration: () => Milliseconds | undefined;
    protected constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], { fetcher, tuning, getCurrentPosition, getCurrentStallDuration, manifest }: Dependencies);
    protected abstract loadItems(itemsToLoad: IBufferPlaybackQueueItem<T>[], representation: Representation, priority?: Priority): Promise<void>;
    protected abstract selectItemsToLoad(): IBufferPlaybackQueueItem<T>[];
    protected abstract prepareFetchParams(items: IBufferPlaybackQueueItem<T>[], representation: Representation): FetchParamsWithUrl;
    protected abstract onSomeDataLoaded(data: ISomeDataLoadedCallbackParams<T>): Promise<void>;
    protected abstract updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
    startWith: (param_0: string) => Promise<void | undefined>;
    switchTo: (param_0: string, param_1: boolean | undefined) => Promise<void | undefined>;
    seek(position: Milliseconds): Promise<void>;
    maintain(currentPosition?: Milliseconds | undefined): Promise<void>;
    getForwardPlaybackBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
    getPlaybackBufferState(): IRange<Milliseconds> | null;
    abort(): Promise<void>;
    findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
    getRepresentationInitialTime(): Seconds;
    calculateDurationFromSegments(representationId: Representation['id']): Milliseconds;
    get lastDataObtainedTimestamp(): Milliseconds;
    setTarget(time: Milliseconds): void;
    setPreloadOnly(preloadOnly: boolean): void;
    destroy(): void;
    protected forceSwitchCondition(oldRepresentation: Representation, newRepresentation: Representation): boolean;
    protected clearBuffer(): Promise<void>;
    protected abortDownload(): void;
    protected abortDownloadingItems(): void;
    protected abortNativeBuffer(): Promise<boolean>;
    protected loadInits(startingRepresentation: Representation): Promise<void>;
    protected loadInitIfNeeded(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
    protected loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
    protected maintainNativeBuffer(): Promise<void>;
    protected maintainPlaybackBuffer(position: Milliseconds): Promise<void>;
    protected actualizeLastSegmentInfo(currentPosition: Milliseconds): void;
    protected selectDownloadingItems(position: Milliseconds, segments: T[]): IBufferPlaybackQueueItem<T>[];
    protected processCachedItems(): Promise<void>;
    protected withinInterval(currentPosition: Milliseconds | undefined, { from, to }: IRange<Milliseconds>, tolerance?: Milliseconds): boolean;
    protected withinAppendInterval(currentPosition: Milliseconds | undefined, { from, to }: IRange<Milliseconds>): boolean;
    protected withinRemoveInterval(currentPosition: Milliseconds | undefined, { to }: IRange<Milliseconds>): boolean;
    protected waitExponentialDownloadDelay: () => Promise<void | undefined>;
    protected appendSegmentFully(nextPlayingItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
    protected appendSegmentPartially(nextPlayingItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
    protected parseFeedableSegmentChunk(chunk: DataView): DataView | null;
    protected onItemFullyDownloaded(downloadedItem: IBufferPlaybackQueueItem<T>): void;
    protected onItemFullyAppended(appendedItem: IBufferPlaybackQueueItem<T>): void;
    protected removeSegment(nextRemoveItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
    protected onDownloadItem(downloadedItem: IBufferPlaybackQueueItem<T>): Promise<void>;
    protected pruneVirtualBuffer(currentPosition: Milliseconds): void;
    protected updateRepresentationsBaseUrlIfNeeded(): void;
}
