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/video/capture/win/video_capture_device_win.h" | 5 #include "media/video/capture/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> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // static | 148 // static |
149 VideoPixelFormat VideoCaptureDeviceWin::TranslateMediaSubtypeToPixelFormat( | 149 VideoPixelFormat VideoCaptureDeviceWin::TranslateMediaSubtypeToPixelFormat( |
150 const GUID& sub_type) { | 150 const GUID& sub_type) { |
151 static struct { | 151 static struct { |
152 const GUID& sub_type; | 152 const GUID& sub_type; |
153 VideoPixelFormat format; | 153 VideoPixelFormat format; |
154 } pixel_formats[] = { | 154 } pixel_formats[] = { |
155 { kMediaSubTypeI420, PIXEL_FORMAT_I420 }, | 155 { kMediaSubTypeI420, PIXEL_FORMAT_I420 }, |
156 { MEDIASUBTYPE_IYUV, PIXEL_FORMAT_I420 }, | 156 { MEDIASUBTYPE_IYUV, PIXEL_FORMAT_I420 }, |
157 { MEDIASUBTYPE_RGB24, PIXEL_FORMAT_RGB24 }, | 157 { MEDIASUBTYPE_RGB24, PIXEL_FORMAT_RGB24 }, |
| 158 { MEDIASUBTYPE_RGB32, PIXEL_FORMAT_RGB32 }, |
158 { MEDIASUBTYPE_YUY2, PIXEL_FORMAT_YUY2 }, | 159 { MEDIASUBTYPE_YUY2, PIXEL_FORMAT_YUY2 }, |
159 { MEDIASUBTYPE_MJPG, PIXEL_FORMAT_MJPEG }, | 160 { MEDIASUBTYPE_MJPG, PIXEL_FORMAT_MJPEG }, |
160 { MEDIASUBTYPE_UYVY, PIXEL_FORMAT_UYVY }, | 161 { MEDIASUBTYPE_UYVY, PIXEL_FORMAT_UYVY }, |
161 { MEDIASUBTYPE_ARGB32, PIXEL_FORMAT_ARGB }, | 162 { MEDIASUBTYPE_ARGB32, PIXEL_FORMAT_ARGB }, |
162 { kMediaSubTypeHDYC, PIXEL_FORMAT_UYVY }, | 163 { kMediaSubTypeHDYC, PIXEL_FORMAT_UYVY }, |
163 }; | 164 }; |
164 for (size_t i = 0; i < arraysize(pixel_formats); ++i) { | 165 for (const auto& pixel_format : pixel_formats) { |
165 if (sub_type == pixel_formats[i].sub_type) | 166 if (sub_type == pixel_format.sub_type) |
166 return pixel_formats[i].format; | 167 return pixel_format.format; |
167 } | 168 } |
168 #ifndef NDEBUG | 169 #ifndef NDEBUG |
169 WCHAR guid_str[128]; | 170 WCHAR guid_str[128]; |
170 StringFromGUID2(sub_type, guid_str, arraysize(guid_str)); | 171 StringFromGUID2(sub_type, guid_str, arraysize(guid_str)); |
171 DVLOG(2) << "Device (also) supports an unknown media type " << guid_str; | 172 DVLOG(2) << "Device (also) supports an unknown media type " << guid_str; |
172 #endif | 173 #endif |
173 return PIXEL_FORMAT_UNKNOWN; | 174 return PIXEL_FORMAT_UNKNOWN; |
174 } | 175 } |
175 | 176 |
176 void VideoCaptureDeviceWin::ScopedMediaType::Free() { | 177 void VideoCaptureDeviceWin::ScopedMediaType::Free() { |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 return E_FAIL; | 613 return E_FAIL; |
613 return S_OK; | 614 return S_OK; |
614 } | 615 } |
615 | 616 |
616 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { | 617 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { |
617 DCHECK(CalledOnValidThread()); | 618 DCHECK(CalledOnValidThread()); |
618 state_ = kError; | 619 state_ = kError; |
619 client_->OnError(reason); | 620 client_->OnError(reason); |
620 } | 621 } |
621 } // namespace media | 622 } // namespace media |
OLD | NEW |