Click here to Skip to main content
12,501,082 members (42,421 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Windows MFC directshow
Hello,

Windows provides these digital signal processor objects:
http://msdn.microsoft.com/en-us/library/windows/desktop/ff819501(v=vs.85).aspx[^]

I am trying to embed a Frame rate converter DSP as in the following link:
http://msdn.microsoft.com/en-us/library/windows/desktop/ff819100(v=vs.85).aspx[^]

My computer which I am compiling on is Windows XP, but I am using the latest Microsoft SDK environment.
The documentation reveals that the following at the requirements for use the Frame Rate Converter:
Header
Wmcodecdsp.h
DLL
Mfvdsp.dll

I was able to find Wmcodecdsp.h on my PC but was not able to find mfvdsp.dll . So I got the dll from a Windows 7 machine, I really don't know how should I notify my Visual Studio environment that this .dll is a dependency?

The line of code that I am trying to compile is:
hr=CoCreateInstance(CLSID_CResizerDMO, NULL, CLSCTX_INPROC, IID_IBaseFilter, (void **)&m_pFrameRateBaseFilt); 

where m_pFrameRateBaseFilt is IBaseFilter*.
I get the error message:
error LNK2019: unresolved external symbol _CLSID_CResizerDMO referenced in function "public: long __thiscall renderEngine::PreviewToRender(void)" (?PreviewToRender@renderEngine@@QAEJXZ)

help plz?

[Edit]Code block added[/Edit]
Posted 30-Nov-12 5:40am
Updated 30-Nov-12 6:10am
ProgramFOX187.5K
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hello,

#pragma comment(lib,"wmcodecdspuuid.lib")
or
__uuidof(CResizerDMO) instead of CLSID_CResizerDMO

Regards,
Maxim
  Permalink  
Comments
Amin Ur Rehman 30-Nov-12 13:06pm
   
Thank you for your solution.

I similiarly added CLSID_CFrameRateConvertDmo.

It compiles, so thats one problem out of the way.

Could you also suggest how to change the MFPKEY_CONV_OUTPUTFRAMERATE property for CLSID_CFrameRateConvertDmo?

Thanks,
Kind Regards,
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

I post here as in comment it shows not formatted
IBaseFilter * pYourFilter; // initialized 
int _numerator; // rate numerator
int _denominator; // rate denominator

IPropertyStore * _store;
if (S_OK == pYourFilter->QueryInterface(IID_IPropertyStore,(void**)&_store))
{
	PROPVARIANT _value;
	PropVariantInit(&_value);
	_value.vt = VT_UI8;
	_value.uhVal.HighPart = _numerator;
	_value.uhVal.LowPart  = _denominator;
	_store->SetValue(MFPKEY_CONV_OUTPUTFRAMERATE,_value);
	_store->Release();
	PropVariantClear(&_value);
}
  Permalink  
Comments
Amin Ur Rehman 30-Nov-12 13:31pm
   
Thanks for your comprehensive answer Maxim!
You are the man!

I am unfortunately still stuck at CoCreateInstance, the program compiles fine, however I am getting a HRESULT return 0x80040154 (Class not registered) :S ANy ideas?
Maxim Kartavenkov 30-Nov-12 13:57pm
   
You should register DMO classes example for resizer:
WINDIR\System32\vidreszr.dll

IBaseFilter * _filter;
hr = CoCreateInstance(CLSID_DMOWrapperFilter,NULL,CLSCTX_ALL,IID_IBaseFilter,(void**)&_filter);
ASSERT(hr == S_OK);
IDMOWrapperFilter * _wrapper;
hr = _filter->QueryInterface(IID_IDMOWrapperFilter(void**)&_wrapper);
if (S_OK == hr)
{
hr = _wrapper->Init(__uuidof(CResizerDMO),DMOCATEGORY_VIDEO_EFFECT);
ASSERT(hr == S_OK);
_wrapper->Release();
}
// Use DMO wrapper filter: _filter
...

IMediaObject * _object;
hr = CoCreateInstance(__uuidof(CResizerDMO),NULL,CLSCTX_ALL,IID_IMediaObject,(void**)&_object);
ASSERT(hr == S_OK);
// Use DMO object : _object
...
Amin Ur Rehman 30-Nov-12 14:01pm
   
Yes thanks,

I did register them through regsvr32, even though the registration succeeded, the HRESULT return wasn't successful. :(

I tried to run the program in Windows 7, so I don't know why it can;t get a hold of it.
Maxim Kartavenkov 30-Nov-12 13:58pm
   
NOTE: those DSP may work under vista and above only - but not sure - I didn't try to port them into XP
Amin Ur Rehman 30-Nov-12 14:51pm
   
Hey guys,

Thanks to Maxim's great explainations, I have reached somewhere.
The program is running in Windows 7.

My aim is for the frame rate convert DMO to render at 25 fps, I am using an external renderer which only makes a connection if the incoming frame-rate is 25fps

So if I was to use an avi of 25 fps, it would connect just fine, however if I was to connect with an avi of 24fps, it would refuse to connect.


Here is a snippet my code, am I using the frame rate convert DMO correctly to render at 25fps?

// Some extra includes
#include "Wmcodecdsp.h"
#include "dmodshow.h"
#include "Dmo.h"


#pragma comment(lib,"wmcodecdspuuid.lib")



IBaseFilter * _filter;
hr = CoCreateInstance(CLSID_DMOWrapperFilter,NULL,CLSCTX_ALL,IID_IBaseFilter,(void**)&_filter);
// HRESULT = 0
IDMOWrapperFilter * _wrapper;
hr = _filter->QueryInterface(__uuidof(IDMOWrapperFilter),(void**)&_wrapper);
// HRESULT = 0

hr = _wrapper->Init(__uuidof(CFrameRateConvertDmo),DMOCATEGORY_VIDEO_EFFECT);
// HRESULT = 0

_wrapper->Release();

int _numerator=25; // rate numerator
int _denominator=1; // rate denominator

IPropertyStore * _store;
if (S_OK == _filter->QueryInterface(IID_IPropertyStore,(void**)&_store))
{
printf("\n Alles OK! ");

PROPVARIANT _value;
PropVariantInit(&_value);
_value.vt = VT_UI8;
_value.uhVal.HighPart = _numerator;
_value.uhVal.LowPart = _denominator;
_store->SetValue(MFPKEY_CONV_OUTPUTFRAMERATE,_value);
_store->Release();
PropVariantClear(&_value);
}
else{

printf("Alles nicht ok! ");

}


hr=pGraph->AddFilter(_filter, L"FPS Adjust");
// pGraph is the Graph Builder



Then I go along and connect the frame rate converter right before the renderer (direct pin connections)
As I said, everything connects fine if the source video file is 25fps, if its not I was assuming that the Frame Rate converter should convert it to 25 fps, but sadly it comes with a 0x80040217 return.

Any ideas?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Ok, I counted my chickens too soon.

The program compiles alright,
hr=CoCreateInstance((CLSID_CFrameRateConvertDmo), NULL, CLSCTX_INPROC, IID_IBaseFilter, (void **)&m_pFrameRateBaseFilt);

But the HRESULT return of this is 0x80040154 (Name: REGDB_E_CLASSNOTREG) on a Windows 7 machine.
Any ideas? Thanks!

Kind Regards,
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Oh wait a second! I need a wrapper do I? :S I will just try that!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 30 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100