1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 *
10 */
11
12 #ifndef SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_
13 #define SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_
14
15 #include <CoreFoundation/CoreFoundation.h>
16 #include <VideoToolbox/VideoToolbox.h>
17 #include <string>
18
19 // Convenience function for creating a dictionary.
CreateCFTypeDictionary(CFTypeRef * keys,CFTypeRef * values,size_t size)20 inline CFDictionaryRef CreateCFTypeDictionary(CFTypeRef* keys,
21 CFTypeRef* values,
22 size_t size) {
23 return CFDictionaryCreate(kCFAllocatorDefault, keys, values, size,
24 &kCFTypeDictionaryKeyCallBacks,
25 &kCFTypeDictionaryValueCallBacks);
26 }
27
28 // Copies characters from a CFStringRef into a std::string.
29 std::string CFStringToString(const CFStringRef cf_string);
30
31 // Convenience function for setting a VT property.
32 void SetVTSessionProperty(VTSessionRef session, CFStringRef key, int32_t value);
33
34 // Convenience function for setting a VT property.
35 void SetVTSessionProperty(VTSessionRef session,
36 CFStringRef key,
37 uint32_t value);
38
39 // Convenience function for setting a VT property.
40 void SetVTSessionProperty(VTSessionRef session, CFStringRef key, bool value);
41
42 // Convenience function for setting a VT property.
43 void SetVTSessionProperty(VTSessionRef session,
44 CFStringRef key,
45 CFStringRef value);
46
47 #endif // SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_
48