Пример #1
0
        internal MediaPacketVideoPlane(MediaPacket packet, int index)
        {
            Debug.Assert(packet != null, "The packet is null!");
            Debug.Assert(!packet.IsDisposed, "Packet is already disposed!");
            Debug.Assert(index >= 0, "Video plane index must not be negative!");

            _packet = packet;

            int ret = Native.GetVideoStrideWidth(packet.GetHandle(), index, out _strideWidth);

            MultimediaDebug.AssertNoError(ret);

            ret = Native.GetVideoStrideHeight(packet.GetHandle(), index, out _strideHeight);
            MultimediaDebug.AssertNoError(ret);

            Debug.Assert(_strideWidth >= 0 && _strideHeight >= 0, "size must not be negative!");

            ret = Native.GetVideoPlaneData(packet.GetHandle(), index, out var dataHandle);
            MultimediaDebug.AssertNoError(ret);

            Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!");

            _buffer = new DependentMediaBuffer(packet, dataHandle, _strideWidth * _strideHeight);
        }