* 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
#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"
#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"
}
/* 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 )
{
p_intf->pf_manage = intf_Manage;
/* Initialize structure */
- p_intf->b_die = 0;
+ p_intf->b_die = 0;
- p_intf->p_input = NULL;
- p_intf->p_keys = NULL;
- p_intf->b_menu = 0;
+ p_intf->p_input = NULL;
+ p_intf->p_keys = NULL;
+ p_intf->b_menu = 0;
p_intf->b_menu_change = 0;
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 );
}
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 ) )
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
{
}
/* 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 );
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);
}
/*****************************************************************************
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 */
return( 0 );
}
-