Exemplo n.º 1
0
            public BufferHelper(Sample sample, int sampleHeight)
            {
                buffer2D = null;
                buffer   = sample.ConvertToContiguousBuffer();
                buffer2D = buffer.QueryInterfaceOrNull <SharpDX.MediaFoundation.Buffer2D>();
                int length = 0, pitch = 0;

                if (buffer2D != null)
                {
                    byte[] arr = new byte[IntPtr.Size];
                    buffer2D.Lock2D(arr, out pitch);
                    length = buffer2D.ContiguousLength;
                    Data   = new IntPtr(BitConverter.ToInt32(arr, 0));
                }
                else
                {
                    int curlen;
                    Data  = buffer.Lock(out length, out curlen);
                    pitch = length / sampleHeight;
                }
                Length = length;
                Pitch  = pitch;
            }