Commit 4da4c94a authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/video_filter/**/*.c: mouse clicks and keyboard events are now

    sent to the parent video output by all filters, and mouse coordinates are
    translated when necessary (Closes: #15).
parent 8470508b
/***************************************************************************** /*****************************************************************************
* adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc * adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: adjust.c,v 1.8 2003/01/09 17:47:05 sam Exp $ * $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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -50,6 +50,9 @@ static int Init ( vout_thread_t * ); ...@@ -50,6 +50,9 @@ static int Init ( vout_thread_t * );
static void End ( vout_thread_t * ); static void End ( vout_thread_t * );
static void Render ( vout_thread_t *, picture_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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -151,6 +154,8 @@ static int Init( vout_thread_t *p_vout ) ...@@ -151,6 +154,8 @@ static int Init( vout_thread_t *p_vout )
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -178,6 +183,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -178,6 +183,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; 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 ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
...@@ -361,3 +367,14 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -361,3 +367,14 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); 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 * clone.c : Clone video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002, 2003 VideoLAN
* $Id: clone.c,v 1.4 2003/01/09 17:47:05 sam Exp $ * $Id: clone.c,v 1.5 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -44,6 +44,9 @@ static void Render ( vout_thread_t *, picture_t * ); ...@@ -44,6 +44,9 @@ static void Render ( vout_thread_t *, picture_t * );
static void RemoveAllVout ( vout_thread_t *p_vout ); 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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -86,7 +89,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -86,7 +89,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL ) if( p_vout->p_sys == NULL )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
return( 1 ); return VLC_ENOMEM;
} }
p_vout->pf_init = Init; p_vout->pf_init = Init;
...@@ -108,10 +111,10 @@ static int Create( vlc_object_t *p_this ) ...@@ -108,10 +111,10 @@ static int Create( vlc_object_t *p_this )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
free( p_vout->p_sys ); free( p_vout->p_sys );
return( 1 ); return VLC_ENOMEM;
} }
return( 0 ); return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -144,13 +147,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -144,13 +147,14 @@ static int Init( vout_thread_t *p_vout )
p_vout->p_sys->i_clones ); p_vout->p_sys->i_clones );
p_vout->p_sys->i_clones = i_vout; p_vout->p_sys->i_clones = i_vout;
RemoveAllVout( p_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 ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 ); return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -257,7 +261,20 @@ static void RemoveAllVout( vout_thread_t *p_vout ) ...@@ -257,7 +261,20 @@ static void RemoveAllVout( vout_thread_t *p_vout )
while( p_vout->p_sys->i_clones ) while( p_vout->p_sys->i_clones )
{ {
--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] ); 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 * crop.c : Crop video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002, 2003 VideoLAN
* $Id: crop.c,v 1.6 2003/01/09 17:47:05 sam Exp $ * $Id: crop.c,v 1.7 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -45,6 +45,9 @@ static void Render ( vout_thread_t *, picture_t * ); ...@@ -45,6 +45,9 @@ static void Render ( vout_thread_t *, picture_t * );
static void UpdateStats ( vout_thread_t *, picture_t * ); 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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -243,6 +246,8 @@ static int Init( vout_thread_t *p_vout ) ...@@ -243,6 +246,8 @@ static int Init( vout_thread_t *p_vout )
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -270,7 +275,9 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -270,7 +275,9 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; 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 ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
...@@ -460,3 +467,27 @@ static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -460,3 +467,27 @@ static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->p_sys->b_changed = VLC_TRUE; 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 * deinterlace.c : deinterlacer plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: deinterlace.c,v 1.5 2002/11/28 17:35:00 sam Exp $ * $Id: deinterlace.c,v 1.6 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -57,6 +57,9 @@ static void RenderLinear ( vout_thread_t *, picture_t *, picture_t *, int ); ...@@ -57,6 +57,9 @@ static void RenderLinear ( vout_thread_t *, picture_t *, picture_t *, int );
static void Merge ( void *, const void *, const void *, size_t ); 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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -107,7 +110,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -107,7 +110,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL ) if( p_vout->p_sys == NULL )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
return 1; return VLC_ENOMEM;
} }
p_vout->pf_init = Init; p_vout->pf_init = Init;
...@@ -165,7 +168,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -165,7 +168,7 @@ static int Create( vlc_object_t *p_this )
free( psz_method ); free( psz_method );
} }
return 0; return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -193,7 +196,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -193,7 +196,7 @@ static int Init( vout_thread_t *p_vout )
break; break;
default: default:
return 0; /* unknown chroma */ return VLC_EGENERIC; /* unknown chroma */
break; break;
} }
...@@ -242,12 +245,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -242,12 +245,14 @@ static int Init( vout_thread_t *p_vout )
{ {
msg_Err( p_vout, "cannot open vout, aborting" ); msg_Err( p_vout, "cannot open vout, aborting" );
return 0; return VLC_EGENERIC;
} }
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return 0; ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -274,6 +279,8 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -274,6 +279,8 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; 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 ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
...@@ -377,7 +384,7 @@ static void RenderDiscard( vout_thread_t *p_vout, ...@@ -377,7 +384,7 @@ static void RenderDiscard( vout_thread_t *p_vout,
/* Copy image and skip lines */ /* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 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; int i_increment;
p_in = p_pic->p[i_plane].p_pixels p_in = p_pic->p[i_plane].p_pixels
...@@ -449,7 +456,7 @@ static void RenderBob( vout_thread_t *p_vout, ...@@ -449,7 +456,7 @@ static void RenderBob( vout_thread_t *p_vout,
/* Copy image and skip lines */ /* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 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_in = p_pic->p[i_plane].p_pixels;
p_out = p_outpic->p[i_plane].p_pixels; p_out = p_outpic->p[i_plane].p_pixels;
...@@ -501,7 +508,7 @@ static void RenderLinear( vout_thread_t *p_vout, ...@@ -501,7 +508,7 @@ static void RenderLinear( vout_thread_t *p_vout,
/* Copy image and skip lines */ /* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 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_in = p_pic->p[i_plane].p_pixels;
p_out = p_outpic->p[i_plane].p_pixels; p_out = p_outpic->p[i_plane].p_pixels;
...@@ -555,7 +562,7 @@ static void RenderMean( vout_thread_t *p_vout, ...@@ -555,7 +562,7 @@ static void RenderMean( vout_thread_t *p_vout,
/* Copy image and skip lines */ /* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 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_in = p_pic->p[i_plane].p_pixels;
...@@ -583,7 +590,7 @@ static void RenderBlend( vout_thread_t *p_vout, ...@@ -583,7 +590,7 @@ static void RenderBlend( vout_thread_t *p_vout,
/* Copy image and skip lines */ /* Copy image and skip lines */
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) 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_in = p_pic->p[i_plane].p_pixels;
...@@ -608,27 +615,56 @@ static void RenderBlend( vout_thread_t *p_vout, ...@@ -608,27 +615,56 @@ static void RenderBlend( vout_thread_t *p_vout,
} }
} }
static void Merge( void *p_dest, const void *p_s1, static void Merge( void *_p_dest, const void *_p_s1,
const void *p_s2, size_t i_bytes ) 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; *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*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;
*(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1; *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*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;
*(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1; *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*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;
*(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1; *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*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_end += 8; 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" ) )
{
switch( p_vout->p_sys->i_mode )
{ {
*(u8*)p_dest++ = ( (u16)(*(u8*)p_s1++) + (u16)(*(u8*)p_s2++) ) >> 1; 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 * distort.c : Misc video effects plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: distort.c,v 1.5 2003/01/09 17:47:05 sam Exp $ * $Id: distort.c,v 1.6 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -50,6 +50,9 @@ static void Render ( vout_thread_t *, picture_t * ); ...@@ -50,6 +50,9 @@ static void Render ( vout_thread_t *, picture_t * );
static void DistortWave ( vout_thread_t *, picture_t *, picture_t * ); static void DistortWave ( vout_thread_t *, picture_t *, picture_t * );
static void DistortRipple ( 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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -196,6 +199,8 @@ static int Init( vout_thread_t *p_vout ) ...@@ -196,6 +199,8 @@ static int Init( vout_thread_t *p_vout )
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); 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->f_angle = 0.0;
p_vout->p_sys->last_date = 0; p_vout->p_sys->last_date = 0;
...@@ -226,6 +231,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -226,6 +231,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; 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 ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
...@@ -418,3 +424,15 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic, ...@@ -418,3 +424,15 @@ static void DistortRipple( vout_thread_t *p_vout, picture_t *p_inpic,
} }
} }
} }
/*****************************************************************************
* 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 * filter_common.h: Common filter functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001, 2002, 2003 VideoLAN
* $Id: filter_common.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: filter_common.h,v 1.2 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -61,3 +61,17 @@ ...@@ -61,3 +61,17 @@
I_OUTPUTPICTURES++; \ 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 * invert.c : Invert video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: invert.c,v 1.4 2003/01/09 17:47:05 sam Exp $ * $Id: invert.c,v 1.5 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -42,6 +42,9 @@ static int Init ( vout_thread_t * ); ...@@ -42,6 +42,9 @@ static int Init ( vout_thread_t * );
static void End ( vout_thread_t * ); static void End ( vout_thread_t * );
static void Render ( vout_thread_t *, picture_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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -77,7 +80,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -77,7 +80,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL ) if( p_vout->p_sys == NULL )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
return( 1 ); return VLC_ENOMEM;
} }
p_vout->pf_init = Init; p_vout->pf_init = Init;
...@@ -86,7 +89,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -86,7 +89,7 @@ static int Create( vlc_object_t *p_this )
p_vout->pf_render = Render; p_vout->pf_render = Render;
p_vout->pf_display = NULL; p_vout->pf_display = NULL;
return( 0 ); return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -117,12 +120,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -117,12 +120,14 @@ static int Init( vout_thread_t *p_vout )
{ {
msg_Err( p_vout, "can't open vout, aborting" ); msg_Err( p_vout, "can't open vout, aborting" );
return( 0 ); return VLC_EGENERIC;
} }
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 ); ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -149,6 +154,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -149,6 +154,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; 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 ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
...@@ -226,3 +232,14 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -226,3 +232,14 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); 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 * motion_blur.c : motion blur filter for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: motionblur.c,v 1.5 2003/01/09 17:47:05 sam Exp $ * $Id: motionblur.c,v 1.6 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -45,6 +45,9 @@ static void Render ( vout_thread_t *, picture_t * ); ...@@ -45,6 +45,9 @@ static void Render ( vout_thread_t *, picture_t * );
static void RenderBlur ( vout_thread_t *, picture_t *, picture_t *, picture_t * ); static void RenderBlur ( vout_thread_t *, picture_t *, picture_t *, picture_t * );
static void CopyPicture ( vout_thread_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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -162,6 +165,8 @@ static int Init( vout_thread_t *p_vout ) ...@@ -162,6 +165,8 @@ static int Init( vout_thread_t *p_vout )
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -189,6 +194,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -189,6 +194,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; 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 ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
...@@ -327,3 +333,14 @@ static void RenderBlur( vout_thread_t *p_vout, picture_t *p_oldpic, ...@@ -327,3 +333,14 @@ static void RenderBlur( vout_thread_t *p_vout, picture_t *p_oldpic,
} }
} }
/*****************************************************************************
* 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 * transform.c : transform image plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: transform.c,v 1.6 2003/01/09 17:47:05 sam Exp $ * $Id: transform.c,v 1.7 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -48,6 +48,9 @@ static int Init ( vout_thread_t * ); ...@@ -48,6 +48,9 @@ static int Init ( vout_thread_t * );
static void End ( vout_thread_t * ); static void End ( vout_thread_t * );
static void Render ( vout_thread_t *, picture_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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -94,7 +97,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -94,7 +97,7 @@ static int Create( vlc_object_t *p_this )
if( p_vout->p_sys == NULL ) if( p_vout->p_sys == NULL )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
return( 1 ); return VLC_ENOMEM;
} }
p_vout->pf_init = Init; p_vout->pf_init = Init;
...@@ -150,7 +153,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -150,7 +153,7 @@ static int Create( vlc_object_t *p_this )
free( psz_method ); free( psz_method );
} }
return( 0 ); return VLC_EGENERIC;
} }
/***************************************************************************** /*****************************************************************************
...@@ -192,12 +195,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -192,12 +195,14 @@ static int Init( vout_thread_t *p_vout )
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
{ {
msg_Err( p_vout, "cannot open vout, aborting" ); msg_Err( p_vout, "cannot open vout, aborting" );
return( 0 ); return VLC_EGENERIC;
} }
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 ); ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -224,6 +229,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -224,6 +229,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; 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 ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
...@@ -298,7 +304,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -298,7 +304,8 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
for( ; p_in < p_in_end ; ) 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_in_end -= p_pic->p[i_index].i_pitch
- p_pic->p[i_index].i_visible_pitch; - p_pic->p[i_index].i_visible_pitch;
...@@ -395,3 +402,63 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -395,3 +402,63 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); 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 * wall.c : Wall video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
* $Id: wall.c,v 1.5 2003/01/09 17:47:05 sam Exp $ * $Id: wall.c,v 1.6 2003/01/17 16:18:03 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -44,6 +44,9 @@ static void Render ( vout_thread_t *, picture_t * ); ...@@ -44,6 +44,9 @@ static void Render ( vout_thread_t *, picture_t * );
static void RemoveAllVout ( vout_thread_t *p_vout ); 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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -260,6 +263,9 @@ static int Init( vout_thread_t *p_vout ) ...@@ -260,6 +263,9 @@ static int Init( vout_thread_t *p_vout )
RemoveAllVout( p_vout ); RemoveAllVout( p_vout );
return VLC_EGENERIC; 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++;
} }
...@@ -414,8 +420,55 @@ static void RemoveAllVout( vout_thread_t *p_vout ) ...@@ -414,8 +420,55 @@ static void RemoveAllVout( vout_thread_t *p_vout )
--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 ) 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( 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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment