Jump to content
  • Advertisement
Sign in to follow this  
pex22

QueryInterface(REFIID,LPVOID*) doesnt work

This topic is 5403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i dont get it,
CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER, IID_IGraphBuilder,(void**)&graph);
graph->QueryInterface(IID_IObject,(void**)&object);
both success, i can play the video. but i cant use any methods of the object class. (object is IVideoWindow, etc.) whats wrong (or missing)? or maybe its my DirectShow?.. regards, pex.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by pex22
i dont get it,

CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER, IID_IGraphBuilder,(void**)&graph);
graph->QueryInterface(IID_IObject,(void**)&object);

both success, i can play the video.
but i cant use any methods of the object class. (object is IVideoWindow, etc.)

whats wrong (or missing)?
or maybe its my DirectShow?..

regards,
pex.


QueryInterface expects an interface id as it's first parameter, corresponding to the interface that you wish to obtain. Therefore, you should use IID_IVideoWindow instead of IID_IObject if you want to get the video window interface from the query.

Share this post


Link to post
Share on other sites
i wrote IID_IObject because the problem is not only in IVideoWindow.
its in every IDD_I object (audio, seek, etc.)
for the full initialization function:
	// Initialize the video feature
bool Movie::init(HWND hWnd)
{
video=0;
if (FAILED(CoInitialize(0)))
return false;
if (FAILED(CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,(void**)&graph)))
return false;
if (FAILED(graph->QueryInterface(IID_IMediaControl,(void**)&control)))
return false;
if (FAILED(graph->QueryInterface(IID_IMediaEvent,(void**)&event)))
return false;
if (FAILED(graph->QueryInterface(IID_IMediaSeeking,(void**)&mseek)))
return false;
if (FAILED(graph->QueryInterface(IID_IBasicAudio,(void**)&audio)))
return false;
if (FAILED(graph->QueryInterface(IID_IVideoWindow,(void**)&video)))
return false;
mhWnd = hWnd;
return true;
};

Share this post


Link to post
Share on other sites
you mean,
	IGraphBuilder* graph;
IMediaControl* control;
IMediaEvent* event;
IMediaSeeking* mseek;
IBasicAudio* audio;
IVideoWindow* video;
?

Share this post


Link to post
Share on other sites

if (FAILED(graph->QueryInterface(IID_IBasicAudio,(void**)&audio)))
return false;
if (FAILED(graph->QueryInterface(IID_IVideoWindow,(void**)&video)))
return false;


I think this is not going to work because until the graph is built (either manually or via Render/RenderFile), there are no filters which support these interfaces. Try building the graph and then query for these interfaces.

EDIT: What Nik02 said :).

Share this post


Link to post
Share on other sites
hm.
ok, so now i dragged

if (FAILED(graph->QueryInterface(IID_IBasicAudio,(void**)&audio)))
return false;
if (FAILED(graph->QueryInterface(IID_IVideoWindow,(void**)&video)))
return false;
to the load function (after RenderFile).
but now windows gives me an error and destroy my app..
(right now i cant check because every app that calls RenderFile get stuck, but before that problem windows gave me an error (i could run other video players))

Share this post


Link to post
Share on other sites
Now step the program thru with the debugger - you'll see in which part of the program the crash occurs.

My bet is that you try to use the interfaces before actually getting them - causing an access violation. Just a guess, though...

Also, it would be helpful to know exactly which error occurred [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!