I have a simple question i copy/paste this code below one to one from the Microsoft page and its
not working. I tried everything from a to z and
cant get this dummy thing going.
I get an access violation at this stage:
pGraphBuilder->RenderFile(L"\\test.wmv", NULL);
Any help would very much appreciate
Rgds & thks
#include <dshow.h>
void __cdecl main(void)
{
IGraphBuilder *pGraphBuilder;
IMediaControl *pMediaControl;
CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraphBuilder);
pGraphBuilder->QueryInterface(IID_IMediaControl,
(void **)&pMediaControl);
pGraphBuilder->RenderFile(L"\\test.wmv", NULL);
pMediaControl->Run();
MessageBox(NULL, "Click OK to end playback.", "DirectShow", MB_OK);
pMediaControl->Release();
pGraphBuilder->Release();
CoUninitialize();
}
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
> I get an access violation at this stage:
> pGraphBuilder->RenderFile(L"\\test.wmv", NULL);
What version of Windows do you have?
If it's not WinCE, have you tried specifying the drive letter? Example:
L"C:\\test.wmv"
--
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
> I get an access violation at this stage:
> pGraphBuilder->RenderFile(L"\\test.wmv", NULL);
Not just any access violation, but a null pointer exception.
What's the value of pGraphBuilder? Why don't you check the
HRESULTs of the calls?
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
I'm using wm5 therefore the first suggestion will not work.
Secondly i checked the hresults they look strange.
Before:
hr: 0 {S_OK}
after:
hr: -2147220970
the pgraphbuilder/ifitlergraph/iuknown look before and after the same.
Rgds & many thks
> I'm using wm5 therefore the first suggestion will not work.
> Secondly i checked the hresults they look strange.
>
> Before:
> hr: 0 {S_OK}
> after:
> hr: -2147220970
>
> the pgraphbuilder/ifitlergraph/iuknown look before and after the same.
HRESULT: 0x80040216 (2147746326)
Name: VFW_E_NOT_FOUND
Description: An object or name was not found.
Severity code: Failed
Facility Code: FACILITY_ITF (4)
Error Code: 0x0216 (534)
Are you sure the \\test.wmv file exists? Is WM5 case sensitive?
thks
Maybe somebody can help, the hr says a share violation has occured.
I tried with wmv file and asf!!! Do i need to ren it in a seperate
thread?
------------------------------------------------------------------------------------------------------------------
Sending STREAM_BEGIN message from CompleteConnect()
Video-Thread Message : STREAM_BEGIN
AHI-ERROR : DecodeMmSys() FAILed in DecodeFileEx() -- sts = 0x4
AHI-ERROR : DecodeFileEx() FAILed in MPEGDecodeInit() -- sts = 0x4
AHI-ERROR: Initializations = 0x4
Video-Thread Message : STREAM_BEGIN(Reply given)
Sending STREAM_END message from CompleteConnect()
Video-Thread Message : STREAM_END
[HTCDisableDShowAudio] Success to disable DShow Audio
Video-Thread Message : STREAM_END(Reply given)Load module:
HTCDrmAPI.dll
Load module: HTCAsyncSrcFlt.dll
[CHTCAsyncFilter]CreateInstance() 1
[CAsyncOutputPin] CAsyncOutputPin()
[HTCDrmStream] HTCDrmStream()
[CHTCAsyncFilter]1 CHTCAsyncFilter()
Load module: audioparser.dll
Video-Thread Message : EXIT_THREAD
Video-Thread Message : EXIT_THREAD(Reply given)The thread 0x4294349a
has exited with code 0 (0x0).
[CHTCAsyncFilter]1 ~CHTCAsyncFilter()
[CAsyncOutputPin] ~CAsyncOutputPin()
------------------------------------------------------------------------------------------------------------------