render videos on a d3d texture with the VMR9  
Author Message
Zebes





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

hallo,

a the moment im trying to develop a program which should play videos. i want to build the menu with d3d sprites and display the videos with the vrm9. until now i've tried to do this with the allocator presenter from the ms samples. rendering the video as a sprite works fine, but theres a problem in the sample. the allocator presenter calls the draw function, when the video stops, the rendering of the sprites stops too. but a menu has to be rendered all time independend if the viedeo is playing or not. i've tried two several ways to solve this problem without any succsess.

1. i tried to call in the allocator presenter the render function by a callback function, and call the render function in the main loop too. the efect was a flickering picture when i moved the mouse over the window.

2. i tried do give a pointer of the texture from the allocator presenter to the drawing object. so that every time the object calls the render methode it has an actually texture. the efect was that the sprite was not longer rendered. when i move with the mouse over the window the picture will become rendered but sometimes only with jitter.

i've contactet several other communities but nobody could help me. i hope sombody of you has made some experiences with this problem

i'm sorry for that bad english.

best regards
zebes


Software Development for Windows Vista3  
 
 
Zebes





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

has nobody an idea what can help me

best regards
zebes

 
 
David Weller





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

DirectShow is not part of DirectX. Moving to the DirectShow forums.

 
 
LGS





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

Sorry, I have no help to offer.

You might try asking at http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.win32.programmer.directx.video&lang=en&cr=US


 
 
Fredrik Bergstrom





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

You need to have a separate render loop, in the VMR9 samples rendering are triggered by a new video frame coming from the VMR.

1. You can only call Present from one thread, so you should only call it from (the end of) your own render loop.

2. Make sure that your render loop has all the textures at hand and draws them every render pass. Maybe you have to make sure that none of the textures get updated while you are drawing.


 
 
Zebes





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

I'm wondering that nobody has done something like this before. how do they display video in there computer games are they all writing an own renderer vor ingame videos

best regards
Zebes

 
 
Zebes





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

ok thanks for the answer i will try it.



 
 
Zebes





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

ok i've tried to seperate the present function from the vmr9 render function. i hope i understood you right. this is the main loop:

while (GetMessage(&msg, NULL, 0, 0))
{
//pD3DDevice->GetD3DDevice()->Clear( 0L, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0L );
// Translate and dispatch the message
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//pVideoDisplay->DrawScene(NULL);
//ObjectLock.Lock();
pD3DDevice->GetD3DDevice()->Present(NULL, NULL, NULL, NULL);
//ObjectLock.Unlock();
}

how you can see i tried several things with locking and clearing the backbuffer.

this is the essential cod of the presenthelper function of the allocator presenter:

hr = lpPresInfo->lpSurf->GetContainer(IID_IDirect3DTexture9, (LPVOID*)&m_TextureInfo.pTexture.p);

if(FAILED(hr))
return hr;

if(!m_pDrawScene(&m_TextureInfo))
return E_FAIL;

m_pDrawScene is a pointer to a function for rendering the texture as a sprite.

here the code for this:

m_pSprite->Begin(D3DXSPRITE_ALPHABLEND);
m_pSprite->Draw(pTextureInfo->pTexture.p,NULL,NULL,NULL,0xffffffff);
m_pSprite->End();

there musst be an essential problem in my programm. if i start the program, it will draw the picture only if i move the mouse over the window. how can I make shure, taht i have the texture. i thougt tha the drwa method of the sprite moves the texture in the backbuffe until i clear it. and when i call the present function it should drawn to the monitor i thought.

best regards
Zebes

 
 
Douglas Jordan





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

Recode your message loop with PeekMessage and the other code will run continuously although maybe to fast. Probably should use an independent thread but that's just me.

GetMessage will not return until there is a message in the application message que or WM_QUIT. Your app is probably recieving WM_MOUSEMOVE messages when you place the cursor over the window and then GetMessage returns with the message which allows your other code to run.



 
 
Zebes





PostPosted: DirectShow Development, render videos on a d3d texture with the VMR9 Top

thanks for the help that was the main problem.

but now theres a new problem.

during the video is playing, a white background is flickering through the video picture everey few seccond and after some minutes the video stops but the sound does not.

does anybody has an idea whats happend

mfg
Zebes