microsoft / Windows-classic-samples

This repo contains samples that demonstrate the API used in Windows classic desktop applications.
Other
5.1k stars 3.24k forks source link

How to Get rotated image from camera with media foundation #251

Open nhl100 opened 2 years ago

nhl100 commented 2 years ago

i use the MF_MT_VIDEO_ROTATION attribute,but it does not take effect. The process is as follows: 1、hr = m_pReader->GetNativeMediaType( (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, i, &pType ); 2、hr = pType->SetUINT32(MF_MT_VIDEO_ROTATION, MFVideoRotationFormat_90); 3、hr = m_pReader->SetCurrentMediaType( (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, NULL, pType ); 4、hr = m_pReader->ReadSample( (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, NULL, NULL, NULL );

What's the problem?