UNPKG

@isomp4/box-moof

Version:

Implements encoding and decoding of the moof box type

80 lines (79 loc) 2.91 kB
import type { Buffer } from "buffer"; import type { BoxHeader, FullBox } from "@isomp4/core"; import { FullBoxEncoding } from "@isomp4/core"; export interface TrackRunSample { duration?: number; size?: number; flags?: number; compositionTimeOffset?: number; } export declare namespace TrackRunSample { type UInt2 = 0 | 1 | 2 | 3; export interface Flags { /** * - 0: the leading nature of this sample is unknown. * - 1: this sample is a leading sample that has a dependency * before the referenced I‐picture (and is therefore not decodable). * - 2: this sample is not a leading sample. * - 3: this sample is a leading sample that has no dependency * before the referenced I‐picture (and is therefore decodable). */ isLeading: UInt2; /** * - 0: the dependency of this sample is unknown. * - 1: this sample does depend on others (not an I picture). * - 2: this sample does not depend on others (I picture). * - 3: reserved. */ dependsOn: UInt2; /** * - 0: the dependency of other samples on this sample is unknown. * - 1: other samples may depend on this one (not disposable). * - 2: no other sample depends on this one (disposable). * - 3: reserved. */ isDependedOn: UInt2; /** * - 0: it is unknown whether there is redundant coding in this sample. * - 1: there is redundant coding in this sample. * - 2: there is no redundant coding in this sample. * - 3: reserved. */ hasRedundancy: UInt2; /** * A byte-alignment padding value (from 0 to 7, inclusive). */ paddingValue: number; /** * Whether the sample is a keyframe (I picture). */ isSync: boolean; degradationPriority: number; } export function parseFlags(flags: number): Flags; export {}; } export interface TrackRunBox extends FullBox { dataOffset?: number; firstSampleFlags?: number; samples: TrackRunSample[]; } export declare namespace TrackRunBox { interface Flags { dataOffsetPresent: boolean; firstSampleFlagsPresent: boolean; sampleDurationPresent: boolean; sampleSizePresent: boolean; sampleFlagsPresent: boolean; sampleCompositionTimeOffsetsPresent: boolean; } function parseFlags(flags: number): Flags; } declare class TrackRunBoxEncoding extends FullBoxEncoding { constructor(); encodingLength(obj: TrackRunBox): number; encodeTo(obj: TrackRunBox, buffer: Buffer): number; decode(buffer: Buffer, header?: BoxHeader): TrackRunBox | number; } export declare const trun: TrackRunBoxEncoding; export {};