*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
#include <string.h>
#include <vlc/vlc.h>
-#include <vlc/vout.h>
+#include <vlc_interface.h>
+#include <vlc_playlist.h>
+#include <vlc_vout.h>
#include <commctrl.h>
#define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong
#define GWLP_USERDATA GWL_USERDATA
+#define AdjustWindowRect(a,b,c)
#endif //UNDER_CE
#ifndef WS_NONAVDONEBUTTON
int i_window_y;
int i_window_width;
int i_window_height;
+ int i_window_style;
int render_width;
int render_height;
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_VOUT );
#ifdef MODULE_NAME_IS_wingapi
- set_shortname( _("Windows GAPI") );
+ set_shortname( "Windows GAPI" );
set_description( _("Windows GAPI video output") );
set_capability( "video output", 20 );
#else
- set_shortname( _("Windows GDI") );
+ set_shortname( "Windows GDI" );
set_description( _("Windows GDI video output") );
set_capability( "video output", 10 );
#endif
#else
p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height;
+
+ p_vout->fmt_out = p_vout->fmt_in;
+ p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
#endif
+
p_vout->output.i_aspect = p_vout->render.i_aspect;
p_pic->p->p_pixels = p_vout->p_sys->p_pic_buffer;
else
i_style = WS_OVERLAPPEDWINDOW|WS_SIZEBOX|WS_VISIBLE|WS_CLIPCHILDREN;
+ p_vout->p_sys->i_window_style = i_style;
+
p_vout->p_sys->hwnd =
CreateWindow( _T("VLC WinGDI"), _T(VOUT_TITLE), i_style,
(p_vout->p_sys->i_window_x < 0) ? CW_USEDEFAULT :
switch( msg.wParam )
{
case VK_ESCAPE:
- p_event->p_vlc->b_die = VLC_TRUE;
+ p_event->p_libvlc->b_die = VLC_TRUE;
break;
}
TranslateMessage( &msg );
{
case 'q':
case 'Q':
- p_event->p_vlc->b_die = VLC_TRUE;
+ p_event->p_libvlc->b_die = VLC_TRUE;
break;
}
break;
#ifndef UNDER_CE
/* Catch the screensaver and the monitor turn-off */
if( message == WM_SYSCOMMAND &&
- ( wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER ) )
+ ( (wParam & 0xFFF0) == SC_SCREENSAVE || (wParam & 0xFFF0) == SC_MONITORPOWER ) )
{
//if( p_vout ) msg_Dbg( p_vout, "WinProc WM_SYSCOMMAND screensaver" );
return 0; /* this stops them from happening */
p_vout->p_sys->b_video_display = VLC_TRUE;
break;
+ /* the user wants to close the window */
+ case WM_CLOSE:
+ {
+ playlist_t * p_playlist =
+ (playlist_t *)vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ if( p_playlist == NULL ) return 0;
+
+ playlist_Stop( p_playlist );
+ vlc_object_release( p_playlist );
+ return 0;
+ }
+
case WM_DESTROY:
msg_Dbg( p_vout, "WinProc WM_DESTROY" );
PostQuitMessage( 0 );
*****************************************************************************/
static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{
+ unsigned int *pi_width, *pi_height;
vlc_bool_t b_bool;
+ RECT rect_window;
+ POINT point;
switch( i_query )
{
+ case VOUT_GET_SIZE:
+ if( p_vout->p_sys->hparent )
+ return vout_ControlWindow( p_vout,
+ (void *)p_vout->p_sys->hparent, i_query, args );
+
+ pi_width = va_arg( args, unsigned int * );
+ pi_height = va_arg( args, unsigned int * );
+
+ GetClientRect( p_vout->p_sys->hwnd, &rect_window );
+
+ *pi_width = rect_window.right - rect_window.left;
+ *pi_height = rect_window.bottom - rect_window.top;
+ return VLC_SUCCESS;
+
+ case VOUT_SET_SIZE:
+ if( p_vout->p_sys->hparent )
+ return vout_ControlWindow( p_vout,
+ (void *)p_vout->p_sys->hparent, i_query, args );
+
+ /* Update dimensions */
+ rect_window.top = rect_window.left = 0;
+ rect_window.right = va_arg( args, unsigned int );
+ rect_window.bottom = va_arg( args, unsigned int );
+ if( !rect_window.right ) rect_window.right = p_vout->i_window_width;
+ if( !rect_window.bottom ) rect_window.bottom = p_vout->i_window_height;
+ AdjustWindowRect( &rect_window, p_vout->p_sys->i_window_style, 0 );
+
+ SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
+ rect_window.right - rect_window.left,
+ rect_window.bottom - rect_window.top, SWP_NOMOVE );
+
+ return VLC_SUCCESS;
+
+ case VOUT_CLOSE:
+ ShowWindow( p_vout->p_sys->hwnd, SW_HIDE );
+ case VOUT_REPARENT:
+ /* Change window style, borders and title bar */
+ //vlc_mutex_lock( &p_vout->p_sys->lock );
+ p_vout->p_sys->hparent = 0;
+ //vlc_mutex_unlock( &p_vout->p_sys->lock );
+
+ /* Retrieve the window position */
+ point.x = point.y = 0;
+ ClientToScreen( p_vout->p_sys->hwnd, &point );
+
+ SetParent( p_vout->p_sys->hwnd, 0 );
+ p_vout->p_sys->i_window_style =
+ WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
+ p_vout->p_sys->i_window_style |
+ (i_query == VOUT_CLOSE ? 0 : WS_VISIBLE) );
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW );
+ SetWindowPos( p_vout->p_sys->hwnd, 0, point.x, point.y, 0, 0,
+ SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
+
+ return vout_vaControlDefault( p_vout, i_query, args );
+
case VOUT_SET_FOCUS:
b_bool = va_arg( args, vlc_bool_t );