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

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

Issue 2864523002: Rename ScopedComPtr::QueryInterface to ScopedComPtr::CopyTo (Closed)
Patch Set: Created 3 years, 7 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 #include <objbase.h> 9 #include <objbase.h>
10 10
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 DLOG_IF_FAILED_WITH_HRESULT("Failed to create the Capture Graph Builder", hr); 287 DLOG_IF_FAILED_WITH_HRESULT("Failed to create the Capture Graph Builder", hr);
288 if (FAILED(hr)) 288 if (FAILED(hr))
289 return false; 289 return false;
290 290
291 hr = capture_graph_builder_->SetFiltergraph(graph_builder_.Get()); 291 hr = capture_graph_builder_->SetFiltergraph(graph_builder_.Get());
292 DLOG_IF_FAILED_WITH_HRESULT("Failed to give graph to capture graph builder", 292 DLOG_IF_FAILED_WITH_HRESULT("Failed to give graph to capture graph builder",
293 hr); 293 hr);
294 if (FAILED(hr)) 294 if (FAILED(hr))
295 return false; 295 return false;
296 296
297 hr = graph_builder_.QueryInterface(media_control_.Receive()); 297 hr = graph_builder_.CopyTo(media_control_.Receive());
298 DLOG_IF_FAILED_WITH_HRESULT("Failed to create media control builder", hr); 298 DLOG_IF_FAILED_WITH_HRESULT("Failed to create media control builder", hr);
299 if (FAILED(hr)) 299 if (FAILED(hr))
300 return false; 300 return false;
301 301
302 hr = graph_builder_->AddFilter(capture_filter_.Get(), NULL); 302 hr = graph_builder_->AddFilter(capture_filter_.Get(), NULL);
303 DLOG_IF_FAILED_WITH_HRESULT("Failed to add the capture device to the graph", 303 DLOG_IF_FAILED_WITH_HRESULT("Failed to add the capture device to the graph",
304 hr); 304 hr);
305 if (FAILED(hr)) 305 if (FAILED(hr))
306 return false; 306 return false;
307 307
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 const CapabilityWin found_capability = 343 const CapabilityWin found_capability =
344 GetBestMatchedCapability(params.requested_format, capabilities_); 344 GetBestMatchedCapability(params.requested_format, capabilities_);
345 345
346 // Reduce the frame rate if the requested frame rate is lower 346 // Reduce the frame rate if the requested frame rate is lower
347 // than the capability. 347 // than the capability.
348 const float frame_rate = 348 const float frame_rate =
349 std::min(params.requested_format.frame_rate, 349 std::min(params.requested_format.frame_rate,
350 found_capability.supported_format.frame_rate); 350 found_capability.supported_format.frame_rate);
351 351
352 ScopedComPtr<IAMStreamConfig> stream_config; 352 ScopedComPtr<IAMStreamConfig> stream_config;
353 HRESULT hr = output_capture_pin_.QueryInterface(stream_config.Receive()); 353 HRESULT hr = output_capture_pin_.CopyTo(stream_config.Receive());
354 if (FAILED(hr)) { 354 if (FAILED(hr)) {
355 SetErrorState(FROM_HERE, "Can't get the Capture format settings", hr); 355 SetErrorState(FROM_HERE, "Can't get the Capture format settings", hr);
356 return; 356 return;
357 } 357 }
358 358
359 int count = 0, size = 0; 359 int count = 0, size = 0;
360 hr = stream_config->GetNumberOfCapabilities(&count, &size); 360 hr = stream_config->GetNumberOfCapabilities(&count, &size);
361 if (FAILED(hr)) { 361 if (FAILED(hr)) {
362 SetErrorState(FROM_HERE, "Failed to GetNumberOfCapabilities", hr); 362 SetErrorState(FROM_HERE, "Failed to GetNumberOfCapabilities", hr);
363 return; 363 return;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 mojom::BlobPtr blob = Blobify(buffer, length, format); 476 mojom::BlobPtr blob = Blobify(buffer, length, format);
477 if (blob) 477 if (blob)
478 cb.Run(std::move(blob)); 478 cb.Run(std::move(blob));
479 } 479 }
480 } 480 }
481 481
482 bool VideoCaptureDeviceWin::CreateCapabilityMap() { 482 bool VideoCaptureDeviceWin::CreateCapabilityMap() {
483 DCHECK(thread_checker_.CalledOnValidThread()); 483 DCHECK(thread_checker_.CalledOnValidThread());
484 ScopedComPtr<IAMStreamConfig> stream_config; 484 ScopedComPtr<IAMStreamConfig> stream_config;
485 HRESULT hr = output_capture_pin_.QueryInterface(stream_config.Receive()); 485 HRESULT hr = output_capture_pin_.CopyTo(stream_config.Receive());
486 DLOG_IF_FAILED_WITH_HRESULT( 486 DLOG_IF_FAILED_WITH_HRESULT(
487 "Failed to get IAMStreamConfig from capture device", hr); 487 "Failed to get IAMStreamConfig from capture device", hr);
488 if (FAILED(hr)) 488 if (FAILED(hr))
489 return false; 489 return false;
490 490
491 // Get interface used for getting the frame rate. 491 // Get interface used for getting the frame rate.
492 ScopedComPtr<IAMVideoControl> video_control; 492 ScopedComPtr<IAMVideoControl> video_control;
493 hr = capture_filter_.QueryInterface(video_control.Receive()); 493 hr = capture_filter_.CopyTo(video_control.Receive());
494 494
495 int count = 0, size = 0; 495 int count = 0, size = 0;
496 hr = stream_config->GetNumberOfCapabilities(&count, &size); 496 hr = stream_config->GetNumberOfCapabilities(&count, &size);
497 DLOG_IF_FAILED_WITH_HRESULT("Failed to GetNumberOfCapabilities", hr); 497 DLOG_IF_FAILED_WITH_HRESULT("Failed to GetNumberOfCapabilities", hr);
498 if (FAILED(hr)) 498 if (FAILED(hr))
499 return false; 499 return false;
500 500
501 std::unique_ptr<BYTE[]> caps(new BYTE[size]); 501 std::unique_ptr<BYTE[]> caps(new BYTE[size]);
502 for (int stream_index = 0; stream_index < count; ++stream_index) { 502 for (int stream_index = 0; stream_index < count; ++stream_index) {
503 ScopedMediaType media_type; 503 ScopedMediaType media_type;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 void VideoCaptureDeviceWin::SetErrorState( 590 void VideoCaptureDeviceWin::SetErrorState(
591 const tracked_objects::Location& from_here, 591 const tracked_objects::Location& from_here,
592 const std::string& reason, 592 const std::string& reason,
593 HRESULT hr) { 593 HRESULT hr) {
594 DCHECK(thread_checker_.CalledOnValidThread()); 594 DCHECK(thread_checker_.CalledOnValidThread());
595 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); 595 DLOG_IF_FAILED_WITH_HRESULT(reason, hr);
596 state_ = kError; 596 state_ = kError;
597 client_->OnError(from_here, reason); 597 client_->OnError(from_here, reason);
598 } 598 }
599 } // namespace media 599 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/win/video_capture_device_factory_win.cc ('k') | media/gpu/d3d11_video_decode_accelerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698