FUVideoReader.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // FUVideoReader.h
  3. // AVAssetReader2
  4. //
  5. // Created by L on 2018/6/13.
  6. // Copyright © 2018年 千山暮雪. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AVFoundation/AVFoundation.h>
  10. typedef NS_ENUM(NSInteger, FUVideoReaderOrientation) {
  11. FUVideoReaderOrientationPortrait = 0,
  12. FUVideoReaderOrientationLandscapeRight = 1,
  13. FUVideoReaderOrientationUpsideDown = 2,
  14. FUVideoReaderOrientationLandscapeLeft = 3,
  15. };
  16. @protocol FUVideoReaderDelegate <NSObject>
  17. @optional
  18. // 每一帧视频数据
  19. - (void)videoReaderDidReadVideoBuffer:(CVPixelBufferRef)pixelBuffer;
  20. // 读写视频完成
  21. - (void)videoReaderDidFinishReadSuccess:(BOOL)success ;
  22. @end
  23. @interface FUVideoReader : NSObject
  24. @property (nonatomic, assign) id<FUVideoReaderDelegate>delegate ;
  25. @property (nonatomic, strong) NSURL *videoURL ;
  26. // 视频朝向
  27. @property (nonatomic, assign, readonly) FUVideoReaderOrientation videoOrientation ;
  28. - (instancetype)initWithVideoURL:(NSURL *)videoRUL;
  29. // 只读 第一帧
  30. - (void)startReadForFirstFrame ;
  31. // 只读 最后一帧
  32. - (void)startReadForLastFrame ;
  33. // 读写整个视频
  34. - (void)startReadWithDestinationPath:(NSString *)destinationPath ;
  35. // 停止
  36. - (void)stopReading ;
  37. /* 继续 */
  38. -(void)continueReading;
  39. // 销毁
  40. - (void)destory ;
  41. @end