| Author |
Message |
godofcpu
Guest
|
Posted:
Mon Oct 04, 2004 9:17 pm Post subject:
Inserting Filters into WMP? |
|
|
I am writing a C++ application that uses windows media player as a backend
for playing music. I have written my own "scope" filter that lets me
visualize audio data. I would like to use this filter to visualize the data
output by windows media player. Is there anyway that I can insert my own
custom rendering filter into the graph programmatically? I can't write a
visualization plugin since my app is a directx based one and I can't show any
of the regular UI windows for WMP including the visualization.
I know I could write a DSP plugin that the data will get passed through,
however, I believe this would require the user to manually select it for it
to get used? Is there a way to manually insert a DSP filter programmatically
so I could accomplish the same thing and not have to worry about whether the
user enabled it or not and have it only be used when my app is running?
|
|
| Back to top |
|
 |
Jim Travis [ms]
Guest
|
|
| Back to top |
|
 |
godofcpu
Guest
|
Posted:
Wed Oct 06, 2004 8:03 pm Post subject:
Re: Inserting Filters into WMP? |
|
|
Freaking sweet, that looks to be just what I'm looking for. Thanks! I was
using WMP 9, guess I now have a reason to upgrade.
I'll be playing around with this later today, but any clue if everything
will still work if I change the graph in the prerender call? i.e. I remove
the current sound renderer at the end of the graph, insert a smart tee filter
connected to my own sound renderer and my own scope filter, will WMP still
play fine?
|
|
| Back to top |
|
 |
Jim Travis [ms]
Guest
|
|
| Back to top |
|
 |
godofcpu
Guest
|
Posted:
Thu Oct 07, 2004 8:27 am Post subject:
Re: Inserting Filters into WMP? |
|
|
Jim, thanks for all your help so far.
I'm using CAxWindow to host the WMP ActiveX control in a C++ app. I
implemented my own IWMPGraphCreation child class and compiling seemed to go
well, but now I get a linker error for IID_IWMPGraphCreation
i.e.
CreationGraph.obj : error LNK2001: unresolved external symbol
_IID_IWMPGraphCreation
Am I suppose to include some additiional library or something else, its the
only linker error I get. I added #pragma comment(lib,"strmiids.lib") from
another example I saw, but I have no idea what this is suppose to do and it
didn't help me at all. I still get just the one linker error.
I also just installed WMP 10 and the SDK for it. I was using 9 prior, but I
changed my include directory in VS options to point to 10. |
|
| Back to top |
|
 |
godofcpu
Guest
|
Posted:
Thu Oct 07, 2004 10:05 am Post subject:
Re: Inserting Filters into WMP? |
|
|
I fixed my linker errors, I just used __uuiidof()...
Now I have my app running, but it never calls QueryService with the uuid for
the IWMGraphCreation interface. I did verify it is using the version 10.0 of
the control using the IWMPCore::get_versioninfo call.
Heres a snippet of the code I use to create the control, I did not include
my CRemoteClass code which implements the IServiceProvider interface and
recieves a call with a uuid for IWMPRemoteMediaServices, but not anything
else:
CComPtr<IObjectWithSite> spHostObject;
CComPtr<IAxWinHostWindow> spHost;
CComPtr<IWMPSettings> pSettings;
HRESULT hr;
// Get an simple container to contain WMP OCX
AtlAxWinInit();
m_pView = new CAxWindow();
UV_RET_CHECKHR(m_pView? S_OK : E_OUTOFMEMORY);
GetClientRect(m_lpAD->m_lpWndHost->GetHostHwnd(), rcWMP);
m_pView->Create(m_lpAD->m_lpWndHost->GetHostHwnd(), rcWMP, NULL,
WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
UV_RET_CHECKHR(::IsWindow(m_pView->m_hWnd)? S_OK : E_FAIL);
UV_RET_CHECKHR(m_pView->QueryHost(IID_IObjectWithSite, (void
**)&spHostObject));
UV_RET_CHECKHR(spHostObject.p? hr : E_POINTER);
// Create remote host which implements IServiceProvider and
IWMPRemoteMediaServices
if(SUCCEEDED(hr))
{
hr = CComObject<CRemoteHost>::CreateInstance(&m_pRemoteHost);
if(m_pRemoteHost)
{
m_pRemoteHost->AddRef();
}
else
{
hr = E_POINTER;
}
}
// Set site to the remote host
if(SUCCEEDED(hr))
{
hr = spHostObject->SetSite((IWMPRemoteMediaServices *)m_pRemoteHost);
}
UV_RET_CHECKHR(m_pView->QueryHost(&spHost));
UV_RET_CHECKHR(spHost.p? hr : E_POINTER);
// Create WMP control using its CLSI
UV_RET_CHECKHR(spHost->CreateControl(CComBSTR(L"{6BF52A52-394A-11d3-B153-00C04F79FAA6}"), m_pView->m_hWnd, 0));
UV_RET_CHECKHR(m_pView->QueryControl(&m_pPlayer)); |
|
| Back to top |
|
 |
Jim Travis [ms]
Guest
|
|
| Back to top |
|
 |
godofcpu
Guest
|
Posted:
Fri Oct 08, 2004 3:49 am Post subject:
Re: Inserting Filters into WMP? |
|
|
Thanks for you help, yes, my app was remoted, however, I have since changed
it to "Local", but the QueryService call still never gets called with the
guid for IWMPGraphCreation.
Maybe I'm just not understanding what the documentation is saying has to be
done to get this to work... What I'm doing now to see if it works is I just
take the "RemoteSkin" example provided with the SDK, change
CRemoteHost::GetApplication to return E_NOTIMPL and
CRemoteHost::GetServiceType to set pbstrType to "Local". I then set a
breakpoint in QueryService of CRemoteHost and look at the guids, I only
recieve 1 and its not for IWMPGraphCreation. Am I missing something?
"Jim Travis [ms]" wrote:
| Quote: | Is your remote host class first hooking up IWMPRemoteMediaServices as
remote? IWMPGraphCreation is not supported for remoted Player controls.
--
Jim Travis
Microsoft Corp.
Windows Media Player SDK |
|
|
| Back to top |
|
 |
godofcpu
Guest
|
Posted:
Fri Oct 08, 2004 6:27 am Post subject:
Re: Inserting Filters into WMP? |
|
|
I got it working and its awesome! Turns out WMP 9 was set as the default
player after I uninstalled XP SP2, I just reinstalled WMP 10 and now it works
great.
I just wish I had this a few months ago, it would of saved a ton of time
looking for workarounds of getting a custom equalizer working, which I never
did. I can now add my own EQ, grapic spectrum, and select whatever sound
card I want to render to. This really has solved my only major gripe with
the WMP SDK.
Thanks!
"godofcpu" wrote:
| Quote: | Thanks for you help, yes, my app was remoted, however, I have since changed
it to "Local", but the QueryService call still never gets called with the
guid for IWMPGraphCreation.
Maybe I'm just not understanding what the documentation is saying has to be
done to get this to work... What I'm doing now to see if it works is I just
take the "RemoteSkin" example provided with the SDK, change
CRemoteHost::GetApplication to return E_NOTIMPL and
CRemoteHost::GetServiceType to set pbstrType to "Local". I then set a
breakpoint in QueryService of CRemoteHost and look at the guids, I only
recieve 1 and its not for IWMPGraphCreation. Am I missing something?
|
|
|
| Back to top |
|
 |
|
|
|
|