/*****************************************************************************
* kva.c: KVA video output plugin for vlc
*****************************************************************************
- * Copyright (C) 2010, 2011 the VideoLAN team
+ * Copyright (C) 2010, 2011, 2012 VLC authors and VideoLAN
*
* Authors: KO Myung-Hun <komh@chollian.net>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
"Select a proper video mode to be used by KVA." )
static const char *const ppsz_kva_video_mode[] = {
- "auto", "snap", "wo", "dive" };
+ "auto", "snap", "wo", "vman", "dive" };
static const char *const ppsz_kva_video_mode_text[] = {
- N_("Auto"), N_("SNAP"), N_("WarpOverlay!"), N_("DIVE") };
+ N_("Auto"), N_("SNAP"), N_("WarpOverlay!"), N_("VMAN"), N_("DIVE") };
vlc_module_begin ()
set_shortname( "KVA" )
set_subcategory( SUBCAT_VIDEO_VOUT )
add_string( "kva-video-mode", ppsz_kva_video_mode[0], KVA_VIDEO_MODE_TEXT,
KVA_VIDEO_MODE_LONGTEXT, false )
- change_string_list( ppsz_kva_video_mode, ppsz_kva_video_mode_text, 0 )
- add_bool( "kva-fixt23", false, KVA_FIXT23_TEXT, KVA_FIXT23_LONGTEXT, true );
+ change_string_list( ppsz_kva_video_mode, ppsz_kva_video_mode_text )
+ add_bool( "kva-fixt23", false, KVA_FIXT23_TEXT, KVA_FIXT23_LONGTEXT, true )
set_description( N_("K Video Acceleration video output") )
set_capability( "vout display", 100 )
add_shortcut( "kva" )
HWND parent;
RECTL parent_rect;
picture_pool_t *pool;
- picture_resource_t resource;
unsigned button_pressed;
bool is_mouse_hidden;
+ bool is_on_top;
};
struct picture_sys_t
#define WM_VLC_FULLSCREEN_CHANGE ( WM_USER + 2 )
#define WM_VLC_SIZE_CHANGE ( WM_USER + 3 )
-static const char *psz_video_mode[ 3 ] = {"DIVE", "WarpOverlay!", "SNAP"};
+static const char *psz_video_mode[ 4 ] = {"DIVE", "WarpOverlay!", "SNAP",
+ "VMAN"};
static void PMThread( void *arg )
{
{
sys->parent = ( HWND )sys->parent_window->handle.hwnd;
- /* Workaround :
- * When an embedded window opened first, it is not positioned
- * correctly. So reposition it here, again.
- */
- WinSetWindowPos( WinQueryWindow( sys->parent, QW_PARENT ),
- HWND_TOP, 0, 0, 0, 0, SWP_MOVE );
-
ULONG i_style = WinQueryWindowULong( sys->parent, QWL_STYLE );
WinSetWindowULong( sys->parent, QWL_STYLE,
i_style | WS_CLIPCHILDREN );
WinSetWindowPtr( sys->client, 0, vd );
- if( sys->b_fixt23 )
+ if( !sys->parent_window )
{
WinSetWindowPtr( sys->frame, 0, vd );
sys->p_old_frame = WinSubclassWindow( sys->frame, MyFrameWndProc );
i_kva_mode = KVAM_SNAP;
else if( strcmp( psz_mode, "wo" ) == 0 )
i_kva_mode = KVAM_WO;
+ else if( strcmp( psz_mode, "vman" ) == 0 )
+ i_kva_mode = KVAM_VMAN;
else if( strcmp( psz_mode, "dive" ) == 0 )
i_kva_mode = KVAM_DIVE;
sys->i_result = VLC_SUCCESS;
DosPostEventSem( sys->ack_event );
+ if( !sys->parent_window )
+ WinSetVisibleRegionNotify( sys->frame, TRUE );
+
while( WinGetMsg( sys->hab, &qm, NULLHANDLE, 0, 0 ))
WinDispatchMsg( sys->hab, &qm );
+ if( !sys->parent_window )
+ WinSetVisibleRegionNotify( sys->frame, FALSE );
+
kvaEnableScreenSaver();
CloseDisplay( vd );
kvaDone();
exit_kva_init :
- if( sys->b_fixt23 )
+ if( !sys->parent_window )
WinSubclassWindow( sys->frame, sys->p_old_frame );
WinDestroyWindow( sys->frame );
POINTL ptl;
WinQueryPointerPos( HWND_DESKTOP, &ptl );
- if( WinWindowFromPoint( HWND_DESKTOP, &ptl, TRUE ) == sys->client )
+ if( !sys->is_mouse_hidden &&
+ WinWindowFromPoint( HWND_DESKTOP, &ptl, TRUE ) == sys->client )
{
WinShowPointer( HWND_DESKTOP, FALSE );
sys->is_mouse_hidden = true;
return VLC_SUCCESS;
}
+ case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
+ {
+ const unsigned state = va_arg( args, unsigned );
+ const bool is_on_top = (state & VOUT_WINDOW_STATE_ABOVE) != 0;
+
+ if( sys->parent_window )
+ {
+ if( vout_window_SetState( sys->parent_window, state ))
+ return VLC_EGENERIC;
+ }
+ else if( is_on_top )
+ WinSetWindowPos( sys->frame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER );
+
+ sys->is_on_top = is_on_top;
+
+ return VLC_SUCCESS;
+ }
+
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
{
const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
{
vout_window_SetSize(sys->parent_window,
cfg->display.width, cfg->display.height);
-
- /* Workaround :
- * If changing aspect ratio after resizing a main window,
- * an embedded window is misplaced. So reposition it, here.
- */
- WinSetWindowPos( WinQueryWindow( sys->parent, QW_PARENT ),
- HWND_TOP, 0, 1, 0, 0, SWP_MOVE );
- WinSetWindowPos( WinQueryWindow( sys->parent, QW_PARENT ),
- HWND_TOP, 0, 0, 0, 0, SWP_MOVE );
}
else
WinPostMsg( sys->client, WM_VLC_SIZE_CHANGE,
}
case VOUT_DISPLAY_RESET_PICTURES:
- case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
case VOUT_DISPLAY_CHANGE_ZOOM:
case VOUT_DISPLAY_GET_OPENGL:
i_chroma_shift = 2;
break;
+ case VLC_CODEC_RGB32:
+ b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_BGR32;
+ i_kva_fourcc = FOURCC_BGR4;
+ i_chroma_shift = 0;
+ break;
+
case VLC_CODEC_RGB24:
b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_BGR24;
i_kva_fourcc = FOURCC_BGR3;
}
/* Create the associated picture */
- picture_resource_t *rsc = &sys->resource;
- rsc->p_sys = malloc( sizeof( *rsc->p_sys ));
- if( !rsc->p_sys )
- return VLC_EGENERIC;
-
- rsc->p_sys->i_chroma_shift = i_chroma_shift;
+ picture_sys_t *picsys = malloc( sizeof( *picsys ) );
+ if( picsys == NULL )
+ return VLC_ENOMEM;
+ picsys->i_chroma_shift = i_chroma_shift;
- for( int i = 0; i < PICTURE_PLANE_MAX; i++ )
+ picture_resource_t resource = { .p_sys = picsys };
+ picture_t *picture = picture_NewFromResource( fmt, &resource );
+ if( !picture )
{
- rsc->p[ i ].p_pixels = NULL;
- rsc->p[ i ].i_pitch = 0;
- rsc->p[ i ].i_lines = 0;
+ free( picsys );
+ return VLC_ENOMEM;
}
- picture_t *picture = picture_NewFromResource( fmt, rsc );
- if( !picture )
- goto exit_picture;
-
/* Wrap it into a picture pool */
picture_pool_configuration_t pool_cfg;
memset( &pool_cfg, 0, sizeof( pool_cfg ));
if( !sys->pool )
{
picture_Release( picture );
-
- goto exit_picture;
+ return VLC_ENOMEM;
}
if (vd->cfg->display.title)
SWP_ACTIVATE );
return VLC_SUCCESS;
-
-exit_picture:
- free( rsc->p_sys );
-
- return VLC_EGENERIC;
}
/*****************************************************************************
{
case WM_QUERYTRACKINFO :
{
+ MRESULT mr;
+
+ mr = sys->p_old_frame( hwnd, msg, mp1, mp2 );
+ if( !sys->b_fixt23 )
+ return mr;
+
PTRACKINFO pti = ( PTRACKINFO )mp2;
RECTL rcl;
- sys->p_old_frame( hwnd, msg, mp1, mp2 );
-
pti->rclBoundary.xLeft = 0;
pti->rclBoundary.yBottom = 0;
pti->rclBoundary.xRight = sys->i_screen_width;
case WM_ADJUSTWINDOWPOS :
{
+ if( !sys->b_fixt23 )
+ break;
+
PSWP pswp = ( PSWP )mp1;
- RECTL rcl;
if( pswp->fl & SWP_SIZE )
{
+ RECTL rcl;
+
rcl.xLeft = pswp->x;
rcl.yBottom = pswp->y;
rcl.xRight = rcl.xLeft + pswp->cx;
break;
}
+
+ //case WM_VRNDISABLED :
+ case WM_VRNENABLED :
+ if( !vd->cfg->is_fullscreen && sys->is_on_top )
+ WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER );
+ break;
}
return sys->p_old_frame( hwnd, msg, mp1, mp2 );