KSYGPUViewCapture.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // KSYGPUViewCapture.h
  3. // KSYStreamer
  4. //
  5. // Created by yiqian on 1/30/16.
  6. // Copyright © 2016 yiqian. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AVFoundation/AVFoundation.h>
  10. #import <CoreMedia/CoreMedia.h>
  11. #import <GPUImage/GPUImage.h>
  12. /** GPU UIView视图 采集模块
  13. * 采集UIView视图的内容到GPU
  14. * 内部使用 CADisplayLink 作为timer 驱动画面更新
  15. * 可通过属性设置更新频率
  16. */
  17. @interface KSYGPUViewCapture : GPUImageOutput
  18. /**
  19. 设置需要采集的视图
  20. @param inputView 被采集的视图
  21. @return 采集实例
  22. */
  23. - (id)initWithView:(UIView *)inputView;
  24. /**
  25. 设置需要采集的视图图层
  26. @param inputLayer 被采集的图层
  27. @return 采集实例
  28. */
  29. - (id)initWithLayer:(CALayer *)inputLayer;
  30. // Layer management
  31. - (CGSize)layerSizeInPixels;
  32. /** 更新画面内容 使用无效时间戳 */
  33. - (void)update;
  34. /** 更新画面内容 使用当前时间戳 */
  35. - (void)updateUsingCurrentTime;
  36. /**
  37. 更新画面内容
  38. @param frameTime 时间戳
  39. */
  40. - (void)updateWithTimestamp:(CMTime)frameTime;
  41. /// UI刷新的频率 默认值为15 (有效值fps=60/N, 比如60, 30, 20, 15, 10等)
  42. @property int updateFps;
  43. /** 启动采集 */
  44. - (void) start;
  45. /** 停止采集 */
  46. - (void) stop;
  47. /** 暂停 / 继续 */
  48. @property BOOL paused;
  49. @end