summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/public/SDLVideoStreamingRange.h
blob: 71cc1bf1dcac1a279f080938e333952772acbfe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
//  SDLVideoStreamingRange.h
//  SmartDeviceLink
//
//  Created on 6/11/20.
//

#import <Foundation/Foundation.h>

@class SDLImageResolution;

NS_ASSUME_NONNULL_BEGIN

/// A range of supported video streaming sizes from minimum to maximum
@interface SDLVideoStreamingRange : NSObject <NSCopying>

/// The minimum supported normalized aspect ratio, min value is 1.0, defaults to 1.0
@property (nonatomic, assign) float minimumAspectRatio;

/// The maximum supported normalized aspect ratio, min value is 1.0, defaults to 9999.0
@property (nonatomic, assign) float maximumAspectRatio;

/// The minimum supported diagonal screen size in inches, defaults to 0.0 (matches any size)
@property (nonatomic, assign) float minimumDiagonal;

/// The minimum resolution to support, it overrides .minimumAspectRatio
@property (nonatomic, strong, nullable) SDLImageResolution *minimumResolution;

/// The maximum resolution to support, it overrides .maximumAspectRatio
@property (nonatomic, strong, nullable) SDLImageResolution *maximumResolution;

/// Create a video streaming range based on a minimum and maximum resolution
/// @param minResolution The minimum supported height / width resolution
/// @param maxResolution The maximum supported height / width resolution
- (instancetype)initWithMinimumResolution:(nullable SDLImageResolution *)minResolution maximumResolution:(nullable SDLImageResolution *)maxResolution;

/// Create a video streaming range with all supported options
/// @param minResolution The minimum supported height / width resolution
/// @param maxResolution The maximum supported height / width resolution
/// @param minimumAspectRatio The minimum supported normalized aspect ratio, min value is 1.0, defaults to 1.0
/// @param maximumAspectRatio The maximum supported normalized aspect ratio, min value is 1.0, defaults to 9999.0
/// @param minimumDiagonal The minimum supported diagonal screen size in inches, defaults to 0 (0 matches any size)
- (instancetype)initWithMinimumResolution:(nullable SDLImageResolution *)minResolution maximumResolution:(nullable SDLImageResolution *)maxResolution minimumAspectRatio:(float)minimumAspectRatio maximumAspectRatio:(float)maximumAspectRatio minimumDiagonal:(float)minimumDiagonal;

/// A convenience method to create a disabled range with the min and max resolutions equal to zero
+ (instancetype)disabled;

/// Check if the argument is within the [.minimumResolution, .maximumResolution] range
- (BOOL)isImageResolutionInRange:(SDLImageResolution *)imageResolution;

/// Check if the argument is within the [.minimumAspectRatio, .maximumAspectRatio] range
- (BOOL)isAspectRatioInRange:(float)aspectRatio;

@end

NS_ASSUME_NONNULL_END