mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-10 01:03:45 +02:00
Add license headers, add @mediabunny/server to build process, add doc blocks, small fixes
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
/*!
|
||||
* Copyright (c) 2026-present, Vanilagy and contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { registerDecoder, registerEncoder, registerVideoSampleTransformer } from 'mediabunny';
|
||||
import * as NodeAv from 'node-av';
|
||||
import { NodeAvVideoDecoder } from './video-decoder';
|
||||
@@ -18,6 +26,20 @@ if ((globalThis as Record<symbol, unknown>)[SERVER_LOADED_SYMBOL]) {
|
||||
(globalThis as Record<symbol, unknown>)[SERVER_LOADED_SYMBOL] = true;
|
||||
|
||||
let registered = false;
|
||||
|
||||
/**
|
||||
* Registers video and audio decoders and encoders for all codecs, using FFmpeg's libavcodec under the hood.
|
||||
* Additionally, a custom `VideoSample` transformer based on libavfilter is registered to enable resizing, rotation and
|
||||
* cropping of video frames.
|
||||
*
|
||||
* Make sure to call this function before interacting with Mediabunny.
|
||||
*
|
||||
* The decoders and encoders will automatically detect hardware acceleration support for each codec and platform and
|
||||
* make use of it if applicable.
|
||||
*
|
||||
* @group \@mediabunny/server
|
||||
* @public
|
||||
*/
|
||||
export const registerMediabunnyServer = () => {
|
||||
if (registered) {
|
||||
return;
|
||||
@@ -36,3 +58,6 @@ export const registerMediabunnyServer = () => {
|
||||
|
||||
registerVideoSampleTransformer(transformVideoSample);
|
||||
};
|
||||
|
||||
export { NodeAvFrameVideoSampleResource } from './video-sample';
|
||||
export { NodeAvFrameAudioSampleResource } from './audio-sample';
|
||||
|
||||
Reference in New Issue
Block a user