OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_ | |
6 #define MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_ | |
7 | |
8 #include "base/mac/scoped_cftyperef.h" | |
9 #include "media/base/mac/videotoolbox_glue.h" | |
10 #include "media/base/media_export.h" | |
11 | |
12 namespace media { | |
13 | |
14 namespace video_toolbox { | |
15 | |
16 // Create a CFDictionaryRef with the given keys and values. | |
17 MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef> | |
18 DictionaryWithKeysAndValues(CFTypeRef* keys, CFTypeRef* values, size_t size); | |
19 | |
20 // Create a CFDictionaryRef with the given key and value. | |
21 MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef> DictionaryWithKeyValue( | |
22 CFTypeRef key, | |
23 CFTypeRef value); | |
24 | |
25 // Create a CFArrayRef with the given array of integers. | |
26 MEDIA_EXPORT base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegers(const int* v, | |
27 size_t size); | |
28 | |
29 // Create a CFArrayRef with the given int and float values. | |
30 MEDIA_EXPORT base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegerAndFloat( | |
31 int int_val, | |
32 float float_val); | |
33 | |
34 // Copy a H.264 frame stored in a CM sample buffer to an Annex B buffer. Copies | |
35 // parameter sets for keyframes before the frame data as well. | |
36 MEDIA_EXPORT bool CopySampleBufferToAnnexBBuffer( | |
37 CoreMediaGlue::CMSampleBufferRef sbuf, | |
38 bool keyframe, | |
39 std::string* annexb_buffer); | |
40 MEDIA_EXPORT bool CopySampleBufferToAnnexBBuffer( | |
41 CoreMediaGlue::CMSampleBufferRef sbuf, | |
42 bool keyframe, | |
43 size_t annexb_buffer_size, | |
44 char* annexb_buffer, | |
45 size_t* used_buffer_size); | |
46 | |
47 // Helper class to add session properties to a VTCompressionSessionRef. | |
48 class MEDIA_EXPORT SessionPropertySetter { | |
49 public: | |
50 SessionPropertySetter( | |
51 base::ScopedCFTypeRef<VideoToolboxGlue::VTCompressionSessionRef> session, | |
52 const VideoToolboxGlue* const glue); | |
53 ~SessionPropertySetter(); | |
54 | |
55 bool Set(CFStringRef key, int32_t value); | |
56 bool Set(CFStringRef key, bool value); | |
57 bool Set(CFStringRef key, CFStringRef value); | |
58 bool Set(CFStringRef key, CFArrayRef value); | |
59 | |
60 private: | |
61 base::ScopedCFTypeRef<VideoToolboxGlue::VTCompressionSessionRef> session_; | |
62 const VideoToolboxGlue* glue_; | |
63 }; | |
64 | |
65 } // namespace video_toolbox | |
66 | |
67 } // namespace media | |
68 | |
69 #endif // MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_ | |
OLD | NEW |