Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } | |
|
mcasas
2016/10/21 00:10:51
Here and in the equivalent MF version, I don't lik
aleksandar.stojiljkovic
2016/10/21 22:11:11
No problem - I though it was a good idea to share
aleksandar.stojiljkovic
2016/10/24 14:57:49
Done. Done like for other formats.
| |
| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 void VideoCaptureDeviceWin::SetErrorState( | 589 void VideoCaptureDeviceWin::SetErrorState( |
| 587 const tracked_objects::Location& from_here, | 590 const tracked_objects::Location& from_here, |
| 588 const std::string& reason, | 591 const std::string& reason, |
| 589 HRESULT hr) { | 592 HRESULT hr) { |
| 590 DCHECK(thread_checker_.CalledOnValidThread()); | 593 DCHECK(thread_checker_.CalledOnValidThread()); |
| 591 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); | 594 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); |
| 592 state_ = kError; | 595 state_ = kError; |
| 593 client_->OnError(from_here, reason); | 596 client_->OnError(from_here, reason); |
| 594 } | 597 } |
| 595 } // namespace media | 598 } // namespace media |
| OLD | NEW |