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, ContainerFormat, 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 { SegmentDataAtom } from '../stream-data-structure/segment/SegmentDataAtom'; import type { ContextWithState } from '../Types'; import type Errors from './Errors'; import type { SegmentProcessorType } from './SegmentProcessorType'; export type { SegmentProcessorType } from './SegmentProcessorType'; 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>; export type CodecMap = { [key in MediaType]?: string[]; }; export type VideoInfo = { width: number; height: number; }; type BaseProcessorData = { segment: SegmentAtom; input: DataStreamAtom; output: DataStreamAtom; }; type BaseSegmentProcessor = { name: string; type: SegmentProcessorType; process: NamedTask>; }; export type SegmentDecryptorData = BaseProcessorData; export type SegmentDecryptor = BaseSegmentProcessor & { type: SegmentProcessorType.Decryptor; supportedEncryptionFormats: string[]; }; export type SegmentParserData = BaseProcessorData & { segment: SegmentAtom; codecsExtracted: Transient; videoInfoExtracted: Transient; playbackTimeExtracted: Transient; durationExtracted: Transient; }; export type SegmentParser = BaseSegmentProcessor & { type: SegmentProcessorType.Parser; container: ContainerFormat; }; export type SegmentPreprocessorData = BaseProcessorData; export type SegmentPreprocessor = BaseSegmentProcessor & { type: SegmentProcessorType.Preprocessor; container: ContainerFormat; }; export type SegmentTransmuxerData = BaseProcessorData; export type SegmentTransmuxer = BaseSegmentProcessor & { type: SegmentProcessorType.Transmuxer; inputContainer: ContainerFormat; outputContainer: ContainerFormat; inputCodecsExtracted: Transient; outputCodecsExtracted: Transient; }; export type SegmentPostprocessorData = BaseProcessorData; export type SegmentPostprocessor = BaseSegmentProcessor & { 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>; export type SegmentProcessingComponentData = BaseProcessorData & { codecsExtracted: Transient<{ [key in MediaType]?: string[]; }>; videoInfoExtracted: Transient; playbackTimeExtracted: Transient; durationExtracted: Transient; selectContainerFormat: SelectContainerFormatTask; }; export interface SegmentProcessingComponent { addProcessor(processor: SegmentProcessor): RemoveProcessor; process: NamedTask>; }