import type { ContextHaving, ContextUsing } from '../../../framework-types/execution-context/Types';
import type { NamedTask, Task } from '../../../framework-types/task/Types';
import type { EmptyObject } from '../../Types';
import type { Constants, MediaType } from '../core/Constants';
import type { EventListenerEffect } from '../core/effects/EventListenerEffectFactory';
import type { DataStreamAtom } from '../core/state/data-stream/DataStreamAtom';
import type { CoreExportNames, CoreStateAtoms } from '../core/Types';
import type { Transient } from '../core/utils/StateUtils';
import type { CoreUtils } from '../core/utils/Types';
import type { StreamDataStructureSegments } from '../stream-data-structure/segment/Exports';
import type { SegmentAtom } from '../stream-data-structure/segment/SegmentAtom';
import type { ContainerFormat, SegmentDataAtom } from '../stream-data-structure/segment/SegmentDataAtom';
import type { ContextWithState } from '../Types';
import type Errors from './Errors';
type ProcessorDependencies = {
    [CoreExportNames.Utils]: CoreUtils;
    [CoreExportNames.Constants]: Constants;
    [CoreExportNames.CoreStateAtoms]: CoreStateAtoms;
    [SegmentProcessingExportNames.SegmentProcessorErrors]: typeof Errors;
} & StreamDataStructureSegments;
export declare enum SegmentProcessingExportNames {
    SegmentProcessingComponent = "segment-processing-component",
    SegmentProcessorType = "segment-processor-type",
    SegmentProcessorErrors = "segment-processor-errors"
}
export type SegmentProcessorContext = ContextUsing<[
    EventListenerEffect
], ContextHaving<ProcessorDependencies, EmptyObject, ContextWithState>>;
export type CodecMap = {
    [key in MediaType]?: string[];
};
export declare enum SegmentProcessorType {
    Decryptor = "decryptor",
    Parser = "parser",
    Preprocessor = "preprocessor",
    Transmuxer = "transmuxer",
    Postprocessor = "postprocessor"
}
type BaseProcessorData<I, O> = {
    segment: SegmentAtom;
    input: DataStreamAtom<I>;
    output: DataStreamAtom<O>;
};
type BaseSegmentProcessor<Data> = {
    name: string;
    type: SegmentProcessorType;
    process: NamedTask<Task<SegmentProcessorContext, Data, void>>;
};
export type SegmentDecryptorData = BaseProcessorData<Uint8Array, Uint8Array>;
export type SegmentDecryptor = BaseSegmentProcessor<SegmentDecryptorData> & {
    type: SegmentProcessorType.Decryptor;
    supportedEncryptionFormats: string[];
};
export type SegmentParserData = BaseProcessorData<Uint8Array, SegmentDataAtom> & {
    segment: SegmentAtom;
    codecsExtracted: Transient<CodecMap>;
    playbackTimeExtracted: Transient<number>;
    durationExtracted: Transient<number>;
};
export type SegmentParser = BaseSegmentProcessor<SegmentParserData> & {
    type: SegmentProcessorType.Parser;
    container: ContainerFormat;
};
export type SegmentPreprocessorData = BaseProcessorData<SegmentDataAtom, SegmentDataAtom>;
export type SegmentPreprocessor = BaseSegmentProcessor<SegmentPreprocessorData> & {
    type: SegmentProcessorType.Preprocessor;
    container: ContainerFormat;
};
export type SegmentTransmuxerData = BaseProcessorData<SegmentDataAtom, SegmentDataAtom>;
export type SegmentTransmuxer = BaseSegmentProcessor<SegmentTransmuxerData> & {
    type: SegmentProcessorType.Transmuxer;
    inputContainer: ContainerFormat;
    outputContainer: ContainerFormat;
    inputCodecsExtracted: Transient<CodecMap>;
    outputCodecsExtracted: Transient<CodecMap>;
};
export type SegmentPostprocessorData = BaseProcessorData<SegmentDataAtom, SegmentDataAtom>;
export type SegmentPostprocessor = BaseSegmentProcessor<SegmentPostprocessorData> & {
    type: SegmentProcessorType.Postprocessor;
    container: ContainerFormat;
};
export type SegmentProcessor = SegmentDecryptor | SegmentParser | SegmentPreprocessor | SegmentTransmuxer | SegmentPostprocessor;
export type RemoveProcessor = () => void;
export type SelectContainerFormatInput = {
    availableContainerFormats: ContainerFormat[];
    segment: SegmentAtom;
};
export type SelectContainerFormatTask = NamedTask<Task<SegmentProcessorContext, SelectContainerFormatInput, ContainerFormat>>;
export type SegmentProcessingComponentData = BaseProcessorData<Uint8Array, SegmentDataAtom> & {
    codecsExtracted: Transient<{
        [key in MediaType]?: string[];
    }>;
    playbackTimeExtracted: Transient<number>;
    durationExtracted: Transient<number>;
    selectContainerFormat: SelectContainerFormatTask;
};
export interface SegmentProcessingComponent {
    addProcessor(processor: SegmentProcessor): RemoveProcessor;
    process: NamedTask<Task<SegmentProcessorContext, SegmentProcessingComponentData, void>>;
}
export {};
