OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ | 5 #ifndef MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ |
6 #define MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ | 6 #define MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "media/base/mac/coremedia_glue.h" | 11 #include "media/base/mac/coremedia_glue.h" |
12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
13 | 13 |
14 // VideoToolbox API is available in and after OS X 10.9 and iOS 8 (10.8 has | 14 // VideoToolbox API is available in OS X 10.9 and iOS 8 (10.8 has support for |
15 // support for software encoding, but this class exposes the 10.9 API level). | 15 // software encoding, but this class exposes the 10.9 API level). Chromium |
16 // Chromium requires OS X 10.9 or iOS 9. This class is defined to try and load | 16 // requires OS X 10.6 or iOS 6. Linking with VideoToolbox therefore has to |
17 // the VideoToolbox library at runtime. If it succeeds, clients can use | 17 // happen at runtime. This class is defined to try and load the VideoToolbox |
18 // VideoToolbox via this class. | 18 // library. If it succeeds, clients can use VideoToolbox via this class. |
19 // Note that this file is necessary because Chromium still targets OS X 10.6 for | |
20 // deployment. It should be deprecated soon, see crbug.com/579648. | |
21 class MEDIA_EXPORT VideoToolboxGlue { | 19 class MEDIA_EXPORT VideoToolboxGlue { |
22 public: | 20 public: |
23 class Loader; | 21 class Loader; |
24 | 22 |
25 // Returns a glue object if VideoToolbox is supported or null otherwise. | 23 // Returns a glue object if VideoToolbox is supported or null otherwise. |
26 // Using a glue object allows to avoid expensive atomic operations on every | 24 // Using a glue object allows to avoid expensive atomic operations on every |
27 // function call. The object has process life duration and must not be | 25 // function call. The object has process life duration and must not be |
28 // deleted. | 26 // deleted. |
29 static const VideoToolboxGlue* Get(); | 27 static const VideoToolboxGlue* Get(); |
30 | 28 |
(...skipping 13 matching lines...) Expand all Loading... |
44 VTEncodeInfoFlags infoFlags, | 42 VTEncodeInfoFlags infoFlags, |
45 CoreMediaGlue::CMSampleBufferRef sampleBuffer); | 43 CoreMediaGlue::CMSampleBufferRef sampleBuffer); |
46 | 44 |
47 // Originally from VTSession.h | 45 // Originally from VTSession.h |
48 typedef CFTypeRef VTSessionRef; | 46 typedef CFTypeRef VTSessionRef; |
49 | 47 |
50 // Originally from VTCompressionProperties.h | 48 // Originally from VTCompressionProperties.h |
51 CFStringRef kVTCompressionPropertyKey_AllowFrameReordering() const; | 49 CFStringRef kVTCompressionPropertyKey_AllowFrameReordering() const; |
52 CFStringRef kVTCompressionPropertyKey_AverageBitRate() const; | 50 CFStringRef kVTCompressionPropertyKey_AverageBitRate() const; |
53 CFStringRef kVTCompressionPropertyKey_ColorPrimaries() const; | 51 CFStringRef kVTCompressionPropertyKey_ColorPrimaries() const; |
54 CFStringRef kVTCompressionPropertyKey_DataRateLimits() const; | |
55 CFStringRef kVTCompressionPropertyKey_ExpectedFrameRate() const; | 52 CFStringRef kVTCompressionPropertyKey_ExpectedFrameRate() const; |
56 CFStringRef kVTCompressionPropertyKey_MaxFrameDelayCount() const; | 53 CFStringRef kVTCompressionPropertyKey_MaxFrameDelayCount() const; |
57 CFStringRef kVTCompressionPropertyKey_MaxKeyFrameInterval() const; | 54 CFStringRef kVTCompressionPropertyKey_MaxKeyFrameInterval() const; |
58 CFStringRef kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration() const; | 55 CFStringRef kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration() const; |
59 CFStringRef kVTCompressionPropertyKey_ProfileLevel() const; | 56 CFStringRef kVTCompressionPropertyKey_ProfileLevel() const; |
60 CFStringRef kVTCompressionPropertyKey_RealTime() const; | 57 CFStringRef kVTCompressionPropertyKey_RealTime() const; |
61 CFStringRef kVTCompressionPropertyKey_TransferFunction() const; | 58 CFStringRef kVTCompressionPropertyKey_TransferFunction() const; |
62 CFStringRef kVTCompressionPropertyKey_YCbCrMatrix() const; | 59 CFStringRef kVTCompressionPropertyKey_YCbCrMatrix() const; |
63 | 60 |
64 CFStringRef kVTEncodeFrameOptionKey_ForceKeyFrame() const; | 61 CFStringRef kVTEncodeFrameOptionKey_ForceKeyFrame() const; |
65 | 62 |
66 CFStringRef kVTProfileLevel_H264_Baseline_AutoLevel() const; | 63 CFStringRef kVTProfileLevel_H264_Baseline_AutoLevel() const; |
67 CFStringRef kVTProfileLevel_H264_Main_AutoLevel() const; | 64 CFStringRef kVTProfileLevel_H264_Main_AutoLevel() const; |
68 CFStringRef kVTProfileLevel_H264_Extended_AutoLevel() const; | 65 CFStringRef kVTProfileLevel_H264_Extended_AutoLevel() const; |
69 CFStringRef kVTProfileLevel_H264_High_AutoLevel() const; | 66 CFStringRef kVTProfileLevel_H264_High_AutoLevel() const; |
70 | 67 |
71 CFStringRef | 68 CFStringRef |
72 kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder() | 69 kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder() |
73 const; | 70 const; |
74 CFStringRef | |
75 kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder() const; | |
76 | 71 |
77 // Originally from VTCompressionSession.h | 72 // Originally from VTCompressionSession.h |
78 OSStatus VTCompressionSessionCreate( | 73 OSStatus VTCompressionSessionCreate( |
79 CFAllocatorRef allocator, | 74 CFAllocatorRef allocator, |
80 int32_t width, | 75 int32_t width, |
81 int32_t height, | 76 int32_t height, |
82 CoreMediaGlue::CMVideoCodecType codecType, | 77 CoreMediaGlue::CMVideoCodecType codecType, |
83 CFDictionaryRef encoderSpecification, | 78 CFDictionaryRef encoderSpecification, |
84 CFDictionaryRef sourceImageBufferAttributes, | 79 CFDictionaryRef sourceImageBufferAttributes, |
85 CFAllocatorRef compressedDataAllocator, | 80 CFAllocatorRef compressedDataAllocator, |
(...skipping 21 matching lines...) Expand all Loading... |
107 CFTypeRef propertyValue) const; | 102 CFTypeRef propertyValue) const; |
108 | 103 |
109 private: | 104 private: |
110 struct Library; | 105 struct Library; |
111 VideoToolboxGlue(); | 106 VideoToolboxGlue(); |
112 Library* library_; | 107 Library* library_; |
113 DISALLOW_COPY_AND_ASSIGN(VideoToolboxGlue); | 108 DISALLOW_COPY_AND_ASSIGN(VideoToolboxGlue); |
114 }; | 109 }; |
115 | 110 |
116 #endif // MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ | 111 #endif // MEDIA_BASE_MAC_VIDEOTOOLBOX_GLUE_H_ |
OLD | NEW |