/*****************************************************************************
* qte.cpp : QT Embedded plugin for vlc
*****************************************************************************
- * Copyright (C) 1998-2003 VideoLAN
- * $Id: qte.cpp,v 1.18 2003/05/05 16:09:38 gbazin Exp $
+ * Copyright (C) 1998-2003 the VideoLAN team
+ * $Id$
*
- * Authors: Gerald Hansink <gerald.hansink@ordain.nl>
- * Jean-Paul Saman <jpsaman@wxs.nl>
+ * Authors: Gerald Hansink <gerald.hansink@ordina.nl>
+ * Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
*
* 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
*
* 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.
*****************************************************************************/
/*****************************************************************************
extern "C"
{
#include <errno.h> /* ENOMEM */
-#include <stdlib.h> /* free() */
-#include <string.h> /* strerror() */
-#include <vlc/vlc.h>
-#include <vlc/intf.h>
-#include <vlc/vout.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_interface.h>
+#include <vlc_vout.h>
#ifdef HAVE_MACHINE_PARAM_H
/* BSD */
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-#define DISPLAY_TEXT N_("QT Embedded display name")
+#define DISPLAY_TEXT N_("QT Embedded display")
#define DISPLAY_LONGTEXT N_( \
- "Specify the Qt Embedded hardware display you want to use. By default VLC will " \
- "use the value of the DISPLAY environment variable.")
+ "Qt Embedded hardware display to use. " \
+ "By default VLC will use the value of the DISPLAY environment variable.")
/*****************************************************************************
* Local prototypes
static void ToggleFullScreen ( vout_thread_t * );
-static void RunQtThread( event_thread_t *p_event );
+static void* RunQtThread( vlc_object_t *p_this );
} /* extern "C" */
/*****************************************************************************
extern "C"
{
-vlc_module_begin();
-// add_category_hint( N_("QT Embedded"), NULL );
-// add_string( "qte-display", "landscape", NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT);
- set_description( _("QT Embedded video output") );
- set_capability( "video output", 70 );
- add_shortcut( "qte" );
- set_callbacks( Open, Close);
-vlc_module_end();
+vlc_module_begin ()
+ set_category( CAT_VIDEO )
+ set_subcategory( SUBCAT_VIDEO_VOUT )
+// add_category_hint( N_("QT Embedded"), NULL )
+// add_string( "qte-display", "landscape", NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT)
+ set_description( N_("QT Embedded video output") )
+ set_capability( "video output", 70 )
+ add_shortcut( "qte" )
+ set_callbacks( Open, Close)
+vlc_module_end ()
} /* extern "C" */
p_vout->p_sys = (struct vout_sys_t*) malloc( sizeof( struct vout_sys_t ) );
if( p_vout->p_sys == NULL )
- {
- msg_Err( p_vout, "out of memory" );
return( 1 );
- }
p_vout->pf_init = Init;
p_vout->pf_end = End;
p_vout->pf_display = Display;
#ifdef NEED_QTE_MAIN
- p_vout->p_sys->p_qte_main = module_Need( p_this, "gui-helper", "qte" );
+ p_vout->p_sys->p_qte_main =
+ module_need( p_this, "gui-helper", "qte", true );
if( p_vout->p_sys->p_qte_main == NULL )
{
free( p_vout->p_sys );
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
- msg_Dbg( p_vout, "Close" );
+ msg_Dbg( p_vout, "close" );
if( p_vout->p_sys->p_event )
{
vlc_object_detach( p_vout->p_sys->p_event );
/* Kill RunQtThread */
- p_vout->p_sys->p_event->b_die = VLC_TRUE;
+ vlc_object_kill( p_vout->p_sys->p_event );
CloseDisplay(p_vout);
vlc_thread_join( p_vout->p_sys->p_event );
- vlc_object_destroy( p_vout->p_sys->p_event );
+ vlc_object_release( p_vout->p_sys->p_event );
}
#ifdef NEED_QTE_MAIN
- msg_Dbg( p_vout, "Releasing gui-helper" );
- module_Unneed( p_vout, p_vout->p_sys->p_qte_main );
+ msg_Dbg( p_vout, "releasing gui-helper" );
+ module_unneed( p_vout, p_vout->p_sys->p_qte_main );
#endif
- if( p_vout->p_sys )
- {
- free( p_vout->p_sys );
- p_vout->p_sys = NULL;
- }
+ free( p_vout->p_sys );
+ p_vout->p_sys = NULL;
}
/*****************************************************************************
I_OUTPUTPICTURES = 0;
- p_vout->output.i_chroma = (dd == 16) ? VLC_FOURCC('R','V','1','6'): VLC_FOURCC('R','V','3','2');
+ p_vout->output.i_chroma = (dd == 16) ? VLC_CODEC_RGB16 : VLC_CODEC_RGB32;
p_vout->output.i_rmask = 0xf800;
p_vout->output.i_gmask = 0x07e0;
p_vout->output.i_bmask = 0x001f;
&x, &y, &w, &h );
#if 0
msg_Dbg(p_vout, "+qte::Display( p_vout, i_width=%d, i_height=%d, x=%u, y=%u, w=%u, h=%u",
- p_vout->output.i_width, p_vout->output.i_height, x, y, w, h );
+ p_vout->output.i_width, p_vout->output.i_height, x, y, w, h );
#endif
if(p_vout->p_sys->p_VideoWidget)
{
// shameless borrowed from opie mediaplayer....
#ifndef USE_DIRECT_PAINTER
- msg_Dbg(p_vout, "Not using direct painter");
+ msg_Dbg(p_vout, "not using direct painter");
QPainter p(p_vout->p_sys->p_VideoWidget);
/* rotate frame */
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
- msg_Dbg( p_vout, "Manage" );
+// msg_Dbg( p_vout, "Manage" );
/* Fullscreen change */
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
/* Pointer change */
// if( ! p_vout->p_sys->b_cursor_autohidden &&
-// ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
+// ( mdate() - p_vout->p_sys->i_lastmoved >
+// p_vout->p_sys->i_mouse_hide_timeout ) )
// {
// /* Hide the mouse automatically */
// p_vout->p_sys->b_cursor_autohidden = 1;
// SDL_ShowCursor( 0 );
// }
+//
+// if( !vlc_object_alive (p_vout->p_libvlc) )
+// p_vout->p_sys->bRunning = FALSE;
return 0;
}
p_pic->p->p_pixels = (p_pic->p_sys->pQImage->jumpTable())[0];
p_pic->p->i_pitch = p_pic->p_sys->pQImage->bytesPerLine();
p_pic->p->i_lines = p_vout->output.i_height;
+ p_pic->p->i_visible_lines = p_vout->output.i_height;
p_pic->p->i_visible_pitch =
p_pic->p->i_pixel_pitch * p_vout->output.i_width;
if ( p_vout->b_fullscreen )
p_vout->p_sys->p_VideoWidget->showFullScreen();
else
- p_vout->p_sys->p_VideoWidget->showNormal();
+ p_vout->p_sys->p_VideoWidget->showNormal();
p_vout->b_fullscreen = !p_vout->b_fullscreen;
}
/* Initializations */
#if 1 /* FIXME: I need an event queue to handle video output size changes. */
- p_vout->b_fullscreen = VLC_TRUE;
+ p_vout->b_fullscreen = true;
#endif
/* Set main window's size */
p_vout->i_window_height = p_vout->p_sys->i_height;
#endif
- msg_Dbg( p_vout, "OpenDisplay (h=%d,w=%d)",p_vout->p_sys->i_height,p_vout->p_sys->i_width);
+ msg_Dbg( p_vout, "opening display (h=%d,w=%d)",p_vout->p_sys->i_height,p_vout->p_sys->i_width);
/* create thread to exec the qpe application */
if ( vlc_thread_create( p_vout->p_sys->p_event, "QT Embedded Thread",
RunQtThread,
- VLC_THREAD_PRIORITY_OUTPUT, VLC_TRUE) )
+ VLC_THREAD_PRIORITY_OUTPUT, true) )
{
msg_Err( p_vout, "cannot create QT Embedded Thread" );
- vlc_object_destroy( p_vout->p_sys->p_event );
+ vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
return -1;
}
static void CloseDisplay( vout_thread_t *p_vout )
{
// quit qt application loop
- msg_Dbg( p_vout, "Destroying Qt Window" );
+ msg_Dbg( p_vout, "destroying Qt Window" );
#ifdef NEED_QTE_MAIN
if(p_vout->p_sys->p_QApplication)
{
/*****************************************************************************
* main loop of qtapplication
*****************************************************************************/
-static void RunQtThread(event_thread_t *p_event)
+static void* RunQtThread( vlc_object_t *p_this )
{
- msg_Dbg( p_event->p_vout, "RunQtThread Starting" );
+ event_thread_t *p_event = (event_thread_t *)p_this;
+ int canc = vlc_savecancel ();
+ msg_Dbg( p_event->p_vout, "RunQtThread starting" );
#ifdef NEED_QTE_MAIN
if (qApp)
}
QWidget* pWidget = new QWidget();
if (pWidget)
- {
+ {
p_event->p_vout->p_sys->p_VideoWidget = pWidget;
}
}
if (p_event->p_vout->p_sys->p_QApplication)
{
/* Set default window width and heigh to exactly preferred size. */
- QWidget *desktop = p_event->p_vout->p_sys->p_QApplication->desktop();
- p_event->p_vout->p_sys->p_VideoWidget->setMinimumWidth( 10 );
- p_event->p_vout->p_sys->p_VideoWidget->setMinimumHeight( 10 );
- p_event->p_vout->p_sys->p_VideoWidget->setBaseSize( p_event->p_vout->p_sys->i_width,
- p_event->p_vout->p_sys->i_height );
+ QWidget *desktop = p_event->p_vout->p_sys->p_QApplication->desktop();
+ p_event->p_vout->p_sys->p_VideoWidget->setMinimumWidth( 10 );
+ p_event->p_vout->p_sys->p_VideoWidget->setMinimumHeight( 10 );
+ p_event->p_vout->p_sys->p_VideoWidget->setBaseSize( p_event->p_vout->p_sys->i_width,
+ p_event->p_vout->p_sys->i_height );
p_event->p_vout->p_sys->p_VideoWidget->setMaximumWidth( desktop->width() );
p_event->p_vout->p_sys->p_VideoWidget->setMaximumHeight( desktop->height() );
/* Check on fullscreen */
if (p_event->p_vout->b_fullscreen)
- p_event->p_vout->p_sys->p_VideoWidget->showFullScreen();
+ p_event->p_vout->p_sys->p_VideoWidget->showFullScreen();
else
- p_event->p_vout->p_sys->p_VideoWidget->showNormal();
+ p_event->p_vout->p_sys->p_VideoWidget->showNormal();
p_event->p_vout->p_sys->p_VideoWidget->show();
p_event->p_vout->p_sys->bRunning = TRUE;
#ifdef NEED_QTE_MAIN
- while(!p_event->b_die && p_event->p_vout->p_sys->bRunning)
- {
- /* Check if we are asked to exit */
- if( p_event->b_die )
+ while(vlc_object_alive (p_event) && p_event->p_vout->p_sys->bRunning)
+ {
+ /* Check if we are asked to exit */
+ if( !vlc_object_alive (p_event) )
break;
- msleep(100);
- }
+ msleep(100);
+ }
#else
// run the main loop of qtapplication until someone says: 'quit'
p_event->p_vout->p_sys->pcQApplication->exec();
#endif
msg_Dbg( p_event->p_vout, "RunQtThread terminating" );
+ vlc_restorecancel (canc);
+ return NULL;
}