/*****************************************************************************
* adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc
*****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: adjust.c,v 1.8 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: adjust.c,v 1.9 2003/01/17 16:18:03 sam Exp $
*
- * Authors: Simon Latapie <garf@via.ecp.fr>, Samuel Hocevar <sam@zoy.org>
+ * Authors: Simon Latapie <garf@via.ecp.fr>
*
* 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
static void End ( vout_thread_t * );
static void Render ( vout_thread_t *, picture_t * );
+static int SendEvents( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
return VLC_SUCCESS;
}
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
}
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ var_Set( (vlc_object_t *)p_data, psz_var, newval );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* clone.c : Clone video plugin for vlc
*****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: clone.c,v 1.4 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2002, 2003 VideoLAN
+ * $Id: clone.c,v 1.5 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void RemoveAllVout ( vout_thread_t *p_vout );
+static int SendEvents( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return( 1 );
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
{
msg_Err( p_vout, "out of memory" );
free( p_vout->p_sys );
- return( 1 );
+ return VLC_ENOMEM;
}
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
p_vout->p_sys->i_clones );
p_vout->p_sys->i_clones = i_vout;
RemoveAllVout( p_vout );
- return 0;
+ return VLC_EGENERIC;
}
+ ADD_CALLBACKS( p_vout->p_sys->pp_vout[ i_vout ], SendEvents );
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
while( p_vout->p_sys->i_clones )
{
--p_vout->p_sys->i_clones;
+ DEL_CALLBACKS( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones],
+ SendEvents );
vout_Destroy( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
}
}
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ var_Set( (vlc_object_t *)p_data, psz_var, newval );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* crop.c : Crop video plugin for vlc
*****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: crop.c,v 1.6 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2002, 2003 VideoLAN
+ * $Id: crop.c,v 1.7 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void UpdateStats ( vout_thread_t *, picture_t * );
+static int SendEvents( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
return VLC_SUCCESS;
}
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout );
+
free( p_vout->p_sys );
}
p_vout->p_sys->b_changed = VLC_TRUE;
}
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
+ vlc_value_t sentval = newval;
+
+ /* Translate the mouse coordinates */
+ if( !strcmp( psz_var, "mouse-x" ) )
+ {
+ sentval.i_int += p_vout->p_sys->i_x;
+ }
+ else if( !strcmp( psz_var, "mouse-y" ) )
+ {
+ sentval.i_int += p_vout->p_sys->i_y;
+ }
+
+ var_Set( p_vout, psz_var, sentval );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* deinterlace.c : deinterlacer plugin for vlc
*****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: deinterlace.c,v 1.5 2002/11/28 17:35:00 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: deinterlace.c,v 1.6 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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
static void Merge ( void *, const void *, const void *, size_t );
+static int SendEvents ( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
* This function allocates and initializes a Deinterlace vout method.
*****************************************************************************/
static int Create( vlc_object_t *p_this )
-{
+{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
char *psz_method;
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return 1;
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
free( psz_method );
}
- return 0;
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
int i_index;
picture_t *p_pic;
-
+
I_OUTPUTPICTURES = 0;
/* Initialize the output structure, full of directbuffers since we want
break;
default:
- return 0; /* unknown chroma */
+ return VLC_EGENERIC; /* unknown chroma */
break;
}
{
msg_Err( p_vout, "cannot open vout, aborting" );
- return 0;
+ return VLC_EGENERIC;
}
-
+
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
- return 0;
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
return;
}
msleep( VOUT_OUTMEM_SLEEP );
- }
+ }
/* 20ms is a bit arbitrary, but it's only for the first image we get */
if( !p_vout->p_sys->last_date )
/* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
- u8 *p_in, *p_out_end, *p_out;
+ uint8_t *p_in, *p_out_end, *p_out;
int i_increment;
p_in = p_pic->p[i_plane].p_pixels
static void RenderBob( vout_thread_t *p_vout,
picture_t *p_outpic, picture_t *p_pic, int i_field )
{
- int i_plane;
+ int i_plane;
/* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
- u8 *p_in, *p_out_end, *p_out;
+ uint8_t *p_in, *p_out_end, *p_out;
p_in = p_pic->p[i_plane].p_pixels;
p_out = p_outpic->p[i_plane].p_pixels;
if( i_field == 1 )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
- p_in += p_pic->p[i_plane].i_pitch;
+ p_in += p_pic->p[i_plane].i_pitch;
p_out += p_pic->p[i_plane].i_pitch;
}
-
+
p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
-
+
for( ; p_out < p_out_end ; )
{
p_vout->p_vlc->pf_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-
+
p_out += p_pic->p[i_plane].i_pitch;
p_vout->p_vlc->pf_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-
+
p_in += 2 * p_pic->p[i_plane].i_pitch;
p_out += p_pic->p[i_plane].i_pitch;
}
-
+
p_vout->p_vlc->pf_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
-
+
/* For TOP field we need to add the last line */
if( i_field == 0 )
{
- p_in += p_pic->p[i_plane].i_pitch;
+ p_in += p_pic->p[i_plane].i_pitch;
p_out += p_pic->p[i_plane].i_pitch;
p_vout->p_vlc->pf_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
- }
+ }
}
}
/* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
- u8 *p_in, *p_out_end, *p_out;
+ uint8_t *p_in, *p_out_end, *p_out;
p_in = p_pic->p[i_plane].p_pixels;
p_out = p_outpic->p[i_plane].p_pixels;
/* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
- u8 *p_in, *p_out_end, *p_out;
+ uint8_t *p_in, *p_out_end, *p_out;
p_in = p_pic->p[i_plane].p_pixels;
/* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
- u8 *p_in, *p_out_end, *p_out;
+ uint8_t *p_in, *p_out_end, *p_out;
p_in = p_pic->p[i_plane].p_pixels;
}
}
-static void Merge( void *p_dest, const void *p_s1,
- const void *p_s2, size_t i_bytes )
+static void Merge( void *_p_dest, const void *_p_s1,
+ const void *_p_s2, size_t i_bytes )
{
- u8* p_end = (u8*)p_dest + i_bytes - 8;
+ uint8_t* p_dest = (uint8_t*)_p_dest;
+ const uint8_t *p_s1 = (const uint8_t *)_p_s1;
+ const uint8_t *p_s2 = (const uint8_t *)_p_s2;
+ uint8_t* p_end = p_dest + i_bytes - 8;
- while( (u8*)p_dest < p_end )
+ while( p_dest < p_end )
{
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
}
p_end += 8;
- while( (u8*)p_dest < p_end )
+ while( p_dest < p_end )
+ {
+ *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
+ }
+}
+
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
+ vlc_value_t sentval = newval;
+
+ if( !strcmp( psz_var, "mouse-y" ) )
{
- *(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1;
+ switch( p_vout->p_sys->i_mode )
+ {
+ case DEINTERLACE_MEAN:
+ case DEINTERLACE_DISCARD:
+ sentval.i_int *= 2;
+ break;
+ }
}
+
+ var_Set( p_vout, psz_var, sentval );
+
+ return VLC_SUCCESS;
}
+
/*****************************************************************************
* distort.c : Misc video effects plugin for vlc
*****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: distort.c,v 1.5 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: distort.c,v 1.6 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void DistortWave ( vout_thread_t *, picture_t *, picture_t * );
static void DistortRipple ( vout_thread_t *, picture_t *, picture_t * );
+static int SendEvents ( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
p_vout->p_sys->f_angle = 0.0;
p_vout->p_sys->last_date = 0;
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
}
}
}
+
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ var_Set( (vlc_object_t *)p_data, psz_var, newval );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* filter_common.h: Common filter functions
*****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: filter_common.h,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * Copyright (C) 2001, 2002, 2003 VideoLAN
+ * $Id: filter_common.h,v 1.2 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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
I_OUTPUTPICTURES++; \
} \
+#define ADD_CALLBACKS( newvout, handler ) \
+ var_AddCallback( newvout, "mouse-x", SendEvents, p_vout ); \
+ var_AddCallback( newvout, "mouse-y", SendEvents, p_vout ); \
+ var_AddCallback( newvout, "mouse-moved", SendEvents, p_vout ); \
+ var_AddCallback( newvout, "mouse-clicked", SendEvents, p_vout ); \
+ var_AddCallback( newvout, "key-pressed", SendEvents, p_vout )
+
+#define DEL_CALLBACKS( newvout, handler ) \
+ var_DelCallback( newvout, "mouse-x", SendEvents, p_vout ); \
+ var_DelCallback( newvout, "mouse-y", SendEvents, p_vout ); \
+ var_DelCallback( newvout, "mouse-moved", SendEvents, p_vout ); \
+ var_DelCallback( newvout, "mouse-clicked", SendEvents, p_vout ); \
+ var_DelCallback( newvout, "key-pressed", SendEvents, p_vout )
+
/*****************************************************************************
* invert.c : Invert video plugin for vlc
*****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: invert.c,v 1.4 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: invert.c,v 1.5 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void End ( vout_thread_t * );
static void Render ( vout_thread_t *, picture_t * );
+static int SendEvents( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return( 1 );
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
p_vout->pf_render = Render;
p_vout->pf_display = NULL;
- return( 0 );
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
msg_Err( p_vout, "can't open vout, aborting" );
- return( 0 );
+ return VLC_EGENERIC;
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
- return( 0 );
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
}
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ var_Set( (vlc_object_t *)p_data, psz_var, newval );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* motion_blur.c : motion blur filter for vlc
*****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: motionblur.c,v 1.5 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: motionblur.c,v 1.6 2003/01/17 16:18:03 sam Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
static void RenderBlur ( vout_thread_t *, picture_t *, picture_t *, picture_t * );
static void CopyPicture ( vout_thread_t*, picture_t *, picture_t * );
+static int SendEvents( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
return VLC_SUCCESS;
}
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
}
}
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
+{
+ var_Set( (vlc_object_t *)p_data, psz_var, newval );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* transform.c : transform image plugin for vlc
*****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: transform.c,v 1.6 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: transform.c,v 1.7 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void End ( vout_thread_t * );
static void Render ( vout_thread_t *, picture_t * );
+static int SendEvents( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
if( p_vout->p_sys == NULL )
{
msg_Err( p_vout, "out of memory" );
- return( 1 );
+ return VLC_ENOMEM;
}
p_vout->pf_init = Init;
free( psz_method );
}
- return( 0 );
+ return VLC_EGENERIC;
}
/*****************************************************************************
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "cannot open vout, aborting" );
- return( 0 );
+ return VLC_EGENERIC;
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
- return( 0 );
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys );
for( ; p_in < p_in_end ; )
{
- uint8_t *p_line_start = p_in - p_pic->p[i_index].i_pitch;
+ uint8_t *p_line_start = p_in_end
+ - p_pic->p[i_index].i_pitch;
p_in_end -= p_pic->p[i_index].i_pitch
- p_pic->p[i_index].i_visible_pitch;
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
}
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
+ vlc_value_t sentval = newval;
+
+ /* Translate the mouse coordinates */
+ if( !strcmp( psz_var, "mouse-x" ) )
+ {
+ switch( p_vout->p_sys->i_mode )
+ {
+ case TRANSFORM_MODE_270:
+ sentval.i_int = p_vout->p_sys->p_vout->output.i_width
+ - sentval.i_int;
+ case TRANSFORM_MODE_90:
+ var_Set( p_vout, "mouse-y", sentval );
+ return VLC_SUCCESS;
+
+ case TRANSFORM_MODE_180:
+ case TRANSFORM_MODE_HFLIP:
+ sentval.i_int = p_vout->p_sys->p_vout->output.i_width
+ - sentval.i_int;
+ break;
+
+ case TRANSFORM_MODE_VFLIP:
+ default:
+ break;
+ }
+ }
+ else if( !strcmp( psz_var, "mouse-y" ) )
+ {
+ switch( p_vout->p_sys->i_mode )
+ {
+ case TRANSFORM_MODE_90:
+ sentval.i_int = p_vout->p_sys->p_vout->output.i_height
+ - sentval.i_int;
+ case TRANSFORM_MODE_270:
+ var_Set( p_vout, "mouse-x", sentval );
+ return VLC_SUCCESS;
+
+ case TRANSFORM_MODE_180:
+ case TRANSFORM_MODE_VFLIP:
+ sentval.i_int = p_vout->p_sys->p_vout->output.i_height
+ - sentval.i_int;
+ break;
+
+ case TRANSFORM_MODE_HFLIP:
+ default:
+ break;
+ }
+ }
+
+ var_Set( p_vout, psz_var, sentval );
+
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* wall.c : Wall video plugin for vlc
*****************************************************************************
- * Copyright (C) 2000, 2001 VideoLAN
- * $Id: wall.c,v 1.5 2003/01/09 17:47:05 sam Exp $
+ * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
+ * $Id: wall.c,v 1.6 2003/01/17 16:18:03 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void RemoveAllVout ( vout_thread_t *p_vout );
+static int SendEvents( vlc_object_t *, char const *,
+ vlc_value_t, vlc_value_t, void * );
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
RemoveAllVout( p_vout );
return VLC_EGENERIC;
}
+ ADD_CALLBACKS(
+ p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
+ SendEvents );
p_vout->p_sys->i_vout++;
}
--p_vout->p_sys->i_vout;
if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
{
+ DEL_CALLBACKS(
+ p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
+ SendEvents );
vout_Destroy(
- p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
+ p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
}
}
}
+
+/*****************************************************************************
+ * SendEvents: forward mouse and keyboard events to the parent p_vout
+ *****************************************************************************/
+static int SendEvents( vlc_object_t *p_this, char const *psz_var,
+ vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
+{
+ vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
+ int i_vout;
+ vlc_value_t sentval = newval;
+
+ /* Find the video output index */
+ for( i_vout = 0; i_vout < p_vout->p_sys->i_vout; i_vout++ )
+ {
+ if( p_this == (vlc_object_t *)p_vout->p_sys->pp_vout[ i_vout ].p_vout )
+ {
+ break;
+ }
+ }
+
+ if( i_vout == p_vout->p_sys->i_vout )
+ {
+ return VLC_EGENERIC;
+ }
+
+ /* Translate the mouse coordinates */
+ if( !strcmp( psz_var, "mouse-x" ) )
+ {
+ sentval.i_int += p_vout->output.i_width
+ * (i_vout % p_vout->p_sys->i_col)
+ / p_vout->p_sys->i_col;
+ }
+ else if( !strcmp( psz_var, "mouse-y" ) )
+ {
+ sentval.i_int += p_vout->output.i_height
+ * (i_vout / p_vout->p_sys->i_row)
+ / p_vout->p_sys->i_row;
+ }
+
+ var_Set( p_vout, psz_var, sentval );
+
+ return VLC_SUCCESS;
+}
+