Class CVPixelBuffer


  • public class CVPixelBuffer
    extends CVImageBuffer
    Represents a CoreVideo CVPixelBufferRef.
    Author:
    Lyubomir Marinov
    • Constructor Summary

      Constructors 
      Constructor Description
      CVPixelBuffer​(long ptr)
      Initializes a new CVPixelBuffer instance which is to represent a specific CoreVideo CVPixelBufferRef.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getByteCount()
      Gets the number of bytes which represent the pixels of the associated CoreVideo CVPixelBufferRef.
      byte[] getBytes()
      Gets a byte array which represents the pixels of the associated CoreVideo CVPixelBufferRef.
      int getBytes​(long buf, int bufLength)
      Gets the bytes which represent the pixels of the associated CVPixelBufferRef into a specific native byte buffer with a specific capacity.
      int getHeight()
      Gets the height in pixels of this CVPixelBuffer.
      int getWidth()
      Gets the width in pixels of this CVPixelBuffer.
      static void memcpy​(byte[] dst, int dstOffset, int dstLength, long src)
      Native copy from native pointer src to byte array dst.
    • Constructor Detail

      • CVPixelBuffer

        public CVPixelBuffer​(long ptr)
        Initializes a new CVPixelBuffer instance which is to represent a specific CoreVideo CVPixelBufferRef.
        Parameters:
        ptr - the CoreVideo CVPixelBufferRef to be represented by the new instance
    • Method Detail

      • getByteCount

        public int getByteCount()
        Gets the number of bytes which represent the pixels of the associated CoreVideo CVPixelBufferRef.
        Returns:
        the number of bytes which represent the pixels of the associated CoreVideo CVPixelBufferRef
      • getBytes

        public byte[] getBytes()
        Gets a byte array which represents the pixels of the associated CoreVideo CVPixelBufferRef.
        Returns:
        a byte array which represents the pixels of the associated CoreVideo CVPixelBufferRef
      • getBytes

        public int getBytes​(long buf,
                            int bufLength)
        Gets the bytes which represent the pixels of the associated CVPixelBufferRef into a specific native byte buffer with a specific capacity.
        Parameters:
        buf - the native byte buffer to return the bytes into
        bufLength - the capacity in bytes of buf
        Returns:
        the number of bytes written into buf
      • getHeight

        public int getHeight()
        Gets the height in pixels of this CVPixelBuffer.
        Returns:
        the height in pixels of this CVPixelBuffer
      • getWidth

        public int getWidth()
        Gets the width in pixels of this CVPixelBuffer.
        Returns:
        the width in pixels of this CVPixelBuffer
      • memcpy

        public static void memcpy​(byte[] dst,
                                  int dstOffset,
                                  int dstLength,
                                  long src)
        Native copy from native pointer src to byte array dst.
        Parameters:
        dst - destination array
        dstOffset - offset of dst to copy data to
        dstLength - length of dst
        src - native pointer source