// // WCLRecordEncoder.h // WCL // // ************************************************** // * _____ * // * __ _ __ ___ \ / * // * \ \/ \/ / / __\ / / * // * \ _ / | (__ / / * // * \/ \/ \___/ / /__ * // * /_____/ * // * * // ************************************************** // Github :https://github.com/631106979 // HomePage:https://imwcl.com // CSDN :http://blog.csdn.net/wang631106979 // // Created by 王崇磊 on 16/9/14. // Copyright © 2016年 王崇磊. All rights reserved. // // @class WCLRecordEncoder // @abstract 视频编码类 // @discussion 视频编码类 // #import #import /** * 写入并编码视频的的类 */ @interface WCLRecordEncoder : NSObject @property (nonatomic, readonly) NSString *path; @property (nonatomic, strong) AVAssetWriter *writer;//媒体写入对象 /** * WCLRecordEncoder遍历构造器的 * * @param path 媒体存发路径 * @param cy 视频分辨率的高 * @param cx 视频分辨率的宽 * @param ch 音频通道 * @param rate 音频的采样比率 * * @return WCLRecordEncoder的实体 */ + (WCLRecordEncoder*)encoderForPath:(NSString*)path Height:(NSInteger)cy width:(NSInteger)cx channels: (int)ch samples:(Float64)rate; /** * 初始化方法 * * @param path 媒体存发路径 * @param cy 视频分辨率的高 * @param cx 视频分辨率的宽 * @param ch 音频通道 * @param rate 音频的采样率 * * @return WCLRecordEncoder的实体 */ - (instancetype)initPath:(NSString*)path Height:(NSInteger)cy width:(NSInteger)cx channels: (int)ch samples:(Float64)rate; /** * 完成视频录制时调用 * * @param handler 完成的回掉block */ - (void)finishWithCompletionHandler:(void (^)(void))handler; /** * 通过这个方法写入数据 * * @param sampleBuffer 写入的数据 * @param isVideo 是否写入的是视频 * * @return 写入是否成功 */ - (BOOL)encodeFrame:(CMSampleBufferRef)sampleBuffer pixelBuffer:(CVPixelBufferRef)buffer isVideo:(BOOL)isVideo; - (void)initAudioInputChannels:(int)ch samples:(Float64)rate; @end