FURecordEncoder.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // FURecordEncoder.h
  3. // FULive
  4. //
  5. // Created by L on 2018/1/15.
  6. // Copyright © 2018年 L. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AVFoundation/AVFoundation.h>
  10. /**
  11. * 写入并编码视频的的类
  12. */
  13. @interface FURecordEncoder : NSObject
  14. @property (nonatomic, readonly) NSString *path;
  15. /**
  16. * WCLRecordEncoder遍历构造器的
  17. *
  18. * @param path 媒体存发路径
  19. * @param cy 视频分辨率的高
  20. * @param cx 视频分辨率的宽
  21. * @param ch 音频通道
  22. * @param rate 音频的采样比率
  23. *
  24. * @return WCLRecordEncoder的实体
  25. */
  26. + (FURecordEncoder*)encoderForPath:(NSString*)path Height:(NSInteger)cy width:(NSInteger)cx channels: (int)ch samples:(Float64)rate;
  27. /**
  28. * 初始化方法
  29. *
  30. * @param path 媒体存发路径
  31. * @param cy 视频分辨率的高
  32. * @param cx 视频分辨率的宽
  33. * @param ch 音频通道
  34. * @param rate 音频的采样率
  35. *
  36. * @return WCLRecordEncoder的实体
  37. */
  38. - (instancetype)initPath:(NSString*)path Height:(NSInteger)cy width:(NSInteger)cx channels: (int)ch samples:(Float64)rate;
  39. /**
  40. * 完成视频录制时调用
  41. *
  42. * @param handler 完成的回掉block
  43. */
  44. - (void)finishWithCompletionHandler:(void (^)(void))handler;
  45. /**
  46. * 通过这个方法写入数据
  47. *
  48. * @param sampleBuffer 写入的数据
  49. * @param isVideo 是否写入的是视频
  50. *
  51. * @return 写入是否成功
  52. */
  53. - (BOOL)encodeFrame:(CMSampleBufferRef)sampleBuffer isVideo:(BOOL)isVideo;
  54. @end