@@ -18,14 +18,14 @@ + (instancetype)defaultConfiguration{
18
18
}
19
19
20
20
+ (instancetype )defaultConfigurationForQuality : (LFLiveVideoQuality)videoQuality {
21
- LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration defaultConfigurationForQuality: videoQuality orientation: UIInterfaceOrientationPortrait ];
21
+ LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration defaultConfigurationForQuality: videoQuality landscape: NO ];
22
22
return configuration;
23
23
}
24
24
25
- + (instancetype )defaultConfigurationForQuality : (LFLiveVideoQuality)videoQuality orientation : (UIInterfaceOrientation) orientation {
25
+ + (instancetype )defaultConfigurationForQuality : (LFLiveVideoQuality)videoQuality landscape : ( BOOL ) landscape {
26
26
LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration new ];
27
27
switch (videoQuality) {
28
- case LFLiveVideoQuality_Low1:
28
+ case LFLiveVideoQuality_Low1:
29
29
{
30
30
configuration.sessionPreset = LFCaptureSessionPreset360x640;
31
31
configuration.videoFrameRate = 15 ;
@@ -37,7 +37,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
37
37
configuration.videoSize = CGSizeMake (360 , 640 );
38
38
}
39
39
break ;
40
- case LFLiveVideoQuality_Low2:
40
+ case LFLiveVideoQuality_Low2:
41
41
{
42
42
configuration.sessionPreset = LFCaptureSessionPreset360x640;
43
43
configuration.videoFrameRate = 24 ;
@@ -49,7 +49,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
49
49
configuration.videoSize = CGSizeMake (360 , 640 );
50
50
}
51
51
break ;
52
- case LFLiveVideoQuality_Low3:
52
+ case LFLiveVideoQuality_Low3:
53
53
{
54
54
configuration.sessionPreset = LFCaptureSessionPreset360x640;
55
55
configuration.videoFrameRate = 30 ;
@@ -61,7 +61,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
61
61
configuration.videoSize = CGSizeMake (360 , 640 );
62
62
}
63
63
break ;
64
- case LFLiveVideoQuality_Medium1:
64
+ case LFLiveVideoQuality_Medium1:
65
65
{
66
66
configuration.sessionPreset = LFCaptureSessionPreset540x960;
67
67
configuration.videoFrameRate = 15 ;
@@ -73,7 +73,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
73
73
configuration.videoSize = CGSizeMake (540 , 960 );
74
74
}
75
75
break ;
76
- case LFLiveVideoQuality_Medium2:
76
+ case LFLiveVideoQuality_Medium2:
77
77
{
78
78
configuration.sessionPreset = LFCaptureSessionPreset540x960;
79
79
configuration.videoFrameRate = 24 ;
@@ -85,7 +85,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
85
85
configuration.videoSize = CGSizeMake (540 , 960 );
86
86
}
87
87
break ;
88
- case LFLiveVideoQuality_Medium3:
88
+ case LFLiveVideoQuality_Medium3:
89
89
{
90
90
configuration.sessionPreset = LFCaptureSessionPreset540x960;
91
91
configuration.videoFrameRate = 30 ;
@@ -97,7 +97,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
97
97
configuration.videoSize = CGSizeMake (540 , 960 );
98
98
}
99
99
break ;
100
- case LFLiveVideoQuality_High1:
100
+ case LFLiveVideoQuality_High1:
101
101
{
102
102
configuration.sessionPreset = LFCaptureSessionPreset720x1280;
103
103
configuration.videoFrameRate = 15 ;
@@ -109,7 +109,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
109
109
configuration.videoSize = CGSizeMake (720 , 1280 );
110
110
}
111
111
break ;
112
- case LFLiveVideoQuality_High2:
112
+ case LFLiveVideoQuality_High2:
113
113
{
114
114
configuration.sessionPreset = LFCaptureSessionPreset720x1280;
115
115
configuration.videoFrameRate = 24 ;
@@ -121,7 +121,7 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
121
121
configuration.videoSize = CGSizeMake (720 , 1280 );
122
122
}
123
123
break ;
124
- case LFLiveVideoQuality_High3:
124
+ case LFLiveVideoQuality_High3:
125
125
{
126
126
configuration.sessionPreset = LFCaptureSessionPreset720x1280;
127
127
configuration.videoFrameRate = 30 ;
@@ -138,12 +138,12 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
138
138
}
139
139
configuration.sessionPreset = [configuration supportSessionPreset: configuration.sessionPreset];
140
140
configuration.videoMaxKeyframeInterval = configuration.videoFrameRate *2 ;
141
- configuration.orientation = orientation ;
141
+ configuration.landscape = landscape ;
142
142
CGSize size = configuration.videoSize ;
143
- if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown){
144
- configuration.videoSize = CGSizeMake (size.width , size.height );
145
- }else {
143
+ if (landscape){
146
144
configuration.videoSize = CGSizeMake (size.height , size.width );
145
+ }else {
146
+ configuration.videoSize = CGSizeMake (size.width , size.height );
147
147
}
148
148
return configuration;
149
149
}
@@ -152,17 +152,17 @@ + (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality
152
152
- (NSString *)avSessionPreset {
153
153
NSString *avSessionPreset = nil ;
154
154
switch (self.sessionPreset ) {
155
- case LFCaptureSessionPreset360x640:
155
+ case LFCaptureSessionPreset360x640:
156
156
{
157
157
avSessionPreset = AVCaptureSessionPreset640x480;
158
158
}
159
159
break ;
160
- case LFCaptureSessionPreset540x960:
160
+ case LFCaptureSessionPreset540x960:
161
161
{
162
162
avSessionPreset = AVCaptureSessionPresetiFrame960x540;
163
163
}
164
164
break ;
165
- case LFCaptureSessionPreset720x1280:
165
+ case LFCaptureSessionPreset720x1280:
166
166
{
167
167
avSessionPreset = AVCaptureSessionPreset1280x720;
168
168
}
@@ -195,7 +195,6 @@ - (void)setVideoMinFrameRate:(NSUInteger)videoMinFrameRate{
195
195
_videoMinFrameRate = videoMinFrameRate;
196
196
}
197
197
198
-
199
198
#pragma mark -- Custom Method
200
199
- (LFLiveVideoSessionPreset)supportSessionPreset : (LFLiveVideoSessionPreset)sessionPreset {
201
200
NSString *avSessionPreset = [self avSessionPreset ];
@@ -225,7 +224,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder {
225
224
[aCoder encodeObject: @(self .videoMaxKeyframeInterval) forKey: @" videoMaxKeyframeInterval" ];
226
225
[aCoder encodeObject: @(self .videoBitRate) forKey: @" videoBitRate" ];
227
226
[aCoder encodeObject: @(self .sessionPreset) forKey: @" sessionPreset" ];
228
- [aCoder encodeObject: @(self .orientation ) forKey: @" orientation " ];
227
+ [aCoder encodeObject: @(self .landscape ) forKey: @" landscape " ];
229
228
}
230
229
231
230
- (id )initWithCoder : (NSCoder *)aDecoder {
@@ -235,7 +234,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder {
235
234
_videoMaxKeyframeInterval = [[aDecoder decodeObjectForKey: @" videoMaxKeyframeInterval" ] unsignedIntegerValue ];
236
235
_videoBitRate = [[aDecoder decodeObjectForKey: @" videoBitRate" ] unsignedIntegerValue ];
237
236
_sessionPreset = [[aDecoder decodeObjectForKey: @" sessionPreset" ] unsignedIntegerValue ];
238
- _orientation = [[aDecoder decodeObjectForKey: @" orientation " ] unsignedIntegerValue ];
237
+ _landscape = [[aDecoder decodeObjectForKey: @" landscape " ] unsignedIntegerValue ];
239
238
return self;
240
239
}
241
240
@@ -252,7 +251,7 @@ - (NSUInteger)hash {
252
251
@(self .isClipVideo),
253
252
self .avSessionPreset,
254
253
@(self .sessionPreset),
255
- @(self .orientation ),];
254
+ @(self .landscape ),];
256
255
257
256
for (NSObject *value in values) {
258
257
hash ^= value.hash ;
@@ -279,7 +278,7 @@ - (BOOL)isEqual:(id)other
279
278
object.isClipVideo == self.isClipVideo &&
280
279
[object.avSessionPreset isEqualToString: self .avSessionPreset] &&
281
280
object.sessionPreset == self.sessionPreset &&
282
- object.orientation == self.orientation ;
281
+ object.landscape == self.landscape ;
283
282
}
284
283
}
285
284
@@ -302,7 +301,7 @@ - (NSString *)description{
302
301
[desc appendFormat: @" isClipVideo:%zi " ,self .isClipVideo];
303
302
[desc appendFormat: @" avSessionPreset:%@ " ,self .avSessionPreset];
304
303
[desc appendFormat: @" sessionPreset:%zi " ,self .sessionPreset];
305
- [desc appendFormat: @" orientation :%zi " ,self .orientation ];
304
+ [desc appendFormat: @" landscape :%zi " ,self .landscape ];
306
305
return desc;
307
306
}
308
307
0 commit comments