mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-28 11:23:45 +02:00
Add VideoSample.transform(), add custom transformer functions, ditch CanvasSink path in Conversion API, add libavfilter-based VideoSample transformation
This commit is contained in:
+8
-2
@@ -113,6 +113,10 @@ export type VideoTransformOptions = {
|
||||
* clamped to the dimensions of the frame. Cropping is performed after rotation but before resizing.
|
||||
*/
|
||||
crop?: CropRectangle;
|
||||
/**
|
||||
* Whether to discard or keep the transparency information of the video samples. The default is `'keep'`.
|
||||
*/
|
||||
alpha?: 'keep' | 'discard';
|
||||
/**
|
||||
* The frame rate in hertz to normalize the video frame stream to.
|
||||
*/
|
||||
@@ -193,10 +197,12 @@ export const validateVideoEncodingConfig = (config: VideoEncodingConfig) => {
|
||||
if (
|
||||
config.transform.fit !== undefined
|
||||
&& ['fill', 'contain', 'cover'].includes(config.sizeChangeBehavior!)
|
||||
&& config.transform.fit !== config.sizeChangeBehavior
|
||||
) {
|
||||
throw new TypeError(
|
||||
'config.transform.fit cannot be used when config.sizeChangeBehavior is \'fill\', \'contain\' or'
|
||||
+ ' \'cover\', as sizeChangeBehavior already determines the fitting algorithm.',
|
||||
'config.transform.fit, when provided, cannot differ from config.sizeChangeBehavior when'
|
||||
+ ' config.sizeChangeBehavior is \'fill\', \'contain\' or \'cover\', as sizeChangeBehavior already'
|
||||
+ ' determines the fitting algorithm.',
|
||||
);
|
||||
}
|
||||
if (config.transform.rotate !== undefined && ![0, 90, 180, 270].includes(config.transform.rotate)) {
|
||||
|
||||
Reference in New Issue
Block a user