Commit 1a1ae383 authored by Vincent Seguin's avatar Vincent Seguin

A tout kass�.

parent 7929ae1b
......@@ -9,32 +9,71 @@
# Configuration
################################################################################
# Environment
#CC = gcc
#SHELL = /bin/sh
# Video output settings
VIDEO=X11
#VIDEO=DGA
#VIDEO=FB
#VIDEO=BEOS
# Target architecture and optimization
#ARCH=
ARCH=MMX
#ARCH=PPC
#----------------- do not change anything below this line ----------------------
################################################################################
# Configuration pre-processing
################################################################################
# DEFINE will contain all the constants definitions decided in Makefile
DEFINE = -DVIDEO_$(VIDEO)
# video is a lowercase version of VIDEO used for filenames
video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
################################################################################
# Settings and other variables
# Tunning and other variables
################################################################################
#
# Transformation for video decompression (Fourier or cosine)
#
TRANSFORM=vdec_idct
#TRANSFORM=vdec_idft
#
# C headers directories
#
INCLUDE += -Iinclude
ifeq ($(VIDEO),X11)
INCLUDE += -I/usr/X11R6/include/X11
endif
#
# Libraries
#
LIB += -lpthread
ifeq ($(VIDEO),X11)
LIB += -L/usr/X11R6/lib
LIB += -lX11
LIB += -lXext
LIB += -lpthread
LIB += -lXpm
endif
# System dependant libraries
#??LIB += -lXxf86dga
#
# C compiler flags: compilation
#
CCFLAGS += $(INCLUDE)
CCFLAGS += $(DEFINE) $(INCLUDE)
CCFLAGS += -Wall
CCFLAGS += -D_REENTRANT
CCFLAGS += -D_GNU_SOURCE
......@@ -44,21 +83,24 @@ CCFLAGS += -O6
CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
CCFLAGS += -fomit-frame-pointer
#CCFLAGS += -fomit-frame-pointer -s
#LCFLAGS += -s
# Platform-specific optimizations
# Optimizations for x86 familiy :
# Optimizations for x86 familiy, without MMX
ifeq ($(ARCH),)
CCFLAGS += -malign-double
CCFLAGS += -march=pentiumpro
#CCFLAGS += -march=pentium
endif
# MMX support :
CFLAGS += -DHAVE_MMX
ASM_OBJ = video_decoder_ref/idctmmx.o \
video_decoder_ref/yuv12-rgb16.o
# Optimization for x86 with MMX support
ifeq ($(ARCH),MMX)
CCFLAGS += -malign-double
CCFLAGS += -march=pentiumpro
endif
#Optimizations for PowerPC :
#CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
# Optimizations for PowerPC
ifeq ($(ARCH),PPC)
CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
endif
#
# C compiler flags: dependancies
......@@ -71,31 +113,16 @@ DCFLAGS += -MM
#
LCFLAGS += $(LIB)
LCFLAGS += -Wall
#
# C compiler flags: functions flow
#
FCFLAGS += $(INCLUDE)
FCFLAGS += -A
FCFLAGS += -P
FCFLAGS += -v
FCFLAGS += -a
FCFLAGS += -X errno.h
FCFLAGS += -X fcntl.h
FCFLAGS += -X signal.h
FCFLAGS += -X stdio.h
FCFLAGS += -X stdlib.h
FCFLAGS += -X string.h
FCFLAGS += -X unistd.h
FCFLAGS += -X sys/ioctl.h
FCFLAGS += -X sys/stat.h
FCFLAGS += -X X11/Xlib.h
FFILTER = grep -v "intf_.*Msg.*\.\.\."
#LCFLAGS += -s
#
# C compiler flags: common flags
#
# CFLAGS
# Optimizations for x86 with MMX support
ifeq ($(ARCH),MMX)
CFLAGS += -DHAVE_MMX
endif
#
# Additionnal debugging flags
......@@ -104,7 +131,7 @@ FFILTER = grep -v "intf_.*Msg.*\.\.\."
# Note that electric fence and accurate profiling are quite uncompatible.
#CCFLAGS += -g
#CCFLAGS += -pg
#LCFLAGS += -g
#LCFLAGS += -g
#LCFLAGS += -pg
#LIB += -ldmalloc
#LIB += -lefence
......@@ -122,7 +149,8 @@ interface_obj = interface/main.o \
interface/intf_cmd.o \
interface/intf_ctrl.o \
interface/control.o \
interface/xconsole.o
interface/intf_console.o \
interface/intf_$(video).o
input_obj = input/input_vlan.o \
input/input_file.o \
......@@ -136,14 +164,14 @@ input_obj = input/input_vlan.o \
audio_output_obj = audio_output/audio_output.o \
audio_output/audio_dsp.o
#video_output_obj = video_output/video_output.o \
# video_output/video_x11.o \
# video_output/video_graphics.o
video_output_obj = video_output/video_output.o \
video_output/video_$(video).o
audio_decoder_obj = audio_decoder/audio_decoder.o \
audio_decoder/audio_math.o
#generic_decoder_obj = generic_decoder/generic_decoder.o
#??generic_decoder_obj = generic_decoder/generic_decoder.o
# remeber to add it to OBJ
video_decoder_obj = video_decoder_ref/video_decoder.o \
video_decoder_ref/display.o \
......@@ -155,7 +183,8 @@ video_decoder_obj = video_decoder_ref/video_decoder.o \
video_decoder_ref/motion.o \
video_decoder_ref/mpeg2dec.o \
video_decoder_ref/recon.o \
video_decoder_ref/spatscal.o
video_decoder_ref/spatscal.o
# video_decoder_ref/$(TRANSFORM).o
#video_parser_obj = video_parser/video_parser.o \
# video_parser/vpar_headers.o \
......@@ -173,6 +202,12 @@ misc_obj = misc/mtime.o \
misc/rsc_files.o \
misc/netutils.o
ifeq ($(ARCH),MMX)
ASM_OBJ = video_decoder_ref/idctmmx.o \
video_decoder_ref/yuv12-rgb16.o
endif
C_OBJ = $(interface_obj) \
$(input_obj) \
$(audio_output_obj) \
......@@ -182,7 +217,7 @@ C_OBJ = $(interface_obj) \
$(video_parser_obj) \
$(video_decoder_obj) \
$(vlan_obj) \
$(misc_obj) \
$(misc_obj)
#
# Other lists of files
......@@ -207,7 +242,7 @@ clean:
distclean: clean
rm -f **/*.o **/*~ *.log
rm -f vlc gmon.out core Documentation/cflow
rm -f vlc gmon.out core
rm -rf dep
FORCE:
......@@ -218,9 +253,6 @@ FORCE:
vlc: $(C_OBJ) $(ASM_OBJ)
$(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
Documentation/cflow: $(sources)
cflow $(FCFLAGS) $(CFLAGS) $(sources) | $(FFILTER) > $@
#
# Generic rules (see below)
#
......@@ -232,7 +264,7 @@ $(C_OBJ): %.o: dep/%.d
$(C_OBJ): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
$(ASM_OBJ): %.o: %.S
$(CC) -c -o $@ $<
$(CC) $(CFLAGS) -c -o $@ $<
################################################################################
# Note on generic rules and dependancies
......
......@@ -200,10 +200,9 @@ typedef struct aout_thread_s
/******************************************************************************
* Prototypes
******************************************************************************/
int aout_Open ( aout_thread_t *p_aout );
int aout_SpawnThread ( aout_thread_t *p_aout );
void aout_CancelThread ( aout_thread_t *p_aout );
void aout_Close ( aout_thread_t *p_aout );
aout_thread_t * aout_CreateThread ( int *pi_status );
void aout_DestroyThread ( aout_thread_t *p_aout, int *pi_status );
aout_fifo_t * aout_CreateFifo ( aout_thread_t *p_aout, aout_fifo_t *p_fifo );
void aout_DestroyFifo ( aout_fifo_t *p_fifo );
......@@ -9,7 +9,7 @@
*******************************************************************************/
/*******************************************************************************
* Types definitions
* Basic types definitions
*******************************************************************************/
/* Basic types definitions */
......@@ -30,6 +30,48 @@ typedef int boolean_t;
/* Counter for statistics and profiling */
typedef unsigned long count_t;
/*******************************************************************************
* Classes declaration
*******************************************************************************/
/* Interface */
struct intf_thread_s;
struct intf_sys_s;
struct intf_console_s;
struct intf_msg_s;
typedef struct intf_thread_s * p_intf_thread_t;
typedef struct intf_sys_s * p_intf_sys_t;
typedef struct intf_console_s * p_intf_console_t;
typedef struct intf_msg_s * p_intf_msg_t;
/* Input */
struct input_thread_s;
struct input_vlan_method_s;
struct input_cfg_s;
typedef struct input_thread_s * p_input_thread_t;
typedef struct input_vlan_method_s * p_input_vlan_method_t;
typedef struct input_cfg_s * p_input_cfg_t;
/* Audio */
struct aout_thread_s;
typedef struct aout_thread_s * p_aout_thread_t;
/* Video */
struct vout_thread_s;
struct vout_sys_s;
struct vdec_thread_s;
struct vpar_thread_s;
struct video_parser_s;
typedef struct vout_thread_s * p_vout_thread_t;
typedef struct vout_sys_s * p_vout_sys_t;
typedef struct vdec_thread_s * p_vdec_thread_t;
typedef struct vpar_thread_s * p_vpar_thread_t;
typedef struct video_parser_s * p_video_parser_t;
/*******************************************************************************
* Macros and inline functions
*******************************************************************************/
......
......@@ -3,17 +3,29 @@
* (c)1999 VideoLAN
*******************************************************************************
* Defines all compilation-time configuration constants and size limits
*******************************************************************************
* required headers:
* none
*******************************************************************************/
/* Conventions regarding names of symbols and variables
* ----------------------------------------------------
*
* - Symbols should begin with a prefix indicating in which module they are
* used, such as INTF_, VOUT_ or ADEC_.
*
* - Regarding environment variables, which are used as initialization parameters
* for threads :
* + variable names should end with '_VAR'
* + environment variable default value should end with '_DEFAULT'
* + values having a special meaning with '_VAL'
* + complete environment strings with '_ENV'
*
*/
/*******************************************************************************
* Program information
*******************************************************************************/
/* Program version and copyright message */
#define PROGRAM_VERSION "0.0.x"
#define PROGRAM_VERSION "DR 2.1"
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " (" __DATE__ ") - (c)1999 VideoLAN\n"
/*******************************************************************************
......@@ -45,6 +57,10 @@
/* General debugging support */
#define DEBUG
/* Extended debugging support - in this mode, debugging messages will have their
* date and context printed */
#define DEBUG_CONTEXT
/* Modules specific debugging */
#define DEBUG_INTF
#define DEBUG_INPUT
......@@ -54,10 +70,9 @@
/* Debugging log file - if defined, a file can be used to store all messages. If
* DEBUG_LOG_ONLY is defined, debug messages will only be printed to the log and
* will not appear on the screen */
//#define DEBUG_LOG "vlc-debug.log"
//#define DEBUG_LOG_ONLY
#define DEBUG_LOG "vlc-debug.log"
#define DEBUG_LOG_ONLY
/* ?? VOUT_DEBUG and co have changed ! */
/*******************************************************************************
* Common settings
......@@ -67,7 +82,8 @@
#define AUTO_SPAWN
/* Startup script */
#define INIT_SCRIPT "vlc.init"
#define INTF_INIT_SCRIPT_VAR "vlc_init"
#define INTF_INIT_SCRIPT_DEFAULT "vlc.init"
/* ?? */
#define THREAD_SLEEP 100000
......@@ -164,11 +180,23 @@
#define VLAN_DEFAULT_SERVER_PORT 6010
/*******************************************************************************
* Audio output thread configuration
* Audio configuration
*******************************************************************************/
/* Environment variable used to store dsp device name, and default value */
#define AOUT_DSP_VAR "vlc_dsp"
#define AOUT_DSP_DEFAULT "/dev/dsp"
/* Environment variable for stereo, and default value */
#define AOUT_STEREO_VAR "vlc_stereo"
#define AOUT_STEREO_DEFAULT 1
/* Environment variable for output rate, and default value */
#define AOUT_RATE_VAR "vlc_audio_rate"
#define AOUT_RATE_DEFAULT 44100
/*******************************************************************************
* Video output thread configuration
* Video configuration
*******************************************************************************/
/*
......@@ -176,34 +204,19 @@
*/
/* Title of the window */
#define VOUT_TITLE "VideoLAN Client: output"
#define VOUT_TITLE "VideoLAN Client"
/* Default use of XShm extension */
#define VOUT_SHM_EXT 1
/* Dimensions for display window */
/* Default dimensions for display window - these dimensions are the standard
* width and height for broadcasted MPEG-2 */
#define VOUT_WIDTH 544
#define VOUT_HEIGHT 576
/* Default heap size */
#define VOUT_HEAP_SIZE 100
/*
* Limitations
*/
/* Maximum number of video output threads - this value is used exclusively by
* interface, and is in fact an interface limitation */
#define VOUT_MAX_THREADS 10
/* Maximum number of video streams per video output thread */
#define VOUT_MAX_STREAMS 10
/* Maximum number of pictures which can be rendered in one loop, plus one */
/* Default video heap size - remember that a decompressed picture is big
* (~1 Mbyte) before using huge values */
#define VOUT_MAX_PICTURES 10
/*
* Other settings
* Time settings
*/
/* Time during which the thread will sleep if it has nothing to
......@@ -219,12 +232,12 @@
/* ?? this constant will probably evolve to a calculated value */
#define VOUT_DISPLAY_DELAY 150000
/* Maximum lap of time during which images are rendered in the same
* time. It should be greater than the maximum time between two succesive
* images to avoid useless renderings and calls to the display driver,
* but not to high to avoid desynchronization */
/* ?? this constant will probably evolve to a calculated value */
#define VOUT_DISPLAY_TOLERANCE 150000
/*
* Environment settings
*/
/* Allow use of X11 XShm (shared memory) extension if possible */
#define VOUT_XSHM 1
/*******************************************************************************
* Video parser configuration
......@@ -277,28 +290,12 @@
/* Maximal size of a command line in a script */
#define INTF_MAX_CMD_SIZE 240
/*
* Messages functions
* X11 interface properties
*/
/* Maximal size of the message queue - in case of overflow, all messages in the
* queue are printed by the calling thread */
#define INTF_MSG_QSIZE 32
/* Define to enable messages queues - disabling messages queue can be usefull
* when debugging, since it allows messages which would not otherwise be printed,
* due to a crash, to be printed anyway */
/*#define INTF_MSG_QUEUE*/
/* Format of the header for debug messages. The arguments following this header
* are the file (char *), the function (char *) and the line (int) in which the
* message function was called */
#define INTF_MSG_DBG_FORMAT "## %s:%s(),%i: "
/* Filename to log message
* Note that messages are only logged when debugging */
//#define INTF_MSG_LOGFILE "vlc.log"
#define INTF_APP_CLASS "vlc"
#define INTF_APP_NAME "vlc"
//??#define
/*
* X11 console properties
......@@ -323,15 +320,37 @@
#define INTF_XCONSOLE_FONT "-*-helvetica-medium-r-normal-*-18-*-*-*-*-*-iso8859-1"
/* Number of memorized lines in X11 console window text zone */
#define INTF_XCONSOLE_MAX_LINES 100
#define INTF_CONSOLE_MAX_TEXT 100
/* Maximal number of commands which can be saved in history list */
#define INTF_XCONSOLE_HISTORY_SIZE 20
#define INTF_CONSOLE_MAX_HISTORY 20
/* Maximum width of a line in an X11 console window. If a larger line is
* printed, it will be wrapped. */
#define INTF_XCONSOLE_MAX_LINE_WIDTH 120
#define ENV_VLC_DISPLAY "vlc_DISPLAY"
#define INTF_MAIN_WIDTH 600
#define INTF_MAIN_HEIGHT 600
/*******************************************************************************
* Interface messages functions
*******************************************************************************/
/* Maximal size of the message queue - in case of overflow, all messages in the
* queue are printed by the calling thread */
#define INTF_MSG_QSIZE 32
/* Define to enable messages queues - disabling messages queue can be usefull
* when debugging, since it allows messages which would not otherwise be printed,
* due to a crash, to be printed anyway */
//#define INTF_MSG_QUEUE
/* Format of the header for debug messages. The arguments following this header
* are the file (char *), the function (char *) and the line (int) in which the
* message function was called */
#define INTF_MSG_DBG_FORMAT "## %s:%s(),%i: "
/*******************************************************************************
* Network and VLAN management
......
......@@ -24,12 +24,6 @@
/*******************************************************************************
* Prototypes
*******************************************************************************/
int intf_CreateVoutThread ( intf_thread_t *p_intf, char *psz_title,
int i_width, int i_height );
void intf_DestroyVoutThread ( intf_thread_t *p_intf, int i_thread );
int intf_CreateInputThread ( intf_thread_t *p_intf, input_cfg_t* p_cfg );
void intf_DestroyInputThread ( intf_thread_t *p_intf, int i_thread );
int intf_SelectAudioStream ( intf_thread_t *p_intf, int i_input, int i_id );
void intf_DeselectAudioStream( intf_thread_t *p_intf, int i_input, int i_id );
int intf_SelectVideoStream ( intf_thread_t *p_intf, int i_input,
......
......@@ -310,7 +310,7 @@ typedef int (*f_read_t)( struct input_thread_struct *, const struct iovec *,
size_t );
typedef void (*f_clean_t)( struct input_thread_struct * );
typedef struct input_thread_struct
typedef struct input_thread_s
{
/* Thread properties and locks */
boolean_t b_die; /* 'die' flag */
......@@ -369,7 +369,7 @@ typedef struct input_thread_struct
* properties, asking the called function to use default settings for
* the other ones.
******************************************************************************/
typedef struct input_cfg_struct
typedef struct input_cfg_s
{
u64 i_properties;
......
......@@ -38,72 +38,11 @@
#define VLAN_ID_VLAN( vlan_id ) ( (vlan_id) & 0xff )
#define VLAN_ID( iface, vlan ) ( ((iface) << 8) | (vlan) )
/*******************************************************************************
* input_vlan_server_t: vlan server
*******************************************************************************
* This structure describes a vlan server.
*******************************************************************************/
typedef struct
{
struct sockaddr_in sa_in; /* server address */
int i_socket; /* socket descriptor */
/* Login informations */
char * psz_login; /* server login */
char * psz_passwd; /* server password */
} input_vlan_server_t;
/*******************************************************************************
* input_vlan_iface_t: vlan-capable network interface
*******************************************************************************
* This structure describes the abilities of a network interface capable of
* vlan management. Note that an interface could have several IP adresses, but
* since only the MAC address is used to change vlan, only one needs to be
* retrieved.
* ?? it could be interesting to send a port id on vlan request, to know if two
* interfaces are dependant regarding vlan changes.
*******************************************************************************/
typedef struct
{
char * psz_name; /* interface name */
struct sockaddr_in sa_in; /* interface IP */
char psz_mac[20]; /* interface MAC */
/* Hardware properties */
int i_master; /* master interface index */
int i_switch; /* switch number */
int i_port; /* port number */
int i_sharers; /* number of MACs on this port */
/* Vlan properties - these are only used if i_master is negative */
int i_refcount; /* locks counter */
int i_vlan; /* current vlan */
int i_default_vlan; /* default vlan */
} input_vlan_iface_t;
/*******************************************************************************
* vlan_method_data_t
*******************************************************************************
* Store global vlan library data.
*******************************************************************************/
typedef struct
{
vlc_mutex_t lock; /* library lock */
/* Server */
input_vlan_server_t server; /* vlan server */
/* Network interfaces */
int i_ifaces; /* number of vlan-compliant interfaces */
input_vlan_iface_t * p_iface; /* interfaces */
} input_vlan_method_t;
/*******************************************************************************
* Prototypes
*******************************************************************************/
int input_VlanMethodInit ( input_vlan_method_t *p_method,
char *psz_server, int i_port);
void input_VlanMethodFree ( input_vlan_method_t *p_method );
int input_VlanCreate ( void );
void input_VlanDestroy ( void );
int input_VlanId ( char *psz_iface, int i_vlan );
int input_VlanJoin ( int i_vlan_id );
......
......@@ -26,23 +26,25 @@
* This structe describes all interface-specific data of the main (interface)
* thread.
******************************************************************************/
typedef struct
typedef struct intf_thread_s
{
boolean_t b_die; /* `die' flag */
/* Threads control */
input_thread_t * pp_input[INPUT_MAX_THREADS]; /* input threads */
vout_thread_t * pp_vout[VOUT_MAX_THREADS]; /* vout threads */
aout_thread_t * p_aout; /* aout thread */
int i_input; /* default input thread */
int i_vout; /* default output thread */
/* Specific interfaces */
xconsole_t xconsole; /* X11 console */
p_intf_console_t p_console; /* console */
p_intf_sys_t p_sys; /* system interface */
/* Main threads - NULL if not active */
p_vout_thread_t p_vout;
p_input_thread_t p_input;
} intf_thread_t;
/******************************************************************************
* Prototypes
******************************************************************************/
int intf_Run( intf_thread_t * p_intf );
intf_thread_t * intf_Create ( void );
void intf_Run ( intf_thread_t * p_intf );
void intf_Destroy ( intf_thread_t * p_intf );
int intf_SelectInput ( intf_thread_t * p_intf, p_input_cfg_t p_cfg );
/*******************************************************************************
* intf_console.h: generic console methods for interface
* (c)1998 VideoLAN
*******************************************************************************/
/*******************************************************************************
* Prototypes
*******************************************************************************/
p_intf_console_t intf_ConsoleCreate ( void );
void intf_ConsoleDestroy ( p_intf_console_t p_console );
void intf_ConsoleClear ( p_intf_console_t p_console );
void intf_ConsolePrint ( p_intf_console_t p_console, char *psz_str );
void intf_ConsoleExec ( p_intf_console_t p_console, char *psz_str );
......@@ -3,75 +3,8 @@
* (c)1999 VideoLAN
*******************************************************************************
* This library provides basic functions for threads to interact with user
* interface, such as message output. If INTF_MSG_QUEUE is defined (which is the
* defaul), messages are not printed directly by threads, to bypass console
* limitations and slow printf() calls, but sent to a queue and printed later by
* interface thread.
* If INTF_MSG_QUEUE is not defined, output is directly performed on stderr.
*******************************************************************************
* required headers:
* "config.h"
* "mtime.h"
* "vlc_thread.h"
*******************************************************************************/
/*******************************************************************************
* interface_message_t
*******************************************************************************
* Store a single message. Messages have a maximal size of INTF_MSG_MSGSIZE.
* If DEBUG is defined, messages have a date field and debug messages are
* printed with a date to allow more precise profiling.
*******************************************************************************/
typedef struct
{
int i_type; /* message type, see below */
char * psz_msg; /* the message itself */
#ifdef DEBUG
/* Debugging informations - in DEBUG mode, all messages are dated and debug
* messages have calling location informations printed */
mtime_t date; /* date of the message (all messages) */
char * psz_file; /* file in which the function was called */
char * psz_function; /* function from which the function was called */
int i_line; /* line at which the function was called */
#endif
} interface_msg_message_t;
/* Message types */
#define INTF_MSG_STD 0 /* standard message */
#define INTF_MSG_ERR 1 /* error message */
#define INTF_MSG_INTF 2 /* interface message */
#define INTF_MSG_DBG 3 /* debug message */
/*******************************************************************************
* interface_msg_t
*******************************************************************************
* Store all data requiered by messages interfaces. It has a singe instance in
* program_data.
* interface, such as message output. See config.h for output configuration.
*******************************************************************************/
typedef struct
{
#ifdef INTF_MSG_QUEUE
/* Message queue */
vlc_mutex_t lock; /* message queue lock */
int i_count; /* number of messages stored */
interface_msg_message_t msg[INTF_MSG_QSIZE]; /* message queue */
#endif
#ifdef DEBUG_LOG
/* Log file */
FILE * p_log_file; /* log file */
#endif
#ifndef INTF_MSG_QUEUE
#ifndef DEBUG_LOG
/* If neither messages queue, neither log file is used, then the structure
* is empty. However, empty structures are not allowed in C. Therefore, a
* dummy integer is used to fill it. */
int i_dummy; /* unused filler */