I have the following problem using VMR9. As I read the msdn
documentation well, VMR9 has an IQualityControl interface to take
control of frame supply by VMR9.
However, if I try to query that interface by IID_IQualityControl, it
returns a not implemented result ?
MSDN: http://msdn2.microsoft.com/en-us/library/ms787918(VS.85).aspx
Does some of you experienced programmers know of this problem?
As you can see in the code below, I use the renderless mode and all
other interface queries in the code return a good interface.
Thnx,
Frederik
HRESULT CRD_VideoVMRGraphInstance::ExtraBuildFilterGraph()
{
HRESULT hr;
CComPtr<IVMRFilterConfig9> pConfig;
// CREATE
hr = CoCreateInstance( CLSID_VideoMixingRenderer9, NULL,
CLSCTX_INPROC,
IID_IBaseFilter, (void**)&m_pVMR );
if( FAILED(hr))
{
return hr;
}
// configure VMR9
hr = m_pVMR->QueryInterface( IID_IVMRFilterConfig9,
(void**)&(pConfig.p));
if( FAILED(hr))
{
return hr;
}
// set VMR to the renderless mode
hr = pConfig->SetRenderingMode( VMR9Mode_Renderless );
if( FAILED(hr))
{
return hr;
}
hr = m_pVMR->QueryInterface( IID_IQualProp,
(PVOID *)&m_pQualityInformation );
if( FAILED(hr))
{
return hr;
}
{
CComPtr<IQualityControl> qc;
hr = m_pVMR->QueryInterface( IID_IQualityControl, (PVOID *)&(qc.p) );
if ( SUCCEEDED( hr ) )
{
m_pQC = (CRD_VideoVMRQualityControl*)
CRD_VideoVMRQualityControl::CreateInstance( NULL, &hr );
qc->SetSink( m_pQC );
}
return S_OK;
}
First a couple of comments on your code to make it more readable:
>
> // CREATE
> hr = CoCreateInstance( CLSID_VideoMixingRenderer9, NULL,
> CLSCTX_INPROC,
> IID_IBaseFilter, (void**)&m_pVMR );
> if( FAILED(hr))
> {
> return hr;
> }
if (FAILED(m_pVMR.CoCreateInstance(CLSID_VideoMixingRenderer9)))
return E_FAILED;
> // configure VMR9
> hr = m_pVMR->QueryInterface( IID_IVMRFilterConfig9,
> (void**)&(pConfig.p));
> if( FAILED(hr))
> {
> return hr;
> }
CComQIPtr<IVMRFilterConfig9> pConfig(m_pVMR);
if (!pConfig)
return E_NOINTERFACE;
> CComPtr<IQualityControl> qc;
>
> hr = m_pVMR->QueryInterface( IID_IQualityControl, (PVOID *)&(qc.p) );
>
CComQIPtr<IQualityControl> qc(m_pVMR);
if (!qc)
return E_NOINTERFACE;
What happens if the graph is fully built when you are querying for the
IQualityControl interface?
Also, the IQualityControl interface is implemented on the VMR9s input pins
so you may need to query them instead of the filter itself.
--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
> if(FAILED(m_pVMR.CoCreateInstance(CLSID_VideoMixingRenderer9)))
> return E_FAILED;
Ahem... this looses the actual HRESULT value :-)
if(FAILED(hr = m_pVMR.CoCreateInstance(...))) return hr;
Or, since S_OK is the only expected success code in this
case:
if(S_OK != (hr = ...)) return hr;
> What happens if the graph is fully built when you are
> querying for the IQualityControl interface?
Even though it is a *very* good practice to only use a
filter in any way after adding it to the graph, looking at
the implementation of its QueryInterface() shows that
querying for IID_IQualityControl always returns S_OK. The OP
said it returns "a not implemented result" which I take to
mean E_NOTIMPL instead of E_NOINTERFACE, which doesn't make
sense, since E_NOTIMPL is not an exptected HRESULT of
IUnknown::QueryInterface(). Unless he meant that he gets
E_NOTIMPL when calling one of the methods on
IQualityControl.
> Also, the IQualityControl interface is implemented on the
> VMR9s input pins so you may need to query them instead of
> the filter itself.
Nope, the VMR implements IQualityControl on both its input
pins and the filter itself.
The IQualityControl on the pins is inherited from
CBaseInputPin and works the way the BaseClasses' reference
says it works: IQualityControl::Notify() does nothing and
always returns S_OK while IQualityControl::SetSink()
installs a sink to prevent the quality messages from being
delivered upstream.
The IQualityControl methods on the filter on the other hand
always return E_NOTIMPL (contrary to what the tutorial on
quality control would lead you to believe), which implies
that, to sink all quality messages, you need to sink them
for each pin instead.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
> From: "The March Hare [MVP]"
>
>> if(FAILED(m_pVMR.CoCreateInstance(CLSID_VideoMixingRenderer9)))
>> return E_FAILED;
>
> Ahem... this looses the actual HRESULT value :-)
My error handling is better than that but relies on some macros which would
take more time to go into. In my case, I return the actual HRESULT along
with the source line, line number and filename in a string.
>
>> What happens if the graph is fully built when you are
>> querying for the IQualityControl interface?
>
> Even though it is a *very* good practice to only use a
> filter in any way after adding it to the graph, looking at
> the implementation of its QueryInterface() shows that
> querying for IID_IQualityControl always returns S_OK. The OP
> said it returns "a not implemented result" which I take to
> mean E_NOTIMPL instead of E_NOINTERFACE, which doesn't make
> sense, since E_NOTIMPL is not an exptected HRESULT of
> IUnknown::QueryInterface(). Unless he meant that he gets
> E_NOTIMPL when calling one of the methods on
> IQualityControl.
>
>> Also, the IQualityControl interface is implemented on the
>> VMR9s input pins so you may need to query them instead of
>> the filter itself.
>
> Nope, the VMR implements IQualityControl on both its input
> pins and the filter itself.
I know it is (I read the docs too). I was just giving the OP an
alternative to see if it helped him.
> The IQualityControl on the pins is inherited from
> CBaseInputPin and works the way the BaseClasses' reference
> says it works: IQualityControl::Notify() does nothing and
> always returns S_OK while IQualityControl::SetSink()
> installs a sink to prevent the quality messages from being
> delivered upstream.
>
> The IQualityControl methods on the filter on the other hand
> always return E_NOTIMPL (contrary to what the tutorial on
> quality control would lead you to believe), which implies
> that, to sink all quality messages, you need to sink them
> for each pin instead.
Which is what I was suggesting he try, isn't it? :)
[...]
> Which is what I was suggesting he try, isn't it? :)
OK, the post sounded like a critique but that was not my
intention, I was just expanding not correcting.
> OK, the post sounded like a critique but that was not my
> intention, I was just expanding not correcting.
But you hurt my feelings <g> I'll still buy you a beer at the Summit :)
> But you hurt my feelings <g> I'll still buy you a beer
> at the Summit :)
If I'll be allowed to come: my /boss/ still hasn't let me
know :-))
> From: "The March Hare [MVP]"
>
>> But you hurt my feelings <g> I'll still buy you a beer
>> at the Summit :)
>
> If I'll be allowed to come: my /boss/ still hasn't let me
> know :-))
Your /boss/ is waiting for a definitive answer from his boss. :) It
sounded like you were good to go though.
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
Thnx for looking into this problem. The problem I had indeed was that the
query returns E_NOINTERFACE...
>> What happens if the graph is fully built when you are
>> querying for the IQualityControl interface?
I did this and it gave me the same result. Also querying this interface on
the input pin was of no help.
I did not get to the point of setting a sink because I did not receive the
IQualityControl interface.
regards,
Frederik