Commit f24c2a0d authored by Damien Fouilleul's avatar Damien Fouilleul

- direct3d: enable user control of hardware YUV pixel format (basically a RGB...

- direct3d: enable user control of hardware YUV pixel format (basically a RGB pixel format can be forced)
parent d3f573a0
...@@ -155,6 +155,11 @@ static int OpenVideo( vlc_object_t *p_this ) ...@@ -155,6 +155,11 @@ static int OpenVideo( vlc_object_t *p_this )
SetRectEmpty( &p_vout->p_sys->rect_display ); SetRectEmpty( &p_vout->p_sys->rect_display );
SetRectEmpty( &p_vout->p_sys->rect_parent ); SetRectEmpty( &p_vout->p_sys->rect_parent );
var_Create( p_vout, "directx-hw-yuv", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "directx-device", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
p_vout->p_sys->b_cursor_hidden = 0; p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate(); p_vout->p_sys->i_lastmoved = mdate();
...@@ -285,6 +290,10 @@ static void CloseVideo( vlc_object_t *p_this ) ...@@ -285,6 +290,10 @@ static void CloseVideo( vlc_object_t *p_this )
static int Init( vout_thread_t *p_vout ) static int Init( vout_thread_t *p_vout )
{ {
int i_ret; int i_ret;
vlc_value_t val;
var_Get( p_vout, "directx-hw-yuv", &val );
p_vout->p_sys->b_hw_yuv = val.b_bool;
/* Initialise Direct3D */ /* Initialise Direct3D */
if( VLC_SUCCESS != Direct3DVoutOpen( p_vout ) ) if( VLC_SUCCESS != Direct3DVoutOpen( p_vout ) )
...@@ -796,6 +805,8 @@ static D3DFORMAT Direct3DVoutSelectFormat( vout_thread_t *p_vout, D3DFORMAT targ ...@@ -796,6 +805,8 @@ static D3DFORMAT Direct3DVoutSelectFormat( vout_thread_t *p_vout, D3DFORMAT targ
D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3DFORMAT target) D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3DFORMAT target)
{ {
if( p_vout->p_sys->b_hw_yuv )
{
switch( i_chroma ) switch( i_chroma )
{ {
case VLC_FOURCC('U','Y','V','Y'): case VLC_FOURCC('U','Y','V','Y'):
...@@ -824,6 +835,11 @@ D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3DFORMAT ...@@ -824,6 +835,11 @@ D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3DFORMAT
{ D3DFMT_YUY2, D3DFMT_UYVY, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 }; { D3DFMT_YUY2, D3DFMT_UYVY, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT)); return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
} }
}
}
switch( i_chroma )
{
case VLC_FOURCC('R', 'V', '1', '5'): case VLC_FOURCC('R', 'V', '1', '5'):
{ {
static const D3DFORMAT formats[] = static const D3DFORMAT formats[] =
...@@ -849,7 +865,18 @@ D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3DFORMAT ...@@ -849,7 +865,18 @@ D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3DFORMAT
return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT)); return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
} }
default: default:
; {
/* use display default format */
LPDIRECT3D9 p_d3dobj = p_vout->p_sys->p_d3dobj;
D3DDISPLAYMODE d3ddm;
HRESULT hr = IDirect3D9_GetAdapterDisplayMode(p_d3dobj, D3DADAPTER_DEFAULT, &d3ddm );
if( SUCCEEDED(hr))
{
msg_Dbg( p_vout, "defaulting to adpater pixel format");
return Direct3DVoutSelectFormat(p_vout, target, &d3ddm.Format, 1);
}
}
} }
return D3DFMT_UNKNOWN; return D3DFMT_UNKNOWN;
} }
...@@ -864,6 +891,9 @@ static int Direct3DVoutSetOutputFormat(vout_thread_t *p_vout, D3DFORMAT format) ...@@ -864,6 +891,9 @@ static int Direct3DVoutSetOutputFormat(vout_thread_t *p_vout, D3DFORMAT format)
case D3DFMT_UYVY: case D3DFMT_UYVY:
p_vout->output.i_chroma = VLC_FOURCC('U', 'Y', 'V', 'Y'); p_vout->output.i_chroma = VLC_FOURCC('U', 'Y', 'V', 'Y');
break; break;
case D3DFMT_R8G8B8:
p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '2', '4');
break;
case D3DFMT_X8R8G8B8: case D3DFMT_X8R8G8B8:
case D3DFMT_A8R8G8B8: case D3DFMT_A8R8G8B8:
/* /*
......
...@@ -88,6 +88,8 @@ struct vout_sys_t ...@@ -88,6 +88,8 @@ struct vout_sys_t
RECT rect_dest; RECT rect_dest;
RECT rect_dest_clipped; RECT rect_dest_clipped;
vlc_bool_t b_hw_yuv; /* Should we use hardware YUV->RGB conversions */
#ifdef MODULE_NAME_IS_vout_directx #ifdef MODULE_NAME_IS_vout_directx
/* Overlay alignment restrictions */ /* Overlay alignment restrictions */
int i_align_src_boundary; int i_align_src_boundary;
...@@ -97,7 +99,6 @@ struct vout_sys_t ...@@ -97,7 +99,6 @@ struct vout_sys_t
vlc_bool_t b_using_overlay; /* Are we using an overlay surface */ vlc_bool_t b_using_overlay; /* Are we using an overlay surface */
vlc_bool_t b_use_sysmem; /* Should we use system memory for surfaces */ vlc_bool_t b_use_sysmem; /* Should we use system memory for surfaces */
vlc_bool_t b_hw_yuv; /* Should we use hardware YUV->RGB conversions */
vlc_bool_t b_3buf_overlay; /* Should we use triple buffered overlays */ vlc_bool_t b_3buf_overlay; /* Should we use triple buffered overlays */
/* DDraw capabilities */ /* DDraw capabilities */
...@@ -127,6 +128,7 @@ struct vout_sys_t ...@@ -127,6 +128,7 @@ struct vout_sys_t
D3DPRESENT_PARAMETERS d3dpp; D3DPRESENT_PARAMETERS d3dpp;
HINSTANCE hd3d9_dll; /* handle of the opened d3d9 dll */ HINSTANCE hd3d9_dll; /* handle of the opened d3d9 dll */
#endif #endif
event_thread_t *p_event; event_thread_t *p_event;
vlc_mutex_t lock; vlc_mutex_t lock;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment