Commit 92c69994 authored by Vincent Seguin's avatar Vincent Seguin

Changement de chaine. Delicat encore, mais il marche. Quelques corrections

esthetiques, un timeout pour les vlans et le frame buffer et c'est la
release d�mo (en ce qui me concerne) !
parent 07686534
...@@ -47,11 +47,11 @@ typedef struct intf_msg_s * p_intf_msg_t; ...@@ -47,11 +47,11 @@ typedef struct intf_msg_s * p_intf_msg_t;
/* Input */ /* Input */
struct input_thread_s; struct input_thread_s;
struct input_vlan_method_s; struct input_vlan_s;
struct input_cfg_s; struct input_cfg_s;
typedef struct input_thread_s * p_input_thread_t; typedef struct input_thread_s * p_input_thread_t;
typedef struct input_vlan_method_s * p_input_vlan_method_t; typedef struct input_vlan_s * p_input_vlan_t;
typedef struct input_cfg_s * p_input_cfg_t; typedef struct input_cfg_s * p_input_cfg_t;
/* Audio */ /* Audio */
......
...@@ -181,18 +181,18 @@ ...@@ -181,18 +181,18 @@
/* Use a LIFO or FIFO for PES netlist ? */ /* Use a LIFO or FIFO for PES netlist ? */
#undef INPUT_LIFO_PES_NETLIST #undef INPUT_LIFO_PES_NETLIST
/* Maximum length of a hostname */ /* Maximum length of a hostname or source name */
#define INPUT_MAX_HOSTNAME_LENGTH 100 #define INPUT_MAX_SOURCE_LENGTH 100
/* Default input method */ /* Default input method */
#define INPUT_DEFAULT_METHOD INPUT_METHOD_TS_UCAST #define INPUT_DEFAULT_METHOD INPUT_METHOD_TS_UCAST
/* Default remote server */ /* Default remote server */
#define VIDEOLAN_DEFAULT_SERVER "vod.via.ecp.fr" #define INPUT_DEFAULT_SERVER "138.195.143.220"
/* Default videolan port */ /* Default input port */
#define VIDEOLAN_DEFAULT_PORT 1234 #define INPUT_DEFAULT_PORT 1234
/* Default videolan VLAN */ /* Default videolan VLAN */
#define VIDEOLAN_DEFAULT_VLAN 3 #define VIDEOLAN_DEFAULT_VLAN 3
...@@ -201,9 +201,15 @@ ...@@ -201,9 +201,15 @@
* Vlan method * Vlan method
*/ */
/* Default VLAN server */ /* Default network interface and environment variable */
#define VLAN_DEFAULT_SERVER "vlanserver.via.ecp.fr" #define INPUT_IFACE_VAR "vlc_iface"
#define VLAN_DEFAULT_SERVER_PORT 6010 #define INPUT_IFACE_DEFAULT "eth0"
/* Default server and port */
#define INPUT_VLAN_SERVER_VAR "vlc_vlan_server"
#define INPUT_VLAN_SERVER_DEFAULT "138.195.140.31"
#define INPUT_VLAN_PORT_VAR "vlc_vlan_port"
#define INPUT_VLAN_PORT_DEFAULT 6010
/******************************************************************************* /*******************************************************************************
* Audio configuration * Audio configuration
......
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* file.h: file streams functions interface * input_file.h: file streams functions interface
* (c)1999 VideoLAN * (c)1999 VideoLAN
*******************************************************************************/ *******************************************************************************/
/****************************************************************************** /******************************************************************************
* Prototypes * Prototypes
******************************************************************************/ ******************************************************************************/
int input_FileCreateMethod( input_thread_t *p_input , int input_FileOpen ( input_thread_t *p_input );
input_cfg_t *p_cfg ); int input_FileRead ( input_thread_t *p_input, const struct iovec *p_vector,
int input_FileRead( input_thread_t *p_input, const struct iovec *p_vector,
size_t i_count ); size_t i_count );
void input_FileDestroyMethod( input_thread_t *p_input ); void input_FileClose ( input_thread_t *p_input );
...@@ -10,17 +10,14 @@ ...@@ -10,17 +10,14 @@
/****************************************************************************** /******************************************************************************
* Prototypes * Prototypes
******************************************************************************/ ******************************************************************************/
int input_NetlistOpen( input_thread_t *p_input ); int input_NetlistInit ( input_thread_t *p_input );
void input_NetlistClean( input_thread_t *p_input ); void input_NetlistEnd ( input_thread_t *p_input );
/* ?? implement also a "normal" (non inline, non static) function in input_netlist.c,
which will be used when inline is disabled */ static __inline__ void input_NetlistFreePES( input_thread_t *p_input, pes_packet_t *p_pes_packet );
/* ?? test */ static __inline__ void input_NetlistFreePES( input_thread_t *p_input, static __inline__ void input_NetlistFreeTS( input_thread_t *p_input, ts_packet_t *p_ts_packet );
pes_packet_t *p_pes_packet );
static __inline__ void input_NetlistFreeTS( input_thread_t *p_input,
ts_packet_t *p_ts_packet );
static __inline__ pes_packet_t* input_NetlistGetPES( input_thread_t *p_input ); static __inline__ pes_packet_t* input_NetlistGetPES( input_thread_t *p_input );
/******************************************************************************* /******************************************************************************
* input_NetlistFreePES: add a PES packet to the netlist * input_NetlistFreePES: add a PES packet to the netlist
******************************************************************************* *******************************************************************************
* Add a PES packet to the PES netlist, so that the packet can immediately be * Add a PES packet to the PES netlist, so that the packet can immediately be
......
/******************************************************************************* /*******************************************************************************
* network.h: network functions interface * input_network.h: network functions interface
* (c)1999 VideoLAN * (c)1999 VideoLAN
*******************************************************************************/ *******************************************************************************/
/*
needs :
- <sys/uio.h>
- <sys/socket.h>
- <unistd.h>
- <netinet/in.h>
- <netdb.h>
- <arpa/inet.h>
- <stdio.h>
- <sys/ioctl.h>
- <net/if.h>
*/
/****************************************************************************** /******************************************************************************
* Prototypes * Prototypes
******************************************************************************/ ******************************************************************************/
int input_NetworkCreateMethod( input_thread_t *p_input, int input_NetworkOpen ( input_thread_t *p_input );
input_cfg_t *p_cfg ); int input_NetworkRead ( input_thread_t *p_input, const struct iovec *p_vector,
int input_NetworkRead( input_thread_t *p_input, const struct iovec *p_vector,
size_t i_count ); size_t i_count );
void input_NetworkDestroyMethod( input_thread_t *p_input ); void input_NetworkClose ( input_thread_t *p_input );
...@@ -23,4 +23,4 @@ ...@@ -23,4 +23,4 @@
int input_PcrInit ( input_thread_t *p_input ); int input_PcrInit ( input_thread_t *p_input );
void input_PcrDecode ( input_thread_t *p_input, es_descriptor_t* p_es, void input_PcrDecode ( input_thread_t *p_input, es_descriptor_t* p_es,
u8* p_pcr_data ); u8* p_pcr_data );
void input_PcrClean ( input_thread_t *p_input ); void input_PcrEnd ( input_thread_t *p_input );
/******************************************************************************* /*******************************************************************************
* psi.h: PSI management interface * psi.h: PSI management interface
* (c)1999 VideoLAN * (c)1999 VideoLAN
*******************************************************************************
* Requires:
* "config.h"
* "common.h"
* "mtime.h"
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
* Prototypes * Prototypes
******************************************************************************/ ******************************************************************************/
int input_PsiInit( input_thread_t *p_input ); int input_PsiInit ( input_thread_t *p_input );
void input_PsiDecode( input_thread_t *p_input, psi_section_t* p_psi_section ); void input_PsiDecode ( input_thread_t *p_input, psi_section_t* p_psi_section );
void input_PsiRead( input_thread_t *p_input /* ??? */ ); void input_PsiRead ( input_thread_t *p_input );
int input_PsiClean( input_thread_t *p_input ); int input_PsiEnd ( input_thread_t *p_input );
...@@ -9,46 +9,13 @@ ...@@ -9,46 +9,13 @@
* "vlc_thread.h" * "vlc_thread.h"
*******************************************************************************/ *******************************************************************************/
/*******************************************************************************
* Vlan server related constants
*******************************************************************************/
#define VLAN_SERVER_MSG_LENGTH 256 /* maximum length of a message */
#define VLAN_CLIENT_VERSION "1.3.0" /* vlan client version */
/* Messages codes */
#define VLAN_LOGIN_REQUEST 98 /* login: <version> <login> <passwd> */
#define VLAN_LOGIN_ANSWER 97 /* login accepted: [msg] */
#define VLAN_LOGIN_REJECTED 96 /* login rejected: [msg] */
#define VLAN_LOGOUT 99 /* logout */
#define VLAN_INFO_REQUEST 31 /* info: no argument */
#define VLAN_INFO_ANSWER 32/* info ok: <switch> <port> <vlan> <sharers> */
#define VLAN_INFO_REJECTED 33 /* info rejected: [msg] */
#define VLAN_CHANGE_REQUEST 21/* change: <mac> [ip] <vlan dest> [vlan src] */
#define VLAN_CHANGE_ANSWER 22 /* change ok: [msg] */
#define VLAN_CHANGE_REJECTED 23 /* change failed: [msg] */
/*******************************************************************************
* Macros to build/extract vlan_ids
*******************************************************************************/
#define VLAN_ID_IFACE( vlan_id ) ( ((vlan_id) >> 8) & 0xff )
#define VLAN_ID_VLAN( vlan_id ) ( (vlan_id) & 0xff )
#define VLAN_ID( iface, vlan ) ( ((iface) << 8) | (vlan) )
/******************************************************************************* /*******************************************************************************
* Prototypes * Prototypes
*******************************************************************************/ *******************************************************************************/
int input_VlanCreate ( void ); int input_VlanCreate ( void );
void input_VlanDestroy ( void ); void input_VlanDestroy ( void );
int input_VlanId ( char *psz_iface, int i_vlan );
int input_VlanJoin ( int i_vlan_id ); int input_VlanJoin ( int i_vlan_id );
void input_VlanLeave ( int i_vlan_id ); void input_VlanLeave ( int i_vlan_id );
int input_VlanRequest ( char *psz_iface );
int input_VlanSynchronize ( void );
...@@ -34,7 +34,7 @@ typedef struct ...@@ -34,7 +34,7 @@ typedef struct
/* Shared data - these structures are accessed directly from p_main by /* Shared data - these structures are accessed directly from p_main by
* several modules */ * several modules */
p_intf_msg_t p_msg; /* messages interface data */ p_intf_msg_t p_msg; /* messages interface data */
p_input_vlan_method_t p_input_vlan; /* vlan input method */ p_input_vlan_t p_vlan; /* vlan library data */
} main_t; } main_t;
extern main_t *p_main; extern main_t *p_main;
......
...@@ -22,13 +22,12 @@ ...@@ -22,13 +22,12 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <net/if.h> #include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/shm.h> #include <sys/shm.h>
#include <sys/soundcard.h> #include <sys/soundcard.h>
...@@ -70,6 +69,7 @@ ...@@ -70,6 +69,7 @@
/* Video */ /* Video */
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "vdec_idct.h"
#ifdef OLD_DECODER #ifdef OLD_DECODER
#include "video_decoder.h" #include "video_decoder.h"
...@@ -87,10 +87,14 @@ ...@@ -87,10 +87,14 @@
/* Interface */ /* Interface */
#include "intf_cmd.h" #include "intf_cmd.h"
#include "intf_ctrl.h" #include "intf_ctrl.h"
#ifndef OLD_DECODER #ifndef OLD_DECODER
#include "intf_sys.h" #include "intf_sys.h"
#include "intf_console.h" #include "intf_console.h"
#endif #endif
#include "interface.h" #include "interface.h"
#include "main.h" #include "main.h"
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* file.c: functions to read from a file * input_file.c: functions to read from a file
* (c)1999 VideoLAN * (c)1999 VideoLAN
*******************************************************************************/ *******************************************************************************/
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
#include "input_file.h" #include "input_file.h"
/****************************************************************************** /******************************************************************************
* input_FileCreateMethod : open a file descriptor * input_FileOpen : open a file descriptor
******************************************************************************/ ******************************************************************************/
int input_FileCreateMethod( input_thread_t *p_input , int input_FileOpen( input_thread_t *p_input )
input_cfg_t *p_cfg )
{ {
return( -1 ); //??
return( 1 );
} }
/****************************************************************************** /******************************************************************************
...@@ -32,12 +32,14 @@ int input_FileCreateMethod( input_thread_t *p_input , ...@@ -32,12 +32,14 @@ int input_FileCreateMethod( input_thread_t *p_input ,
int input_FileRead( input_thread_t *p_input, const struct iovec *p_vector, int input_FileRead( input_thread_t *p_input, const struct iovec *p_vector,
size_t i_count ) size_t i_count )
{ {
//??
return( -1 ); return( -1 );
} }
/****************************************************************************** /******************************************************************************
* input_FileDestroyMethod : close a file descriptor * input_FileClose : close a file descriptor
******************************************************************************/ ******************************************************************************/
void input_FileDestroyMethod( input_thread_t *p_input ) void input_FileClose( input_thread_t *p_input )
{ {
//??
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/****************************************************************************** /******************************************************************************
* input_NetlistOpen: initialize the netlists buffers * input_NetlistOpen: initialize the netlists buffers
******************************************************************************/ ******************************************************************************/
int input_NetlistOpen( input_thread_t *p_input ) int input_NetlistInit( input_thread_t *p_input )
{ {
int i_base, i_packets, i_iovec; int i_base, i_packets, i_iovec;
...@@ -119,7 +119,7 @@ int input_NetlistOpen( input_thread_t *p_input ) ...@@ -119,7 +119,7 @@ int input_NetlistOpen( input_thread_t *p_input )
/****************************************************************************** /******************************************************************************
* input_NetlistClean: clean the netlists buffers * input_NetlistClean: clean the netlists buffers
******************************************************************************/ ******************************************************************************/
void input_NetlistClean( input_thread_t *p_input ) void input_NetlistEnd( input_thread_t *p_input )
{ {
int i; int i;
......
...@@ -33,57 +33,37 @@ ...@@ -33,57 +33,37 @@
#include "intf_msg.h" #include "intf_msg.h"
/****************************************************************************** /******************************************************************************
* Local prototypes * input_NetworkOpen: initialize a network stream
******************************************************************************/ ******************************************************************************/
int input_NetworkOpen( input_thread_t *p_input )
/******************************************************************************
* input_NetworkCreateMethod: initialize a network stream
******************************************************************************/
int input_NetworkCreateMethod( input_thread_t *p_input,
input_cfg_t *p_cfg )
{ {
int i_socket_option, i_port, i_dummy; int i_socket_option;
struct sockaddr_in sa_in; struct sockaddr_in sa_in;
char psz_hostname[INPUT_MAX_HOSTNAME_LENGTH]; char psz_hostname[INPUT_MAX_SOURCE_LENGTH];
/* First and foremost, in the VLAN method, we join the desired VLAN. */ /* First and foremost, in the VLAN method, join the desired VLAN. */
if( p_input->i_method == INPUT_METHOD_TS_VLAN_BCAST ) if( p_input->i_method == INPUT_METHOD_TS_VLAN_BCAST )
{ {
/* Get a VLAN ID (VlanLib). */ if( input_VlanJoin( p_input->i_vlan ) )
if( ( p_input->i_vlan_id = input_VlanId( NULL, p_cfg->i_vlan ) )
== (-1) )
{
intf_ErrMsg("input error: VlanId() failed (%d)\n",
p_input->i_vlan_id);
return( -1 );
}
/* Join the VLAN. */
if( ( i_dummy = input_VlanJoin( p_input->i_vlan_id ) ) != 0 )
{ {
intf_ErrMsg("input error: VlanJoin() failed (%d)\n", intf_ErrMsg("error: can't join vlan %d\n", p_input->i_vlan);
i_dummy); return( 1 );
return( -1 );
} }
} }
/* We open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0) /* Open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0)
* protocol */ * protocol */
if( (p_input->i_handle = socket( AF_INET, SOCK_DGRAM, 0 )) == (-1) ) if( (p_input->i_handle = socket( AF_INET, SOCK_DGRAM, 0 )) == (-1) )
{ {
intf_ErrMsg("input error: socket() error (%s)\n", intf_ErrMsg("error: can't create socket (%s)\n", strerror(errno));
strerror(errno)); return( 1 );
return( -1 );
} }
intf_DbgMsg("input debug: socket %d opened (cfg: %p)\n", p_input->i_handle, /*
p_cfg); * Set up the options of the socket
*/
/* we set up the options of our socket. It doesn't need to be non-blocking, /* Set SO_REUSEADDR option which allows to re-bind() a busy port */
* on the contrary (when this thread is waiting for data, it doesn't have
* the lock, so decoders can work. */
/* set SO_REUSEADDR option which allows to re-bind() a busy port */
i_socket_option = 1; i_socket_option = 1;
if( setsockopt( p_input->i_handle, if( setsockopt( p_input->i_handle,
SOL_SOCKET, SOL_SOCKET,
...@@ -91,10 +71,9 @@ int input_NetworkCreateMethod( input_thread_t *p_input, ...@@ -91,10 +71,9 @@ int input_NetworkCreateMethod( input_thread_t *p_input,
&i_socket_option, &i_socket_option,
sizeof( i_socket_option ) ) == (-1) ) sizeof( i_socket_option ) ) == (-1) )
{ {
intf_ErrMsg("input error: setsockopt(SO_REUSEADDR) error (%s)\n", intf_ErrMsg("error: can't configure socket (%s)\n", strerror(errno));
strerror(errno));
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
/* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to avoid
...@@ -106,30 +85,19 @@ int input_NetworkCreateMethod( input_thread_t *p_input, ...@@ -106,30 +85,19 @@ int input_NetworkCreateMethod( input_thread_t *p_input,
&i_socket_option, &i_socket_option,
sizeof( i_socket_option ) ) == (-1) ) sizeof( i_socket_option ) ) == (-1) )
{ {
intf_ErrMsg("input error: setsockopt(SO_RCVBUF) error (%s)\n", intf_ErrMsg("error: can't configure socket (%s)\n", strerror(errno));
strerror(errno));
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
/* Now, we bind the socket. */ /*
* Bind the socket
*/
/* Find the port. */ /* Use default port if not specified */
if( p_cfg->i_properties & INPUT_CFG_PORT ) if( p_input->i_port == 0 )
{ {
i_port = p_cfg->i_port; p_input->i_port = INPUT_DEFAULT_PORT;
intf_DbgMsg("input debug: using port %d\n", i_port);
}
else
{
#ifdef VIDEOLAN_DEFAULT_PORT
/* default port */
i_port = VIDEOLAN_DEFAULT_PORT;
intf_DbgMsg("input debug: using default port (%d)\n", i_port);
#else
intf_ErrMsg("input error: no default port\n");
return( -1 );
#endif
} }
/* Find the address. */ /* Find the address. */
...@@ -142,99 +110,77 @@ int input_NetworkCreateMethod( input_thread_t *p_input, ...@@ -142,99 +110,77 @@ int input_NetworkCreateMethod( input_thread_t *p_input,
* implementation, so we thought using a #define would be much * implementation, so we thought using a #define would be much
* simpler. */ * simpler. */
#ifdef INPUT_BCAST_ADDR #ifdef INPUT_BCAST_ADDR
if( BuildInetAddr( &sa_in, INPUT_BCAST_ADDR, i_port ) == (-1) ) if( BuildInetAddr( &sa_in, INPUT_BCAST_ADDR, p_input->i_port ) == (-1) )
{ /* see netutils.c */ {
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
#else #else
/* We bind with any address. Security problem ! */ /* We bind with any address. Security problem ! */
if( BuildInetAddr( &sa_in, NULL, i_port ) == (-1) ) if( BuildInetAddr( &sa_in, NULL, p_input->i_port ) == (-1) )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ), return( -1 );
} }
#endif #endif
break; break;
case INPUT_METHOD_TS_UCAST: case INPUT_METHOD_TS_UCAST:
/* We bind with the local address. */ /* Unicast: bind with the local address. */
if( gethostname( psz_hostname, sizeof( psz_hostname ) ) == (-1) ) if( gethostname( psz_hostname, sizeof( psz_hostname ) ) == (-1) )
{ {
intf_ErrMsg("input error: gethostname failed (%s)\n", intf_ErrMsg("error: can't get hostname (%s)\n", strerror(errno));
strerror(errno));
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
if( BuildInetAddr( &sa_in, psz_hostname, i_port ) == (-1) ) if( BuildInetAddr( &sa_in, psz_hostname, p_input->i_port ) == (-1) )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
break; break;
case INPUT_METHOD_TS_MCAST: case INPUT_METHOD_TS_MCAST:
/* We bind with 239.0.0.1. */ /* Multicast: bind with 239.0.0.1. */
if( BuildInetAddr( &sa_in, "239.0.0.1", i_port ) == (-1) ) if( BuildInetAddr( &sa_in, "239.0.0.1", p_input->i_port ) == (-1) )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
break; break;
} }
/* Effectively bind the socket. */ /* Effectively bind the socket. */
if( bind( p_input->i_handle, if( bind( p_input->i_handle, (struct sockaddr *) &sa_in, sizeof( sa_in ) ) < 0 )
(struct sockaddr *) &sa_in,
sizeof( sa_in ) ) < 0 )
{ {
intf_ErrMsg("input error: bind() failed (%s)\n", intf_ErrMsg("error: can't bind socket (%s)\n", strerror(errno));
strerror(errno));
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
/* Connect the socket to the remote server. */ /*
* Connect the socket to the remote server
*/
/* Find which server we have to use. */ /* Use default host if not specified */
if( p_cfg->i_properties & INPUT_CFG_HOSTNAME ) if( p_input->psz_source == NULL )
{
if( BuildInetAddr( &sa_in, p_cfg->psz_hostname, htons(0) ) == (-1) )
{
close( p_input->i_handle );
return( -1 );
}
}
else if( p_cfg->i_properties & INPUT_CFG_IP )
{
if( BuildInetAddr( &sa_in, p_cfg->psz_ip, htons(0) ) == (-1) )
{ {
close( p_input->i_handle ); p_input->psz_source = INPUT_DEFAULT_SERVER;
return( -1 );
}
} }
else
{ if( BuildInetAddr( &sa_in, p_input->psz_source, htons(0) ) == (-1) )
#ifdef VIDEOLAN_DEFAULT_SERVER
/* default server */
if( BuildInetAddr( &sa_in, VIDEOLAN_DEFAULT_SERVER, htons(0) ) == (-1) )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( -1 );
} }
#else
intf_ErrMsg("input error: no default videolan server\n");
return( -1 );
#endif
}
/* Effectively connect the socket. */ /* Connect the socket. */
if( connect( p_input->i_handle, if( connect( p_input->i_handle, (struct sockaddr *) &sa_in,
(struct sockaddr *) &sa_in,
sizeof( sa_in ) ) == (-1) ) sizeof( sa_in ) ) == (-1) )
{ {
intf_ErrMsg("input error: connect() failed\n"); intf_ErrMsg("error: can't connect socket\n" );
close( p_input->i_handle ); close( p_input->i_handle );
return( -1 ); return( 1 );
} }
return( 0 ); return( 0 );
} }
...@@ -275,23 +221,20 @@ int input_NetworkRead( input_thread_t *p_input, const struct iovec *p_vector, ...@@ -275,23 +221,20 @@ int input_NetworkRead( input_thread_t *p_input, const struct iovec *p_vector,
} }
/****************************************************************************** /******************************************************************************
* input_NetworkDestroyMethod: close a network stream * input_NetworkClose: close a network stream
******************************************************************************/ ******************************************************************************/
void input_NetworkDestroyMethod( input_thread_t *p_input ) void input_NetworkClose( input_thread_t *p_input )
{ {
/* Close local socket. */ /* Close local socket. */
if( p_input->i_handle ) if( p_input->i_handle )
{ {
if( close( p_input->i_handle) == (-1) ) close( p_input->i_handle );
{
intf_ErrMsg("input error: can't close network socket (%s)\n",
strerror(errno) );
}
} }
/* In case of VLAN method, leave the current VLAN. */ /* Leave vlan if required */
if( p_input->i_method == INPUT_METHOD_TS_VLAN_BCAST ) if( p_input->i_method == INPUT_METHOD_TS_VLAN_BCAST )
{ {
input_VlanLeave( p_input->i_vlan_id ); input_VlanLeave( p_input->i_vlan );
} }
} }
...@@ -129,9 +129,9 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es, ...@@ -129,9 +129,9 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
} }
/****************************************************************************** /******************************************************************************
* input_PcrClean : Clean PCR structures before dying * input_PcrEnd : Clean PCR structures before dying
******************************************************************************/ ******************************************************************************/
void input_PcrClean( input_thread_t *p_input ) void input_PcrEnd( input_thread_t *p_input )
{ {
ASSERT( p_input ); ASSERT( p_input );
......
...@@ -138,7 +138,7 @@ int input_PsiInit( input_thread_t *p_input ) ...@@ -138,7 +138,7 @@ int input_PsiInit( input_thread_t *p_input )
/****************************************************************************** /******************************************************************************
* input_PsiClean: Clean PSI structures before dying * input_PsiClean: Clean PSI structures before dying
******************************************************************************/ ******************************************************************************/
int input_PsiClean( input_thread_t *p_input ) int input_PsiEnd( input_thread_t *p_input )
{ {
ASSERT(p_input); ASSERT(p_input);
......
This diff is collapsed.
...@@ -31,42 +31,6 @@ ...@@ -31,42 +31,6 @@
#include "intf_sys.h" #include "intf_sys.h"
/*******************************************************************************
* Constants
*******************************************************************************/
/* INTF_INPUT_CFG: pre-configured inputs */
#define INTF_MAX_INPUT_CFG 10
static const input_cfg_t INTF_INPUT_CFG[] =
{
/* properties method
* file host ip port vlan */
/* Local input (unicast) */
{ INPUT_CFG_METHOD | INPUT_CFG_IP, INPUT_METHOD_TS_UCAST,
NULL, NULL, "127.0.0.1", 0, 0 },
/* Broadcasts */
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 0 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 1 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 2 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 3 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 4 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 5 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 6 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 7 },
{ INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST,
NULL, NULL, NULL, 0, 8 }
};
/******************************************************************************* /*******************************************************************************
* intf_Create: prepare interface before main loop * intf_Create: prepare interface before main loop
******************************************************************************* *******************************************************************************
...@@ -141,7 +105,7 @@ void intf_Run( intf_thread_t *p_intf ) ...@@ -141,7 +105,7 @@ void intf_Run( intf_thread_t *p_intf )
} }
if( (p_intf->p_input != NULL) && p_intf->p_input->b_error ) 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; p_intf->p_input = NULL;
intf_DbgMsg("Input thread destroyed\n"); intf_DbgMsg("Input thread destroyed\n");
} }
...@@ -175,23 +139,18 @@ void intf_Destroy( intf_thread_t *p_intf ) ...@@ -175,23 +139,18 @@ void intf_Destroy( intf_thread_t *p_intf )
*******************************************************************************/ *******************************************************************************/
int intf_SelectInput( intf_thread_t * p_intf, int i_index ) int intf_SelectInput( intf_thread_t * p_intf, int i_index )
{ {
intf_DbgMsg("0x%x\n", p_intf ); intf_DbgMsg("\n");
/* Kill existing input, if any */ /* Kill existing input, if any */
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
input_DestroyThread( p_intf->p_input /*??, NULL*/ ); input_DestroyThread( p_intf->p_input, NULL );
}
/* Check that input index is valid */
if( (i_index < 0) || (INTF_MAX_INPUT_CFG < i_index) )
{
p_intf->p_input = NULL;
return( 1 );
} }
/* Open a new input */ /* Open a new input */
p_intf->p_input = input_CreateThread( &INTF_INPUT_CFG[ i_index ] /*??, NULL*/ ); 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 ); return( p_intf->p_input == NULL );
} }
...@@ -207,7 +166,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key ) ...@@ -207,7 +166,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
{ {
case 'Q': /* quit order */ case 'Q': /* quit order */
case 'q': case 'q':
case 27: case 27: /* escape key */
p_intf->b_die = 1; p_intf->b_die = 1;
break; break;
case '0': /* source change */ case '0': /* source change */
......
...@@ -458,15 +458,15 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv ) ...@@ -458,15 +458,15 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
/****************************************************************************** /******************************************************************************
* SpawnInput: spawn an input thread (ok ?) * SpawnInput: spawn an input thread (ok ?)
****************************************************************************** ******************************************************************************
* Spawn an input thread with the correct p_cfg parameters. * Spawn an input thread
******************************************************************************/ ******************************************************************************/
static int SpawnInput( int i_argc, intf_arg_t *p_argv ) static int SpawnInput( int i_argc, intf_arg_t *p_argv )
{ {
input_cfg_t cfg;
int i_arg; int i_arg;
int i_method = 0; /* method parameter */
/* Erase p_cfg. */ char * psz_source = NULL; /* source parameter */
bzero( &cfg, sizeof( cfg ) ); int i_port = 0; /* port parameter */
int i_vlan = 0; /* vlan parameter */
/* Parse parameters - see command list above */ /* Parse parameters - see command list above */
for ( i_arg = 1; i_arg < i_argc; i_arg++ ) for ( i_arg = 1; i_arg < i_argc; i_arg++ )
...@@ -474,62 +474,31 @@ static int SpawnInput( int i_argc, intf_arg_t *p_argv ) ...@@ -474,62 +474,31 @@ static int SpawnInput( int i_argc, intf_arg_t *p_argv )
switch( p_argv[i_arg].i_index ) switch( p_argv[i_arg].i_index )
{ {
case 0: /* method */ case 0: /* method */
cfg.i_method = p_argv[i_arg].i_num; i_method = p_argv[i_arg].i_num;
break;
case 1: /* filename */
cfg.psz_filename = p_argv[i_arg].psz_str;
break;
case 2: /* hostname */
cfg.psz_hostname = p_argv[i_arg].psz_str;
break; break;
case 3: /* ip */ case 1: /* filename, hostname, ip */
cfg.psz_ip = p_argv[i_arg].psz_str; case 2:
case 3:
psz_source = p_argv[i_arg].psz_str;
break; break;
case 4: /* port */ case 4: /* port */
cfg.i_port = p_argv[i_arg].i_num; i_port = p_argv[i_arg].i_num;
break; break;
case 5: /* VLAN */ case 5: /* VLAN */
cfg.i_vlan = p_argv[i_arg].i_num; i_vlan = p_argv[i_arg].i_num;
break; break;
} }
} }
/* Setting i_properties to indicate which parameters are set. */ /* Destroy current input, if any */
if( cfg.i_method )
{
cfg.i_properties |= INPUT_CFG_METHOD;
}
if( cfg.psz_filename )
{
cfg.i_properties |= INPUT_CFG_FILENAME;
}
if( cfg.psz_hostname )
{
cfg.i_properties |= INPUT_CFG_HOSTNAME;
}
if( cfg.psz_ip )
{
cfg.i_properties |= INPUT_CFG_IP;
}
if( cfg.i_port )
{
cfg.i_properties |= INPUT_CFG_PORT;
}
if( cfg.i_vlan )
{
cfg.i_properties |= INPUT_CFG_VLAN;
}
/* Default settings for the decoder threads */
cfg.p_aout = p_main->p_aout;
/* Create the input thread */
if( p_main->p_intf->p_input != NULL ) if( p_main->p_intf->p_input != NULL )
{ {
input_DestroyThread( p_main->p_intf->p_input /*??, NULL*/ ); input_DestroyThread( p_main->p_intf->p_input, NULL );
} }
p_main->p_intf->p_input = input_CreateThread( &cfg /*??,NULL*/ ); p_main->p_intf->p_input = input_CreateThread( i_method, psz_source, i_port, i_vlan,
p_main->p_intf->p_vout, p_main->p_aout,
NULL );
return( INTF_NO_ERROR ); return( INTF_NO_ERROR );
} }
...@@ -583,18 +552,8 @@ static int Vlan( int i_argc, intf_arg_t *p_argv ) ...@@ -583,18 +552,8 @@ static int Vlan( int i_argc, intf_arg_t *p_argv )
; ;
} }
/* Command is 'synchro' */
if( !strcmp(p_argv[i_command].psz_str, "synchro") )
{
input_VlanSynchronize();
}
/* Command is 'request' */
else if( !strcmp(p_argv[i_command].psz_str, "request") )
{
/* ?? */
}
/* Command is 'join' */ /* Command is 'join' */
else if( !strcmp(p_argv[i_command].psz_str, "join") ) if( !strcmp(p_argv[i_command].psz_str, "join") )
{ {
/* ?? */ /* ?? */
} }
......
...@@ -423,7 +423,9 @@ static void Usage( void ) ...@@ -423,7 +423,9 @@ static void Usage( void )
/* Vlan parameters */ /* Vlan parameters */
intf_Msg("VLANs (Virtual Local Aera Networks) parameters:\n" \ intf_Msg("VLANs (Virtual Local Aera Networks) parameters:\n" \
" vlan_server=<host>[:<port>] VLANs server address and port\n" \ " " INPUT_IFACE_VAR "=<interface> network interface\n" \
" " INPUT_VLAN_SERVER_VAR "=<hostname> vlan server\n" \
" " INPUT_VLAN_PORT_VAR "=<port> vlan server port\n" \
); );
/* Interfaces keys */ /* Interfaces keys */
......
...@@ -55,6 +55,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ ...@@ -55,6 +55,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
int i_status; /* thread status */ int i_status; /* thread status */
/* Allocate descriptor */ /* Allocate descriptor */
intf_DbgMsg("\n");
p_vout = (vout_thread_t *) malloc( sizeof(vout_thread_t) ); p_vout = (vout_thread_t *) malloc( sizeof(vout_thread_t) );
if( p_vout == NULL ) if( p_vout == NULL )
{ {
...@@ -123,7 +124,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ ...@@ -123,7 +124,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
return( NULL ); return( NULL );
} }
intf_Msg("Video: display initialized (%dx%d, %d bpp)\n", intf_Msg("Video display initialized (%dx%d, %d bpp)\n",
p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth ); p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth );
/* If status is NULL, wait until the thread is created */ /* If status is NULL, wait until the thread is created */
...@@ -155,6 +156,7 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status ) ...@@ -155,6 +156,7 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
int i_status; /* thread status */ int i_status; /* thread status */
/* Set status */ /* Set status */
intf_DbgMsg("\n");
p_vout->pi_status = (pi_status != NULL) ? pi_status : &i_status; p_vout->pi_status = (pi_status != NULL) ? pi_status : &i_status;
*p_vout->pi_status = THREAD_DESTROY; *p_vout->pi_status = THREAD_DESTROY;
...@@ -544,6 +546,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -544,6 +546,7 @@ static int InitThread( vout_thread_t *p_vout )
int i_index; /* generic index */ int i_index; /* generic index */
/* Update status */ /* Update status */
intf_DbgMsg("\n");
*p_vout->pi_status = THREAD_START; *p_vout->pi_status = THREAD_START;
/* Initialize output method - this function issues its own error messages */ /* Initialize output method - this function issues its own error messages */
...@@ -600,6 +603,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -600,6 +603,7 @@ static void RunThread( vout_thread_t *p_vout)
free( p_vout ); /* destroy descriptor */ free( p_vout ); /* destroy descriptor */
return; return;
} }
intf_DbgMsg("\n");
/* /*
* Main loop - it is not executed if an error occured during * Main loop - it is not executed if an error occured during
...@@ -752,6 +756,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -752,6 +756,7 @@ static void RunThread( vout_thread_t *p_vout)
static void ErrorThread( vout_thread_t *p_vout ) static void ErrorThread( vout_thread_t *p_vout )
{ {
/* Wait until a `die' order */ /* Wait until a `die' order */
intf_DbgMsg("\n");
while( !p_vout->b_die ) while( !p_vout->b_die )
{ {
/* Sleep a while */ /* Sleep a while */
...@@ -771,6 +776,7 @@ static void EndThread( vout_thread_t *p_vout ) ...@@ -771,6 +776,7 @@ static void EndThread( vout_thread_t *p_vout )
int i_picture; int i_picture;
/* Store status */ /* Store status */
intf_DbgMsg("\n");
pi_status = p_vout->pi_status; pi_status = p_vout->pi_status;
*pi_status = THREAD_END; *pi_status = THREAD_END;
......
...@@ -136,7 +136,7 @@ int vout_SysInit( vout_thread_t *p_vout ) ...@@ -136,7 +136,7 @@ int vout_SysInit( vout_thread_t *p_vout )
} }
if( i_err ) /* an error occured */ if( i_err ) /* an error occured */
{ {
intf_Msg("Video: XShm extension desactivated\n" ); intf_Msg("XShm video sextension desactivated\n" );
p_vout->p_sys->b_shm = 0; p_vout->p_sys->b_shm = 0;
} }
} }
...@@ -229,7 +229,7 @@ int vout_SysManage( vout_thread_t *p_vout ) ...@@ -229,7 +229,7 @@ int vout_SysManage( vout_thread_t *p_vout )
intf_ErrMsg("error: can't resize display\n"); intf_ErrMsg("error: can't resize display\n");
return( 1 ); return( 1 );
} }
intf_Msg("Video: display resized to %dx%d\n", p_vout->i_width, p_vout->i_height); intf_Msg("Video display resized to %dx%d\n", p_vout->i_width, p_vout->i_height);
} }
return 0; return 0;
...@@ -388,7 +388,7 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root ...@@ -388,7 +388,7 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display ); p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
if( !p_vout->p_sys->b_shm ) if( !p_vout->p_sys->b_shm )
{ {
intf_Msg("Video: XShm extension is not available\n"); intf_Msg("XShm video extension is not available\n");
} }
/* Get the screen depth */ /* Get the screen depth */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment