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

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

Issue 2398463003: 16 bit capture and GPU&CPU memory buffer support.
Patch Set: fixes. 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/macros.h" 14 #include "base/macros.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "base/win/scoped_co_mem.h" 16 #include "base/win/scoped_co_mem.h"
17 #include "base/win/scoped_variant.h" 17 #include "base/win/scoped_variant.h"
18 #include "media/base/timestamp_constants.h" 18 #include "media/base/timestamp_constants.h"
19 #include "media/capture/video/blob_utils.h" 19 #include "media/capture/video/video_capture_utils.h"
20 20
21 using base::win::ScopedCoMem; 21 using base::win::ScopedCoMem;
22 using base::win::ScopedComPtr; 22 using base::win::ScopedComPtr;
23 using base::win::ScopedVariant; 23 using base::win::ScopedVariant;
24 24
25 namespace media { 25 namespace media {
26 26
27 #if DCHECK_IS_ON() 27 #if DCHECK_IS_ON()
28 #define DLOG_IF_FAILED_WITH_HRESULT(message, hr) \ 28 #define DLOG_IF_FAILED_WITH_HRESULT(message, hr) \
29 { \ 29 { \
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 {MEDIASUBTYPE_YUY2, PIXEL_FORMAT_YUY2}, 168 {MEDIASUBTYPE_YUY2, PIXEL_FORMAT_YUY2},
169 {MEDIASUBTYPE_MJPG, PIXEL_FORMAT_MJPEG}, 169 {MEDIASUBTYPE_MJPG, PIXEL_FORMAT_MJPEG},
170 {MEDIASUBTYPE_UYVY, PIXEL_FORMAT_UYVY}, 170 {MEDIASUBTYPE_UYVY, PIXEL_FORMAT_UYVY},
171 {MEDIASUBTYPE_ARGB32, PIXEL_FORMAT_ARGB}, 171 {MEDIASUBTYPE_ARGB32, PIXEL_FORMAT_ARGB},
172 {kMediaSubTypeHDYC, PIXEL_FORMAT_UYVY}, 172 {kMediaSubTypeHDYC, PIXEL_FORMAT_UYVY},
173 }; 173 };
174 for (const auto& pixel_format : kMediaSubtypeToPixelFormatCorrespondence) { 174 for (const auto& pixel_format : kMediaSubtypeToPixelFormatCorrespondence) {
175 if (sub_type == pixel_format.sub_type) 175 if (sub_type == pixel_format.sub_type)
176 return pixel_format.format; 176 return pixel_format.format;
177 } 177 }
178 if (IsY16FormatFourCc(sub_type.Data1)) {
179 return PIXEL_FORMAT_Y16;
180 }
178 #ifndef NDEBUG 181 #ifndef NDEBUG
179 WCHAR guid_str[128]; 182 WCHAR guid_str[128];
180 StringFromGUID2(sub_type, guid_str, arraysize(guid_str)); 183 StringFromGUID2(sub_type, guid_str, arraysize(guid_str));
181 DVLOG(2) << "Device (also) supports an unknown media type " << guid_str; 184 DVLOG(2) << "Device (also) supports an unknown media type " << guid_str;
182 #endif 185 #endif
183 return PIXEL_FORMAT_UNKNOWN; 186 return PIXEL_FORMAT_UNKNOWN;
184 } 187 }
185 188
186 void VideoCaptureDeviceWin::ScopedMediaType::Free() { 189 void VideoCaptureDeviceWin::ScopedMediaType::Free() {
187 if (!media_type_) 190 if (!media_type_)
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 void VideoCaptureDeviceWin::SetErrorState( 592 void VideoCaptureDeviceWin::SetErrorState(
590 const tracked_objects::Location& from_here, 593 const tracked_objects::Location& from_here,
591 const std::string& reason, 594 const std::string& reason,
592 HRESULT hr) { 595 HRESULT hr) {
593 DCHECK(thread_checker_.CalledOnValidThread()); 596 DCHECK(thread_checker_.CalledOnValidThread());
594 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); 597 DLOG_IF_FAILED_WITH_HRESULT(reason, hr);
595 state_ = kError; 598 state_ = kError;
596 client_->OnError(from_here, reason); 599 client_->OnError(from_here, reason);
597 } 600 }
598 } // namespace media 601 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/win/video_capture_device_mf_win.cc ('k') | media/renderers/gpu_video_accelerator_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698