//
//  NXVideoFrameContext.h
//  NXKit
//
//  Created by 徐家骏 on 2019/5/7.
//  Copyright © 2019 徐家骏. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/*16bit的attribute:
 1、是否i帧
 2、是否前置摄像头
 3、是否已有镜像（android）
 45、设备的方向
 67、摄像头的方向
 8、图片是否只解码不实际渲染
 9-16：扩展用
 */

typedef NS_ENUM(uint16_t, NXVideoExtraAttribute)
{
    EXTRA_ATTR_IFRAME        = 1,
    EXTRA_ATTR_FRONT_CAMERA  = 2,
    EXTRA_ATTR_MIRRORED      = 4,
    EXTRA_ATTR_DEVICE_ORIENT_PORTRAIT        = 0,
    EXTRA_ATTR_DEVICE_ORIENT_PORTRAIT_UP     = 8,
    EXTRA_ATTR_DEVICE_ORIENT_LANDSCAPE_LEFT  = 16,
    EXTRA_ATTR_DEVICE_ORIENT_LANDSCAPE_RIGHT = 24,
    EXTRA_ATTR_CAMERA_ORIENT_PORTRAIT        = 0,
    EXTRA_ATTR_CAMERA_ORIENT_PORTRAIT_UP     = 32,
    EXTRA_ATTR_CAMERA_ORIENT_LANDSCAPE_LEFT  = 64,
    EXTRA_ATTR_CAMERA_ORIENT_LANDSCAPE_RIGHT = 96,
    EXTRA_ATTR_NOT_RENDER_TO_SCREEN   = 128,
};

@interface NXVideoFrameContext : NSObject
@property (nonatomic) uint16_t  attribute;
@property (nonatomic) int16_t  audioSeqId;
@property (nonatomic) int16_t  timestamp;

@property (nonatomic) BOOL     forLocalPreview;

- (instancetype) initWithData:(NSData *)data;
- (void)setFlag:(uint16_t)flag;
- (BOOL)isIFrame;
- (BOOL)isFrontCamera;
- (BOOL)isMirrored;
- (uint16_t)deviceOrientation;
- (uint16_t)cameraOrientation;
- (BOOL)flagNotRenderToScreen;
- (NSData *)toData;
@end

NS_ASSUME_NONNULL_END
