Commit 48b30bb9 authored by Sam Hocevar's avatar Sam Hocevar

  * Mouse wheel seek patch for XVideo courtesy of Peter Surda.
  * Ported to SDL.
parent 3475fc64
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method * vout_sdl.c: SDL video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org> * Pierre Baillet <oct@zoy.org>
...@@ -54,6 +54,9 @@ ...@@ -54,6 +54,9 @@
#include "interface.h" #include "interface.h"
#include "stream_control.h" /* needed by input_ext-intf.h... */
#include "input_ext-intf.h"
#include "modules.h" #include "modules.h"
#include "modules_export.h" #include "modules_export.h"
...@@ -315,6 +318,21 @@ static void vout_Destroy( vout_thread_t *p_vout ) ...@@ -315,6 +318,21 @@ static void vout_Destroy( vout_thread_t *p_vout )
free( p_vout->p_sys ); 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 * vout_Manage: handle Sys events
***************************************************************************** *****************************************************************************
...@@ -366,7 +384,18 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -366,7 +384,18 @@ static int vout_Manage( vout_thread_t *p_vout )
switch( event.button.button ) switch( event.button.button )
{ {
case SDL_BUTTON_LEFT: 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;
} }
break; break;
...@@ -411,7 +440,23 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -411,7 +440,23 @@ static int vout_Manage( vout_thread_t *p_vout )
case SDLK_MENU: case SDLK_MENU:
p_main->p_intf->b_menu_change = 1; p_main->p_intf->b_menu_change = 1;
break; 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_F10: network_ChannelJoin( 0 ); break;
case SDLK_F1: network_ChannelJoin( 1 ); break; case SDLK_F1: network_ChannelJoin( 1 ); break;
case SDLK_F2: network_ChannelJoin( 2 ); break; case SDLK_F2: network_ChannelJoin( 2 ); break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_common.c: Functions common to the X11 and XVideo plugins * vout_common.c: Functions common to the X11 and XVideo plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -83,31 +83,28 @@ ...@@ -83,31 +83,28 @@
#include "modules.h" #include "modules.h"
#include "modules_export.h" #include "modules_export.h"
/***************************************************************************** static __inline__ void vout_Seek( off_t i_seek )
* vout_Manage: handle X11 events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* 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; #define area p_main->p_intf->p_input->stream.p_selected_area
off_t i_tell = area->i_tell;
i_tell += i_seek * 50 * p_main->p_intf->p_input->stream.i_mux_rate; i_tell += i_seek * (off_t)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 = ( i_tell <= area->i_start ) ? area->i_start
{ : ( i_tell >= area->i_size ) ? area->i_size
i_tell = p_main->p_intf->p_input->stream.p_selected_area->i_start; : i_tell;
}
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 ); input_Seek( p_main->p_intf->p_input, i_tell );
#undef area
} }
/*****************************************************************************
* vout_Manage: handle X11 events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* X11 events and allows window resizing. It returns a non null value on
* error.
*****************************************************************************/
int _M( vout_Manage ) ( vout_thread_t *p_vout ) int _M( vout_Manage ) ( vout_thread_t *p_vout )
{ {
XEvent xevent; /* X11 event */ XEvent xevent; /* X11 event */
...@@ -252,6 +249,14 @@ int _M( vout_Manage ) ( vout_thread_t *p_vout ) ...@@ -252,6 +249,14 @@ int _M( vout_Manage ) ( vout_thread_t *p_vout )
input_SetStatus( p_main->p_intf->p_input, input_SetStatus( p_main->p_intf->p_input,
INPUT_STATUS_PAUSE ); INPUT_STATUS_PAUSE );
break; break;
case Button4:
vout_Seek( 15 );
break;
case Button5:
vout_Seek( -15 );
break;
} }
} }
/* Mouse release */ /* Mouse release */
......
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