Commit b19c5784 authored by David Kaplan's avatar David Kaplan Committed by Laurent Aimar

Direct2D video output module

Adds support for the D2D API on Win7/Vista SP2 with Platform Update
Requires d2d1 contrib headers
Signed-off-by: default avatarLaurent Aimar <fenrir@videolan.org>
parent ba0b1020
...@@ -3449,6 +3449,23 @@ then ...@@ -3449,6 +3449,23 @@ then
fi fi
fi fi
dnl
dnl Windows Direct2D plugin
dnl
AC_ARG_ENABLE(direct2d,
[ --enable-direct2d Win7/VistaPU Direct2D support (default auto on Win32)])
if test "${enable_direct2d}" != "no"; then
if test "${SYS}" = "mingw32" -o "${SYS}" = "mingwce"
then
AC_CHECK_HEADERS(d2d1.h,
[
VLC_ADD_PLUGIN([direct2d])
VLC_ADD_LIBS([direct2d],[-lgdi32 -lole32])
], [AC_MSG_WARN([Cannot find Direct2D headers!])]
)
fi
fi
dnl dnl
dnl win32 GDI plugin dnl win32 GDI plugin
dnl dnl
......
SOURCES_direct2d = \
direct2d.c \
common.h \
events.h \
events.c \
common.c \
$(NULL)
SOURCES_directx = \ SOURCES_directx = \
directx.c \ directx.c \
common.h \ common.h \
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
#ifdef MODULE_NAME_IS_glwin32 #ifdef MODULE_NAME_IS_glwin32
#include "../opengl.h" #include "../opengl.h"
#endif #endif
#ifdef MODULE_NAME_IS_direct2d
#include <d2d1.h>
#endif
#include "common.h" #include "common.h"
...@@ -379,7 +382,7 @@ void UpdateRects(vout_display_t *vd, ...@@ -379,7 +382,7 @@ void UpdateRects(vout_display_t *vd,
SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS); SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS);
/* Destination image position and dimensions */ /* Destination image position and dimensions */
#if defined(MODULE_NAME_IS_direct3d) #if defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
rect_dest.left = 0; rect_dest.left = 0;
rect_dest.right = place.width; rect_dest.right = place.width;
rect_dest.top = 0; rect_dest.top = 0;
...@@ -398,7 +401,7 @@ void UpdateRects(vout_display_t *vd, ...@@ -398,7 +401,7 @@ void UpdateRects(vout_display_t *vd,
#endif #endif
#if defined(MODULE_NAME_IS_directx) || defined(MODULE_NAME_IS_direct3d) #if defined(MODULE_NAME_IS_directx) || defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
/* UpdateOverlay directdraw function doesn't automatically clip to the /* UpdateOverlay directdraw function doesn't automatically clip to the
* display size so we need to do it otherwise it will fail * display size so we need to do it otherwise it will fail
* It is also needed for d3d to avoid exceding our surface size */ * It is also needed for d3d to avoid exceding our surface size */
...@@ -457,7 +460,7 @@ void UpdateRects(vout_display_t *vd, ...@@ -457,7 +460,7 @@ void UpdateRects(vout_display_t *vd,
/* Apply overlay hardware constraints */ /* Apply overlay hardware constraints */
if (sys->use_overlay) if (sys->use_overlay)
AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size); AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size);
#elif defined(MODULE_NAME_IS_direct3d) #elif defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_direct2d)
/* Needed at least with YUV content */ /* Needed at least with YUV content */
rect_src_clipped.left &= ~1; rect_src_clipped.left &= ~1;
rect_src_clipped.right &= ~1; rect_src_clipped.right &= ~1;
......
...@@ -157,6 +157,13 @@ struct vout_display_sys_t ...@@ -157,6 +157,13 @@ struct vout_display_sys_t
vout_display_opengl_t vgl; vout_display_opengl_t vgl;
#endif #endif
#ifdef MODULE_NAME_IS_direct2d
HINSTANCE d2_dll; /* handle of the opened d2d1 dll */
ID2D1Factory *d2_factory; /* D2D factory */
ID2D1HwndRenderTarget *d2_render_target; /* D2D rendering target */
ID2D1Bitmap *d2_bitmap; /* D2 bitmap */
#endif
#ifdef MODULE_NAME_IS_direct3d #ifdef MODULE_NAME_IS_direct3d
bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */ bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */
/* show video on desktop window ? */ /* show video on desktop window ? */
......
This diff is collapsed.
...@@ -49,6 +49,9 @@ ...@@ -49,6 +49,9 @@
#ifdef MODULE_NAME_IS_glwin32 #ifdef MODULE_NAME_IS_glwin32
#include "../opengl.h" #include "../opengl.h"
#endif #endif
#ifdef MODULE_NAME_IS_direct2d
#include <d2d1.h>
#endif
#include <vlc_keys.h> #include <vlc_keys.h>
#include "common.h" #include "common.h"
......
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