1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-16 16:02:54 +02:00

* Mouse wheel seek patch for XVideo courtesy of Peter Surda.

* Ported to SDL.
This commit is contained in:
Sam Hocevar 2001-12-20 15:43:15 +00:00
parent 3475fc64ad
commit 48b30bb9ce
2 changed files with 72 additions and 22 deletions

View File

@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_sdl.c,v 1.72 2001/12/19 18:14:23 sam Exp $
* $Id: vout_sdl.c,v 1.73 2001/12/20 15:43:15 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
@ -54,6 +54,9 @@
#include "interface.h"
#include "stream_control.h" /* needed by input_ext-intf.h... */
#include "input_ext-intf.h"
#include "modules.h"
#include "modules_export.h"
@ -315,6 +318,21 @@ static void vout_Destroy( vout_thread_t *p_vout )
free( p_vout->p_sys );
}
static __inline__ void vout_Seek( off_t i_seek )
{
#define area p_main->p_intf->p_input->stream.p_selected_area
off_t i_tell = area->i_tell;
i_tell += i_seek * (off_t)50 * p_main->p_intf->p_input->stream.i_mux_rate;
i_tell = ( i_tell <= area->i_start ) ? area->i_start
: ( i_tell >= area->i_size ) ? area->i_size
: i_tell;
input_Seek( p_main->p_intf->p_input, i_tell );
#undef area
}
/*****************************************************************************
* vout_Manage: handle Sys events
*****************************************************************************
@ -366,7 +384,18 @@ static int vout_Manage( vout_thread_t *p_vout )
switch( event.button.button )
{
case SDL_BUTTON_LEFT:
/* Handle clicks */
/* In this part we will eventually manage
* clicks for DVD navigation for instance. For the
* moment just pause the stream. */
input_SetStatus( p_main->p_intf->p_input, INPUT_STATUS_PAUSE );
break;
case 4:
vout_Seek( 15 );
break;
case 5:
vout_Seek( -15 );
break;
}
break;
@ -411,7 +440,23 @@ static int vout_Manage( vout_thread_t *p_vout )
case SDLK_MENU:
p_main->p_intf->b_menu_change = 1;
break;
case SDLK_LEFT:
vout_Seek( -5 );
break;
case SDLK_RIGHT:
vout_Seek( 5 );
break;
case SDLK_UP:
vout_Seek( 60 );
break;
case SDLK_DOWN:
vout_Seek( -60 );
break;
case SDLK_F10: network_ChannelJoin( 0 ); break;
case SDLK_F1: network_ChannelJoin( 1 ); break;
case SDLK_F2: network_ChannelJoin( 2 ); break;

View File

@ -2,7 +2,7 @@
* vout_common.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_common.c,v 1.6 2001/12/19 18:14:23 sam Exp $
* $Id: vout_common.c,v 1.7 2001/12/20 15:43:15 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
@ -83,6 +83,21 @@
#include "modules.h"
#include "modules_export.h"
static __inline__ void vout_Seek( off_t i_seek )
{
#define area p_main->p_intf->p_input->stream.p_selected_area
off_t i_tell = area->i_tell;
i_tell += i_seek * (off_t)50 * p_main->p_intf->p_input->stream.i_mux_rate;
i_tell = ( i_tell <= area->i_start ) ? area->i_start
: ( i_tell >= area->i_size ) ? area->i_size
: i_tell;
input_Seek( p_main->p_intf->p_input, i_tell );
#undef area
}
/*****************************************************************************
* vout_Manage: handle X11 events
*****************************************************************************
@ -90,24 +105,6 @@
* X11 events and allows window resizing. It returns a non null value on
* error.
*****************************************************************************/
static __inline__ void vout_Seek( int i_seek )
{
int i_tell = p_main->p_intf->p_input->stream.p_selected_area->i_tell;
i_tell += i_seek * 50 * p_main->p_intf->p_input->stream.i_mux_rate;
if( i_tell < p_main->p_intf->p_input->stream.p_selected_area->i_start )
{
i_tell = p_main->p_intf->p_input->stream.p_selected_area->i_start;
}
else if( i_tell > p_main->p_intf->p_input->stream.p_selected_area->i_size )
{
i_tell = p_main->p_intf->p_input->stream.p_selected_area->i_size;
}
input_Seek( p_main->p_intf->p_input, i_tell );
}
int _M( vout_Manage ) ( vout_thread_t *p_vout )
{
XEvent xevent; /* X11 event */
@ -252,6 +249,14 @@ int _M( vout_Manage ) ( vout_thread_t *p_vout )
input_SetStatus( p_main->p_intf->p_input,
INPUT_STATUS_PAUSE );
break;
case Button4:
vout_Seek( 15 );
break;
case Button5:
vout_Seek( -15 );
break;
}
}
/* Mouse release */