Mark
Mark

Reputation: 5038

Virtual Driver: how to force resolutions for debugging

I'm working on a Virtual Driver (Directshow filter) and I'm using graphedt to test and debug the filter.

Right now my code supports only the resolution of 320x240 px (hardcoded). As far as I understand I need to handle the GetMediaType and GetStreamCaps functions to support other resolutions.

Two questions:

  1. I'm looking for an example for this but I cannot find it, perhaps I'm using wrong keywords in my websearch

  2. how to force a request for a specific resolution in order to test my code using graphedt or any other tool?

Upvotes: 0

Views: 35

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69687

I'm looking for an example for this but I cannot find it, perhaps I'm using wrong keywords in my websearch

Here you go: https://github.com/rdp/open-source-directshow-video-capture-demo-filter/blob/master/vcam_vs_2010_demo_video_capture_project/vcam_vs_2010/Filters.cpp#L237

Eight resolutions:

if(iPosition < 0) return E_INVALIDARG;
if(iPosition > 8) return VFW_S_NO_MORE_ITEMS;

[...]

pvi->bmiHeader.biWidth      = 80 * iPosition;
pvi->bmiHeader.biHeight     = 60 * iPosition;

how to force a request for a specific resolution in order to test my code using graphedt or any other tool?

Real application will (might) choose among available.

GraphStudioNext offers Ctrl+Shift+M option to choose while connecting.

Otherwise it is typical to pick resolutions/media types in order of enumeration, so the line 237 I highlighted with the link above shows you the way to temporarily override:

if (iIndex == 0) iIndex = 4;

Upvotes: 1

Related Questions