]> git.sesse.net Git - vlc/blobdiff - src/interface/interface.c
* Mandatory step for video output IV and the audio output quality
[vlc] / src / interface / interface.c
index a7dff1eb286c926bf2b6d5494a6c53f2dcd81f3a..b627e8c2a367bb12d46b25860240a24936e853d5 100644 (file)
@@ -4,8 +4,9 @@
  * interface, such as command line.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
+ * $Id: interface.c,v 1.75 2001/05/01 04:18:18 sam Exp $
  *
- * Authors:
+ * Authors: Vincent Seguin <seguin@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
@@ -31,6 +32,7 @@
 #include <stdlib.h>                                      /* free(), strtol() */
 #include <stdio.h>                                                   /* FILE */
 #include <string.h>                                            /* strerror() */
+#include <sys/types.h>                                              /* off_t */
 
 #include "config.h"
 #include "common.h"
@@ -45,8 +47,7 @@
 
 #include "intf_msg.h"
 #include "interface.h"
-#include "intf_cmd.h"
-#include "intf_plst.h"
+#include "intf_playlist.h"
 #include "intf_channels.h"
 #include "keystrokes.h"
 
@@ -80,8 +81,7 @@ intf_thread_t* intf_Create( void )
     }
 
     /* Choose the best module */
-    p_intf->p_module = module_Need( p_main->p_bank,
-                                    MODULE_CAPABILITY_INTF, NULL );
+    p_intf->p_module = module_Need( MODULE_CAPABILITY_INTF, NULL );
 
     if( p_intf->p_module == NULL )
     {
@@ -110,7 +110,7 @@ intf_thread_t* intf_Create( void )
     if( p_intf->pf_open( p_intf ) )
     {
         intf_ErrMsg("intf error: cannot create interface");
-        module_Unneed( p_main->p_bank, p_intf->p_module );
+        module_Unneed( p_intf->p_module );
         free( p_intf );
         return( NULL );
     }
@@ -141,7 +141,7 @@ static void intf_Manage( intf_thread_t *p_intf )
     intf_FlushMsg();
 
     /* Manage module bank */
-    module_ManageBank( p_main->p_bank );
+    module_ManageBank( );
 
     if( ( p_intf->p_input != NULL ) &&
             ( p_intf->p_input->b_error || p_intf->p_input->b_eof ) )
@@ -155,12 +155,14 @@ static void intf_Manage( intf_thread_t *p_intf )
     if( p_intf->p_input == NULL && !p_intf->b_die )
     {
         /* Select the next playlist item */
-        intf_PlstNext( p_main->p_playlist );
+        intf_PlaylistNext( p_main->p_playlist );
 
         if( p_main->p_playlist->i_index == -1 )
         {
             /*    FIXME: wait for user to add stuff to playlist ? */
+#if 0
             p_intf->b_die = 1;
+#endif
         }
         else
         {
@@ -202,7 +204,7 @@ void intf_Destroy( intf_thread_t *p_intf )
     }
          
     /* Unlock module */
-    module_Unneed( p_main->p_bank, p_intf->p_module );
+    module_Unneed( p_intf->p_module );
 
     vlc_mutex_destroy( &p_intf->change_lock );
 
@@ -304,6 +306,7 @@ void intf_AssignNormalKeys( intf_thread_t *p_intf)
     intf_AssignKey( p_intf , ' ', INTF_KEY_TOGGLE_INTERFACE, 0);
     intf_AssignKey( p_intf , 'i', INTF_KEY_TOGGLE_INFO, 0);
     intf_AssignKey( p_intf , 's', INTF_KEY_TOGGLE_SCALING, 0);
+    intf_AssignKey( p_intf , 'd', INTF_KEY_DUMP_STREAM, 0);
 }   
 
 /*****************************************************************************
@@ -318,50 +321,58 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
     keyparm k_reply;
     
     k_reply = intf_GetKey( p_intf, g_key); 
-    
     switch( k_reply.key )
     {
-    case INTF_KEY_QUIT:                                                  /* quit order */
+    case INTF_KEY_QUIT:                                        /* quit order */
         p_intf->b_die = 1;
         break;
     case INTF_KEY_SET_CHANNEL:
         /* Change channel - return code is ignored since SelectChannel displays
          * its own error messages */
-        intf_SelectChannel( p_intf, k_reply.param );
+/*        intf_SelectChannel( p_intf, k_reply.param ); */
+/*        network_ChannelJoin() */
+/* FIXME : keyboard event is for the time being half handled by the interface
+ * half handled directly by the plugins. We should decide what to do. */        
         break;
     case INTF_KEY_INC_VOLUME:                                    /* volume + */
-        if( (p_main->p_aout != NULL) && (p_main->p_aout->vol < VOLUME_MAX) )
-            p_main->p_aout->vol += VOLUME_STEP;
+        if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol < VOLUME_MAX) )
+            p_main->p_aout->i_vol += VOLUME_STEP;
         break;
     case INTF_KEY_DEC_VOLUME:                                    /* volume - */
-        if( (p_main->p_aout != NULL) && (p_main->p_aout->vol > VOLUME_STEP) )
-            p_main->p_aout->vol -= VOLUME_STEP;
+        if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol > VOLUME_STEP) )
+            p_main->p_aout->i_vol -= VOLUME_STEP;
         break;
     case INTF_KEY_TOGGLE_VOLUME:                              /* toggle mute */
-        if( (p_main->p_aout != NULL) && (p_main->p_aout->vol))
+        if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol))
         {
-            i_volbackup = p_main->p_aout->vol;
-            p_main->p_aout->vol = 0;
+            i_volbackup = p_main->p_aout->i_vol;
+            p_main->p_aout->i_vol = 0;
         }
-        else if( (p_main->p_aout != NULL) && (!p_main->p_aout->vol))
-            p_main->p_aout->vol = i_volbackup;
+        else if( (p_main->p_aout != NULL) && (!p_main->p_aout->i_vol))
+            p_main->p_aout->i_vol = i_volbackup;
         break;
     case INTF_KEY_DEC_GAMMA:                                      /* gamma - */
         if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
         {
-            vlc_mutex_lock( &p_main->p_vout->change_lock );
+            /* FIXME: we should lock if called from the interface */
             p_main->p_vout->f_gamma   -= INTF_GAMMA_STEP;
             p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
-            vlc_mutex_unlock( &p_main->p_vout->change_lock );
         }
         break;
     case INTF_KEY_INC_GAMMA:                                      /* gamma + */
         if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma < INTF_GAMMA_LIMIT) )
         {
-            vlc_mutex_lock( &p_main->p_vout->change_lock );
+            /* FIXME: we should lock if called from the interface */
             p_main->p_vout->f_gamma   += INTF_GAMMA_STEP;
             p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
-            vlc_mutex_unlock( &p_main->p_vout->change_lock );
+        }
+        break;
+   case INTF_KEY_DUMP_STREAM:
+        if( p_intf->p_input != NULL )
+        {
+            vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
+            input_DumpStream( p_intf->p_input );
+            vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
         }
         break;
    default:                                                   /* unknown key */
@@ -370,4 +381,3 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
 
     return( 0 );
 }
-