Beispiel #1
0
        public void Update(IntPtr newData, int planeIndex = 0)
        {
            if (format == null)
            {
                throw new InvalidOperationException($"{nameof(VideoFrame)} 对象未指定格式");
            }
            if (planeIndex < 0 || planeIndex >= format.PlaneCount)
            {
                throw new ArgumentOutOfRangeException(nameof(planeIndex), $"{nameof(planeIndex)}必须大于等于0,且小于格式的{nameof(format.PlaneCount)}");
            }

            var bytewidth = FF.av_image_get_linesize(format.PixelFormat, format.Width, planeIndex);

            FF.av_image_copy_plane((byte *)datas[planeIndex], format.strides[planeIndex], (byte *)newData, format.strides[planeIndex], bytewidth, format.Height);
        }