From 72eb54391e7abc3348e857f7d71985d981314a6e Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Sun, 24 Aug 2025 18:10:35 +0200 Subject: [PATCH] Reorder --- src/conversion.ts | 74 +++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/conversion.ts b/src/conversion.ts index b392717..92c1e7c 100644 --- a/src/conversion.ts +++ b/src/conversion.ts @@ -41,6 +41,43 @@ import { assert, clamp, MaybePromise, normalizeRotation, promiseWithResolvers, R import { Output, TrackType } from './output'; import { AudioSample, VideoSample } from './sample'; +/** + * The options for media file conversion. + * @public + */ +export type ConversionOptions = { + /** The input file. */ + input: Input; + /** The output file. */ + output: Output; + + /** + * Video-specific options. When passing an object, the same options are applied to all video tracks. When passing a + * function, it will be invoked for each video track and is expected to return or resolve to the options + * for that specific track. The function is passed an instance of `InputVideoTrack` as well as a number `n`, which + * is the 1-based index of the track in the list of all video tracks. + */ + video?: ConversionVideoOptions + | ((track: InputVideoTrack, n: number) => MaybePromise); + + /** + * Audio-specific options. When passing an object, the same options are applied to all audio tracks. When passing a + * function, it will be invoked for each audio track and is expected to return or resolve to the options + * for that specific track. The function is passed an instance of `InputAudioTrack` as well as a number `n`, which + * is the 1-based index of the track in the list of all audio tracks. + */ + audio?: ConversionAudioOptions + | ((track: InputAudioTrack, n: number) => MaybePromise); + + /** Options to trim the input file. */ + trim?: { + /** The time in the input file in seconds at which the output file should start. Must be less than `end`. */ + start: number; + /** The time in the input file in seconds at which the output file should end. Must be greater than `start`. */ + end: number; + }; +}; + /** * Video-specific options. * @public @@ -162,43 +199,6 @@ const validateVideoOptions = (videoOptions: ConversionVideoOptions | undefined) } }; -/** - * The options for media file conversion. - * @public - */ -export type ConversionOptions = { - /** The input file. */ - input: Input; - /** The output file. */ - output: Output; - - /** - * Video-specific options. When passing an object, the same options are applied to all video tracks. When passing a - * function, it will be invoked for each video track and is expected to return or resolve to the options - * for that specific track. The function is passed an instance of `InputVideoTrack` as well as a number `n`, which - * is the 1-based index of the track in the list of all video tracks. - */ - video?: ConversionVideoOptions - | ((track: InputVideoTrack, n: number) => MaybePromise); - - /** - * Audio-specific options. When passing an object, the same options are applied to all audio tracks. When passing a - * function, it will be invoked for each audio track and is expected to return or resolve to the options - * for that specific track. The function is passed an instance of `InputAudioTrack` as well as a number `n`, which - * is the 1-based index of the track in the list of all audio tracks. - */ - audio?: ConversionAudioOptions - | ((track: InputAudioTrack, n: number) => MaybePromise); - - /** Options to trim the input file. */ - trim?: { - /** The time in the input file in seconds at which the output file should start. Must be less than `end`. */ - start: number; - /** The time in the input file in seconds at which the output file should end. Must be greater than `start`. */ - end: number; - }; -}; - const validateAudioOptions = (audioOptions: ConversionAudioOptions | undefined) => { if (audioOptions !== undefined && (!audioOptions || typeof audioOptions !== 'object')) { throw new TypeError('options.audio, when provided, must be an object.');