mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 13:53:53 +02:00
Remove InputTrack[] option for ConversionOptions.tracks
This commit is contained in:
+4
-16
@@ -72,10 +72,8 @@ export type ConversionOptions = {
|
|||||||
*
|
*
|
||||||
* - `'all'`: All input tracks are eligible for conversion.
|
* - `'all'`: All input tracks are eligible for conversion.
|
||||||
* - `'primary'`: Only the primary video and audio track from the input are eligible for conversion.
|
* - `'primary'`: Only the primary video and audio track from the input are eligible for conversion.
|
||||||
* - Array: A user-specified list of tracks that are eligible for conversion. These must all belong to the
|
|
||||||
* {@link Input} specified in {@link ConversionOptions.input}.
|
|
||||||
*/
|
*/
|
||||||
tracks?: 'all' | 'primary' | InputTrack[];
|
tracks?: 'all' | 'primary';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Video-specific options. When passing an object, the same options are applied to all video tracks. When passing a
|
* Video-specific options. When passing an object, the same options are applied to all video tracks. When passing a
|
||||||
@@ -619,19 +617,13 @@ export class Conversion {
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
options.tracks !== undefined
|
options.tracks !== undefined
|
||||||
&& !(
|
&& options.tracks !== 'all'
|
||||||
options.tracks === 'all'
|
&& options.tracks !== 'primary'
|
||||||
|| options.tracks === 'primary'
|
|
||||||
|| (Array.isArray(options.tracks) && options.tracks.every(x => x instanceof InputTrack))
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
'options.tracks, when provded, must be either \'all\', \'primary\', or an array of InputTrack.',
|
'options.tracks, when provded, must be either \'all\' or \'primary\'.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (Array.isArray(options.tracks) && !options.tracks.every(x => x.input === options.input)) {
|
|
||||||
throw new TypeError('Currently, all tracks in options.tracks must belong to options.input.');
|
|
||||||
}
|
|
||||||
if (
|
if (
|
||||||
options.output._tracks.length > 0
|
options.output._tracks.length > 0
|
||||||
|| Object.keys(options.output._metadataTags).length > 0
|
|| Object.keys(options.output._metadataTags).length > 0
|
||||||
@@ -708,9 +700,6 @@ export class Conversion {
|
|||||||
|
|
||||||
let tracks: InputTrack[];
|
let tracks: InputTrack[];
|
||||||
|
|
||||||
if (Array.isArray(this._options.tracks)) {
|
|
||||||
tracks = this._options.tracks;
|
|
||||||
} else {
|
|
||||||
let trackMode = this._options.tracks;
|
let trackMode = this._options.tracks;
|
||||||
if (trackMode === undefined) {
|
if (trackMode === undefined) {
|
||||||
// HACK to keep bundle size low, temp for now
|
// HACK to keep bundle size low, temp for now
|
||||||
@@ -732,7 +721,6 @@ export class Conversion {
|
|||||||
assertNever(trackMode);
|
assertNever(trackMode);
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const outputTrackCounts = this.output.format.getSupportedTrackCounts();
|
const outputTrackCounts = this.output.format.getSupportedTrackCounts();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user