interface AV1Lib {
int newDecoder()
PixelMapYUV[] decode(int handle, byte encoded[], WH sz)
void destroyDecoder(int handle)
int newEncoder(int w, int h, int fps, int bps)
EncodedFrame[] encode(int handle, PixelMapYUV frame, bool keyFrame)
EncodedFrame[] finishEncode(int handle)
void destroyEncoder(int handle)
}
component provides Encoder:av1(Destructor) requires native AV1Lib lib {
int handle
WH sz
Encoder:Encoder(store WH size, int fps, int bps)
{
handle = lib.newEncoder(size.width, size.height, fps, bps)
if (handle == 0) throw new Exception("encoder initialisation failed")
sz = size
}
EncodedFrame[] Encoder:encode(PixelMapYUV frame, bool keyFrame)
{
return lib.encode(handle, frame, keyFrame)
}
EncodedFrame[] Encoder:finish()
{
return lib.finishEncode(handle)
}
void Destructor:destroy()
{
if (handle != 0) lib.destroyEncoder(handle)
}
}To propose a new revision to this entity, use dana source put -uc your/new/version.dn -n media.video.Encoder:av1 -m "reason for update" -u yourUsername
Version 1 (this version) by barry
Notes for this version: Adds video encoder API