Add API doc generator, improve documentation across the board

This commit is contained in:
Vanilagy
2025-09-03 18:11:43 +02:00
parent 9d70c4c605
commit a2a30c3e92
28 changed files with 2281 additions and 388 deletions
+15 -9
View File
@@ -14,6 +14,7 @@ import { Source } from './source';
/**
* The options for creating an Input object.
* @group Input files & tracks
* @public
*/
export type InputOptions<S extends Source = Source> = {
@@ -25,6 +26,7 @@ export type InputOptions<S extends Source = Source> = {
/**
* Represents an input media file. This is the root object from which all media read operations start.
* @group Input files & tracks
* @public
*/
export class Input<S extends Source = Source> {
@@ -39,6 +41,10 @@ export class Input<S extends Source = Source> {
/** @internal */
_reader: Reader;
/**
* Creates a new input file from the specified options. No reading operations will be performed until methods are
* called on this instance.
*/
constructor(options: InputOptions<S>) {
if (!options || typeof options !== 'object') {
throw new TypeError('options must be an object.');
@@ -81,9 +87,9 @@ export class Input<S extends Source = Source> {
}
/**
* Returns the format of the input file. You can compare this result directly to the InputFormat singletons or use
* `instanceof` checks for subset-aware logic (for example, `format instanceof MatroskaInputFormat` is true for
* both MKV and WebM).
* Returns the format of the input file. You can compare this result directly to the {@link InputFormat} singletons
* or use `instanceof` checks for subset-aware logic (for example, `format instanceof MatroskaInputFormat` is true
* for both MKV and WebM).
*/
async getFormat() {
await this._getDemuxer();
@@ -112,18 +118,18 @@ export class Input<S extends Source = Source> {
return tracks.filter(x => x.isVideoTrack());
}
/** Returns the primary video track of this input file, or null if there are no video tracks. */
async getPrimaryVideoTrack() {
const tracks = await this.getTracks();
return tracks.find(x => x.isVideoTrack()) ?? null;
}
/** Returns the list of all audio tracks of this input file. */
async getAudioTracks() {
const tracks = await this.getTracks();
return tracks.filter(x => x.isAudioTrack());
}
/** Returns the primary video track of this input file, or null if there are no video tracks. */
async getPrimaryVideoTrack() {
const tracks = await this.getTracks();
return tracks.find(x => x.isVideoTrack()) ?? null;
}
/** Returns the primary audio track of this input file, or null if there are no audio tracks. */
async getPrimaryAudioTrack() {
const tracks = await this.getTracks();