GPUImageRawDataInput.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. } GPUPixelFormat;
  11. typedef enum {
  12. GPUPixelTypeUByte = GL_UNSIGNED_BYTE,
  13. GPUPixelTypeFloat = GL_FLOAT
  14. } GPUPixelType;
  15. @interface GPUImageRawDataInput : GPUImageOutput
  16. {
  17. CGSize uploadedImageSize;
  18. dispatch_semaphore_t dataUpdateSemaphore;
  19. }
  20. // Initialization and teardown
  21. - (id)initWithBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize;
  22. - (id)initWithBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize pixelFormat:(GPUPixelFormat)pixelFormat;
  23. - (id)initWithBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize pixelFormat:(GPUPixelFormat)pixelFormat type:(GPUPixelType)pixelType;
  24. /** Input data pixel format
  25. */
  26. @property (readwrite, nonatomic) GPUPixelFormat pixelFormat;
  27. @property (readwrite, nonatomic) GPUPixelType pixelType;
  28. // Image rendering
  29. - (void)updateDataFromBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize;
  30. - (void)processData;
  31. - (void)processDataForTimestamp:(CMTime)frameTime;
  32. - (CGSize)outputImageSize;
  33. @end