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

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

Issue 2428263004: 16 bpp video stream capture, render and createImageBitmap(video) using (CPU) shared memory buffers (Closed)
Patch Set: Split webrtc_depth_capture_browsertest. Thanks phoglund@, Created 4 years, 1 month 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/location.h" 13 #include "base/location.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "base/win/scoped_co_mem.h" 18 #include "base/win/scoped_co_mem.h"
19 #include "base/win/windows_version.h" 19 #include "base/win/windows_version.h"
20 #include "media/capture/video/win/capability_list_win.h" 20 #include "media/capture/video/win/capability_list_win.h"
21 #include "media/capture/video/win/sink_filter_win.h"
21 22
22 using base::win::ScopedCoMem; 23 using base::win::ScopedCoMem;
23 using base::win::ScopedComPtr; 24 using base::win::ScopedComPtr;
24 25
25 namespace media { 26 namespace media {
26 27
27 static bool GetFrameSize(IMFMediaType* type, gfx::Size* frame_size) { 28 static bool GetFrameSize(IMFMediaType* type, gfx::Size* frame_size) {
28 UINT32 width32, height32; 29 UINT32 width32, height32;
29 if (FAILED(MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width32, &height32))) 30 if (FAILED(MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width32, &height32)))
30 return false; 31 return false;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const GUID& guid; 164 const GUID& guid;
164 const VideoPixelFormat format; 165 const VideoPixelFormat format;
165 } static const kFormatMap[] = { 166 } static const kFormatMap[] = {
166 {MFVideoFormat_I420, PIXEL_FORMAT_I420}, 167 {MFVideoFormat_I420, PIXEL_FORMAT_I420},
167 {MFVideoFormat_YUY2, PIXEL_FORMAT_YUY2}, 168 {MFVideoFormat_YUY2, PIXEL_FORMAT_YUY2},
168 {MFVideoFormat_UYVY, PIXEL_FORMAT_UYVY}, 169 {MFVideoFormat_UYVY, PIXEL_FORMAT_UYVY},
169 {MFVideoFormat_RGB24, PIXEL_FORMAT_RGB24}, 170 {MFVideoFormat_RGB24, PIXEL_FORMAT_RGB24},
170 {MFVideoFormat_ARGB32, PIXEL_FORMAT_ARGB}, 171 {MFVideoFormat_ARGB32, PIXEL_FORMAT_ARGB},
171 {MFVideoFormat_MJPG, PIXEL_FORMAT_MJPEG}, 172 {MFVideoFormat_MJPG, PIXEL_FORMAT_MJPEG},
172 {MFVideoFormat_YV12, PIXEL_FORMAT_YV12}, 173 {MFVideoFormat_YV12, PIXEL_FORMAT_YV12},
174 {kMediaSubTypeY16, PIXEL_FORMAT_Y16},
175 {kMediaSubTypeZ16, PIXEL_FORMAT_Y16},
176 {kMediaSubTypeINVZ, PIXEL_FORMAT_Y16},
173 }; 177 };
174 178
175 for (const auto& kFormat : kFormatMap) { 179 for (const auto& kFormat : kFormatMap) {
176 if (kFormat.guid == guid) { 180 if (kFormat.guid == guid) {
177 *format = kFormat.format; 181 *format = kFormat.format;
178 return true; 182 return true;
179 } 183 }
180 } 184 }
181 185
182 return false; 186 return false;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 HRESULT hr) { 310 HRESULT hr) {
307 if (client_.get()) { 311 if (client_.get()) {
308 client_->OnError( 312 client_->OnError(
309 from_here, 313 from_here,
310 base::StringPrintf("VideoCaptureDeviceMFWin: %s", 314 base::StringPrintf("VideoCaptureDeviceMFWin: %s",
311 logging::SystemErrorCodeToString(hr).c_str())); 315 logging::SystemErrorCodeToString(hr).c_str()));
312 } 316 }
313 } 317 }
314 318
315 } // namespace media 319 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698