58 lines
1.6 KiB
Objective-C
58 lines
1.6 KiB
Objective-C
//
|
|
// AVConstants.h
|
|
// AVDemo
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <UIKit/UIKit.h>
|
|
|
|
// Video Codec
|
|
typedef NS_ENUM(NSInteger, AVVideoCodec) {
|
|
AVVideoCodeH264 = 0,
|
|
AVVideoCodeH265 = 1
|
|
};
|
|
|
|
// Video Resolution
|
|
typedef NS_ENUM(NSInteger, AVVideoResolution) {
|
|
AVVideoResolution360p = 0, // 640x360
|
|
AVVideoResolution480p = 1, // 854x480
|
|
AVVideoResolution540p = 2, // 960x540
|
|
AVVideoResolution720p = 3 // 1280x720
|
|
};
|
|
|
|
// Stream Protocol
|
|
typedef NS_ENUM(NSInteger, AVStreamProtocol) {
|
|
AVStreamProtocolRTC = 0,
|
|
AVStreamProtocolRTMP = 1
|
|
};
|
|
|
|
// Helper functions
|
|
static inline NSString * AVVideoCodecString(AVVideoCodec codec) {
|
|
return codec == AVVideoCodeH264 ? @"H.264" : @"H.265";
|
|
}
|
|
|
|
static inline NSString * AVVideoResolutionString(AVVideoResolution resolution) {
|
|
switch (resolution) {
|
|
case AVVideoResolution360p: return @"360p";
|
|
case AVVideoResolution480p: return @"480p";
|
|
case AVVideoResolution540p: return @"540p";
|
|
case AVVideoResolution720p: return @"720p";
|
|
}
|
|
}
|
|
|
|
static inline CGSize AVVideoResolutionSize(AVVideoResolution resolution) {
|
|
switch (resolution) {
|
|
case AVVideoResolution360p: return CGSizeMake(640, 360);
|
|
case AVVideoResolution480p: return CGSizeMake(854, 480);
|
|
case AVVideoResolution540p: return CGSizeMake(960, 540);
|
|
case AVVideoResolution720p: return CGSizeMake(1280, 720);
|
|
}
|
|
}
|
|
|
|
static inline NSString * AVStreamProtocolString(AVStreamProtocol protocol) {
|
|
return protocol == AVStreamProtocolRTC ? @"RTC" : @"RTMP";
|
|
}
|
|
|
|
// Notification Names
|
|
extern NSString * const AVConfigDidChangeNotification;
|