Example #1
0
        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();

                _oldOutputWidth  = outSurf.RequestedWidth;
                _oldOutputHeight = outSurf.RequestedHeight;
            }

            Span <byte> bs = Prepend(bitstream, SpsAndPpsReconstruction.Reconstruct(ref pictureInfo, _workBuffer));

            return(_context.DecodeFrame(outSurf, bs) == 0);
        }
Example #2
0
 public void Dispose() => _context.Dispose();