Commit ec9bf58a authored by Sam Hocevar's avatar Sam Hocevar

- �a compile sous FreeBSD (mais �a ne tourne pas)

 - les d�pendances sont cach�es dans .deps/ au lieu de deps/
 - suppression d'encore quelques #include inutiles.
 - la gestion des plugins est maintenant encapsul�e dans misc/plugin.c
  un peu comme les threads, pour faciliter le portage.
 - l�ger remaniement de l'output pour --help et --version
 - les p_ts_packet sont cast�s en (void *) pour �viter un warning sous
  certaines architectures.
 - ajout de la GPL dans un fichier COPYING
 - fichier README avec rien dedans pour le moment, � part la liste de
  toutes les personnes ayant particip� au projet. J'en ai *forc�ment*
  oubli� certains, alors si vous avez un nom, rajoutez-le. de m�me, s'il
  y a un gros con que j'ai mis par erreur dans la liste et qui n'a jamais
  rien fait pour le projet, n'h�sitez pas � le supprimer sournoisement.
 - fichier AUTHORS avec la liste des gens ayant boss� sur le client. j'ai
  mis toutes les personnes ayant fait au moins un commit, ainsi que Henri
  parce que je sais qu'il bosse sur l'audio, et HPReg, Steve et Oli parce
  qu'ils ont boss� dessus aussi. Par contre ici aussi j'ai fort probable-
  ment oubli� des gens. Corrigez !
 - r�pertoire debian/ qui servira � cr�er des packages
 - rajout d'une entr�e pour faire `make install' (pas encore parfait)
 - nom de code de la future release 0.2 : `Onatopp' :)
parent 44bcfed0
Rgis Duchesne <regis@via.ecp.fr>
Michel Lespinasse <walken@wrs.com>
Olivier Baxa <oli@via.ecp.fr>
Eric Estievenart <eric@via.ecp.fr>
Jean-Philippe Grimaldi <jeanphi@via.ecp.fr>
Andres Krapf <dae@via.ecp.fr>
Christophe Massiot <massiot@via.ecp.fr>
Vincent Seguin <seguin@via.ecp.fr>
Benoit Steiner <benny@via.ecp.fr>
Jean-Marc Dressler <polux@via.ecp.fr>
Gal Hendryckx <jimmy@via.ecp.fr>
Samuel Hocevar <sam@via.ecp.fr>
Michel Kaempf <maxx@via.ecp.fr>
Stphane Borel <stef@via.ecp.fr>
Renaud Dartus <reno@via.ecp.fr>
Henri Fallon <henri@via.ecp.fr>
This diff is collapsed.
......@@ -13,6 +13,8 @@
CC=egcc
#CC=gcc295
SHELL=/bin/sh
INSTALL=install
PREFIX=/usr
# Audio output settings
AUDIO = dsp
......@@ -45,12 +47,10 @@ SYS=LINUX
#SYS=BEOS
# For x86 architecture, choose MMX support
MMX=YES
#MMX=NO
ARCH += MMX
# For x86 architecture, optimize for Pentium Pro
# (choose NO if you get `Invalid instruction' errors)
PPRO=YES
#PPRO=NO
ARCH += PPRO
# Decoder choice - ?? old decoder will be removed soon
#DECODER=old
......@@ -65,19 +65,16 @@ DEBUG=0
# Configuration pre-processing
################################################################################
# Program version - may only be changed by the project leader
# Program version and codename - may only be changed by the project leader
PROGRAM_VERSION = 0.1.99
PROGRAM_CODENAME = Onatopp
# audio options
audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
# video options
video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
# audio and video options
AUDIO := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
VIDEO := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
# PROGRAM_OPTIONS is an identification string of the compilation options
PROGRAM_OPTIONS = $(ARCH) $(SYS)
PROGRAM_OPTIONS = $(SYS) $(ARCH)
ifeq ($(DEBUG),1)
PROGRAM_OPTIONS += DEBUG
endif
......@@ -89,12 +86,12 @@ PROGRAM_BUILD = `date` $(USER)@`hostname`
# DEFINE will contain some of the constants definitions decided in Makefile,
# including ARCH_xx and SYS_xx. It will be passed to C compiler.
DEFINE += -DARCH_$(ARCH)
DEFINE += -DARCH_$(shell echo $(ARCH) | cut -f1 -d' ')
DEFINE += -DSYS_$(SYS)
DEFINE += -DAUDIO_OPTIONS="\"$(audio)\""
DEFINE += -DVIDEO_OPTIONS="\"$(video)\""
DEFINE += -DPLUGIN_PATH="\"$(PREFIX)/lib/videolan/vlc\""
DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
DEFINE += -DPROGRAM_CODENAME="\"$(PROGRAM_CODENAME)\""
DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
ifeq ($(DEBUG),1)
DEFINE += -DDEBUG
......@@ -113,15 +110,21 @@ INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
#
# Libraries
#
LIB += -L/usr/local/lib
ifeq ($(SYS),GNU)
LIB += -lthreads
else
LIB += -lpthread
LIB += -lthreads -ldl
endif
ifeq ($(SYS),BSD)
LIB += -pthread -lgnugetopt
LIB += -L/usr/local/lib
endif
ifeq ($(SYS),LINUX)
LIB += -lpthread -ldl
endif
LIB += -lm
LIB += -ldl
#
# C compiler flags: compilation
......@@ -137,27 +140,28 @@ CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
CCFLAGS += -fomit-frame-pointer
# Optimizations for x86 familiy
ifeq ($(ARCH),X86)
ifneq (,$(findstring X86,$(ARCH)))
CCFLAGS += -malign-double
#CCFLAGS += -march=pentium
ifeq ($(PPRO), YES)
# Eventual Pentium Pro optimizations
ifneq (,$(findstring PPRO,$(ARCH)))
ifneq ($(SYS), BSD)
CCFLAGS += -march=pentiumpro
endif
endif
# Eventual MMX optimizations for x86
ifeq ($(MMX), YES)
ifneq (,$(findstring MMX,$(ARCH)))
CFLAGS += -DHAVE_MMX
endif
endif
# Optimizations for PowerPC
ifeq ($(ARCH),PPC)
ifneq (,$(findstring PPC,$(ARCH)))
CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
endif
# Optimizations for Sparc
ifeq ($(ARCH),SPARC)
ifneq (,$(findstring SPARC,$(ARCH)))
CCFLAGS += -mhard-float
endif
......@@ -260,6 +264,7 @@ endif
misc_obj = misc/mtime.o \
misc/rsc_files.o \
misc/netutils.o \
misc/plugins.o \
misc/decoder_fifo.o
C_OBJ = $(interface_obj) \
......@@ -278,8 +283,8 @@ C_OBJ = $(interface_obj) \
#
# Assembler Objects
#
ifeq ($(ARCH),X86)
ifeq ($(MMX), YES)
ifneq (,$(findstring X86,$(ARCH)))
ifneq (,$(findstring MMX,$(ARCH)))
ifeq ($(DECODER),new)
ASM_OBJ = video_decoder/vdec_idctmmx.o \
video_output/video_yuv_mmx.o
......@@ -293,9 +298,9 @@ endif
#
# Plugins
#
interface_plugin = $(video:%=interface/intf_%.so)
audio_plugin = $(audio:%=audio_output/aout_%.so)
video_plugin = $(video:%=video_output/vout_%.so)
interface_plugin = $(VIDEO:%=interface/intf_%.so)
audio_plugin = $(AUDIO:%=audio_output/aout_%.so)
video_plugin = $(VIDEO:%=video_output/vout_%.so)
PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin)
......@@ -303,7 +308,7 @@ PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin)
# Other lists of files
#
sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
dependancies := $(sources:%.c=dep/%.d)
dependancies := $(sources:%.c=.dep/%.d)
# All symbols must be exported
export
......@@ -323,7 +328,12 @@ clean:
distclean: clean
rm -f **/*.o **/*.so **/*~ *.log
rm -f vlc gmon.out core
rm -rf dep
rm -rf .dep
install:
$(INSTALL) vlc $(PREFIX)/bin
mkdir -p $(PREFIX)/lib/videolan/vlc
$(INSTALL) $(PLUGIN_OBJ) $(PREFIX)/lib/videolan/vlc
show:
@echo "Command line for C objects:"
......@@ -347,7 +357,7 @@ $(dependancies): %.d: FORCE
@$(MAKE) -s --no-print-directory -f Makefile.dep $@
$(C_OBJ): %.o: Makefile.dep
$(C_OBJ): %.o: dep/%.d
$(C_OBJ): %.o: .dep/%.d
$(C_OBJ): %.o: %.c
@echo "compiling $*.o from $*.c"
@$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
......@@ -358,7 +368,7 @@ $(ASM_OBJ): %.o: %.S
@$(CC) $(CFLAGS) -c -o $@ $<
$(PLUGIN_OBJ): %.so: Makefile.dep
$(PLUGIN_OBJ): %.so: dep/%.d
$(PLUGIN_OBJ): %.so: .dep/%.d
# audio plugins
audio_output/aout_dummy.so audio_output/aout_dsp.so: %.so: %.c
......@@ -367,7 +377,11 @@ audio_output/aout_dummy.so audio_output/aout_dsp.so: %.so: %.c
audio_output/aout_esd.so: %.so: %.c
@echo "compiling $*.so from $*.c"
ifeq ($(SYS), BSD)
@$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
else
@$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
endif
# video plugins
interface/intf_dummy.so video_output/vout_dummy.so \
......@@ -393,15 +407,15 @@ interface/intf_ggi.so video_output/vout_ggi.so: %.so: %.c
################################################################################
# Note on dependancies: each .c file is associated with a .d file, which
# depends of it. The .o file associated with a .c file depends of the .d, of the
# .c itself, and of Makefile. The .d files are stored in a separate dep/
# depends of it. The .o file associated with a .c file depends of the .d, of the
# .c itself, and of Makefile. The .d files are stored in a separate .dep/
# directory.
# The dep directory should be ignored by CVS.
# Note on inclusions: depending of the target, the dependancies files must
# Note on inclusions: depending of the target, the dependancies files must
# or must not be included. The problem is that if we ask make to include a file,
# and this file does not exist, it is made before it can be included. In a
# general way, a .d file should be included if and only if the corresponding .o
# and this file does not exist, it is made before it can be included. In a
# general way, a .d file should be included if and only if the corresponding .o
# needs to be re-made.
# Two makefiles are used: the main one (this one) has regular generic rules,
......
......@@ -26,10 +26,10 @@ default:
# .c and from itself.
-include $(MAKECMDGOALS)
$(dependancies): dep/%.d: %.c
@test -d dep/$(dir $*) || mkdir -p dep/$(dir $*)
$(dependancies): .dep/%.d: %.c
@test -d .dep/$(dir $*) || mkdir -p .dep/$(dir $*)
@echo "generating dependancies for $*.c"
@$(SHELL) -ec '$(CC) $(DCFLAGS) $(CFLAGS) $< \
| sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
.dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
README for vlc, the VideoLAN Client
... Introduction
[ nothing appropriate yet ]
... Running VideoLAN
[ nothing appropriate yet ]
... Troubleshooting
[ nothing appropriate yet ]
... Resources
[ nothing appropriate yet ]
... The team
The following teachers were involved in the VideoLAN project :
Pierre Lecoy, teacher-cum-researcher at ECP,
Philippe Boutin, head of the LMI (MicroComputing Laboratory).
The following students were members of the VideoLAN team :
Pierre Almeras <almeras@via.ecp.fr>
Christophe Arnaud <christophe.arnaud@tps.fr>
Antoine Brenner <brenner@via.ecp.fr>
Rgis Duchesne <regis@via.ecp.fr>
Alexandre Francois <francois@via.ecp.fr>
Hugo Haas <hugo@via.ecp.fr>
Mikael Journo <mj32@cornell.edu>
Michel Lespinasse <walken@wrs.com>
Christophe Ulses <mowgli@laotseu.via.ecp.fr>
Pierre Vandecasteele <pabv2@hermes.cam.ac.uk>
Guillaume Vergnaud <vergnaud@via.ecp.fr>
Olivier Baxa <oli@via.ecp.fr>
Patrice Bazerque <patrice.bazerque@via.ecp.fr>
Etienne Bernard <eb@via.ecp.fr>
Arnaud Bienvenu <arnaud.bienvenu@via.ecp.fr>
Rgis Clment <clement@via.ecp.fr>
Alexandre Duret <alex@via.ecp.fr>
Eric Estievenart <eric@via.ecp.fr>
Sbastien Kurz <seb@tao.via.ecp.fr>
Olivier Pomel <pomel@via.ecp.fr>
Pierre Baillet <octplane@via.ecp.fr>
Alban Fonrouge <alban@via.ecp.fr>
Jean-Philippe Grimaldi <jeanphi@via.ecp.fr>
Andres Krapf <dae@via.ecp.fr>
Christophe Massiot <massiot@via.ecp.fr>
Mathieu Poumeyrol <kaliban@via.ecp.fr>
Etienne Roy <etienne@via.ecp.fr>
Vincent Seguin <seguin@via.ecp.fr>
Benoit Steiner <benny@via.ecp.fr>
Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
Jean-Marc Dressler <polux@via.ecp.fr>
Gal Hendryckx <jimmy@via.ecp.fr>
Samuel Hocevar <sam@via.ecp.fr>
Brieuc Jeunhomme <bbp@via.ecp.fr>
Michel Kaempf <maxx@via.ecp.fr>
Florent Rougon <flo@via.ecp.fr>
Stphane Borel <stef@via.ecp.fr>
Renaud Dartus <reno@via.ecp.fr>
Henri Fallon <henri@via.ecp.fr>
Jean-Michel Grimaldi <jm@via.ecp.fr>
Damien Lucas <nitrox@via.ecp.fr>
Rmi Peyronnet <remi@via.ecp.fr>
Laurent Rossier <gunther@via.ecp.fr>
......@@ -23,7 +23,6 @@
/*****************************************************************************
* Required headers:
* - <sys/soundcard.h> ( audio_buf_info )
* - "common.h" ( boolean_t )
* - "mtime.h" ( mtime_t )
* - "threads.h" ( vlc_thread_t )
......
......@@ -41,10 +41,8 @@
*****************************************************************************/
/* Program version and copyright message */
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " - (c)1999-2000 VideoLAN"
#define VERSION_MESSAGE "VideoLAN Client - (c)1999-2000 VideoLAN\n" \
"version " PROGRAM_VERSION " ( " PROGRAM_BUILD " )\n" \
"compilation options: " PROGRAM_OPTIONS
#define COPYRIGHT_MESSAGE "VideoLAN Client - version " PROGRAM_VERSION \
" " PROGRAM_CODENAME " - (c)1996-2000 VideoLAN"
/*****************************************************************************
* General compilation options
......
......@@ -63,10 +63,10 @@ static __inline__ void input_NetlistFreePES( input_thread_t *p_input,
#ifdef INPUT_LIFO_TS_NETLIST
p_input->netlist.i_ts_index--;
p_input->netlist.p_ts_free[p_input->netlist.i_ts_index].iov_base
= p_ts_packet;
= (void *)p_ts_packet;
#else /* FIFO */
p_input->netlist.p_ts_free[p_input->netlist.i_ts_end].iov_base
= p_ts_packet;
= (void *)p_ts_packet;
p_input->netlist.i_ts_end++;
p_input->netlist.i_ts_end &= INPUT_MAX_TS; /* loop */
#endif
......@@ -104,9 +104,11 @@ static __inline__ void input_NetlistFreeTS( input_thread_t *p_input,
/* Free the TS structure. */
#ifdef INPUT_LIFO_TS_NETLIST
p_input->netlist.i_ts_index--;
p_input->netlist.p_ts_free[p_input->netlist.i_ts_index].iov_base = p_ts_packet;
p_input->netlist.p_ts_free[p_input->netlist.i_ts_index].iov_base
= (void *)p_ts_packet;
#else /* FIFO */
p_input->netlist.p_ts_free[p_input->netlist.i_ts_end].iov_base = p_ts_packet;
p_input->netlist.p_ts_free[p_input->netlist.i_ts_end].iov_base
= (void *)p_ts_packet;
p_input->netlist.i_ts_end++;
p_input->netlist.i_ts_end &= INPUT_MAX_TS; /* loop */
#endif
......
/*****************************************************************************
* plugins.h : Dynamic plugin management functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
*
* 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-1307, USA.
*****************************************************************************/
void * RequestPlugin ( char * psz_mask, char * psz_name );
void TrashPlugin ( void * p_plugin );
void * GetPluginFunction ( void *plugin, char *name );
......@@ -41,12 +41,11 @@
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <dlfcn.h> /* plugins */
#include "common.h"
#include "config.h"
#include "mtime.h" /* mtime_t, mdate(), msleep() */
#include "threads.h"
#include "plugins.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
......@@ -81,7 +80,6 @@ aout_thread_t *aout_CreateThread( int *pi_status )
{
aout_thread_t * p_aout; /* thread descriptor */
char * psz_method;
char * psz_plugin;
#if 0
int i_status; /* thread status */
#endif
......@@ -93,39 +91,33 @@ aout_thread_t *aout_CreateThread( int *pi_status )
return( NULL );
}
/* Initialize method-dependent functions */
/* Request an interface plugin */
psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD );
p_aout->p_aout_plugin = RequestPlugin( "aout", psz_method );
psz_plugin = malloc( sizeof("./audio_output/aout_.so") + strlen(psz_method) );
sprintf( psz_plugin, "./audio_output/aout_%s.so", psz_method );
p_aout->p_aout_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
if( p_aout->p_aout_plugin == NULL )
if( !p_aout->p_aout_plugin )
{
intf_ErrMsg( "error: could not open audio plugin %s\n", psz_plugin );
free( psz_plugin );
intf_ErrMsg( "error: could not open audio plugin aout_%s.so\n", psz_method );
free( p_aout );
return( NULL );
}
free( psz_plugin );
/* Get plugins */
p_aout->p_sys_open = dlsym(p_aout->p_aout_plugin, "aout_SysOpen");
p_aout->p_sys_reset = dlsym(p_aout->p_aout_plugin, "aout_SysReset");
p_aout->p_sys_setformat = dlsym(p_aout->p_aout_plugin, "aout_SysSetFormat");
p_aout->p_sys_setchannels = dlsym(p_aout->p_aout_plugin, "aout_SysSetChannels");
p_aout->p_sys_setrate = dlsym(p_aout->p_aout_plugin, "aout_SysSetRate");
p_aout->p_sys_getbufinfo = dlsym(p_aout->p_aout_plugin, "aout_SysGetBufInfo");
p_aout->p_sys_playsamples = dlsym(p_aout->p_aout_plugin, "aout_SysPlaySamples");
p_aout->p_sys_close = dlsym(p_aout->p_aout_plugin, "aout_SysClose");
p_aout->p_sys_open = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysOpen" );
p_aout->p_sys_reset = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysReset" );
p_aout->p_sys_setformat = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetFormat" );
p_aout->p_sys_setchannels = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetChannels" );
p_aout->p_sys_setrate = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetRate" );
p_aout->p_sys_getbufinfo = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysGetBufInfo" );
p_aout->p_sys_playsamples = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysPlaySamples" );
p_aout->p_sys_close = GetPluginFunction( p_aout->p_aout_plugin, "aout_SysClose" );
/*
* Initialize audio device
*/
if ( p_aout->p_sys_open( p_aout ) )
{
dlclose( p_aout->p_aout_plugin );
TrashPlugin( p_aout->p_aout_plugin );
free( p_aout );
return( NULL );
}
......@@ -136,28 +128,28 @@ aout_thread_t *aout_CreateThread( int *pi_status )
if ( p_aout->p_sys_reset( p_aout ) )
{
p_aout->p_sys_close( p_aout );
dlclose( p_aout->p_aout_plugin );
TrashPlugin( p_aout->p_aout_plugin );
free( p_aout );
return( NULL );
}
if ( p_aout->p_sys_setformat( p_aout ) )
{
p_aout->p_sys_close( p_aout );
dlclose( p_aout->p_aout_plugin );
TrashPlugin( p_aout->p_aout_plugin );
free( p_aout );
return( NULL );
}
if ( p_aout->p_sys_setchannels( p_aout ) )
{
p_aout->p_sys_close( p_aout );
dlclose( p_aout->p_aout_plugin );
TrashPlugin( p_aout->p_aout_plugin );
free( p_aout );
return( NULL );
}
if ( p_aout->p_sys_setrate( p_aout ) )
{
p_aout->p_sys_close( p_aout );
dlclose( p_aout->p_aout_plugin );
TrashPlugin( p_aout->p_aout_plugin );
free( p_aout );
return( NULL );
}
......@@ -168,7 +160,7 @@ aout_thread_t *aout_CreateThread( int *pi_status )
if( aout_SpawnThread( p_aout ) )
{
p_aout->p_sys_close( p_aout );
dlclose( p_aout->p_aout_plugin );
TrashPlugin( p_aout->p_aout_plugin );
free( p_aout );
return( NULL );
}
......@@ -335,7 +327,7 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->psz_device);
/* Close plugin */
dlclose( p_aout->p_aout_plugin );
TrashPlugin( p_aout->p_aout_plugin );
/* Free structure */
free( p_aout );
......
......@@ -102,7 +102,7 @@ int input_NetlistInit( input_thread_t *p_input )
for( i_packets = 0; i_packets < INPUT_MAX_TS + 1; i_packets++ )
{
p_input->netlist.p_ts_free[i_base + i_packets].iov_base
= (p_input->netlist.p_ts_packets + i_packets);
= (void *)(p_input->netlist.p_ts_packets + i_packets);
/* Initialize TS length. */
(p_input->netlist.p_ts_packets[i_packets]).i_payload_end = TS_PACKET_SIZE;
}
......
......@@ -91,7 +91,7 @@ int input_NetworkOpen( input_thread_t *p_input )
&i_socket_option,
sizeof( i_socket_option ) ) == (-1) )
{
intf_ErrMsg("error: can't configure socket (%s)\n", strerror(errno));
intf_ErrMsg("error: can't configure socket (SO_REUSEADDR: %s)\n", strerror(errno));
close( p_input->i_handle );
return( 1 );
}
......@@ -105,7 +105,7 @@ int input_NetworkOpen( input_thread_t *p_input )
&i_socket_option,
sizeof( i_socket_option ) ) == (-1) )
{
intf_ErrMsg("error: can't configure socket (%s)\n", strerror(errno));
intf_ErrMsg("error: can't configure socket (SO_RCVBUF: %s)\n", strerror(errno));
close( p_input->i_handle );
return( 1 );
}
......
......@@ -27,18 +27,17 @@
* Preamble
*****************************************************************************/
#include <errno.h> /* ENOMEM */
#include <stdio.h> /* sprintf() */
#include <stdlib.h> /* free(), strtol() */
#include <stdio.h> /* FILE */
#include <string.h> /* strerror() */
#include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */
#include <dlfcn.h> /* plugins */
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "threads.h"
#include "plugins.h"
#include "input.h"
#include "intf_msg.h"
......@@ -89,7 +88,6 @@ intf_thread_t* intf_Create( void )
{
intf_thread_t *p_intf;
char * psz_method;
char * psz_plugin;
/* Allocate structure */
p_intf = malloc( sizeof( intf_thread_t ) );
......@@ -99,27 +97,21 @@ intf_thread_t* intf_Create( void )
return( NULL );
}
/* Initialize method-dependent functions */
/* Request an interface plugin */
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
p_intf->p_intf_plugin = RequestPlugin( "intf", psz_method );
psz_plugin = malloc( sizeof("./interface/intf_.so") + strlen(psz_method) );
sprintf( psz_plugin, "./interface/intf_%s.so", psz_method );
p_intf->p_intf_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
if( p_intf->p_intf_plugin == NULL )
if( !p_intf->p_intf_plugin )
{
intf_ErrMsg( "error: could not open interface plugin %s\n", psz_plugin );
free( psz_plugin );
intf_ErrMsg( "error: could not open interface plugin intf_%s.so\n", psz_method );
free( p_intf );
return( NULL );
}
free( psz_plugin );
/* Get plugins */
p_intf->p_sys_create = dlsym(p_intf->p_intf_plugin, "intf_SysCreate");
p_intf->p_sys_manage = dlsym(p_intf->p_intf_plugin, "intf_SysManage");
p_intf->p_sys_destroy = dlsym(p_intf->p_intf_plugin, "intf_SysDestroy");
p_intf->p_sys_create = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysCreate" );
p_intf->p_sys_manage = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysManage" );
p_intf->p_sys_destroy = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysDestroy" );
/* Initialize structure */
p_intf->b_die = 0;
......@@ -136,7 +128,7 @@ intf_thread_t* intf_Create( void )
if( p_intf->p_console == NULL )
{
intf_ErrMsg("error: can't create control console\n");
dlclose( p_intf->p_intf_plugin );
TrashPlugin( p_intf->p_intf_plugin );
free( p_intf );
return( NULL );
}
......@@ -144,7 +136,7 @@ intf_thread_t* intf_Create( void )
{
intf_ErrMsg("error: can't create interface\n");
intf_ConsoleDestroy( p_intf->p_console );
dlclose( p_intf->p_intf_plugin );
TrashPlugin( p_intf->p_intf_plugin );
free( p_intf );
return( NULL );
}
......@@ -210,7 +202,7 @@ void intf_Destroy( intf_thread_t *p_intf )
UnloadChannels( p_intf );
/* Close plugin */
dlclose( p_intf->p_intf_plugin );
TrashPlugin( p_intf->p_intf_plugin );
/* Free structure */
free( p_intf );
......
This diff is collapsed.
......@@ -31,6 +31,7 @@
* Preamble
*****************************************************************************/
#include <stdio.h> /* sprintf() */
#include <unistd.h> /* select() */
#include <sys/time.h>
#include "common.h"
......
/*****************************************************************************
* plugins.c : Dynamic plugin management functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
*
* 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-1307, USA.
*****************************************************************************/
#include <stdlib.h> /* free(), strtol() */
#include <stdio.h> /* sprintf() */
#include <dlfcn.h> /* dlopen(), dlsym(), dlclose() */
#define PLUGIN_PATH_COUNT 5
void * RequestPlugin ( char * psz_mask, char * psz_name )
{
int i_count, i_length;
void * fd;
char * psz_plugin;
char * psz_plugin_path[ PLUGIN_PATH_COUNT ] =
{
".",
PLUGIN_PATH,
/* these ones should disappear */
"./audio_output",
"./video_output",
"./interface"
};
i_length = strlen( psz_mask ) + strlen( psz_name );
for ( i_count = 0 ; i_count < PLUGIN_PATH_COUNT ; i_count++ )
{
psz_plugin = malloc( strlen(psz_plugin_path[i_count]) + i_length + 6 );
sprintf( psz_plugin, "%s/%s_%s.so", psz_plugin_path[i_count], psz_mask, psz_name );
fd = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
free( psz_plugin );
if( fd != NULL )
return( fd );
}
return( 0 );
}
void TrashPlugin ( void * p_plugin )
{
dlclose( p_plugin );
}
void *GetPluginFunction ( void *p_plugin, char *psz_name )
{
return( dlsym(p_plugin, psz_name) );
}
......@@ -32,12 +32,11 @@
#include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */
#include <dlfcn.h> /* plugins */
#include "common.h"
#include "config.h"
#include "mtime.h"
#include "threads.h"
#include "plugins.h"
#include "video.h"
#include "video_output.h"
#include "video_text.h"
......@@ -92,7 +91,6 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
int i_status; /* thread status */
int i_index; /* index for array initialization */
char * psz_method;
char * psz_plugin;
/* Allocate descriptor */
intf_DbgMsg("\n");
......@@ -103,30 +101,24 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
return( NULL );
}
/* Initialize method-dependent functions */
/* Request an interface plugin */
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
p_vout->p_vout_plugin = RequestPlugin( "vout", psz_method );
psz_plugin = malloc( sizeof("./video_output/vout_.so") + strlen(psz_method) );
sprintf( psz_plugin, "./video_output/vout_%s.so", psz_method );
p_vout->p_vout_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
if( p_vout->p_vout_plugin == NULL )
if( !p_vout->p_vout_plugin )
{
intf_ErrMsg( "error: could not open video plugin %s\n", psz_plugin );
free( psz_plugin );
intf_ErrMsg( "error: could not open video plugin vout_%s.so\n", psz_method );
free( p_vout );
return( NULL );
}
free( psz_plugin );
/* Get plugins */
p_vout->p_sys_create = dlsym(p_vout->p_vout_plugin, "vout_SysCreate");
p_vout->p_sys_init = dlsym(p_vout->p_vout_plugin, "vout_SysInit");
p_vout->p_sys_end = dlsym(p_vout->p_vout_plugin, "vout_SysEnd");
p_vout->p_sys_destroy = dlsym(p_vout->p_vout_plugin, "vout_SysDestroy");
p_vout->p_sys_manage = dlsym(p_vout->p_vout_plugin, "vout_SysManage");
p_vout->p_sys_display = dlsym(p_vout->p_vout_plugin, "vout_SysDisplay");
p_vout->p_sys_create = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysCreate" );
p_vout->p_sys_init = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysInit" );
p_vout->p_sys_end = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysEnd" );
p_vout->p_sys_destroy = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDestroy" );
p_vout->p_sys_manage = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysManage" );
p_vout->p_sys_display = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDisplay" );
/* Initialize thread properties - thread id and locks will be initialized
* later */
......@@ -189,7 +181,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
* own error messages */
if( p_vout->p_sys_create( p_vout, psz_display, i_root_window ) )
{
dlclose( p_vout->p_vout_plugin );
TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
......@@ -215,7 +207,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
if( p_vout->p_default_font == NULL )
{
p_vout->p_sys_destroy( p_vout );
dlclose( p_vout->p_vout_plugin );
TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
......@@ -224,7 +216,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
{
vout_UnloadFont( p_vout->p_default_font );
p_vout->p_sys_destroy( p_vout );
dlclose( p_vout->p_vout_plugin );
TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
......@@ -240,7 +232,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
vout_UnloadFont( p_vout->p_default_font );
vout_UnloadFont( p_vout->p_large_font );
p_vout->p_sys_destroy( p_vout );
dlclose( p_vout->p_vout_plugin );
TrashPlugin( p_vout->p_vout_plugin );
free( p_vout );
return( NULL );
}
......@@ -1262,7 +1254,7 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status )
p_vout->p_sys_destroy( p_vout );
/* Close plugin */
dlclose( p_vout->p_vout_plugin );
TrashPlugin( p_vout->p_vout_plugin );
/* Free structure */
free( p_vout );
......
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