#include "intf_sys.h"
-
/*******************************************************************************
* intf_Create: prepare interface before main loop
*******************************************************************************
}
if( (p_intf->p_input != NULL) && p_intf->p_input->b_error )
{
- input_DestroyThread( p_intf->p_input /*, NULL */ );
+ input_DestroyThread( p_intf->p_input, NULL );
p_intf->p_input = NULL;
intf_DbgMsg("Input thread destroyed\n");
}
/*******************************************************************************
* intf_SelectInput: change input stream
*******************************************************************************
- * Kill existing input, if any, and try to open a new one. If p_cfg is NULL,
- * no new input will be openned.
+ * Kill existing input, if any, and try to open a new one, using an input
+ * configuration table.
*******************************************************************************/
-int intf_SelectInput( intf_thread_t * p_intf, input_cfg_t *p_cfg )
+int intf_SelectInput( intf_thread_t * p_intf, int i_index )
{
- intf_DbgMsg("0x%x\n", p_intf );
+ intf_DbgMsg("\n");
+
+ /* If VLANs are not active, return with an error */
+ if( !p_main->b_vlans )
+ {
+ intf_ErrMsg("error: VLANs are not activated\n");
+ return( 1 );
+ }
/* Kill existing input, if any */
if( p_intf->p_input != NULL )
{
- input_DestroyThread( p_intf->p_input /*??, NULL*/ );
- p_intf->p_input = NULL;
+ input_DestroyThread( p_intf->p_input, NULL );
}
-
- /* Open new one */
- if( p_cfg != NULL )
- {
- p_intf->p_input = input_CreateThread( p_cfg /*??, NULL*/ );
- }
-
- return( (p_cfg != NULL) && (p_intf->p_input == NULL) );
+
+ /* Open a new input */
+ intf_Msg("Switching to channel %d\n", i_index );
+ p_intf->p_input = input_CreateThread( INPUT_METHOD_TS_VLAN_BCAST, NULL, 0, i_index,
+ p_intf->p_vout, p_main->p_aout, NULL );
+ return( p_intf->p_input == NULL );
}
/*******************************************************************************
{
case 'Q': /* quit order */
case 'q':
- case 27:
+ case 27: /* escape key */
p_intf->b_die = 1;
break;
case '0': /* source change */
case '7':
case '8':
case '9':
- // ??
+ if( intf_SelectInput( p_intf, i_key - '0' ) )
+ {
+ intf_ErrMsg("error: can not open channel %d\n", i_key - '0');
+ }
break;
case '+': /* volume + */
// ??
vlc_mutex_unlock( &p_intf->p_vout->change_lock );
}
break;
- case 'x': /* horizontal aspect ratio - */
- if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_horizontal_scale > -INTF_SCALE_LIMIT) )
- {
- vlc_mutex_lock( &p_intf->p_vout->change_lock );
- p_intf->p_vout->i_horizontal_scale--;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'X': /* horizontal aspect ratio + */
- if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_horizontal_scale < INTF_SCALE_LIMIT) )
- {
- vlc_mutex_lock( &p_intf->p_vout->change_lock );
- p_intf->p_vout->i_horizontal_scale++;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'y': /* vertical aspect ratio - */
- if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_vertical_scale > -INTF_SCALE_LIMIT) )
- {
- vlc_mutex_lock( &p_intf->p_vout->change_lock );
- p_intf->p_vout->i_vertical_scale--;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'Y': /* horizontal aspect ratio + */
- if( (p_intf->p_vout != NULL) && (p_intf->p_vout->i_vertical_scale < INTF_SCALE_LIMIT) )
- {
- vlc_mutex_lock( &p_intf->p_vout->change_lock );
- p_intf->p_vout->i_vertical_scale++;
- p_intf->p_vout->i_changes |= VOUT_RATIO_CHANGE;
- vlc_mutex_unlock( &p_intf->p_vout->change_lock );
- }
- break;
- case 'f': /* toggle fullscreen */
- //??
- break;
case ' ': /* toggle info */
if( p_intf->p_vout != NULL )
{