Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
599340cf
Commit
599340cf
authored
Jul 20, 2006
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- direct3d: new video output module using Direct3D 9 APIs
parent
27c3154a
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1613 additions
and
86 deletions
+1613
-86
configure.ac
configure.ac
+9
-5
modules/video_output/directx/Modules.am
modules/video_output/directx/Modules.am
+6
-0
modules/video_output/directx/direct3d.c
modules/video_output/directx/direct3d.c
+1499
-0
modules/video_output/directx/directx.c
modules/video_output/directx/directx.c
+15
-2
modules/video_output/directx/events.c
modules/video_output/directx/events.c
+42
-28
modules/video_output/directx/glwin32.c
modules/video_output/directx/glwin32.c
+0
-9
modules/video_output/directx/vout.h
modules/video_output/directx/vout.h
+42
-42
No files found.
configure.ac
View file @
599340cf
...
...
@@ -3908,11 +3908,15 @@ then
AC_CHECK_HEADERS(ddraw.h,
[ VLC_ADD_PLUGINS([vout_directx aout_directx])
VLC_ADD_LDFLAGS([vout_directx],[-lgdi32])
dnl to be moved when dependance is removed
AC_CHECK_HEADERS(GL/gl.h, [
VLC_ADD_PLUGINS([glwin32])
])
AC_CHECK_HEADERS(GL/gl.h,
[
VLC_ADD_PLUGINS([glwin32])
VLC_ADD_LDFLAGS([glwin32],[-lopengl32 -lgdi32])
]) ])
])
AC_CHECK_HEADERS(d3d9.h,
[ VLC_ADD_PLUGINS([direct3d])
VLC_ADD_LDFLAGS([direct3d],[-ld3d9 -lgdi32])
])
else
AC_MSG_CHECKING(for directX headers in ${with_directx})
if test -f ${with_directx}/ddraw.h
...
...
modules/video_output/directx/Modules.am
View file @
599340cf
...
...
@@ -4,6 +4,12 @@ SOURCES_vout_directx = \
events.c \
$(NULL)
SOURCES_direct3d = \
direct3d.c \
vout.h \
events.c \
$(NULL)
SOURCES_glwin32 = \
glwin32.c \
vout.h \
...
...
modules/video_output/directx/direct3d.c
0 → 100755
View file @
599340cf
This diff is collapsed.
Click to expand it.
modules/video_output/directx/directx.c
View file @
599340cf
...
...
@@ -57,6 +57,19 @@
#include "vout.h"
/*****************************************************************************
* picture_sys_t: direct buffer method descriptor
*****************************************************************************
* This structure is part of the picture descriptor, it describes the
* DirectX specific properties of a direct buffer.
*****************************************************************************/
struct
picture_sys_t
{
LPDIRECTDRAWSURFACE2
p_surface
;
LPDIRECTDRAWSURFACE2
p_front_surface
;
DDSURFACEDESC
ddsd
;
};
/*****************************************************************************
* DirectDraw GUIDs.
* Defining them here allows us to get rid of the dxguid library during
...
...
@@ -908,7 +921,7 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
rect
.
left
=
monitor_info
.
rcWork
.
left
;
rect
.
top
=
monitor_info
.
rcWork
.
top
;
msg_Dbg
(
p_vout
,
"DirectXEnumCallback: setting window "
"position to %
d,%
d"
,
rect
.
left
,
rect
.
top
);
"position to %
ld,%l
d"
,
rect
.
left
,
rect
.
top
);
SetWindowPos
(
p_vout
->
p_sys
->
hwnd
,
NULL
,
rect
.
left
,
rect
.
top
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_NOACTIVATE
);
...
...
@@ -1040,7 +1053,7 @@ static int DirectXInitDDraw( vout_thread_t *p_vout )
p_vout
->
p_sys
->
rect_display
.
bottom
=
GetSystemMetrics
(
SM_CYSCREEN
);
}
msg_Dbg
(
p_vout
,
"screen dimensions (%
ix%i,%ix%
i)"
,
msg_Dbg
(
p_vout
,
"screen dimensions (%
lix%li,%lix%l
i)"
,
p_vout
->
p_sys
->
rect_display
.
left
,
p_vout
->
p_sys
->
rect_display
.
top
,
p_vout
->
p_sys
->
rect_display
.
right
,
...
...
modules/video_output/directx/events.c
View file @
599340cf
...
...
@@ -44,7 +44,15 @@
#include <windowsx.h>
#include <shellapi.h>
#ifdef MODULE_NAME_IS_vout_directx
#include <ddraw.h>
#endif
#ifdef MODULE_NAME_IS_direct3d
#include <d3d9.h>
#endif
#ifdef MODULE_NAME_IS_glwin32
#include <GL/gl.h>
#endif
#include "vlc_keys.h"
#include "vout.h"
...
...
@@ -301,7 +309,11 @@ void E_(DirectXEventThread)( event_thread_t *p_event )
#ifdef MODULE_NAME_IS_glwin32
val
.
psz_string
=
strdup
(
VOUT_TITLE
" (OpenGL output)"
);
#else
#endif
#ifdef MODULE_NAME_IS_direct3d
val
.
psz_string
=
strdup
(
VOUT_TITLE
" (Direct3D output)"
);
#endif
#ifdef MODULE_NAME_IS_directx
if
(
p_event
->
p_vout
->
p_sys
->
b_using_overlay
)
val
.
psz_string
=
strdup
(
VOUT_TITLE
" (hardware YUV overlay DirectX output)"
);
else
if
(
p_event
->
p_vout
->
p_sys
->
b_hw_yuv
)
val
.
psz_string
=
...
...
@@ -481,9 +493,9 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
_T
(
VOUT_TITLE
)
_T
(
" (DirectX Output)"
),
/* window title */
i_style
,
/* window style */
(
p_vout
->
p_sys
->
i_window_x
<
0
)
?
CW_USEDEFAULT
:
p_vout
->
p_sys
->
i_window_x
,
/* default X coordinate */
(
UINT
)
p_vout
->
p_sys
->
i_window_x
,
/* default X coordinate */
(
p_vout
->
p_sys
->
i_window_y
<
0
)
?
CW_USEDEFAULT
:
p_vout
->
p_sys
->
i_window_y
,
/* default Y coordinate */
(
UINT
)
p_vout
->
p_sys
->
i_window_y
,
/* default Y coordinate */
rect_window
.
right
-
rect_window
.
left
,
/* window width */
rect_window
.
bottom
-
rect_window
.
top
,
/* window height */
p_vout
->
p_sys
->
hparent
,
/* parent window */
...
...
@@ -519,20 +531,33 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
NULL
,
NULL
,
hInstance
,
NULL
);
}
/* Now display the window */
ShowWindow
(
p_vout
->
p_sys
->
hwnd
,
SW_SHOW
);
/* Create video sub-window. This sub window will always exactly match
* the size of the video, which allows us to use crazy overlay colorkeys
* without having them shown outside of the video area. */
SendMessage
(
p_vout
->
p_sys
->
hwnd
,
WM_VLC_CREATE_VIDEO_WIN
,
0
,
0
);
/* Append a "Always On Top" entry in the system menu */
hMenu
=
GetSystemMenu
(
p_vout
->
p_sys
->
hwnd
,
FALSE
);
AppendMenu
(
hMenu
,
MF_SEPARATOR
,
0
,
_T
(
""
)
);
AppendMenu
(
hMenu
,
MF_STRING
|
MF_UNCHECKED
,
IDM_TOGGLE_ON_TOP
,
_T
(
"Always on &Top"
)
);
/* Create video sub-window. This sub window will always exactly match
* the size of the video, which allows us to use crazy overlay colorkeys
* without having them shown outside of the video area. */
p_vout
->
p_sys
->
hvideownd
=
CreateWindow
(
_T
(
"VLC DirectX video"
),
_T
(
""
),
/* window class */
WS_CHILD
|
WS_VISIBLE
,
/* window style */
0
,
0
,
p_vout
->
render
.
i_width
,
/* default width */
p_vout
->
render
.
i_height
,
/* default height */
p_vout
->
p_sys
->
hwnd
,
/* parent window */
NULL
,
hInstance
,
(
LPVOID
)
p_vout
);
/* send p_vout to WM_CREATE */
if
(
!
p_vout
->
p_sys
->
hvideownd
)
msg_Warn
(
p_vout
,
"can't create video sub-window"
);
else
msg_Dbg
(
p_vout
,
"created video sub-window"
);
/* Now display the window */
ShowWindow
(
p_vout
->
p_sys
->
hwnd
,
SW_SHOW
);
return
VLC_SUCCESS
;
}
...
...
@@ -613,6 +638,7 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
rect_dest
.
top
=
point
.
y
+
i_y
;
rect_dest
.
bottom
=
rect_dest
.
top
+
i_height
;
#ifdef MODULE_NAME_IS_vout_directx
/* Apply overlay hardware constraints */
if
(
p_vout
->
p_sys
->
b_using_overlay
)
{
...
...
@@ -626,6 +652,7 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
p_vout
->
p_sys
->
i_align_dest_size
/
2
)
&
~
p_vout
->
p_sys
->
i_align_dest_size
)
+
rect_dest
.
left
;
}
#endif
/* UpdateOverlay directdraw function doesn't automatically clip to the
* display size so we need to do it otherwise it will fail */
...
...
@@ -675,6 +702,7 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
(
rect_dest
.
bottom
-
rect_dest_clipped
.
bottom
)
*
p_vout
->
fmt_out
.
i_visible_height
/
(
rect_dest
.
bottom
-
rect_dest
.
top
);
#ifdef MODULE_NAME_IS_vout_directx
/* Apply overlay hardware constraints */
if
(
p_vout
->
p_sys
->
b_using_overlay
)
{
...
...
@@ -689,6 +717,7 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
p_vout
->
p_sys
->
i_align_src_size
/
2
)
&
~
p_vout
->
p_sys
->
i_align_src_size
)
+
rect_src_clipped
.
left
;
}
#endif
#if 0
msg_Dbg( p_vout, "DirectXUpdateRects image_src_clipped"
...
...
@@ -704,8 +733,10 @@ void E_(DirectXUpdateRects)( vout_thread_t *p_vout, vlc_bool_t b_force )
rect_dest_clipped
.
top
-=
p_vout
->
p_sys
->
rect_display
.
top
;
rect_dest_clipped
.
bottom
-=
p_vout
->
p_sys
->
rect_display
.
top
;
#ifdef MODULE_NAME_IS_vout_directx
if
(
p_vout
->
p_sys
->
b_using_overlay
)
E_
(
DirectXUpdateOverlay
)(
p_vout
);
#endif
/* Signal the change in size/position */
p_vout
->
p_sys
->
i_changes
|=
DX_POSITION_CHANGE
;
...
...
@@ -808,23 +839,6 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
}
break
;
case
WM_VLC_CREATE_VIDEO_WIN
:
/* Create video sub-window */
p_vout
->
p_sys
->
hvideownd
=
CreateWindow
(
_T
(
"VLC DirectX video"
),
_T
(
""
),
/* window class */
WS_CHILD
|
WS_VISIBLE
,
/* window style */
CW_USEDEFAULT
,
CW_USEDEFAULT
,
/* default coordinates */
CW_USEDEFAULT
,
CW_USEDEFAULT
,
hwnd
,
/* parent window */
NULL
,
GetModuleHandle
(
NULL
),
(
LPVOID
)
p_vout
);
/* send p_vout to WM_CREATE */
if
(
!
p_vout
->
p_sys
->
hvideownd
)
msg_Warn
(
p_vout
,
"can't create video sub-window"
);
else
msg_Dbg
(
p_vout
,
"created video sub-window"
);
break
;
case
WM_PAINT
:
case
WM_NCPAINT
:
case
WM_ERASEBKGND
:
...
...
modules/video_output/directx/glwin32.c
View file @
599340cf
...
...
@@ -104,10 +104,6 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout
->
pf_manage
=
Manage
;
p_vout
->
pf_swap
=
GLSwapBuffers
;
p_vout
->
p_sys
->
p_ddobject
=
NULL
;
p_vout
->
p_sys
->
p_display
=
NULL
;
p_vout
->
p_sys
->
p_current_surface
=
NULL
;
p_vout
->
p_sys
->
p_clipper
=
NULL
;
p_vout
->
p_sys
->
hwnd
=
p_vout
->
p_sys
->
hvideownd
=
NULL
;
p_vout
->
p_sys
->
hparent
=
p_vout
->
p_sys
->
hfswnd
=
NULL
;
p_vout
->
p_sys
->
i_changes
=
0
;
...
...
@@ -485,8 +481,3 @@ static void GLSwapBuffers( vout_thread_t *p_vout )
{
SwapBuffers
(
p_vout
->
p_sys
->
hGLDC
);
}
int
E_
(
DirectXUpdateOverlay
)(
vout_thread_t
*
p_vout
)
{
return
1
;
}
modules/video_output/directx/vout.h
View file @
599340cf
...
...
@@ -40,12 +40,6 @@ typedef struct event_thread_t
*****************************************************************************/
struct
vout_sys_t
{
LPDIRECTDRAW2
p_ddobject
;
/* DirectDraw object */
LPDIRECTDRAWSURFACE2
p_display
;
/* Display device */
LPDIRECTDRAWSURFACE2
p_current_surface
;
/* surface currently displayed */
LPDIRECTDRAWCLIPPER
p_clipper
;
/* clipper used for blitting */
HINSTANCE
hddraw_dll
;
/* handle of the opened ddraw dll */
HWND
hwnd
;
/* Handle of the main window */
HWND
hvideownd
;
/* Handle of the video sub-window */
HWND
hparent
;
/* Handle of the parent window */
...
...
@@ -58,15 +52,13 @@ struct vout_sys_t
HMONITOR
(
WINAPI
*
MonitorFromWindow
)(
HWND
,
DWORD
);
BOOL
(
WINAPI
*
GetMonitorInfo
)(
HMONITOR
,
LPMONITORINFO
);
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_hw_yuv
;
/* Should we use hardware YUV->RGB conversions */
vlc_bool_t
b_3buf_overlay
;
/* Should we use triple buffered overlays */
/* size of the display */
RECT
rect_display
;
int
i_display_depth
;
/* size of the overall window (including black bands) */
RECT
rect_parent
;
/* Window position and size */
int
i_window_x
;
int
i_window_y
;
...
...
@@ -74,65 +66,74 @@ struct vout_sys_t
int
i_window_height
;
int
i_window_style
;
volatile
uint16_t
i_changes
;
/* changes made to the video display */
/* Mouse */
volatile
vlc_bool_t
b_cursor_hidden
;
volatile
mtime_t
i_lastmoved
;
/* Misc */
vlc_bool_t
b_on_top_change
;
vlc_bool_t
b_wallpaper
;
/* screensaver system settings to be restored when vout is closed */
UINT
i_spi_lowpowertimeout
;
UINT
i_spi_powerofftimeout
;
UINT
i_spi_screensavetimeout
;
/* Coordinates of src and dest images (used when blitting to display) */
RECT
rect_src
;
RECT
rect_src_clipped
;
RECT
rect_dest
;
RECT
rect_dest_clipped
;
RECT
rect_parent
;
#ifdef MODULE_NAME_IS_vout_directx
/* Overlay alignment restrictions */
int
i_align_src_boundary
;
int
i_align_src_size
;
int
i_align_dest_boundary
;
int
i_align_dest_size
;
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_hw_yuv
;
/* Should we use hardware YUV->RGB conversions */
vlc_bool_t
b_3buf_overlay
;
/* Should we use triple buffered overlays */
/* DDraw capabilities */
int
b_caps_overlay_clipping
;
int
i_rgb_colorkey
;
/* colorkey in RGB used by the overlay */
int
i_colorkey
;
/* colorkey used by the overlay */
volatile
uint16_t
i_changes
;
/* changes made to the video display */
/* Mouse */
volatile
vlc_bool_t
b_cursor_hidden
;
volatile
mtime_t
i_lastmoved
;
/* Misc */
vlc_bool_t
b_on_top_change
;
vlc_bool_t
b_wallpaper
;
COLORREF
color_bkg
;
COLORREF
color_bkgtxt
;
LPDIRECTDRAW2
p_ddobject
;
/* DirectDraw object */
LPDIRECTDRAWSURFACE2
p_display
;
/* Display device */
LPDIRECTDRAWSURFACE2
p_current_surface
;
/* surface currently displayed */
LPDIRECTDRAWCLIPPER
p_clipper
;
/* clipper used for blitting */
HINSTANCE
hddraw_dll
;
/* handle of the opened ddraw dll */
#endif
#ifdef MODULE_NAME_IS_glwin32
HDC
hGLDC
;
HGLRC
hGLRC
;
#endif
/* screensaver system settings to be restored when vout is closed */
UINT
i_spi_lowpowertimeout
;
UINT
i_spi_powerofftimeout
;
UINT
i_spi_screensavetimeout
;
#ifdef MODULE_NAME_IS_direct3d
// core objects
LPDIRECT3D9
p_d3dobj
;
LPDIRECT3DDEVICE9
p_d3ddev
;
D3DPRESENT_PARAMETERS
d3dpp
;
// scene objects
LPDIRECT3DTEXTURE9
p_d3dtex
;
LPDIRECT3DVERTEXBUFFER9
p_d3dvtc
;
#endif
event_thread_t
*
p_event
;
vlc_mutex_t
lock
;
};
/*****************************************************************************
* picture_sys_t: direct buffer method descriptor
*****************************************************************************
* This structure is part of the picture descriptor, it describes the
* DirectX specific properties of a direct buffer.
*****************************************************************************/
struct
picture_sys_t
{
LPDIRECTDRAWSURFACE2
p_surface
;
DDSURFACEDESC
ddsd
;
LPDIRECTDRAWSURFACE2
p_front_surface
;
};
/*****************************************************************************
* Prototypes from vout.c
*****************************************************************************/
...
...
@@ -149,8 +150,7 @@ void E_(DirectXUpdateRects) ( vout_thread_t *p_vout, vlc_bool_t b_force );
*****************************************************************************/
#define WM_VLC_HIDE_MOUSE WM_APP
#define WM_VLC_SHOW_MOUSE WM_APP + 1
#define WM_VLC_CREATE_VIDEO_WIN WM_APP + 2
#define WM_VLC_CHANGE_TEXT WM_APP + 3
#define WM_VLC_CHANGE_TEXT WM_APP + 2
#define IDM_TOGGLE_ON_TOP WM_USER + 1
#define DX_POSITION_CHANGE 0x1000
#define DX_WALLPAPER_CHANGE 0x2000
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment