mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-28 03:13:51 +02:00
* ac3/eac3 detection * fix tests * review pass + follow codebase comments style * Add ac3/eac3 to docs * WIP mpeg-2 * Set registration_descriptor * add support for ac3 system b in mpeg-ts * Update docs with ac3 in .ts support * fix formatting * Remove default to fix linter * Add eac3 to mpeg-ts * fix formatting * Fix failing test * Refactor AC3/EAC3 code a little --------- Co-authored-by: Vanilagy <[email protected]>
33 lines
865 B
TypeScript
33 lines
865 B
TypeScript
/*!
|
|
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
export const TIMESCALE = 90_000; // MPEG-TS timestamps run on a 90 kHz clock
|
|
export const TS_PACKET_SIZE = 188;
|
|
|
|
export const enum MpegTsStreamType {
|
|
MP3_MPEG1 = 0x03,
|
|
MP3_MPEG2 = 0x04,
|
|
AAC = 0x0f,
|
|
AC3_SYSTEM_A = 0x81,
|
|
EAC3_SYSTEM_A = 0x87,
|
|
PRIVATE_DATA = 0x06,
|
|
AVC = 0x1b,
|
|
HEVC = 0x24,
|
|
}
|
|
|
|
export const buildMpegTsMimeType = (codecStrings: (string | null)[]) => {
|
|
let string = 'video/MP2T';
|
|
|
|
const uniqueCodecStrings = [...new Set(codecStrings.filter(Boolean))];
|
|
if (uniqueCodecStrings.length > 0) {
|
|
string += `; codecs="${uniqueCodecStrings.join(', ')}"`;
|
|
}
|
|
|
|
return string;
|
|
};
|