forked from PoomSmart/YTUHD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.x
60 lines (45 loc) · 1.2 KB
/
Tweak.x
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
57
58
59
60
#import "Header.h"
BOOL UseVP9() {
return [[NSUserDefaults standardUserDefaults] boolForKey:UseVP9Key];
}
%hook MLHAMPlayerItem
- (void)load {
MLInnerTubePlayerConfig *config = [self config];
YTIMediaCommonConfig *mediaCommonConfig = [config mediaCommonConfig];
mediaCommonConfig.useServerDrivenAbr = NO;
%orig;
}
%end
static void hookFormats(MLABRPolicy *self) {
YTIHamplayerConfig *config = [self valueForKey:@"_hamplayerConfig"];
config.videoAbrConfig.preferSoftwareHdrOverHardwareSdr = YES;
if ([config respondsToSelector:@selector(setDisableResolveOverlappingQualitiesByCodec:)])
config.disableResolveOverlappingQualitiesByCodec = NO;
YTIHamplayerStreamFilter *filter = config.streamFilter;
filter.enableVideoCodecSplicing = YES;
filter.vp9.maxArea = MAX_PIXELS;
filter.vp9.maxFps = MAX_FPS;
}
%hook MLABRPolicy
- (void)setFormats:(NSArray *)formats {
hookFormats(self);
%orig;
}
%end
%hook MLABRPolicyOld
- (void)setFormats:(NSArray *)formats {
hookFormats(self);
%orig;
}
%end
%hook MLABRPolicyNew
- (void)setFormats:(NSArray *)formats {
hookFormats(self);
%orig;
}
%end
%ctor {
if (UseVP9()) {
%init;
}
}