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

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

Issue 558503003: Windows video capture: Remove duplicated code from GetDeviceSupportedFormats* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: offline discussion Created 6 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/video/capture/win/video_capture_device_mf_win.h" 5 #include "media/video/capture/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 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 !GetFrameSize(type, &format->frame_size) || 51 !GetFrameSize(type, &format->frame_size) ||
52 !GetFrameRate(type, &format->frame_rate) || 52 !GetFrameRate(type, &format->frame_rate) ||
53 !VideoCaptureDeviceMFWin::FormatFromGuid(type_guid, 53 !VideoCaptureDeviceMFWin::FormatFromGuid(type_guid,
54 &format->pixel_format)) { 54 &format->pixel_format)) {
55 return false; 55 return false;
56 } 56 }
57 57
58 return true; 58 return true;
59 } 59 }
60 60
61 HRESULT FillCapabilities(IMFSourceReader* source, 61 HRESULT VideoCaptureDeviceMFWin::FillCapabilities(
62 CapabilityList* capabilities) { 62 IMFSourceReader* source,
63 CapabilityList* capabilities) {
63 DWORD stream_index = 0; 64 DWORD stream_index = 0;
64 ScopedComPtr<IMFMediaType> type; 65 ScopedComPtr<IMFMediaType> type;
65 HRESULT hr; 66 HRESULT hr;
66 while (SUCCEEDED(hr = source->GetNativeMediaType( 67 while (SUCCEEDED(hr = source->GetNativeMediaType(
67 kFirstVideoStream, stream_index, type.Receive()))) { 68 kFirstVideoStream, stream_index, type.Receive()))) {
68 VideoCaptureFormat format; 69 VideoCaptureFormat format;
69 if (FillFormat(type, &format)) 70 if (FillFormat(type, &format))
70 capabilities->emplace_back(stream_index, format); 71 capabilities->emplace_back(stream_index, format);
71 type.Release(); 72 type.Release();
72 ++stream_index; 73 ++stream_index;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 320
320 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { 321 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) {
321 if (client_.get()) { 322 if (client_.get()) {
322 client_->OnError( 323 client_->OnError(
323 base::StringPrintf("VideoCaptureDeviceMFWin: %s", 324 base::StringPrintf("VideoCaptureDeviceMFWin: %s",
324 logging::SystemErrorCodeToString(hr).c_str())); 325 logging::SystemErrorCodeToString(hr).c_str()));
325 } 326 }
326 } 327 }
327 328
328 } // namespace media 329 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/win/video_capture_device_mf_win.h ('k') | media/video/capture/win/video_capture_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698