Skip to content

feat: export BOXES and SampleEntry #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions entries/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export * from '#/text-mp4';
export * from './types';
import * as DESCRIPTORS from '#/descriptor';
import { registerBoxes, registerDescriptors } from '#/registry';

import * as BOXES from './all-boxes';
export { BOXES };
export * from '#/boxes/sampleentries';

export const BoxParser = registerBoxes(BOXES);

Expand Down
8 changes: 4 additions & 4 deletions src/boxes/sampleentries/sampleentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function decimalToHex(d: number | string, padding?: number | null) {
return hex;
}

class avcCSampleEntryBase extends VisualSampleEntry {
export class avcCSampleEntryBase extends VisualSampleEntry {
avcC: avcCBox;
avcCs: Array<avcCBox>;

Expand Down Expand Up @@ -96,7 +96,7 @@ export class dav1SampleEntry extends VisualSampleEntry {
static override readonly fourcc = 'dav1' as const;
}

class hvcCSampleEntryBase extends VisualSampleEntry {
export class hvcCSampleEntryBase extends VisualSampleEntry {
hvcC: hvcCBox;
hvcCs: Array<hvcCBox>;

Expand Down Expand Up @@ -191,7 +191,7 @@ export class dvheSampleEntry extends VisualSampleEntry {
}

/** @babel box-codecs.js */
class vvcCSampleEntryBase extends VisualSampleEntry {
export class vvcCSampleEntryBase extends VisualSampleEntry {
vvcC: vvcCBox;
vvcCs: Array<vvcCBox>;
getCodec() {
Expand Down Expand Up @@ -269,7 +269,7 @@ export class vvcNSampleEntry extends VisualSampleEntry {
static override readonly fourcc = 'vvcN' as const;
}

class vpcCSampleEntryBase extends VisualSampleEntry {
export class vpcCSampleEntryBase extends VisualSampleEntry {
vpcC: vpcCBox;
vpcCs: Array<vpcCBox>;
getCodec() {
Expand Down
4 changes: 4 additions & 0 deletions src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export function registerBoxes(registry: Record<string, object>) {

// Check if SampleEntry class
if (isSampleEntry(value)) {
if (key.endsWith('SampleEntryBase')) {
continue;
}

const fourcc = 'fourcc' in value ? (value.fourcc as string) : undefined;

if (!fourcc) {
Expand Down