import type { ContextHaving, ContextUsing } from '../../../framework-types/execution-context/Types'; import type { NamedTask, Task } from '../../../framework-types/task/Types'; import type { BundleExportNames } from '../../bundles/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 { SegmentAtom } from '../core/state/segment/SegmentAtom'; import type { ContainerFormat, SegmentDataAtom } from '../core/state/segment/SegmentDataAtom'; import type { CoreExportNames, CoreStateAtoms } from '../core/Types'; import type { Logger } from '../core/utils/Logger'; import type { Transient } from '../core/utils/StateUtils'; import type { CoreUtils } from '../core/utils/Types'; import type { ContextWithState } from '../Types'; import type Errors from './Errors'; type ProcessorDependencies = { [BundleExportNames.Logger]: Logger; [CoreExportNames.Utils]: CoreUtils; [CoreExportNames.Constants]: Constants; [CoreExportNames.CoreStateAtoms]: CoreStateAtoms; [SegmentProcessingExportNames.SegmentProcessorErrors]: typeof Errors; }; 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 declare enum SegmentProcessorType { Decryptor = "decryptor", Parser = "parser", Preprocessor = "preprocessor", Transmuxer = "transmuxer", Postprocessor = "postprocessor" } 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; 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[]; }>; playbackTimeExtracted: Transient; durationExtracted: Transient; selectContainerFormat: SelectContainerFormatTask; }; export interface SegmentProcessingComponent { addProcessor(processor: SegmentProcessor): RemoveProcessor; process: NamedTask>; } export {};