Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

Media Foundation MFGetAttributeRatio works differently for Win 7 than WIn8 - how to set format?

$
0
0

I am Using Media foundation ISourceReader, ISourceMedia etc.

My camera supports several Resolutions with 60 FPS and 30 FPS. running the code in win 8 I get a different profile with MAX 60 for the 60 and a different profile with max 30 for the 30 FPS. however running same code in WIN7 gives me that for all FPS I get the 

Code:

Enumerating profiles, and stop at the profile that the desired FPS is the max FPS (as different profiles are returned for each FPS,and the max equals to the MAX_FPS).

for WIN8 following code works:

bool found=false;

while(!found)

{

HRESULT hr = m_reader->GetNativeMediaType(id,i,&pMediaType);
if (hr!=S_OK || pMediaType==NULL)
{
if(pMediaType)
{
pMediaType->Release();
}
break;
}

GUID subtype;
hr=pMediaType->GetGUID(MF_MT_SUBTYPE,&subtype);
frameRate frameRateMin;
frameRate frameRateMax;
MFGetAttributeSize(pMediaType, MF_MT_FRAME_SIZE, &currRes.width, &currRes.height);
MFGetAttributeRatio(pMediaType,MF_MT_FRAME_RATE_RANGE_MIN,&frameRateMin.numerator ,&frameRateMin.denominator);
MFGetAttributeRatio(pMediaType,MF_MT_FRAME_RATE_RANGE_MAX,&frameRateMax.numerator ,&frameRateMax.denominator);

if(frameRateMax==desiredFPS)

found =true;

}

HRESULT hr= m_reader->SetCurrentMediaType(0,0,pMediaType);

What I do see is that in WIn7 each profile is returned twice once with MF_MT_VIDEO_LIGHTING equals 0 and one with 3. but both profiles are with 60 FPS while no profile with 30 as I would expect.



Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>