helpers.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #ifndef SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_
  12. #define SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_
  13. #include <CoreFoundation/CoreFoundation.h>
  14. #include <VideoToolbox/VideoToolbox.h>
  15. #include <string>
  16. // Convenience function for creating a dictionary.
  17. inline CFDictionaryRef CreateCFTypeDictionary(CFTypeRef* keys,
  18. CFTypeRef* values,
  19. size_t size) {
  20. return CFDictionaryCreate(kCFAllocatorDefault, keys, values, size,
  21. &kCFTypeDictionaryKeyCallBacks,
  22. &kCFTypeDictionaryValueCallBacks);
  23. }
  24. // Copies characters from a CFStringRef into a std::string.
  25. std::string CFStringToString(const CFStringRef cf_string);
  26. // Convenience function for setting a VT property.
  27. void SetVTSessionProperty(VTSessionRef session, CFStringRef key, int32_t value);
  28. // Convenience function for setting a VT property.
  29. void SetVTSessionProperty(VTSessionRef session,
  30. CFStringRef key,
  31. uint32_t value);
  32. // Convenience function for setting a VT property.
  33. void SetVTSessionProperty(VTSessionRef session, CFStringRef key, bool value);
  34. // Convenience function for setting a VT property.
  35. void SetVTSessionProperty(VTSessionRef session,
  36. CFStringRef key,
  37. CFStringRef value);
  38. #endif // SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_HELPERS_H_