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

Side by Side Diff: media/capture/video/win/video_capture_device_mf_win.cc

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests: cc, skcanvas_video_renderer, wrtcrecorder... Fake capture supports Y16. Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/capture/video/win/video_capture_device_mf_win.h" 5 #include "media/capture/video/win/video_capture_device_mf_win.h"
6 6
7 #include <mfapi.h> 7 #include <mfapi.h>
8 #include <mferror.h> 8 #include <mferror.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/big_endian.h"
13 #include "base/location.h" 14 #include "base/location.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/strings/sys_string_conversions.h" 17 #include "base/strings/sys_string_conversions.h"
17 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
18 #include "base/win/scoped_co_mem.h" 19 #include "base/win/scoped_co_mem.h"
19 #include "base/win/windows_version.h" 20 #include "base/win/windows_version.h"
20 #include "media/capture/video/win/capability_list_win.h" 21 #include "media/capture/video/win/capability_list_win.h"
21 22
22 using base::win::ScopedCoMem; 23 using base::win::ScopedCoMem;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 {MFVideoFormat_MJPG, PIXEL_FORMAT_MJPEG}, 172 {MFVideoFormat_MJPG, PIXEL_FORMAT_MJPEG},
172 {MFVideoFormat_YV12, PIXEL_FORMAT_YV12}, 173 {MFVideoFormat_YV12, PIXEL_FORMAT_YV12},
173 }; 174 };
174 175
175 for (const auto& kFormat : kFormatMap) { 176 for (const auto& kFormat : kFormatMap) {
176 if (kFormat.guid == guid) { 177 if (kFormat.guid == guid) {
177 *format = kFormat.format; 178 *format = kFormat.format;
178 return true; 179 return true;
179 } 180 }
180 } 181 }
182 // TODO(astojilj) Define GUIDs and move this to common place as the code is
183 // replicated around.
184 uint32_t fourcc;
185 base::ReadBigEndian(reinterpret_cast<const char*>(&guid.Data1), &fourcc);
186 if (fourcc == 'Z16 ' || fourcc == 'INVZ') {
187 *format = PIXEL_FORMAT_Y16;
188 return true;
189 } else if (fourcc == 'Y8 ') {
190 *format = PIXEL_FORMAT_Y8;
191 return true;
192 }
181 193
182 return false; 194 return false;
183 } 195 }
184 196
185 VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin( 197 VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin(
186 const VideoCaptureDeviceDescriptor& device_descriptor) 198 const VideoCaptureDeviceDescriptor& device_descriptor)
187 : descriptor_(device_descriptor), capture_(0) { 199 : descriptor_(device_descriptor), capture_(0) {
188 DetachFromThread(); 200 DetachFromThread();
189 } 201 }
190 202
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 HRESULT hr) { 318 HRESULT hr) {
307 if (client_.get()) { 319 if (client_.get()) {
308 client_->OnError( 320 client_->OnError(
309 from_here, 321 from_here,
310 base::StringPrintf("VideoCaptureDeviceMFWin: %s", 322 base::StringPrintf("VideoCaptureDeviceMFWin: %s",
311 logging::SystemErrorCodeToString(hr).c_str())); 323 logging::SystemErrorCodeToString(hr).c_str()));
312 } 324 }
313 } 325 }
314 326
315 } // namespace media 327 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698