2022-08-12 23:44:10 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-09-06 20:51:34 +00:00
|
|
|
/* eslint-disable camelcase */
|
|
|
|
|
2022-08-12 23:44:10 +00:00
|
|
|
declare module 'mp4box' {
|
2022-08-30 21:24:04 +00:00
|
|
|
type MP4MediaTrack = {
|
2022-08-12 23:44:10 +00:00
|
|
|
alternate_group: number;
|
|
|
|
bitrate: number;
|
|
|
|
codec: string;
|
|
|
|
created: Date;
|
|
|
|
duration: number;
|
|
|
|
id: number;
|
|
|
|
language: string;
|
|
|
|
layer: number;
|
|
|
|
modified: Date;
|
|
|
|
movie_duration: number;
|
|
|
|
nb_samples: number;
|
|
|
|
timescale: number;
|
|
|
|
track_height: number;
|
|
|
|
track_width: number;
|
|
|
|
volume: number;
|
2022-08-30 21:24:04 +00:00
|
|
|
};
|
2022-08-12 23:44:10 +00:00
|
|
|
|
2022-08-30 21:24:04 +00:00
|
|
|
type MP4VideoData = {
|
2022-08-12 23:44:10 +00:00
|
|
|
height: number;
|
|
|
|
width: number;
|
2022-08-30 21:24:04 +00:00
|
|
|
};
|
2022-08-12 23:44:10 +00:00
|
|
|
|
2022-08-30 21:24:04 +00:00
|
|
|
type MP4VideoTrack = MP4MediaTrack & {
|
2022-08-12 23:44:10 +00:00
|
|
|
video: MP4VideoData;
|
2022-08-30 21:24:04 +00:00
|
|
|
};
|
2022-08-12 23:44:10 +00:00
|
|
|
|
2022-08-30 21:24:04 +00:00
|
|
|
type MP4AudioData = {
|
2022-08-12 23:44:10 +00:00
|
|
|
channel_count: number;
|
|
|
|
sample_rate: number;
|
|
|
|
sample_size: number;
|
2022-08-30 21:24:04 +00:00
|
|
|
};
|
2022-08-12 23:44:10 +00:00
|
|
|
|
2022-08-30 21:24:04 +00:00
|
|
|
type MP4AudioTrack = MP4MediaTrack & {
|
2022-08-12 23:44:10 +00:00
|
|
|
audio: MP4AudioData;
|
2022-08-30 21:24:04 +00:00
|
|
|
};
|
2022-08-12 23:44:10 +00:00
|
|
|
|
|
|
|
type MP4Track = MP4VideoTrack | MP4AudioTrack;
|
|
|
|
|
2022-08-30 21:24:04 +00:00
|
|
|
type MP4Info = {
|
2022-08-12 23:44:10 +00:00
|
|
|
brands: Array<string>;
|
|
|
|
created: Date;
|
|
|
|
duration: number;
|
|
|
|
fragment_duration: number;
|
|
|
|
hasIOD: boolean;
|
|
|
|
isFragmented: boolean;
|
|
|
|
isProgressive: boolean;
|
|
|
|
mime: string;
|
|
|
|
modified: Date;
|
|
|
|
timescale: number;
|
|
|
|
tracks: Array<MP4Track>;
|
2022-08-30 21:24:04 +00:00
|
|
|
};
|
2022-08-12 23:44:10 +00:00
|
|
|
|
|
|
|
export type MP4ArrayBuffer = ArrayBuffer & { fileStart: number };
|
|
|
|
|
2022-08-30 21:24:04 +00:00
|
|
|
export type MP4File = {
|
2022-08-12 23:44:10 +00:00
|
|
|
appendBuffer(data: MP4ArrayBuffer): number;
|
|
|
|
flush(): void;
|
|
|
|
onError?: (e: string) => void;
|
|
|
|
onReady?: (info: MP4Info) => void;
|
2022-08-30 21:24:04 +00:00
|
|
|
};
|
2022-08-12 23:44:10 +00:00
|
|
|
|
|
|
|
export function createFile(): MP4File;
|
|
|
|
}
|