//
//  NXLiveVideoConfiguration.h
//  NXLive
//
//  Created by Neuxnet on 2020/11/18.
//  Copyright © 2020 wangran. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "NXLiveOptions.h"

// 视频分辨率（都是16:9 当此设备不支持当前分辨率，自动降低一级）
typedef NS_ENUM(NSUInteger, NXLiveVideoSessionPreset)
{
    NXLiveVideoSessionPreset480x640   = 0,
    NXLiveVideoSessionPreset720x1280  = 1,
    NXLiveVideoSessionPreset1080x1920 = 2,
    NXLiveVideoSessionPreset1440x2560 = 3,
    NXLiveVideoSessionPreset2160x3840 = 4
};

typedef NS_ENUM(NSUInteger, NXLiveVideoQuality)
{
    NXLiveVideoQuality_480p  = 0,
    NXLiveVideoQuality_720p  = 1,
    NXLiveVideoQuality_1080p = 2,
    NXLiveVideoQuality_2K    = 3,
    NXLiveVideoQuality_4K    = 4,
};

NS_ASSUME_NONNULL_BEGIN

@interface NXLiveVideoConfiguration : NSObject<NSCoding, NSCopying>

/// 默认视频配置
+ (instancetype)defaultConfiguration;
/// 视频配置
+ (instancetype)defaultConfigurationForQuality:(NXLiveVideoQuality)quality;
/// 视频配置，采集源类型
+ (instancetype)defaultConfigurationForQuality:(NXLiveVideoQuality)quality captureType:(NXLiveCaptureTypeMask)type;
/// 视频配置，摄像头输出方向
+ (instancetype)defaultConfigurationForQuality:(NXLiveVideoQuality)quality
                                   captureType:(NXLiveCaptureTypeMask)type
                        outputImageOrienration:(UIInterfaceOrientation)outputImageOrientation;


/// 视频的分辨率，宽高无比设定为2的倍数，否则解码播放时可能出现绿边（这个videoSizeRespectingAspectRatio设置为YES则可能会改变）
@property (nonatomic, assign) CGSize videoSize;
/// 摄像头输出分辨率
@property (nonatomic, assign) CGSize captureOutVideoSize;
/// 输出图像是否等比例，默认为NO
@property (nonatomic, assign) BOOL videoSizeRespectingAspectRatio;
// 视频输出方向
@property (nonatomic, assign) UIInterfaceOrientation outputImageOrientation;
/// 自动旋转（只支持 left  -- right，portrait -- portraitUpsideDown）
@property (nonatomic, assign) BOOL autorotate;
/// 视频帧率 fps
@property (nonatomic, assign) NSUInteger videoFrameRate;
/// 视频最大帧率 fps
@property (nonatomic, assign) NSUInteger videoMaxFrameRate;
/// 视频最小帧率 fps
@property (nonatomic, assign) NSUInteger videoMinFrameRate;
/// 最大关键帧间隔，可设定为 fps 的2倍，影响一个 GOP 大小
@property (nonatomic, assign) NSUInteger videoMaxKeyFrameInterval;
/// 视频码率 bps
@property (nonatomic, assign) NSUInteger videoBitRate;
/// 视频最大码率 bps
@property (nonatomic, assign) NSUInteger videoMaxBitRate;
/// 视频最小码率 bps
@property (nonatomic, assign) NSUInteger videoMinBitRate;
/// 分辨率
@property (nonatomic, assign) NXLiveVideoSessionPreset sessionPreset;
/// 直播质量
@property (nonatomic, assign) NXLiveVideoQuality quality;
/// ≈sde3分辨率
@property (nonatomic, assign, readonly) NSString *avSessionPreset;
/// 是否是横屏
@property (nonatomic, assign, readonly) BOOL landscape;
/// 采集类型
@property (nonatomic, assign) NXLiveCaptureTypeMask captureType;

@end

NS_ASSUME_NONNULL_END
