import { Byte, IRange, Kbps, Milliseconds, Nullable } from '@vkontakte/videoplayer-shared';
import { IVideoStream, VideoCodec, AudioCodec } from '../../../player/types';
export declare enum StreamKind {
    VIDEO = "video",
    AUDIO = "audio",
    TEXT = "text"
}
export declare enum Profile {
    WEBM_AS_IN_SPEC = "urn:mpeg:dash:profile:webm-on-demand:2012",// Такой указан в спеке
    WEBM_AS_IN_FFMPEG = "urn:webm:dash:profile:webm-on-demand:2012"
}
export interface Representation {
    id: string;
    kind: StreamKind;
    segmentReference: SegmentReference;
    profiles: Array<Profile | string>;
    duration?: Milliseconds;
    bitrate: Kbps;
    mime: string;
    codecs: string;
    width: number;
    height: number;
    fps?: number;
    quality?: string;
    streamId?: IVideoStream['id'];
    /**
     * @see https://jira.vk.team/browse/UVP-9492
     *
     * помечает видео дорожку как неиспользуемую для телевизоров
     */
    tvDisabled?: boolean;
}
export interface TextRepresentation extends Representation {
    language: string;
    label: string;
    url: string;
    isAuto: boolean;
}
export interface ServerLatencyTimestamps {
    serverDataReceivedTimestamp?: Milliseconds;
    serverDataPreparedTime?: Milliseconds;
}
export declare enum SegmentReferencingType {
    BYTE_RANGE = "byteRange",
    TEMPLATE = "template"
}
export type ByteRangeSegmentReference = {
    type: SegmentReferencingType.BYTE_RANGE;
    url: string;
    initRange: IRange<Byte>;
    indexRange?: IRange<Byte>;
};
export type TemplateSegmentReference = {
    type: SegmentReferencingType.TEMPLATE;
    baseUrl: string;
    initUrl: string;
    segmentTemplateUrl: string;
    totalSegmentsDurationMs: Milliseconds;
    segments: {
        url: string;
        time: IRange<Milliseconds>;
    }[];
    nextSegmentBeyondManifest: {
        url: string;
        time: IRange<Milliseconds>;
    };
    timescale: number;
};
export type SegmentReference = ByteRangeSegmentReference | TemplateSegmentReference;
export interface SegmentInfo {
    /**
     * @deprecated После перехода на VirtualBuffer будет бесполезно. Можно будет удалить. Нужно для старого DashProvider
     */
    status: SegmentStatus;
    networkStatus: Nullable<SegmentNetworkStatus>;
    bufferStatus: Nullable<SegmentBufferStatus>;
    data: Nullable<BufferSource>;
    size: Nullable<Byte>;
    loadedBytes: Nullable<Byte>;
    feedingBytes: Nullable<Byte>;
    fedBytes: Nullable<Byte>;
}
export type ByteRangeSegment = SegmentInfo & {
    time: IRange<Milliseconds>;
    byte: IRange<Byte>;
};
export type TemplateSegment = SegmentInfo & {
    time: IRange<Milliseconds>;
    url: string;
    isCurrentLowLatency?: boolean;
};
export type Segment = ByteRangeSegment | TemplateSegment;
export declare enum SegmentNetworkStatus {
    NONE = "none",
    DOWNLOADING = "downloading",
    DOWNLOADED = "downloaded"
}
export declare enum SegmentBufferStatus {
    NONE = "none",
    PARTIALLY_FED = "partially_fed",
    FED = "fed"
}
export declare enum SegmentStatus {
    NONE = "none",
    DOWNLOADING = "downloading",
    DOWNLOADED = "downloaded",
    PARTIALLY_FED = "partially_fed",
    PARTIALLY_EJECTED = "partially_ejected",
    FED = "fed"
}
export interface Stream {
    id: string;
    hdr?: boolean;
    language?: string;
    isDefault?: boolean;
    label?: string;
    codecs: string;
    mime: string;
    representations: Representation[];
}
export interface Manifest {
    duration: Milliseconds | undefined;
    streams: {
        [key in StreamKind]: Stream[];
    };
    baseUrls: string[];
    codecs?: {
        video?: VideoCodec[];
        audio?: AudioCodec[];
    };
    live?: LiveMetadata;
}
export declare enum ProjectionType {
    RECTANGULAR = 0,
    EQUIRECTANGULAR = 1,
    CUBEMAP = 2,
    MESH = 3
}
export interface BoxLike {
    id: string;
    size: Byte;
    contents: DataView;
}
export interface GenericContainerParser<InitData> {
    validateData(data: DataView): boolean;
    getIndexRange(init: InitData): IRange<Byte> | undefined;
    parseInit(data: DataView): InitData;
    parseSegments(data: DataView, init: InitData, indexRange?: IRange<Byte>): Segment[];
    parseFeedableSegmentChunk(data: DataView, isLive?: boolean): DataView | null;
}
export interface CommonInit {
    is3dVideo: boolean;
    stereoMode?: number;
    projectionType?: ProjectionType;
    projectionData?: {
        pose: {
            yaw: number;
            pitch: number;
            roll: number;
        };
        bounds: {
            top: number;
            bottom: number;
            left: number;
            right: number;
        };
    };
}
export interface WebmInit extends CommonInit {
    segmentStart: Byte;
    segmentEnd: Byte;
    timeScale: number;
    segmentDuration: number;
    cuesSeekPosition?: Byte;
}
export type MpegInit = CommonInit;
export type WebmParser = GenericContainerParser<WebmInit>;
export type MpegParser = GenericContainerParser<MpegInit> & {
    getChunkEndTime(data: DataView, timescale: number): Milliseconds;
    getServerLatencyTimestamps(view: DataView): ServerLatencyTimestamps;
    getTimescaleFromIndex(view: DataView): number | undefined;
};
export type ContainerParser = WebmParser | MpegParser;
export interface LiveMetadata {
    availabilityStartTime: Milliseconds;
    publishTime: Milliseconds;
    latestSegmentPublishTime: Milliseconds;
    streamIsAlive: boolean;
    streamIsUnpublished: boolean;
}
