Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1460)

Side by Side Diff: media/base/mac/videotoolbox_glue.mm

Issue 1801343002: Revert of H264 HW encode using VideoToolbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/mac/videotoolbox_glue.h ('k') | media/base/mac/videotoolbox_helpers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "media/base/mac/videotoolbox_glue.h" 5 #include "media/base/mac/videotoolbox_glue.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 VTCompressionSessionEncodeFrameMethod VTCompressionSessionEncodeFrame; 46 VTCompressionSessionEncodeFrameMethod VTCompressionSessionEncodeFrame;
47 VTCompressionSessionGetPixelBufferPoolMethod 47 VTCompressionSessionGetPixelBufferPoolMethod
48 VTCompressionSessionGetPixelBufferPool; 48 VTCompressionSessionGetPixelBufferPool;
49 VTCompressionSessionInvalidateMethod VTCompressionSessionInvalidate; 49 VTCompressionSessionInvalidateMethod VTCompressionSessionInvalidate;
50 VTCompressionSessionCompleteFramesMethod VTCompressionSessionCompleteFrames; 50 VTCompressionSessionCompleteFramesMethod VTCompressionSessionCompleteFrames;
51 VTSessionSetPropertyMethod VTSessionSetProperty; 51 VTSessionSetPropertyMethod VTSessionSetProperty;
52 52
53 CFStringRef* kVTCompressionPropertyKey_AllowFrameReordering; 53 CFStringRef* kVTCompressionPropertyKey_AllowFrameReordering;
54 CFStringRef* kVTCompressionPropertyKey_AverageBitRate; 54 CFStringRef* kVTCompressionPropertyKey_AverageBitRate;
55 CFStringRef* kVTCompressionPropertyKey_ColorPrimaries; 55 CFStringRef* kVTCompressionPropertyKey_ColorPrimaries;
56 CFStringRef* kVTCompressionPropertyKey_DataRateLimits;
57 CFStringRef* kVTCompressionPropertyKey_ExpectedFrameRate; 56 CFStringRef* kVTCompressionPropertyKey_ExpectedFrameRate;
58 CFStringRef* kVTCompressionPropertyKey_MaxFrameDelayCount; 57 CFStringRef* kVTCompressionPropertyKey_MaxFrameDelayCount;
59 CFStringRef* kVTCompressionPropertyKey_MaxKeyFrameInterval; 58 CFStringRef* kVTCompressionPropertyKey_MaxKeyFrameInterval;
60 CFStringRef* kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration; 59 CFStringRef* kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration;
61 CFStringRef* kVTCompressionPropertyKey_ProfileLevel; 60 CFStringRef* kVTCompressionPropertyKey_ProfileLevel;
62 CFStringRef* kVTCompressionPropertyKey_RealTime; 61 CFStringRef* kVTCompressionPropertyKey_RealTime;
63 CFStringRef* kVTCompressionPropertyKey_TransferFunction; 62 CFStringRef* kVTCompressionPropertyKey_TransferFunction;
64 CFStringRef* kVTCompressionPropertyKey_YCbCrMatrix; 63 CFStringRef* kVTCompressionPropertyKey_YCbCrMatrix;
65 CFStringRef* kVTEncodeFrameOptionKey_ForceKeyFrame; 64 CFStringRef* kVTEncodeFrameOptionKey_ForceKeyFrame;
66 CFStringRef* kVTProfileLevel_H264_Baseline_AutoLevel; 65 CFStringRef* kVTProfileLevel_H264_Baseline_AutoLevel;
67 CFStringRef* kVTProfileLevel_H264_Main_AutoLevel; 66 CFStringRef* kVTProfileLevel_H264_Main_AutoLevel;
68 CFStringRef* kVTProfileLevel_H264_Extended_AutoLevel; 67 CFStringRef* kVTProfileLevel_H264_Extended_AutoLevel;
69 CFStringRef* kVTProfileLevel_H264_High_AutoLevel; 68 CFStringRef* kVTProfileLevel_H264_High_AutoLevel;
70 CFStringRef* 69 CFStringRef*
71 kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder; 70 kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder;
72 CFStringRef*
73 kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder;
74 }; 71 };
75 72
76 // Lazy-instance responsible for loading VideoToolbox. 73 // Lazy-instance responsible for loading VideoToolbox.
77 class VideoToolboxGlue::Loader { 74 class VideoToolboxGlue::Loader {
78 public: 75 public:
79 Loader() { 76 Loader() {
80 NSBundle* bundle = [NSBundle 77 NSBundle* bundle = [NSBundle
81 bundleWithPath:@"/System/Library/Frameworks/VideoToolbox.framework"]; 78 bundleWithPath:@"/System/Library/Frameworks/VideoToolbox.framework"];
82 const char* path = [[bundle executablePath] fileSystemRepresentation]; 79 const char* path = [[bundle executablePath] fileSystemRepresentation];
83 if (!path) 80 if (!path)
(...skipping 10 matching lines...) Expand all
94 LOAD_SYMBOL(VTCompressionSessionCreate) 91 LOAD_SYMBOL(VTCompressionSessionCreate)
95 LOAD_SYMBOL(VTCompressionSessionEncodeFrame) 92 LOAD_SYMBOL(VTCompressionSessionEncodeFrame)
96 LOAD_SYMBOL(VTCompressionSessionGetPixelBufferPool) 93 LOAD_SYMBOL(VTCompressionSessionGetPixelBufferPool)
97 LOAD_SYMBOL(VTCompressionSessionInvalidate) 94 LOAD_SYMBOL(VTCompressionSessionInvalidate)
98 LOAD_SYMBOL(VTCompressionSessionCompleteFrames) 95 LOAD_SYMBOL(VTCompressionSessionCompleteFrames)
99 LOAD_SYMBOL(VTSessionSetProperty) 96 LOAD_SYMBOL(VTSessionSetProperty)
100 97
101 LOAD_SYMBOL(kVTCompressionPropertyKey_AllowFrameReordering) 98 LOAD_SYMBOL(kVTCompressionPropertyKey_AllowFrameReordering)
102 LOAD_SYMBOL(kVTCompressionPropertyKey_AverageBitRate) 99 LOAD_SYMBOL(kVTCompressionPropertyKey_AverageBitRate)
103 LOAD_SYMBOL(kVTCompressionPropertyKey_ColorPrimaries) 100 LOAD_SYMBOL(kVTCompressionPropertyKey_ColorPrimaries)
104 LOAD_SYMBOL(kVTCompressionPropertyKey_DataRateLimits)
105 LOAD_SYMBOL(kVTCompressionPropertyKey_ExpectedFrameRate) 101 LOAD_SYMBOL(kVTCompressionPropertyKey_ExpectedFrameRate)
106 LOAD_SYMBOL(kVTCompressionPropertyKey_MaxFrameDelayCount) 102 LOAD_SYMBOL(kVTCompressionPropertyKey_MaxFrameDelayCount)
107 LOAD_SYMBOL(kVTCompressionPropertyKey_MaxKeyFrameInterval) 103 LOAD_SYMBOL(kVTCompressionPropertyKey_MaxKeyFrameInterval)
108 LOAD_SYMBOL(kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration) 104 LOAD_SYMBOL(kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration)
109 LOAD_SYMBOL(kVTCompressionPropertyKey_ProfileLevel) 105 LOAD_SYMBOL(kVTCompressionPropertyKey_ProfileLevel)
110 LOAD_SYMBOL(kVTCompressionPropertyKey_RealTime) 106 LOAD_SYMBOL(kVTCompressionPropertyKey_RealTime)
111 LOAD_SYMBOL(kVTCompressionPropertyKey_TransferFunction) 107 LOAD_SYMBOL(kVTCompressionPropertyKey_TransferFunction)
112 LOAD_SYMBOL(kVTCompressionPropertyKey_YCbCrMatrix) 108 LOAD_SYMBOL(kVTCompressionPropertyKey_YCbCrMatrix)
113 LOAD_SYMBOL(kVTEncodeFrameOptionKey_ForceKeyFrame); 109 LOAD_SYMBOL(kVTEncodeFrameOptionKey_ForceKeyFrame);
114 LOAD_SYMBOL(kVTProfileLevel_H264_Baseline_AutoLevel) 110 LOAD_SYMBOL(kVTProfileLevel_H264_Baseline_AutoLevel)
115 LOAD_SYMBOL(kVTProfileLevel_H264_Main_AutoLevel) 111 LOAD_SYMBOL(kVTProfileLevel_H264_Main_AutoLevel)
116 LOAD_SYMBOL(kVTProfileLevel_H264_Extended_AutoLevel) 112 LOAD_SYMBOL(kVTProfileLevel_H264_Extended_AutoLevel)
117 LOAD_SYMBOL(kVTProfileLevel_H264_High_AutoLevel) 113 LOAD_SYMBOL(kVTProfileLevel_H264_High_AutoLevel)
118 LOAD_SYMBOL( 114 LOAD_SYMBOL(
119 kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder) 115 kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder)
120 LOAD_SYMBOL(
121 kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder)
122 116
123 #undef LOAD_SYMBOL 117 #undef LOAD_SYMBOL
124 118
125 glue_.library_ = &library_; 119 glue_.library_ = &library_;
126 } 120 }
127 121
128 const VideoToolboxGlue* glue() const { 122 const VideoToolboxGlue* glue() const {
129 return (glue_.library_) ? &glue_ : NULL; 123 return (glue_.library_) ? &glue_ : NULL;
130 } 124 }
131 125
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 CFTypeRef propertyValue) const { 209 CFTypeRef propertyValue) const {
216 return library_->VTSessionSetProperty(session, propertyKey, propertyValue); 210 return library_->VTSessionSetProperty(session, propertyKey, propertyValue);
217 } 211 }
218 212
219 #define KEY_ACCESSOR(KEY) \ 213 #define KEY_ACCESSOR(KEY) \
220 CFStringRef VideoToolboxGlue::KEY() const { return *library_->KEY; } 214 CFStringRef VideoToolboxGlue::KEY() const { return *library_->KEY; }
221 215
222 KEY_ACCESSOR(kVTCompressionPropertyKey_AllowFrameReordering) 216 KEY_ACCESSOR(kVTCompressionPropertyKey_AllowFrameReordering)
223 KEY_ACCESSOR(kVTCompressionPropertyKey_AverageBitRate) 217 KEY_ACCESSOR(kVTCompressionPropertyKey_AverageBitRate)
224 KEY_ACCESSOR(kVTCompressionPropertyKey_ColorPrimaries) 218 KEY_ACCESSOR(kVTCompressionPropertyKey_ColorPrimaries)
225 KEY_ACCESSOR(kVTCompressionPropertyKey_DataRateLimits)
226 KEY_ACCESSOR(kVTCompressionPropertyKey_ExpectedFrameRate) 219 KEY_ACCESSOR(kVTCompressionPropertyKey_ExpectedFrameRate)
227 KEY_ACCESSOR(kVTCompressionPropertyKey_MaxFrameDelayCount) 220 KEY_ACCESSOR(kVTCompressionPropertyKey_MaxFrameDelayCount)
228 KEY_ACCESSOR(kVTCompressionPropertyKey_MaxKeyFrameInterval) 221 KEY_ACCESSOR(kVTCompressionPropertyKey_MaxKeyFrameInterval)
229 KEY_ACCESSOR(kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration) 222 KEY_ACCESSOR(kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration)
230 KEY_ACCESSOR(kVTCompressionPropertyKey_ProfileLevel) 223 KEY_ACCESSOR(kVTCompressionPropertyKey_ProfileLevel)
231 KEY_ACCESSOR(kVTCompressionPropertyKey_RealTime) 224 KEY_ACCESSOR(kVTCompressionPropertyKey_RealTime)
232 KEY_ACCESSOR(kVTCompressionPropertyKey_TransferFunction) 225 KEY_ACCESSOR(kVTCompressionPropertyKey_TransferFunction)
233 KEY_ACCESSOR(kVTCompressionPropertyKey_YCbCrMatrix) 226 KEY_ACCESSOR(kVTCompressionPropertyKey_YCbCrMatrix)
234 KEY_ACCESSOR(kVTEncodeFrameOptionKey_ForceKeyFrame) 227 KEY_ACCESSOR(kVTEncodeFrameOptionKey_ForceKeyFrame)
235 KEY_ACCESSOR(kVTProfileLevel_H264_Baseline_AutoLevel) 228 KEY_ACCESSOR(kVTProfileLevel_H264_Baseline_AutoLevel)
236 KEY_ACCESSOR(kVTProfileLevel_H264_Main_AutoLevel) 229 KEY_ACCESSOR(kVTProfileLevel_H264_Main_AutoLevel)
237 KEY_ACCESSOR(kVTProfileLevel_H264_Extended_AutoLevel) 230 KEY_ACCESSOR(kVTProfileLevel_H264_Extended_AutoLevel)
238 KEY_ACCESSOR(kVTProfileLevel_H264_High_AutoLevel) 231 KEY_ACCESSOR(kVTProfileLevel_H264_High_AutoLevel)
239 KEY_ACCESSOR(kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder) 232 KEY_ACCESSOR(kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder)
240 KEY_ACCESSOR(
241 kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder)
242 233
243 #undef KEY_ACCESSOR 234 #undef KEY_ACCESSOR
OLDNEW
« no previous file with comments | « media/base/mac/videotoolbox_glue.h ('k') | media/base/mac/videotoolbox_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698