#ifndef LWVideoEncoder_h #define LWVideoEncoder_h #import #import #import "LWVideoEncoderConfig.h" typedef NS_ENUM(NSUInteger, LWVideoEncodeStatus) { kLWVideoEncodeStatus_Success, kLWVideoEncodeStatus_Err_Create, kLWVideoEncodeStatus_Err_Config, kLWVideoEncodeStatus_Err_Encode, kLWVideoEncodeStatus_Err_NO_Support, kLWVideoEncodeStatus_Err_NO_Initialized, kLWVideoEncodeStatus_Err_Invalid_Input, }; @protocol LWVideoEncoderDelegate @required - (void)onDidEncoded:(OSStatus)status sourceFrameRef:(void*)sourceFrameRef info:(VTEncodeInfoFlags)infoFlags sampleBuffer:(CMSampleBufferRef)sampleBuffer; @end @interface LWVideoEncoder : NSObject @property (strong, readonly, nonatomic) LWVideoEncoderConfig* config; @property (weak, nonatomic) id delegate; + (instancetype)newVideoEncoder:(LWVideoEncoderConfig*)config; - (instancetype)initWithConfig:(LWVideoEncoderConfig*)config; - (LWVideoEncodeStatus)encode:(CMSampleBufferRef)sampleBuffer sourceFrameRef:(void*)sourceFrameRef; - (LWVideoEncodeStatus)reconfig:(LWVideoEncoderConfig*)config; - (LWVideoEncodeStatus)setOptionWithInt32:(const NSString*)key value:(int32_t)value; - (LWVideoEncodeStatus)getOptionWithInt32:(const NSString*)key value:(int32_t*)value; @end #endif /* LWVideoEncoder_h */