X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_output%2Fmsw%2Fcommon.c;h=414b93dd4c792f2d1b13c5faeb022a9badf0e6a8;hb=6154d28dabf97571b5d1057e107761eb8c951aba;hp=9d607c9000f01f1dfc445884d7c1e9b832ece5cc;hpb=0a231ffaab59a0a98af8f72922cfd70bd553b26e;p=vlc diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index 9d607c9000..414b93dd4c 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -48,6 +48,9 @@ #ifdef MODULE_NAME_IS_glwin32 #include "../opengl.h" #endif +#ifdef MODULE_NAME_IS_direct2d +#include +#endif #include "common.h" @@ -63,8 +66,10 @@ static void CommonChangeThumbnailClip(vout_display_t *, bool show); static int CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen); +#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32) static void DisableScreensaver(vout_display_t *); static void RestoreScreensaver(vout_display_t *); +#endif /* */ int CommonInit(vout_display_t *vd) @@ -84,9 +89,6 @@ int CommonInit(vout_display_t *vd) var_Create(vd, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT); var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); - /* FIXME remove mouse hide from msw */ - var_Create(vd, "mouse-hide-timeout", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT); - /* */ sys->event = EventThreadCreate(vd); if (!sys->event) @@ -191,9 +193,6 @@ void CommonManage(vout_display_t *vd) /* HasMoved means here resize or move */ if (EventThreadGetAndResetHasMoved(sys->event)) UpdateRects(vd, NULL, NULL, false); - - /* Pointer change */ - EventThreadMouseAutoHide(sys->event); } /** @@ -220,6 +219,55 @@ void CommonDisplay(vout_display_t *vd) sys->is_first_display = false; } +/** + * It updates a picture data/pitches. + */ +int CommonUpdatePicture(picture_t *picture, picture_t **fallback, + uint8_t *data, unsigned pitch) +{ + if (fallback) { + if (*fallback == NULL) { + *fallback = picture_NewFromFormat(&picture->format); + if (*fallback == NULL) + return VLC_EGENERIC; + } + for (int n = 0; n < picture->i_planes; n++) { + const plane_t *src = &(*fallback)->p[n]; + plane_t *dst = &picture->p[n]; + dst->p_pixels = src->p_pixels; + dst->i_pitch = src->i_pitch; + dst->i_lines = src->i_lines; + } + return VLC_SUCCESS; + } + /* fill in buffer info in first plane */ + picture->p->p_pixels = data; + picture->p->i_pitch = pitch; + picture->p->i_lines = picture->format.i_height; + + /* Fill chroma planes for planar YUV */ + if (picture->format.i_chroma == VLC_CODEC_I420 || + picture->format.i_chroma == VLC_CODEC_J420 || + picture->format.i_chroma == VLC_CODEC_YV12) { + + for (int n = 1; n < picture->i_planes; n++) { + const plane_t *o = &picture->p[n-1]; + plane_t *p = &picture->p[n]; + + p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch; + p->i_pitch = pitch / 2; + p->i_lines = picture->format.i_height / 2; + } + /* The dx/d3d buffer is always allocated as YV12 */ + if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) { + uint8_t *p_tmp = picture->p[1].p_pixels; + picture->p[1].p_pixels = picture->p[2].p_pixels; + picture->p[2].p_pixels = p_tmp; + } + } + return VLC_SUCCESS; +} + void AlignRect(RECT *r, int align_boundary, int align_size) { if (align_boundary) @@ -336,7 +384,7 @@ void UpdateRects(vout_display_t *vd, SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS); /* 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.right = place.width; rect_dest.top = 0; @@ -355,7 +403,7 @@ void UpdateRects(vout_display_t *vd, #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 * display size so we need to do it otherwise it will fail * It is also needed for d3d to avoid exceding our surface size */ @@ -414,7 +462,7 @@ void UpdateRects(vout_display_t *vd, /* Apply overlay hardware constraints */ if (sys->use_overlay) 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 */ rect_src_clipped.left &= ~1; rect_src_clipped.right &= ~1; @@ -551,9 +599,6 @@ static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen) SetWindowPlacement(hwnd, &window_placement); ShowWindow(hwnd, SW_SHOWNORMAL); } - - /* Make sure the mouse cursor is displayed */ - EventThreadMouseShow(sys->event); } return VLC_SUCCESS; } @@ -627,18 +672,23 @@ int CommonControl(vout_display_t *vd, int query, va_list args) } case VOUT_DISPLAY_CHANGE_FULLSCREEN: { /* const vout_display_cfg_t *p_cfg */ const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); - return CommonControlSetFullscreen(vd, cfg->is_fullscreen); + if (CommonControlSetFullscreen(vd, cfg->is_fullscreen)) + return VLC_EGENERIC; + UpdateRects(vd, NULL, NULL, false); + return VLC_SUCCESS; } - case VOUT_DISPLAY_RESET_PICTURES: case VOUT_DISPLAY_HIDE_MOUSE: + EventThreadMouseHide(sys->event); + return VLC_SUCCESS; + case VOUT_DISPLAY_RESET_PICTURES: assert(0); default: return VLC_EGENERIC; } } -#ifndef UNDER_CE +#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32) static void DisableScreensaver(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys;