import { Byte, Kbps, Milliseconds, IRange, IObservable, ISubject, IValueSubject } from '@vkontakte/videoplayer-shared';
import { IDesiredState, IProviderOutput, IProviderParams } from '../../../providers/types';
import { IObservableVideo } from '../../../providers/utils/HTMLVideoElement/observable';
import { IDashURLSource, IVideoStream } from '../../../player/types';
export declare enum StreamKind {
    VIDEO = "video",
    AUDIO = "audio",
    TEXT = "text"
}
export declare enum LiveStatus {
    ActiveLowLatency = "active_low_latency",
    LiveWithTargetOffset = "live_with_target_offset",
    LiveForwardBuffering = "live_forward_buffering",
    None = "none"
}
export declare enum LiveStreamStatus {
    Active = "active",
    UnexpectedlyDown = "unexpectedly_down",// Стрим в сети, но трансляция оборвалась из-за тех. проблем
    Unpublished = "unpublished"
}
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'];
}
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 ByteRangeSegment {
    status: SegmentStatus;
    time: IRange<Milliseconds>;
    byte: IRange<Byte>;
}
export interface TemplateSegment {
    status: SegmentStatus;
    time: IRange<Milliseconds>;
    size?: Byte;
    url: string;
}
export type Segment = ByteRangeSegment | TemplateSegment;
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 LiveMetadata {
    availabilityStartTime: Milliseconds;
    publishTime: Milliseconds;
    latestSegmentPublishTime: Milliseconds;
    streamIsAlive: boolean;
    streamIsUnpublished: boolean;
}
export interface Manifest {
    duration: Milliseconds | undefined;
    streams: {
        [key in StreamKind]: Stream[];
    };
    baseUrls: string[];
    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 interface IProviderSubscriptionInfo {
    output: IProviderOutput;
    desiredState: IDesiredState;
    observableVideo: IObservableVideo;
    genericErrorListener: (error: Error | unknown) => void;
    connect: <Value>(from: IObservable<Value>, to: ISubject<Value> | IValueSubject<Value> | ((v: Value) => void)) => void;
}
export declare enum ProviderState {
    STOPPED = "stopped",
    READY = "ready",
    PLAYING = "playing",
    PAUSED = "paused"
}
export type IParams = IProviderParams<IDashURLSource>;
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;
