]> git.sesse.net Git - vlc/commitdiff
We can now choose the speed of forward (between 32/1 and 1/8)
authorRenaud Dartus <reno@videolan.org>
Thu, 8 Feb 2001 00:46:12 +0000 (00:46 +0000)
committerRenaud Dartus <reno@videolan.org>
Thu, 8 Feb 2001 00:46:12 +0000 (00:46 +0000)
Thanks to Meuuh, he's MORTEL ;)

include/stream_control.h
plugins/sdl/intf_sdl.c
src/input/input_ext-intf.c

index 607fb81a76347615bf517cda269ab2e22b4b3c81..44154346a0fc4cd1c2cecc441cf9be886307282f 100644 (file)
@@ -28,3 +28,5 @@ typedef struct stream_ctrl_s
 #define START_S             11
 
 #define DEFAULT_RATE        1000
+#define MINIMAL_RATE        31              /* Up to 32/1 */
+#define MAXIMAL_RATE        8000            /* Up to 1/8 */
index f297412b6a036f386131bdffd373eabd5f0c0532..33c56ebaa6d5ad647985b03b3307b9e6947f9f61 100644 (file)
@@ -2,7 +2,7 @@
  * intf_sdl.c: SDL interface plugin
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_sdl.c,v 1.27 2001/02/07 17:44:52 massiot Exp $
+ * $Id: intf_sdl.c,v 1.28 2001/02/08 00:46:12 reno Exp $
  *
  * Authors:
  *
@@ -110,6 +110,7 @@ void intf_SDLManage( intf_thread_t *p_intf )
 {
     SDL_Event event;                                            /* SDL event */
     Uint8   i_key;
+    int     i_rate;
  
     while ( SDL_PollEvent(&event) )
     {
@@ -148,11 +149,20 @@ void intf_SDLManage( intf_thread_t *p_intf )
                 break;
 
             case SDLK_a:
-                input_Forward( p_intf->p_input, DEFAULT_RATE/2 );
+                i_rate = p_intf->p_input->stream.control.i_rate;
+                if ( i_rate/2 >= MINIMAL_RATE )
+                    input_Forward( p_intf->p_input, i_rate/2 );
                 break;
 
             case SDLK_s:
-                input_Forward( p_intf->p_input, DEFAULT_RATE*2 );
+                i_rate = p_intf->p_input->stream.control.i_rate;
+                if ( i_rate*2 <= MAXIMAL_RATE )
+                {
+                    /* Compensation of int truncature */
+                    if ( i_rate*2 > 500 && i_rate*2 < 1000 )
+                        i_rate = 1000/2;
+                    input_Forward( p_intf->p_input, i_rate*2 );
+                }
                 break;
 
             default:
index dad03ab8333a60dc940d674546c36e7f634d0b7f..d6be465e91b9b1111615fe2d9f06f1855cc99810 100644 (file)
@@ -56,7 +56,10 @@ void input_Play( input_thread_t * p_input )
  *****************************************************************************/
 void input_Forward( input_thread_t * p_input, int i_rate )
 {
-    intf_Msg( "Forward enabled" );
+    if ( i_rate > 1000 )
+        intf_Msg( "Forward enabled at 1/%d",i_rate/1000 );
+    else
+        intf_Msg( "Forward enabled at %d/1",1000/i_rate );
     vlc_mutex_lock( &p_input->stream.stream_lock );
     p_input->stream.i_new_status = FORWARD_S;
     p_input->stream.i_new_rate = i_rate;