GPUImageRawDataInput.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #import "GPUImageOutput.h"
  2. // The bytes passed into this input are not copied or retained, but you are free to deallocate them after they are used by this filter.
  3. // The bytes are uploaded and stored within a texture, so nothing is kept locally.
  4. // The default format for input bytes is GPUPixelFormatBGRA, unless specified with pixelFormat:
  5. // The default type for input bytes is GPUPixelTypeUByte, unless specified with pixelType:
  6. typedef enum {
  7. GPUPixelFormatBGRA = GL_BGRA,
  8. GPUPixelFormatRGBA = GL_RGBA,
  9. GPUPixelFormatRGB = GL_RGB,
  10. GPUPixelFormatLuminance = GL_LUMINANCE
  11. } GPUPixelFormat;
  12. typedef enum {
  13. GPUPixelTypeUByte = GL_UNSIGNED_BYTE,
  14. GPUPixelTypeFloat = GL_FLOAT
  15. } GPUPixelType;
  16. @interface GPUImageRawDataInput : GPUImageOutput
  17. {
  18. CGSize uploadedImageSize;
  19. dispatch_semaphore_t dataUpdateSemaphore;
  20. }
  21. // Initialization and teardown
  22. - (id)initWithBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize;
  23. - (id)initWithBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize pixelFormat:(GPUPixelFormat)pixelFormat;
  24. - (id)initWithBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize pixelFormat:(GPUPixelFormat)pixelFormat type:(GPUPixelType)pixelType;
  25. /** Input data pixel format
  26. */
  27. @property (readwrite, nonatomic) GPUPixelFormat pixelFormat;
  28. @property (readwrite, nonatomic) GPUPixelType pixelType;
  29. // Image rendering
  30. - (void)updateDataFromBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize;
  31. - (void)processData;
  32. - (void)processDataForTimestamp:(CMTime)frameTime;
  33. - (CGSize)outputImageSize;
  34. @end