MediaCodecBackend Class
The audio and video codecs plugged into the browsing contexts (BrowsingContextOptions.MediaCodecs): the implementations of the decoders and the encoders of WebCodecs (https://w3c.github.io/webcodecs/), also used by MediaRecorder. The backend tells which configurations it supports and creates the codec implementations; the library implements the codec processing model on top of them (the states, the control message queue, the queue sizes and the dequeue events, flush(), reset(), close(), the output and error callbacks, the validation and the cloning of the configurations, the decoder configuration of the encoded chunks).
public abstract class MediaCodecBackendRemarks
Without a backend (the default), there is no codec: isConfigSupported() resolves with supported: false, and configure() closes the codec with a NotSupportedError.
A backend can be shared by several browsing contexts and by their workers: its methods may be called from several threads, each codec implementation being used by the thread of the event loop of its codec. The codec implementations run in the tasks of that event loop, one operation at a time. The configurations given to the backend are clones with the members recognized by the library: their description is a Byte array. MediaCodecString parses the codec strings of the WebCodecs codec registry.
Constructors
| Name | Description |
|---|---|
| MediaCodecBackend() |
MediaCodecBackend()
protected MediaCodecBackend()No documentation is available.
Methods
| Name | Description |
|---|---|
| CreateAudioDecoder(AudioDecoderConfig) | Creates an audio decoder for a configuration that MediaCodecBackend.IsConfigSupported accepts, or returns null when it cannot (the codec is closed with a NotSupportedError). The default implementation returns null. |
| CreateAudioEncoder(AudioEncoderConfig) | Creates an audio encoder for a supported configuration, or returns null. The default implementation returns null. |
| CreateVideoDecoder(VideoDecoderConfig) | Creates a video decoder for a supported configuration, or returns null. The default implementation returns null. |
| CreateVideoEncoder(VideoEncoderConfig) | Creates a video encoder for a supported configuration, or returns null. The default implementation returns null. |
| IsConfigSupported(AudioDecoderConfig) | Returns whether the backend can decode the audio of a configuration (https://w3c.github.io/webcodecs/#check-configuration-support). The configuration is valid (its codec string is not empty); the codec string is case-sensitive and must not have leading or trailing spaces. The default implementation returns false. |
| IsConfigSupported(AudioEncoderConfig) | Returns whether the backend can encode audio with a configuration. The default implementation returns false. |
| IsConfigSupported(VideoDecoderConfig) | Returns whether the backend can decode the video of a configuration. The default implementation returns false. |
| IsConfigSupported(VideoEncoderConfig) | Returns whether the backend can encode video with a configuration. The default implementation returns false. |
CreateAudioDecoder(AudioDecoderConfig)
MediaCodecBackend.csCreates an audio decoder for a configuration that MediaCodecBackend.IsConfigSupported accepts, or returns null when it cannot (the codec is closed with a NotSupportedError). The default implementation returns null.
public virtual MediaAudioDecoder? CreateAudioDecoder(AudioDecoderConfig config)CreateAudioEncoder(AudioEncoderConfig)
MediaCodecBackend.csCreates an audio encoder for a supported configuration, or returns null. The default implementation returns null.
public virtual MediaAudioEncoder? CreateAudioEncoder(AudioEncoderConfig config)CreateVideoDecoder(VideoDecoderConfig)
MediaCodecBackend.csCreates a video decoder for a supported configuration, or returns null. The default implementation returns null.
public virtual MediaVideoDecoder? CreateVideoDecoder(VideoDecoderConfig config)CreateVideoEncoder(VideoEncoderConfig)
MediaCodecBackend.csCreates a video encoder for a supported configuration, or returns null. The default implementation returns null.
public virtual MediaVideoEncoder? CreateVideoEncoder(VideoEncoderConfig config)IsConfigSupported overloads
IsConfigSupported(AudioDecoderConfig)
MediaCodecBackend.csReturns whether the backend can decode the audio of a configuration (https://w3c.github.io/webcodecs/#check-configuration-support). The configuration is valid (its codec string is not empty); the codec string is case-sensitive and must not have leading or trailing spaces. The default implementation returns false.
public virtual bool IsConfigSupported(AudioDecoderConfig config)IsConfigSupported(AudioEncoderConfig)
MediaCodecBackend.csReturns whether the backend can encode audio with a configuration. The default implementation returns false.
public virtual bool IsConfigSupported(AudioEncoderConfig config)IsConfigSupported(VideoDecoderConfig)
MediaCodecBackend.csReturns whether the backend can decode the video of a configuration. The default implementation returns false.
public virtual bool IsConfigSupported(VideoDecoderConfig config)IsConfigSupported(VideoEncoderConfig)
MediaCodecBackend.csReturns whether the backend can encode video with a configuration. The default implementation returns false.
public virtual bool IsConfigSupported(VideoEncoderConfig config)