12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //
- // ESCVideoToolboxEncodeH264DataTool.h
- // ESCCameraH264Demo
- //
- // Created by xiang on 2019/4/28.
- // Copyright © 2019 xiang. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- NS_ASSUME_NONNULL_BEGIN
- typedef NS_CLOSED_ENUM(NSInteger, VideoCodecType) {
- VideoCodecType_H264 = 0L,
- VideoCodecType_H265
- };
- @class RCYUVEncoder;
- @protocol ESCVideoToolboxYUVEncoderToolDelegate<NSObject>
- /**
- 压缩后的h264数据流
- */
- - (void)encoder:(RCYUVEncoder *)encoder encodeData:(void *)encodeData dataLenth:(NSInteger)lenth;
- /**
- 压缩结束
- */
- - (void)encoderEnd:(RCYUVEncoder *)encoder;
- @end
- @interface RCYUVEncoder : NSObject
- @property(nonatomic,weak)id delegate;
- //sps和pps数据是否包含在关键帧前面,默认为YES
- @property(nonatomic,assign)BOOL spsAndPpsIsIncludedInIframe;
- - (instancetype)initWithCodecType:(VideoCodecType)codecType;
- /**
- yuv流转h264流
- */
- - (void)setupVideoWidth:(NSInteger)width
- height:(NSInteger)height
- frameRate:(NSInteger)frameRate
- delegate:(id<ESCVideoToolboxYUVEncoderToolDelegate>)delegate;
- /**
- 填充需要压缩的yuv流数据
- */
- - (void)encoderYUVData:(NSData *)yuvData;
- /**
- yuv流数据接收完毕
- */
- -(void)endYUVDataStream;
- @end
- NS_ASSUME_NONNULL_END
|