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

Side by Side Diff: media/capture/video/win/video_capture_device_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_win.h" 5 #include "media/capture/video/win/video_capture_device_win.h"
6 6
7 #include <ks.h> 7 #include <ks.h>
8 #include <ksmedia.h> 8 #include <ksmedia.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <list> 11 #include <list>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/big_endian.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
16 #include "base/win/scoped_co_mem.h" 17 #include "base/win/scoped_co_mem.h"
17 #include "base/win/scoped_variant.h" 18 #include "base/win/scoped_variant.h"
18 #include "media/base/timestamp_constants.h" 19 #include "media/base/timestamp_constants.h"
19 20
20 using base::win::ScopedCoMem; 21 using base::win::ScopedCoMem;
21 using base::win::ScopedComPtr; 22 using base::win::ScopedComPtr;
22 using base::win::ScopedVariant; 23 using base::win::ScopedVariant;
23 24
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 {MEDIASUBTYPE_YUY2, PIXEL_FORMAT_YUY2}, 157 {MEDIASUBTYPE_YUY2, PIXEL_FORMAT_YUY2},
157 {MEDIASUBTYPE_MJPG, PIXEL_FORMAT_MJPEG}, 158 {MEDIASUBTYPE_MJPG, PIXEL_FORMAT_MJPEG},
158 {MEDIASUBTYPE_UYVY, PIXEL_FORMAT_UYVY}, 159 {MEDIASUBTYPE_UYVY, PIXEL_FORMAT_UYVY},
159 {MEDIASUBTYPE_ARGB32, PIXEL_FORMAT_ARGB}, 160 {MEDIASUBTYPE_ARGB32, PIXEL_FORMAT_ARGB},
160 {kMediaSubTypeHDYC, PIXEL_FORMAT_UYVY}, 161 {kMediaSubTypeHDYC, PIXEL_FORMAT_UYVY},
161 }; 162 };
162 for (const auto& pixel_format : kMediaSubtypeToPixelFormatCorrespondence) { 163 for (const auto& pixel_format : kMediaSubtypeToPixelFormatCorrespondence) {
163 if (sub_type == pixel_format.sub_type) 164 if (sub_type == pixel_format.sub_type)
164 return pixel_format.format; 165 return pixel_format.format;
165 } 166 }
167 // TODO(astojilj) Define GUIDs and move this to common place as the code is
168 // replicated around.
169 uint32_t fourcc;
170 base::ReadBigEndian(reinterpret_cast<const char*>(&sub_type.Data1), &fourcc);
171 if (fourcc == 'Z16 ' || fourcc == 'INVZ') {
172 return PIXEL_FORMAT_Y16;
173 } else if (fourcc == 'Y8 ') {
174 return PIXEL_FORMAT_Y8;
175 }
166 #ifndef NDEBUG 176 #ifndef NDEBUG
167 WCHAR guid_str[128]; 177 WCHAR guid_str[128];
168 StringFromGUID2(sub_type, guid_str, arraysize(guid_str)); 178 StringFromGUID2(sub_type, guid_str, arraysize(guid_str));
169 DVLOG(2) << "Device (also) supports an unknown media type " << guid_str; 179 DVLOG(2) << "Device (also) supports an unknown media type " << guid_str;
170 #endif 180 #endif
171 return PIXEL_FORMAT_UNKNOWN; 181 return PIXEL_FORMAT_UNKNOWN;
172 } 182 }
173 183
174 void VideoCaptureDeviceWin::ScopedMediaType::Free() { 184 void VideoCaptureDeviceWin::ScopedMediaType::Free() {
175 if (!media_type_) 185 if (!media_type_)
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 595 }
586 596
587 void VideoCaptureDeviceWin::SetErrorState( 597 void VideoCaptureDeviceWin::SetErrorState(
588 const tracked_objects::Location& from_here, 598 const tracked_objects::Location& from_here,
589 const std::string& reason) { 599 const std::string& reason) {
590 DCHECK(thread_checker_.CalledOnValidThread()); 600 DCHECK(thread_checker_.CalledOnValidThread());
591 state_ = kError; 601 state_ = kError;
592 client_->OnError(from_here, reason); 602 client_->OnError(from_here, reason);
593 } 603 }
594 } // namespace media 604 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698