-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathCommon.x
22 lines (17 loc) · 884 Bytes
/
Common.x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#import <VideoToolbox/VideoToolbox.h>
extern BOOL UseVP9();
#ifdef SIDELOADED
typedef struct OpaqueVTVideoDecoder VTVideoDecoderRef;
extern OSStatus VTSelectAndCreateVideoDecoderInstance(CMVideoCodecType codecType, CFAllocatorRef allocator, CFDictionaryRef videoDecoderSpecification, VTVideoDecoderRef *decoderInstanceOut);
#endif
%ctor {
#ifdef SIDELOADED
CFMutableDictionaryRef payload = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
if (payload) {
CFDictionarySetValue(payload, CFSTR("RequireHardwareAcceleratedVideoDecoder"), kCFBooleanTrue);
CFDictionarySetValue(payload, CFSTR("AllowAlternateDecoderSelection"), kCFBooleanTrue);
VTSelectAndCreateVideoDecoderInstance(kCMVideoCodecType_VP9, kCFAllocatorDefault, payload, NULL);
CFRelease(payload);
}
#endif
}