Commit 3e7f51c7 authored by amineer@chromium.org's avatar amineer@chromium.org

Revert 276590 "VideoCaptureDevice Win: Enumerate devices' suppor..."

Reverting on trunk at author's request to eliminate crasher

> VideoCaptureDevice Win: Enumerate devices' supported formats when they don't have a DevicePath property.
> 
> BUG=380939
> 
> Review URL: https://codereview.chromium.org/328463002

TBR=mcasas@chromium.org

Review URL: https://codereview.chromium.org/340353003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278554 0039d316-1c4b-4281-b951-d872f2087c98
parent fc60ce4d
...@@ -123,8 +123,7 @@ static void GetDeviceNamesDirectShow(VideoCaptureDevice::Names* device_names) { ...@@ -123,8 +123,7 @@ static void GetDeviceNamesDirectShow(VideoCaptureDevice::Names* device_names) {
continue; continue;
} }
// Find the description or friendly name. TODO(mcasas): Investigate using // Find the description or friendly name.
// FriendlyName before Description, http://crbug.com/383395.
ScopedVariant name; ScopedVariant name;
hr = prop_bag->Read(L"Description", name.Receive(), 0); hr = prop_bag->Read(L"Description", name.Receive(), 0);
if (FAILED(hr)) if (FAILED(hr))
...@@ -224,9 +223,7 @@ static void GetDeviceSupportedFormatsDirectShow( ...@@ -224,9 +223,7 @@ static void GetDeviceSupportedFormatsDirectShow(
device_id.Reset(); device_id.Reset();
hr = prop_bag->Read(L"DevicePath", device_id.Receive(), 0); hr = prop_bag->Read(L"DevicePath", device_id.Receive(), 0);
if (FAILED(hr) || device_id.type() != VT_BSTR) { if (FAILED(hr) || device_id.type() != VT_BSTR) {
// If there is no clear DevicePath, try with Description and FriendlyName, // If there is no clear DevicePath, try with Description and FriendlyName.
// this might happen with non-USB cameras such as DeckLinks. TODO(mcasas):
// use FriendlyName before Description, http://crbug.com/383395.
ScopedVariant name; ScopedVariant name;
if (SUCCEEDED(prop_bag->Read(L"Description", name.Receive(), 0)) || if (SUCCEEDED(prop_bag->Read(L"Description", name.Receive(), 0)) ||
SUCCEEDED(prop_bag->Read(L"FriendlyName", name.Receive(), 0))) { SUCCEEDED(prop_bag->Read(L"FriendlyName", name.Receive(), 0))) {
...@@ -300,9 +297,8 @@ static void GetDeviceSupportedFormatsDirectShow( ...@@ -300,9 +297,8 @@ static void GetDeviceSupportedFormatsDirectShow(
h->bmiHeader.biHeight); h->bmiHeader.biHeight);
// Trust the frame rate from the VIDEOINFOHEADER. // Trust the frame rate from the VIDEOINFOHEADER.
format.frame_rate = (h->AvgTimePerFrame > 0) ? format.frame_rate = (h->AvgTimePerFrame > 0) ?
kSecondsToReferenceTime / static_cast<float>(h->AvgTimePerFrame) : static_cast<int>(kSecondsToReferenceTime / h->AvgTimePerFrame) :
0.0; 0;
formats->push_back(format); formats->push_back(format);
DVLOG(1) << device.name() << " resolution: " DVLOG(1) << device.name() << " resolution: "
<< format.frame_size.ToString() << ", fps: " << format.frame_rate << format.frame_size.ToString() << ", fps: " << format.frame_rate
...@@ -349,8 +345,7 @@ static void GetDeviceSupportedFormatsMediaFoundation( ...@@ -349,8 +345,7 @@ static void GetDeviceSupportedFormatsMediaFoundation(
DLOG(ERROR) << "MFGetAttributeSize: " << std::hex << hr; DLOG(ERROR) << "MFGetAttributeSize: " << std::hex << hr;
return; return;
} }
capture_format.frame_rate = denominator ? capture_format.frame_rate = denominator ? numerator / denominator : 0;
numerator / static_cast<float>(denominator) : 0.0f;
GUID type_guid; GUID type_guid;
hr = type->GetGUID(MF_MT_SUBTYPE, &type_guid); hr = type->GetGUID(MF_MT_SUBTYPE, &type_guid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment