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

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

Issue 900233002: Enumerate MJPEG as the prefered format if set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit. Created 5 years, 10 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
« no previous file with comments | « media/video/capture/win/sink_input_pin_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 ScopedMediaType media_type; 344 ScopedMediaType media_type;
345 345
346 // Get the windows capability from the capture device. 346 // Get the windows capability from the capture device.
347 // GetStreamCaps can return S_FALSE which we consider an error. Therefore the 347 // GetStreamCaps can return S_FALSE which we consider an error. Therefore the
348 // FAILED macro can't be used. 348 // FAILED macro can't be used.
349 hr = stream_config->GetStreamCaps( 349 hr = stream_config->GetStreamCaps(
350 found_capability.stream_index, media_type.Receive(), caps.get()); 350 found_capability.stream_index, media_type.Receive(), caps.get());
351 if (hr != S_OK) { 351 if (hr != S_OK) {
352 SetErrorState("Failed to get capture device capabilities"); 352 SetErrorState("Failed to get capture device capabilities");
353 return; 353 return;
354 } else { 354 }
355 if (media_type->formattype == FORMAT_VideoInfo) { 355 if (media_type->formattype == FORMAT_VideoInfo) {
356 VIDEOINFOHEADER* h = 356 VIDEOINFOHEADER* h =
357 reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat); 357 reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat);
358 if (format.frame_rate > 0) 358 if (format.frame_rate > 0)
359 h->AvgTimePerFrame = kSecondsToReferenceTime / format.frame_rate; 359 h->AvgTimePerFrame = kSecondsToReferenceTime / format.frame_rate;
360 } 360 }
361 // Set the sink filter to request this format. 361 // Set the sink filter to request this format.
362 sink_filter_->SetRequestedMediaFormat(format); 362 sink_filter_->SetRequestedMediaFormat(format);
363 // Order the capture device to use this format. 363 // Order the capture device to use this format.
364 hr = stream_config->SetFormat(media_type.get()); 364 hr = stream_config->SetFormat(media_type.get());
365 if (FAILED(hr)) { 365 if (FAILED(hr)) {
366 // TODO(grunell): Log the error. http://crbug.com/405016. 366 // TODO(grunell): Log the error. http://crbug.com/405016.
367 SetErrorState("Failed to set capture device output format"); 367 SetErrorState("Failed to set capture device output format");
368 return; 368 return;
369 }
370 } 369 }
371 370
372 SetAntiFlickerInCaptureFilter(); 371 SetAntiFlickerInCaptureFilter();
373 372
374 if (media_type->subtype == kMediaSubTypeHDYC) { 373 if (media_type->subtype == kMediaSubTypeHDYC) {
375 // HDYC pixel format, used by the DeckLink capture card, needs an AVI 374 // HDYC pixel format, used by the DeckLink capture card, needs an AVI
376 // decompressor filter after source, let |graph_builder_| add it. 375 // decompressor filter after source, let |graph_builder_| add it.
377 hr = graph_builder_->Connect(output_capture_pin_.get(), 376 hr = graph_builder_->Connect(output_capture_pin_.get(),
378 input_sink_pin_.get()); 377 input_sink_pin_.get());
379 } else { 378 } else {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 return E_FAIL; 611 return E_FAIL;
613 return S_OK; 612 return S_OK;
614 } 613 }
615 614
616 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { 615 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) {
617 DCHECK(CalledOnValidThread()); 616 DCHECK(CalledOnValidThread());
618 state_ = kError; 617 state_ = kError;
619 client_->OnError(reason); 618 client_->OnError(reason);
620 } 619 }
621 } // namespace media 620 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/win/sink_input_pin_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698