/*****************************************************************************
* intf_ctrl.c: interface commands access to control functions
- * (c)1999 VideoLAN
- *****************************************************************************
* Library of functions common to all interfaces, allowing access to various
* structures and settings. Interfaces should only use those functions
* to read or write informations from other threads.
* error codes defined in command.h. Custom error codes are allowed, but should
* be positive.
* More informations about parameters stand in `list of commands' section.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: intf_ctrl.c,v 1.34 2001/03/21 13:42:34 sam Exp $
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include "vlc.h"
-#include <sys/stat.h>
+#include "defs.h"
+
+#include <sys/stat.h> /* on BSD, fstat() needs stat.h */
+#include <stdio.h> /* fprintf() */
+#include <stdlib.h> /* malloc(), free() */
+#include <unistd.h> /* close(), read() */
+#include <fcntl.h> /* open() */
+
+/* Common headers */
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "debug.h"
+#include "intf_msg.h"
+
+#include "stream_control.h"
+#include "input_ext-intf.h"
+#include "audio_output.h"
+#include "intf_cmd.h"
+#include "interface.h"
+#include "main.h"
/*
* Local prototypes
" functions.\nIf a command name is provided as argument, displays a short "\
"inline help about the command.\n" },
{ "play-audio", PlayAudio, /* play-audio */
- /* format: */ "stereo=i? rate=i? s ",
+ /* format: */ "channels=i? rate=i? s ",
/* summary: */ "play an audio file",
- /* usage: */ "play-audio [stereo=1/0] [rate=r] <file>",
+ /* usage: */ "play-audio [channels=1/2] [rate=r] <file>",
/* help: */ "Load and play an audio file." },
{ "play-video", PlayVideo, /* play-video */
/* format: */ "s ",
*****************************************************************************/
static int DisplayImage( int i_argc, intf_arg_t *p_argv )
{
- /* ?? */
+ /* XXX?? */
return( INTF_NO_ERROR );
}
}
/* Set default configuration */
- fifo.b_stereo = AOUT_DEFAULT_STEREO;
- fifo.l_rate = AOUT_DEFAULT_RATE;
+ fifo.i_channels = 1 + ( fifo.b_stereo = AOUT_STEREO_DEFAULT );
+ fifo.l_rate = AOUT_RATE_DEFAULT;
- /* The stereo and rate parameters are essential ! */
+ /* The channels and rate parameters are essential ! */
/* Parse parameters - see command list above */
for ( i_arg = 1; i_arg < i_argc; i_arg++ )
{
switch( p_argv[i_arg].i_index )
{
- case 0: /* stereo */
- fifo.b_stereo = p_argv[i_arg].i_num;
+ case 0: /* channels */
+ fifo.i_channels = p_argv[i_arg].i_num;
break;
case 1: /* rate */
fifo.l_rate = p_argv[i_arg].i_num;
}
/* Setting up the type of the fifo */
- switch ( fifo.b_stereo )
+ switch ( fifo.i_channels )
{
- case 0:
+ case 1:
fifo.i_type = AOUT_INTF_MONO_FIFO;
break;
- case 1:
+ case 2:
fifo.i_type = AOUT_INTF_STEREO_FIFO;
break;
default:
- intf_IntfMsg("play-audio error: stereo must be 0 or 1");
+ intf_IntfMsg("play-audio error: channels must be 1 or 2");
return( INTF_OTHER_ERROR );
}
}
close( i_fd );
- /* Now we can work out how many output units we can compute with the fifo */
- fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->sys.l_rate)/(s64)fifo.l_rate);
+ /* Now we can work out how many output units we can compute with the fifo */
+ fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->l_rate)/(s64)fifo.l_rate);
/* Create the fifo */
if ( aout_CreateFifo(p_main->p_aout, &fifo) == NULL )
/*****************************************************************************
* PlayVideo: play a video sequence from a file
*****************************************************************************
- * ??
+ * XXX??
*****************************************************************************/
static int PlayVideo( int i_argc, intf_arg_t *p_argv )
{
- /* ?? */
+ /* XXX?? */
return( INTF_NO_ERROR );
}
switch( p_argv[i_arg].i_index )
{
case 0:
- // ?? useless
+ /* FIXME: useless ?? */
i_input = p_argv[i_arg].i_num;
break;
case 1:
/* Find to which input this command is destinated */
- intf_IntfMsg( "Adding PID %d to input %d\n", i_pid, i_input );
-//???? input_AddPgrmElem( p_main->p_intf->p_x11->p_input,
-//???? i_pid );
+ intf_IntfMsg( "Adding PID %d to input %d", i_pid, i_input );
+ //XXX?? input_AddPgrmElem( p_main->p_intf->p_x11->p_input,
+ //XXX?? i_pid );
return( INTF_NO_ERROR );
}
*****************************************************************************/
static int SpawnInput( int i_argc, intf_arg_t *p_argv )
{
+ /* FIXME */
+#if 0
+
int i_arg;
int i_method = 0; /* method parameter */
- char * psz_source = NULL; /* source parameter */
+ char * p_source = NULL; /* source parameter */
int i_port = 0; /* port parameter */
- int i_vlan = 0; /* vlan parameter */
+ int i_vlan_id = 0; /* vlan id parameter */
/* Parse parameters - see command list above */
for ( i_arg = 1; i_arg < i_argc; i_arg++ )
case 1: /* filename, hostname, ip */
case 2:
case 3:
- psz_source = p_argv[i_arg].psz_str;
+ p_source = p_argv[i_arg].psz_str;
break;
case 4: /* port */
i_port = p_argv[i_arg].i_num;
break;
- case 5: /* VLAN */
- i_vlan = p_argv[i_arg].i_num;
+ case 5: /* VLAN id */
+ i_vlan_id = p_argv[i_arg].i_num;
break;
}
}
input_DestroyThread( p_main->p_intf->p_input, NULL );
}
- p_main->p_intf->p_input = input_CreateThread( i_method, psz_source, i_port, i_vlan,
+ p_main->p_intf->p_input = input_CreateThread( i_method, p_source, i_port, i_vlan_id,
p_main->p_intf->p_vout, p_main->p_aout,
NULL );
+#endif
return( INTF_NO_ERROR );
}
{
int i_thread;
-/*?? if( i_argc == 1 )
+/*XXX?? if( i_argc == 1 )
{
i_thread = intf_CreateVoutThread( &p_main->intf_thread, NULL, -1, -1);
intf_IntfMsg("return value: %d", i_thread );
else*/
{
i_thread = p_argv[1].i_num;
- //?? intf_DestroyVoutThread( &p_main->intf_thread, i_thread );
+ //XXX?? intf_DestroyVoutThread( &p_main->intf_thread, i_thread );
}
return( INTF_NO_ERROR );
{
int i_command; /* command argument number */
- /* Do not try anything if vlans are desactivated */
+ /* Do not try anything if vlans are deactivated */
if( !p_main->b_vlans )
{
- intf_IntfMsg("vlans are desactivated");
+ intf_IntfMsg("vlans are deactivated");
return( INTF_OTHER_ERROR );
}
/* Command is 'join' */
if( !strcmp(p_argv[i_command].psz_str, "join") )
{
- /* ?? */
+ /* XXX?? */
}
/* Command is 'leave' */
else if( !strcmp(p_argv[i_command].psz_str, "leave") )
{
- /* ?? */
+ /* XXX?? */
}
/* Command is unknown */
else
{
int i_index = p_argv[1].i_num;
- intf_IntfMsg("Reading PSI table for input %d\n", i_index);
-//???? input_PsiRead(p_main->p_intf->p_x11->p_input );
+ intf_IntfMsg("Reading PSI table for input %d", i_index);
+ //XXX?? input_PsiRead(p_main->p_intf->p_x11->p_input );
return( INTF_NO_ERROR );
}