import { SocketDescriptor } from './socket'; export declare type MimeType = string; export declare type MimeTypes = MimeType[]; /** * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types * */ export declare enum CommonMimeTypes { AUDIO_MP3 = "audio/mpeg", AUDIO_AAC = "audio/aac", AUDIO_ADTS = "audio/adts", AUDIO_OPUS = "audio/opus", AUDIO_MP4 = "audio/mp4", VIDEO_MP4 = "video/mp4", VIDEO_H264_ANNEXB = "video/h264_annexb", VIDEO_H264_AU = "video/h264_au", VIDEO_H264 = "video/h264", VIDEO_MPEGTS = "video/MP2T", APP_HLS = "application/vnd.apple.mpegurl", APP_XMPEGURL = "application/x-mpegurl" } export declare enum CommonCodecFourCCs { mp4a = "mp4a", avc1 = "avc1", mp3 = ".mp3" } export declare enum MimetypePrefix { AUDIO = "audio", VIDEO = "video", TEXT = "text", APPLICATION = "application" } export declare const UNKNOWN_MIMETYPE = "unknown/*"; export declare class PayloadDescriptor { static fromMimeTypeParse(mimeType: string): SocketDescriptor; static fromMimeTypeShadow(prefix: MimetypePrefix): PayloadDescriptor; /** * mime-type if defined */ readonly mimeType: MimeType; /** * unit-less factor to deal with arbitrary integer sample-rates without loosing precision */ readonly sampleDurationNumerator: number; /** * integer bit-depth of one sample */ readonly sampleDepth: SampleBitDepth; /** * Hertz [Hz] */ readonly sampleRateInteger: number; /** * data format/layout applicable for raw signal packets */ readonly dataFormat: PayloadDataFormat; readonly dataLayout: PayloadDataLayout; /** * payload specific details (applicable to audio/video/text etc only e.g or codec-data related) */ details: PayloadDetails; elementaryStreamId: number; /** * codec (if applicable) */ codec: string; constructor(mimeType: string, sampleRateInteger?: number, sampleDepth?: number, sampleDurationNumerator?: number); getFullMimeType(): string; /** * The term sub-type is from the MIME-Type (Internet Media Type) standard reference. * * In fact, this is likely what one would see as "the file format". */ getMediaSubtype(stripCodecs?: boolean): string; /** * e.g audio, video, text, application etc ... (see enum MimetypePrefix) */ getMediaType(): string; protected _getMimeTypePart(i: number): string; hasCodec(): boolean; /** * Sample-duration in normal units ([1/Hz] <=> [s]) * * By default the sampleRate is expected to be in 1*Hz. The unit to expect can be scaled using * the optional unit-less numerator property to N*Hz. Meaning that the unit is not 1/[s] anymore but 1/(N*[s]), * representing the number of sample in N seconds. * * That means that any sample-rates of the form no-of-samples-per-N-seconds [Hz], * where no-of-samples and N is should be integers, can be represented without precision loss. * * Also floating point values may be used but this may yield precision loss when computing the duration here. */ getSampleDuration(): number; /** * Sampling-rate in normal units ([Hz] <=> [1/s]) * * see getSampleDuration, simply the inverted value */ getSamplingRate(): number; /** * Returns size of one sample in bytes */ getSampleSize(): number; isAudio(): boolean; isVideo(): boolean; isText(): boolean; isImage(): boolean; isApplicationSpecific(): boolean; isFont(): boolean; isJson(): boolean; isXml(): boolean; toString(): string; } export declare class PayloadDetails { sequenceDurationInSeconds: number; codecExtraData: ArrayBuffer; codecProfile: number; width: number; height: number; samplesPerFrame: number; numChannels: number; constantBitrate: number; toString(): string; } export declare class PayloadCodec { static isAvc(codec: string): boolean; static isAac(codec: string): boolean; static isMp3(codec: string): boolean; } export declare enum PayloadDataFormat { UNSPECIFIED = 0, S_LE = 1, S_BE = 2, U_LE = 3, U_BE = 4 } export declare enum PayloadDataLayout { UNSPECIFIED = 0, INTERLEAVED = 1, PROGRESSIVE = 2 } export declare enum SampleBitDepth { UNSPECIFIED = NaN, VARIABLE = 0, FOUR = 4, EIGHT = 8, TWELVE = 12, SIXTEEN = 16, THIRTYTWO = 32 }