Hi,
Currently using MFC for my application, I would like to change the current MediaType used by my webcam at runtime (dynamically).
These are the steps of my algorithm:
1.) Create a IMFMediaSource and configure it
2.) Create an IMFSourceReader using the IMFMediaSource above
3.) Use SetCurrentMediaType() to select the media format
4.) Use readSample() method to retrieve samples.
Now, I would like to change my video format after few calls of readSample() (when the user select another video format in my GUI for instance).
I call again the SetCurrentMediaType() on the desired video format. On the next call of readSample, I'm expecting to retrieve MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED on the flags, but it never happen.
Finally, I'm able to get a IMFSample, but it is totally broken (image is totally distorted).
The workaround I've found in some code here (http://svn.openrtm.org/ImageProcessing/trunk/ImageProcessing/opencv/components/MFCamera/src/MFCapture.cpp) is to destroy the IMFSourceReader and to recreate another one.
I'm wondering if this is the normal functioning of this API or if I'm missing something.
Thanks in advance, best regards.
Currently using MFC for my application, I would like to change the current MediaType used by my webcam at runtime (dynamically).
These are the steps of my algorithm:
1.) Create a IMFMediaSource and configure it
2.) Create an IMFSourceReader using the IMFMediaSource above
3.) Use SetCurrentMediaType() to select the media format
4.) Use readSample() method to retrieve samples.
Now, I would like to change my video format after few calls of readSample() (when the user select another video format in my GUI for instance).
I call again the SetCurrentMediaType() on the desired video format. On the next call of readSample, I'm expecting to retrieve MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED on the flags, but it never happen.
Finally, I'm able to get a IMFSample, but it is totally broken (image is totally distorted).
The workaround I've found in some code here (http://svn.openrtm.org/ImageProcessing/trunk/ImageProcessing/opencv/components/MFCamera/src/MFCapture.cpp) is to destroy the IMFSourceReader and to recreate another one.
I'm wondering if this is the normal functioning of this API or if I'm missing something.
Thanks in advance, best regards.