* thread, and destroy a previously opened video output thread.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_output.h,v 1.83 2002/08/08 00:35:10 sam Exp $
+ * $Id: video_output.h,v 1.84 2002/10/17 16:03:18 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
} vout_chroma_t;
-/*****************************************************************************
- * vout_fifo_t
- *****************************************************************************/
-typedef struct vout_fifo_t
-{
- /* See the fifo types below */
- int i_type;
- vlc_bool_t b_die;
- int i_fifo; /* Just to keep track of the fifo index */
-
- vlc_mutex_t data_lock;
- vlc_cond_t data_wait;
-
-} vout_fifo_t;
-
-#define VOUT_EMPTY_FIFO 0
-#define VOUT_YUV_FIFO 1
-#define VOUT_SPU_FIFO 2
-
/*****************************************************************************
* vout_thread_t: video output thread descriptor
*****************************************************************************
count_t c_jitter_samples; /* number of samples used for the *
* calculation of the jitter */
- /* Mouse */
- int i_mouse_x, i_mouse_y, i_mouse_button;
-
/* Filter chain */
char *psz_filter_chain;
};
VLC_EXPORT( vout_thread_t *, __vout_CreateThread, ( vlc_object_t *, int, int, u32, int ) );
VLC_EXPORT( void, vout_DestroyThread, ( vout_thread_t * ) );
-vout_fifo_t * vout_CreateFifo ( void );
-void vout_DestroyFifo ( vout_fifo_t * );
-void vout_FreeFifo ( vout_fifo_t * );
-
VLC_EXPORT( int, vout_ChromaCmp, ( u32, u32 ) );
VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, vlc_bool_t, vlc_bool_t, vlc_bool_t ) );
* intf.c: interface for DVD video manager
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.1 2002/08/04 17:23:42 sam Exp $
+ * $Id: intf.c,v 1.2 2002/10/17 16:03:18 sam Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
*
#include "stream_control.h"
#include "input_ext-intf.h"
-#include "video.h"
-#include "video_output.h"
-
#include "dvd.h"
/*****************************************************************************
vlc_bool_t b_inf_still;
mtime_t m_still_time;
+ dvdplay_ctrl_t control;
+ vlc_bool_t b_click, b_move;
};
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int InitThread ( intf_thread_t *p_intf );
+static int MouseEvent ( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
/* Exported functions */
static void RunIntf ( intf_thread_t *p_intf );
*****************************************************************************/
static void RunIntf( intf_thread_t *p_intf )
{
- vout_thread_t * p_vout;
- dvdplay_ctrl_t control;
+ vlc_object_t * p_vout = NULL;
mtime_t mtime = 0;
mtime_t mlast = 0;
-
+
if( InitThread( p_intf ) < 0 )
{
msg_Err( p_intf, "can't initialize intf" );
}
msg_Dbg( p_intf, "intf initialized" );
- p_vout = NULL;
- control.mouse.i_x = 0;
- control.mouse.i_y = 0;
-
/* Main loop */
while( !p_intf->b_die )
{
/*
* mouse cursor
*/
- p_vout = vlc_object_find( p_intf->p_sys->p_input,
- VLC_OBJECT_VOUT, FIND_CHILD );
- if( p_vout != NULL )
+ if( p_vout && ( p_intf->p_sys->b_click || p_intf->p_sys->b_move ) )
{
- vlc_mutex_lock( &p_vout->change_lock );
+ vlc_value_t val;
+ int i_activate;
- if( control.mouse.i_x != p_vout->i_mouse_x ||
- control.mouse.i_y != p_vout->i_mouse_y ||
- p_vout->i_mouse_button )
- {
- int i_activate = 0;
-
- control.mouse.i_x = p_vout->i_mouse_x;
- control.mouse.i_y = p_vout->i_mouse_y;
+ var_Get( p_vout, "mouse-x", &val );
+ p_intf->p_sys->control.mouse.i_x = val.i_int;
+ var_Get( p_vout, "mouse-y", &val );
+ p_intf->p_sys->control.mouse.i_y = val.i_int;
- if( p_vout->i_mouse_button )
- {
- control.type = DVDCtrlMouseActivate;
-
- msg_Dbg( p_intf, "Activate coordinates: %dx%d",
- p_vout->i_mouse_x, p_vout->i_mouse_y );
- }
- else
- {
- control.type = DVDCtrlMouseSelect;
-
- msg_Dbg( p_intf, "Select coordinates: %dx%d",
- p_vout->i_mouse_x, p_vout->i_mouse_y );
- }
- p_vout->i_mouse_button = 0;
- vlc_mutex_unlock( &p_vout->change_lock );
-
- msg_Dbg( p_intf, "send button" );
-
- /* we can safely interact with libdvdplay
- * with the stream lock */
- vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
-
- i_activate =
- dvdplay_button( p_intf->p_sys->p_dvd->vmg, &control );
-
- vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
-
-
- if( i_activate && p_intf->p_sys->b_still )
- {
- input_SetStatus( p_intf->p_sys->p_input,
- INPUT_STATUS_PLAY );
- p_intf->p_sys->b_still = 0;
- p_intf->p_sys->b_inf_still = 0;
- p_intf->p_sys->m_still_time = 0;
- }
+ if( p_intf->p_sys->b_click )
+ {
+ p_intf->p_sys->control.type = DVDCtrlMouseActivate;
+ p_intf->p_sys->b_click = VLC_FALSE;
}
else
{
- vlc_mutex_unlock( &p_vout->change_lock );
+ p_intf->p_sys->control.type = DVDCtrlMouseSelect;
+ p_intf->p_sys->b_move = VLC_FALSE;
}
-
- vlc_object_release( p_vout );
+ msg_Dbg( p_intf, "send button coordinates: %dx%d",
+ p_intf->p_sys->control.mouse.i_x,
+ p_intf->p_sys->control.mouse.i_y );
+
+ /* we can safely interact with libdvdplay
+ * with the stream lock */
+ vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
+
+ i_activate = dvdplay_button( p_intf->p_sys->p_dvd->vmg,
+ &p_intf->p_sys->control );
+
+ vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+
+ if( i_activate && p_intf->p_sys->b_still )
+ {
+ input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
+ p_intf->p_sys->b_still = 0;
+ p_intf->p_sys->b_inf_still = 0;
+ p_intf->p_sys->m_still_time = 0;
+ }
}
-
+
vlc_mutex_unlock( &p_intf->change_lock );
-
+
+ /*
+ * video output
+ */
+ if( p_vout && p_vout->b_die )
+ {
+ var_DelCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
+ var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
+ vlc_object_release( p_vout );
+ p_vout = NULL;
+ }
+
+ if( p_vout == NULL )
+ {
+ p_vout = vlc_object_find( p_intf->p_sys->p_input,
+ VLC_OBJECT_VOUT, FIND_CHILD );
+ if( p_vout )
+ {
+ var_AddCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
+ var_AddCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
+ }
+ }
+
/* Wait a bit */
msleep( INTF_IDLE_SLEEP );
}
-
- vlc_object_release( p_intf->p_sys->p_input );
+ if( p_vout )
+ {
+ var_DelCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
+ var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
+ vlc_object_release( p_vout );
+ }
+
+ vlc_object_release( p_intf->p_sys->p_input );
}
/*****************************************************************************
{
input_thread_t * p_input;
dvd_data_t * p_dvd;
-
+
p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
p_dvd = (dvd_data_t*)p_input->p_access_data;
p_dvd->p_intf = p_intf;
-
+
vlc_mutex_lock( &p_intf->change_lock );
-
+
p_intf->p_sys->p_input = p_input;
p_intf->p_sys->p_dvd = p_dvd;
+ p_intf->p_sys->b_move = VLC_FALSE;
+ p_intf->p_sys->b_click = VLC_FALSE;
+
vlc_mutex_unlock( &p_intf->change_lock );
return 0;
}
}
+/*****************************************************************************
+ * MouseEvent: callback for mouse events
+ *****************************************************************************/
+static int MouseEvent( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ intf_thread_t *p_intf = (intf_thread_t *)p_data;
+
+ vlc_mutex_lock( &p_intf->change_lock );
+
+ if( psz_var[6] == 'c' ) /* "mouse-clicked" */
+ {
+ p_intf->p_sys->b_click = VLC_TRUE;
+ }
+ else if( psz_var[6] == 'm' ) /* "mouse-moved" */
+ {
+ p_intf->p_sys->b_move = VLC_TRUE;
+ }
+
+ vlc_mutex_unlock( &p_intf->change_lock );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* dvdIntfStillTime: function provided to demux plugin to request
* still images
{
vlc_mutex_lock( &p_intf->change_lock );
#if 1
-
+
if( i_sec == 0xff )
{
p_intf->p_sys->b_still = 1;
{
p_intf->p_sys->m_still_time = 1000000 * i_sec;
}
-
}
#endif
vlc_mutex_unlock( &p_intf->change_lock );
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.4 2002/09/10 12:15:07 sam Exp $
+ * $Id: xcommon.c,v 1.5 2002/10/17 16:03:18 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
else if( xevent.type == ButtonPress )
{
int i_width, i_height, i_x, i_y;
+ vlc_value_t val;
vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width,
p_vout->p_sys->p_win->i_height,
&i_x, &i_y, &i_width, &i_height );
- p_vout->i_mouse_x = ( xevent.xmotion.x - i_x )
- * p_vout->render.i_width / i_width;
- p_vout->i_mouse_y = ( xevent.xmotion.y - i_y )
- * p_vout->render.i_height / i_height;
- p_vout->i_mouse_button = 1;
+ val.i_int = ( xevent.xmotion.x - i_x )
+ * p_vout->render.i_width / i_width;
+ var_Set( p_vout, "mouse-x", val );
+ val.i_int = ( xevent.xmotion.y - i_y )
+ * p_vout->render.i_height / i_height;
+ var_Set( p_vout, "mouse-y", val );
+
+ val.b_bool = VLC_TRUE;
+ var_Set( p_vout, "mouse-clicked", val );
switch( ((XButtonEvent *)&xevent)->button )
{
else if( xevent.type == MotionNotify )
{
int i_width, i_height, i_x, i_y;
+ vlc_value_t val;
/* somewhat different use for vout_PlacePicture:
* here the values are needed to give to mouse coordinates
p_vout->p_sys->p_win->i_height,
&i_x, &i_y, &i_width, &i_height );
- p_vout->i_mouse_x = ( xevent.xmotion.x - i_x )
- * p_vout->render.i_width / i_width;
- p_vout->i_mouse_y = ( xevent.xmotion.y - i_y )
- * p_vout->render.i_height / i_height;
-
+ val.i_int = ( xevent.xmotion.x - i_x )
+ * p_vout->render.i_width / i_width;
+ var_Set( p_vout, "mouse-x", val );
+ val.i_int = ( xevent.xmotion.y - i_y )
+ * p_vout->render.i_height / i_height;
+ var_Set( p_vout, "mouse-y", val );
+
+ val.b_bool = VLC_TRUE;
+ var_Set( p_vout, "mouse-moved", val );
+
p_vout->p_sys->i_time_mouse_last_moved = mdate();
if( ! p_vout->p_sys->b_mouse_pointer_visible )
{