//
//  NXVideoCapture.h
//  NXCall
//
//  Created by 徐家骏 on 2019/4/28.
//  Copyright © 2019 徐家骏. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "NXVideoFrameContext.h"

NS_ASSUME_NONNULL_BEGIN

@protocol NXVideoCaptureDelegate <NSObject>
@required
-(void) onNewVideoCaptureData:(CMSampleBufferRef)sampleBuffer andContext:(NXVideoFrameContext *)frameContext;

@end


@interface NXVideoCapture : NSObject
@property (atomic, weak)        id<NXVideoCaptureDelegate> delegate;
@property (nonatomic)              AVCaptureDevicePosition  position;
@property (nonatomic,strong)       AVCaptureSessionPreset   preset;
@property (nonatomic)              int32_t                  frameRate;
@property (nonatomic)              BOOL                     mirror;

- (instancetype) init;
- (void) CaptureSessionCreate;
- (void) CaptureSessionStart;
- (void) CaptureSessionStop;
- (void) CaptureSessionDestroy;

- (void)handleCaptureRuntimeError:(NSNotification *)notification;
- (void)handleCaptureInterrupted:(NSNotification *)notification;
- (void)handleCaptureInterruptionEnded:(NSNotification *)notification;

@end

NS_ASSUME_NONNULL_END


