[vlc-devel] VLC DirectX programing
MaFai
zh-ma at hkbn.com.hk
Mon May 19 06:34:51 CEST 2003
Hello, Gildas Bazin,
I have read the code of directx.c carefully.
A fraction of code like as following:
/*****************************************************************************
* Display: displays previously rendered output
*****************************************************************************
* This function sends the currently rendered image to the display, wait until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
static void Display( vout_thread_t *p_vout, picture_t *p_pic )
{
HRESULT dxresult;
if( (p_vout->p_sys->p_display == NULL) )
{
msg_Warn( p_vout, "no display!!" );
return;
}
/* Our surface can be lost so be sure to check this
* and restore it if need be */
if( IDirectDrawSurface2_IsLost( p_vout->p_sys->p_display )
== DDERR_SURFACELOST )
{
if( IDirectDrawSurface2_Restore( p_vout->p_sys->p_display ) == DD_OK &&
p_vout->p_sys->b_using_overlay )
DirectXUpdateOverlay( p_vout );
}
if( !p_vout->p_sys->b_using_overlay )
{
DDBLTFX ddbltfx;
/* We ask for the "NOTEARING" option */
memset( &ddbltfx, 0, sizeof(DDBLTFX) );
ddbltfx.dwSize = sizeof(DDBLTFX);
ddbltfx.dwDDFX = DDBLTFX_NOTEARING;
/* Blit video surface to display */
dxresult = IDirectDrawSurface2_Blt( p_vout->p_sys->p_display,
&p_vout->p_sys->rect_dest_clipped,
p_pic->p_sys->p_surface,
&p_vout->p_sys->rect_src_clipped,
DDBLT_ASYNC, &ddbltfx );
if( dxresult != DD_OK )
{
msg_Warn( p_vout, "could not blit surface (error %i)", dxresult );
return;
}
}
else /* using overlay */
{
/* Flip the overlay buffers if we are using back buffers */
if( p_pic->p_sys->p_front_surface == p_pic->p_sys->p_surface )
{
return;
}
dxresult = IDirectDrawSurface2_Flip( p_pic->p_sys->p_front_surface,
NULL, DDFLIP_WAIT );
if( dxresult != DD_OK )
{
msg_Warn( p_vout, "could not flip overlay (error %i)", dxresult );
}
/* set currently displayed pic */
p_vout->p_sys->p_current_surface = p_pic->p_sys->p_front_surface;
/* Lock surface to get all the required info */
if( DirectXLockSurface( p_vout, p_pic ) )
{
/* AAARRGG */
msg_Warn( p_vout, "cannot lock surface" );
return;
}
DirectXUnlockSurface( p_vout, p_pic );
}
}
Disable the using overlay output option in VLC interface.I add my code in this method:
if( !p_vout->p_sys->b_using_overlay )
{
DDBLTFX ddbltfx;
/* We ask for the "NOTEARING" option */
memset( &ddbltfx, 0, sizeof(DDBLTFX) );
ddbltfx.dwSize = sizeof(DDBLTFX);
ddbltfx.dwDDFX = DDBLTFX_NOTEARING;
/////////////////////////////////// My code ////////////////////////////////////
HDC DC;
int xScrn,yScrn;
HRESULT dxresultcut;
dxresultcut = IDirectDrawSurface7_GetDC(p_pic->p_sys->p_surface,DC);
if(dxresultcut != DD_OK)
{
msg_Err(p_vout,"Can not get DC");
}
xScrn = GetDeviceCaps(DC, HORZRES);
yScrn = GetDeviceCaps(DC, VERTRES);
msg_Err(p_vout,"%i %i",xScrn,yScrn);
////////////////////////////////////////////////////////////////////////////////
/* Blit video surface to display */
dxresult = IDirectDrawSurface2_Blt( p_vout->p_sys->p_display,
&p_vout->p_sys->rect_dest_clipped,
p_pic->p_sys->p_surface,
&p_vout->p_sys->rect_src_clipped,
DDBLT_ASYNC, &ddbltfx );
if( dxresult != DD_OK )
{
msg_Warn( p_vout, "could not blit surface (error %i)", dxresult );
return;
}
}
It compiled successfully.But the dxresultcut always not equals to DD_OK,
and xScrn,yScrn equals to 0.
I also have tried IDirectDrawSurface7_GetDC,IDirectDrawSurface4_GetDC,
IDirectDrawSurface3_GetDC,IDirectDrawSurface_GetDC,none work properly.
My destination is get the DC from the dx surface and generate to the bitmap.
May you give me any idea?I appreciate that you help me.
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vlc-devel
mailing list