public bool Decode(ref H264PictureInfo pictureInfo, ISurface output, ReadOnlySpan <byte> bitstream) { Surface outSurf = (Surface)output; if (outSurf.RequestedWidth != _oldOutputWidth || outSurf.RequestedHeight != _oldOutputHeight) { _context.Dispose(); _context = new FFmpegContext(AVCodecID.AV_CODEC_ID_H264); _oldOutputWidth = outSurf.RequestedWidth; _oldOutputHeight = outSurf.RequestedHeight; } Span <byte> bs = Prepend(bitstream, SpsAndPpsReconstruction.Reconstruct(ref pictureInfo, _workBuffer)); return(_context.DecodeFrame(outSurf, bs) == 0); }
public void Dispose() => _context.Dispose();