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

Side by Side Diff: media/video/capture/mac/avfoundation_glue.mm

Issue 258783007: Mac AVFoundation: Allow use of all camera's supported resolutions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bemasc@ nit Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "media/video/capture/mac/avfoundation_glue.h" 5 #import "media/video/capture/mac/avfoundation_glue.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 27 matching lines...) Expand all
38 {&AVCaptureDeviceWasDisconnectedNotification_, 38 {&AVCaptureDeviceWasDisconnectedNotification_,
39 "AVCaptureDeviceWasDisconnectedNotification"}, 39 "AVCaptureDeviceWasDisconnectedNotification"},
40 {&AVMediaTypeVideo_, "AVMediaTypeVideo"}, 40 {&AVMediaTypeVideo_, "AVMediaTypeVideo"},
41 {&AVMediaTypeAudio_, "AVMediaTypeAudio"}, 41 {&AVMediaTypeAudio_, "AVMediaTypeAudio"},
42 {&AVMediaTypeMuxed_, "AVMediaTypeMuxed"}, 42 {&AVMediaTypeMuxed_, "AVMediaTypeMuxed"},
43 {&AVCaptureSessionRuntimeErrorNotification_, 43 {&AVCaptureSessionRuntimeErrorNotification_,
44 "AVCaptureSessionRuntimeErrorNotification"}, 44 "AVCaptureSessionRuntimeErrorNotification"},
45 {&AVCaptureSessionDidStopRunningNotification_, 45 {&AVCaptureSessionDidStopRunningNotification_,
46 "AVCaptureSessionDidStopRunningNotification"}, 46 "AVCaptureSessionDidStopRunningNotification"},
47 {&AVCaptureSessionErrorKey_, "AVCaptureSessionErrorKey"}, 47 {&AVCaptureSessionErrorKey_, "AVCaptureSessionErrorKey"},
48 {&AVCaptureSessionPreset320x240_, "AVCaptureSessionPreset320x240"},
49 {&AVCaptureSessionPreset640x480_, "AVCaptureSessionPreset640x480"},
50 {&AVCaptureSessionPreset1280x720_, "AVCaptureSessionPreset1280x720"},
51 {&AVVideoScalingModeKey_, "AVVideoScalingModeKey"}, 48 {&AVVideoScalingModeKey_, "AVVideoScalingModeKey"},
52 {&AVVideoScalingModeResizeAspectFill_, 49 {&AVVideoScalingModeResizeAspectFill_,
53 "AVVideoScalingModeResizeAspectFill"}, 50 "AVVideoScalingModeResizeAspectFill"},
54 }; 51 };
55 for (size_t i = 0; i < arraysize(av_strings); ++i) { 52 for (size_t i = 0; i < arraysize(av_strings); ++i) {
56 *av_strings[i].loaded_string = *reinterpret_cast<NSString**>( 53 *av_strings[i].loaded_string = *reinterpret_cast<NSString**>(
57 dlsym(library_handle_, av_strings[i].symbol)); 54 dlsym(library_handle_, av_strings[i].symbol));
58 DCHECK(*av_strings[i].loaded_string) << dlerror(); 55 DCHECK(*av_strings[i].loaded_string) << dlerror();
59 } 56 }
60 } 57 }
(...skipping 12 matching lines...) Expand all
73 NSString* AVMediaTypeMuxed() const { return AVMediaTypeMuxed_; } 70 NSString* AVMediaTypeMuxed() const { return AVMediaTypeMuxed_; }
74 NSString* AVCaptureSessionRuntimeErrorNotification() const { 71 NSString* AVCaptureSessionRuntimeErrorNotification() const {
75 return AVCaptureSessionRuntimeErrorNotification_; 72 return AVCaptureSessionRuntimeErrorNotification_;
76 } 73 }
77 NSString* AVCaptureSessionDidStopRunningNotification() const { 74 NSString* AVCaptureSessionDidStopRunningNotification() const {
78 return AVCaptureSessionDidStopRunningNotification_; 75 return AVCaptureSessionDidStopRunningNotification_;
79 } 76 }
80 NSString* AVCaptureSessionErrorKey() const { 77 NSString* AVCaptureSessionErrorKey() const {
81 return AVCaptureSessionErrorKey_; 78 return AVCaptureSessionErrorKey_;
82 } 79 }
83 NSString* AVCaptureSessionPreset320x240() const {
84 return AVCaptureSessionPreset320x240_;
85 }
86 NSString* AVCaptureSessionPreset640x480() const {
87 return AVCaptureSessionPreset640x480_;
88 }
89 NSString* AVCaptureSessionPreset1280x720() const {
90 return AVCaptureSessionPreset1280x720_;
91 }
92 NSString* AVVideoScalingModeKey() const { return AVVideoScalingModeKey_; } 80 NSString* AVVideoScalingModeKey() const { return AVVideoScalingModeKey_; }
93 NSString* AVVideoScalingModeResizeAspectFill() const { 81 NSString* AVVideoScalingModeResizeAspectFill() const {
94 return AVVideoScalingModeResizeAspectFill_; 82 return AVVideoScalingModeResizeAspectFill_;
95 } 83 }
96 84
97 private: 85 private:
98 NSBundle* bundle_; 86 NSBundle* bundle_;
99 void* library_handle_; 87 void* library_handle_;
100 // The following members are replicas of the respectives in AVFoundation. 88 // The following members are replicas of the respectives in AVFoundation.
101 NSString* AVCaptureDeviceWasConnectedNotification_; 89 NSString* AVCaptureDeviceWasConnectedNotification_;
102 NSString* AVCaptureDeviceWasDisconnectedNotification_; 90 NSString* AVCaptureDeviceWasDisconnectedNotification_;
103 NSString* AVMediaTypeVideo_; 91 NSString* AVMediaTypeVideo_;
104 NSString* AVMediaTypeAudio_; 92 NSString* AVMediaTypeAudio_;
105 NSString* AVMediaTypeMuxed_; 93 NSString* AVMediaTypeMuxed_;
106 NSString* AVCaptureSessionRuntimeErrorNotification_; 94 NSString* AVCaptureSessionRuntimeErrorNotification_;
107 NSString* AVCaptureSessionDidStopRunningNotification_; 95 NSString* AVCaptureSessionDidStopRunningNotification_;
108 NSString* AVCaptureSessionErrorKey_; 96 NSString* AVCaptureSessionErrorKey_;
109 NSString* AVCaptureSessionPreset320x240_;
110 NSString* AVCaptureSessionPreset640x480_;
111 NSString* AVCaptureSessionPreset1280x720_;
112 NSString* AVVideoScalingModeKey_; 97 NSString* AVVideoScalingModeKey_;
113 NSString* AVVideoScalingModeResizeAspectFill_; 98 NSString* AVVideoScalingModeResizeAspectFill_;
114 99
115 DISALLOW_COPY_AND_ASSIGN(AVFoundationInternal); 100 DISALLOW_COPY_AND_ASSIGN(AVFoundationInternal);
116 }; 101 };
117 102
118 } // namespace 103 } // namespace
119 104
120 static base::LazyInstance<AVFoundationInternal> g_avfoundation_handle = 105 static base::LazyInstance<AVFoundationInternal> g_avfoundation_handle =
121 LAZY_INSTANCE_INITIALIZER; 106 LAZY_INSTANCE_INITIALIZER;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 151
167 NSString* AVFoundationGlue::AVCaptureSessionDidStopRunningNotification() { 152 NSString* AVFoundationGlue::AVCaptureSessionDidStopRunningNotification() {
168 return 153 return
169 g_avfoundation_handle.Get().AVCaptureSessionDidStopRunningNotification(); 154 g_avfoundation_handle.Get().AVCaptureSessionDidStopRunningNotification();
170 } 155 }
171 156
172 NSString* AVFoundationGlue::AVCaptureSessionErrorKey() { 157 NSString* AVFoundationGlue::AVCaptureSessionErrorKey() {
173 return g_avfoundation_handle.Get().AVCaptureSessionErrorKey(); 158 return g_avfoundation_handle.Get().AVCaptureSessionErrorKey();
174 } 159 }
175 160
176 NSString* AVFoundationGlue::AVCaptureSessionPreset320x240() {
177 return g_avfoundation_handle.Get().AVCaptureSessionPreset320x240();
178 }
179
180 NSString* AVFoundationGlue::AVCaptureSessionPreset640x480() {
181 return g_avfoundation_handle.Get().AVCaptureSessionPreset640x480();
182 }
183
184 NSString* AVFoundationGlue::AVCaptureSessionPreset1280x720() {
185 return g_avfoundation_handle.Get().AVCaptureSessionPreset1280x720();
186 }
187
188 NSString* AVFoundationGlue::AVVideoScalingModeKey() { 161 NSString* AVFoundationGlue::AVVideoScalingModeKey() {
189 return g_avfoundation_handle.Get().AVVideoScalingModeKey(); 162 return g_avfoundation_handle.Get().AVVideoScalingModeKey();
190 } 163 }
191 164
192 NSString* AVFoundationGlue::AVVideoScalingModeResizeAspectFill() { 165 NSString* AVFoundationGlue::AVVideoScalingModeResizeAspectFill() {
193 return g_avfoundation_handle.Get().AVVideoScalingModeResizeAspectFill(); 166 return g_avfoundation_handle.Get().AVVideoScalingModeResizeAspectFill();
194 } 167 }
195 168
196 Class AVFoundationGlue::AVCaptureSessionClass() { 169 Class AVFoundationGlue::AVCaptureSessionClass() {
197 return [AVFoundationBundle() classNamed:@"AVCaptureSession"]; 170 return [AVFoundationBundle() classNamed:@"AVCaptureSession"];
(...skipping 26 matching lines...) Expand all
224 @implementation AVCaptureDeviceInputGlue 197 @implementation AVCaptureDeviceInputGlue
225 198
226 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device 199 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device
227 error:(NSError**)outError { 200 error:(NSError**)outError {
228 return [[AVFoundationGlue::AVFoundationBundle() 201 return [[AVFoundationGlue::AVFoundationBundle()
229 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device 202 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device
230 error:outError]; 203 error:outError];
231 } 204 }
232 205
233 @end // @implementation AVCaptureDeviceInputGlue 206 @end // @implementation AVCaptureDeviceInputGlue
OLDNEW
« no previous file with comments | « media/video/capture/mac/avfoundation_glue.h ('k') | media/video/capture/mac/video_capture_device_avfoundation_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698