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

Unified Diff: trunk/src/media/video/capture/win/video_capture_device_mf_win.cc

Issue 84393002: Revert 236927 "Reorganize media::VideoCapture* types" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/media/video/capture/win/video_capture_device_mf_win.cc
===================================================================
--- trunk/src/media/video/capture/win/video_capture_device_mf_win.cc (revision 236934)
+++ trunk/src/media/video/capture/win/video_capture_device_mf_win.cc (working copy)
@@ -94,11 +94,12 @@
return false;
}
-bool GetFrameSize(IMFMediaType* type, gfx::Size* frame_size) {
+bool GetFrameSize(IMFMediaType* type, int* width, int* height) {
UINT32 width32, height32;
if (FAILED(MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width32, &height32)))
return false;
- frame_size->SetSize(width32, height32);
+ *width = width32;
+ *height = height32;
return true;
}
@@ -120,15 +121,15 @@
VideoCaptureCapabilityWin* capability) {
GUID type_guid;
if (FAILED(type->GetGUID(MF_MT_SUBTYPE, &type_guid)) ||
- !GetFrameSize(type, &capability->supported_format.frame_size) ||
+ !FormatFromGuid(type_guid, &capability->color) ||
+ !GetFrameSize(type, &capability->width, &capability->height) ||
!GetFrameRate(type,
&capability->frame_rate_numerator,
- &capability->frame_rate_denominator) ||
- !FormatFromGuid(type_guid, &capability->supported_format.pixel_format)) {
+ &capability->frame_rate_denominator)) {
return false;
}
// Keep the integer version of the frame_rate for (potential) returns.
- capability->supported_format.frame_rate =
+ capability->frame_rate =
capability->frame_rate_numerator / capability->frame_rate_denominator;
return true;
@@ -336,7 +337,7 @@
}
void VideoCaptureDeviceMFWin::AllocateAndStart(
- const VideoCaptureParams& params,
+ const VideoCaptureCapability& capture_format,
scoped_ptr<VideoCaptureDevice::Client> client) {
DCHECK(CalledOnValidThread());
@@ -353,10 +354,13 @@
}
VideoCaptureCapabilityWin found_capability =
- capabilities.GetBestMatchedFormat(
- params.requested_format.frame_size.width(),
- params.requested_format.frame_size.height(),
- params.requested_format.frame_rate);
+ capabilities.GetBestMatchedCapability(capture_format.width,
+ capture_format.height,
+ capture_format.frame_rate);
+ DLOG(INFO) << "Chosen capture format= (" << found_capability.width << "x"
+ << found_capability.height << ")@("
+ << found_capability.frame_rate_numerator << "/"
+ << found_capability.frame_rate_denominator << ")fps";
ScopedComPtr<IMFMediaType> type;
if (FAILED(hr = reader_->GetNativeMediaType(
@@ -373,7 +377,7 @@
OnError(hr);
return;
}
- capture_format_ = found_capability.supported_format;
+ current_setting_ = found_capability;
capture_ = true;
}
@@ -420,7 +424,7 @@
rotation,
flip_vert,
flip_horiz,
- capture_format_);
+ current_setting_);
if (capture_) {
HRESULT hr = reader_->ReadSample(MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0,

Powered by Google App Engine
This is Rietveld 408576698