Changeset ec9bf58ab3453691a110fcf144d05e18f8b39183

Show
Ignore:
Timestamp:
03/04/00 12:52:48 (8 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 952170768 +0000
git-parent:

[44bcfed01477db0b57e6f08048bbee72f032aa7e]

git-author:
Sam Hocevar <sam@videolan.org> 952170768 +0000
Message:
  • �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' :)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile

    r44bcfed rec9bf58  
    1414#CC=gcc295 
    1515SHELL=/bin/sh 
     16INSTALL=install 
     17PREFIX=/usr 
    1618 
    1719# Audio output settings 
     
    4648 
    4749# For x86 architecture, choose MMX support 
    48 MMX=YES 
    49 #MMX=NO 
     50ARCH += MMX 
    5051# For x86 architecture, optimize for Pentium Pro 
    5152# (choose NO if you get `Invalid instruction' errors) 
    52 PPRO=YES 
    53 #PPRO=NO 
     53ARCH += PPRO 
    5454 
    5555# Decoder choice - ?? old decoder will be removed soon 
     
    6666################################################################################ 
    6767 
    68 # Program version - may only be changed by the project leader 
     68# Program version and codename - may only be changed by the project leader 
    6969PROGRAM_VERSION = 0.1.99 
    70  
    71 # audio options 
    72 audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z') 
    73 AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z') 
    74  
    75 # video options 
    76 video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z') 
    77 VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z') 
     70PROGRAM_CODENAME = Onatopp 
     71 
     72# audio and video options 
     73AUDIO := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z') 
     74VIDEO := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z') 
    7875 
    7976# PROGRAM_OPTIONS is an identification string of the compilation options 
    80 PROGRAM_OPTIONS = $(ARCH) $(SYS
     77PROGRAM_OPTIONS = $(SYS) $(ARCH
    8178ifeq ($(DEBUG),1) 
    8279PROGRAM_OPTIONS += DEBUG 
     
    9087# DEFINE will contain some of the constants definitions decided in Makefile,  
    9188# including ARCH_xx and SYS_xx. It will be passed to C compiler. 
    92 DEFINE += -DARCH_$(ARCH
     89DEFINE += -DARCH_$(shell echo $(ARCH) | cut -f1 -d' '
    9390DEFINE += -DSYS_$(SYS) 
    94 DEFINE += -DAUDIO_OPTIONS="\"$(audio)\"" 
    95 DEFINE += -DVIDEO_OPTIONS="\"$(video)\"" 
     91DEFINE += -DPLUGIN_PATH="\"$(PREFIX)/lib/videolan/vlc\"" 
    9692DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\"" 
    97 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\"" 
     93DEFINE += -DPROGRAM_CODENAME="\"$(PROGRAM_CODENAME)\"" 
     94DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\"" 
    9895DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\"" 
    9996ifeq ($(DEBUG),1) 
     
    114111# Libraries 
    115112# 
     113 
     114ifeq ($(SYS),GNU) 
     115LIB += -lthreads -ldl 
     116endif 
     117 
     118ifeq ($(SYS),BSD) 
     119LIB += -pthread -lgnugetopt 
    116120LIB += -L/usr/local/lib 
    117  
    118 ifeq ($(SYS),GNU) 
    119 LIB += -lthreads 
    120 else 
    121 LIB += -lpthread 
    122 endif 
     121endif 
     122 
     123ifeq ($(SYS),LINUX) 
     124LIB += -lpthread -ldl 
     125endif 
     126 
    123127LIB += -lm 
    124 LIB += -ldl 
    125128 
    126129# 
     
    138141 
    139142# Optimizations for x86 familiy 
    140 ifeq ($(ARCH),X86
     143ifneq (,$(findstring X86,$(ARCH))
    141144CCFLAGS += -malign-double 
    142145#CCFLAGS += -march=pentium 
    143 ifeq ($(PPRO), YES) 
     146# Eventual Pentium Pro optimizations 
     147ifneq (,$(findstring PPRO,$(ARCH))) 
    144148ifneq ($(SYS), BSD) 
    145149CCFLAGS += -march=pentiumpro 
     
    147151endif 
    148152# Eventual MMX optimizations for x86 
    149 ifeq ($(MMX), YES
     153ifneq (,$(findstring MMX,$(ARCH))
    150154CFLAGS += -DHAVE_MMX 
    151155endif 
     
    153157 
    154158# Optimizations for PowerPC 
    155 ifeq ($(ARCH),PPC
     159ifneq (,$(findstring PPC,$(ARCH))
    156160CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring 
    157161endif 
    158162 
    159163# Optimizations for Sparc 
    160 ifeq ($(ARCH),SPARC
     164ifneq (,$(findstring SPARC,$(ARCH))
    161165CCFLAGS += -mhard-float 
    162166endif 
     
    261265                        misc/rsc_files.o \ 
    262266                        misc/netutils.o \ 
     267                        misc/plugins.o \ 
    263268                        misc/decoder_fifo.o 
    264269 
     
    279284# Assembler Objects 
    280285#  
    281 ifeq ($(ARCH),X86
    282 ifeq ($(MMX), YES
     286ifneq (,$(findstring X86,$(ARCH))
     287ifneq (,$(findstring MMX,$(ARCH))
    283288ifeq ($(DECODER),new) 
    284289ASM_OBJ =           video_decoder/vdec_idctmmx.o \ 
     
    294299# Plugins 
    295300# 
    296 interface_plugin =  $(video:%=interface/intf_%.so) 
    297 audio_plugin =      $(audio:%=audio_output/aout_%.so) 
    298 video_plugin =      $(video:%=video_output/vout_%.so) 
     301interface_plugin =  $(VIDEO:%=interface/intf_%.so) 
     302audio_plugin =      $(AUDIO:%=audio_output/aout_%.so) 
     303video_plugin =      $(VIDEO:%=video_output/vout_%.so) 
    299304 
    300305PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin) 
     
    304309# 
    305310sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c) 
    306 dependancies := $(sources:%.c=dep/%.d) 
     311dependancies := $(sources:%.c=.dep/%.d) 
    307312 
    308313# All symbols must be exported 
     
    324329    rm -f **/*.o **/*.so **/*~ *.log 
    325330    rm -f vlc gmon.out core 
    326     rm -rf dep 
     331    rm -rf .dep 
     332 
     333install: 
     334    $(INSTALL) vlc $(PREFIX)/bin 
     335    mkdir -p $(PREFIX)/lib/videolan/vlc 
     336    $(INSTALL) $(PLUGIN_OBJ) $(PREFIX)/lib/videolan/vlc 
    327337 
    328338show: 
     
    348358 
    349359$(C_OBJ): %.o: Makefile.dep 
    350 $(C_OBJ): %.o: dep/%.d 
     360$(C_OBJ): %.o: .dep/%.d 
    351361$(C_OBJ): %.o: %.c 
    352362    @echo "compiling $*.o from $*.c" 
     
    359369 
    360370$(PLUGIN_OBJ): %.so: Makefile.dep 
    361 $(PLUGIN_OBJ): %.so: dep/%.d 
     371$(PLUGIN_OBJ): %.so: .dep/%.d 
    362372 
    363373# audio plugins 
     
    368378audio_output/aout_esd.so: %.so: %.c 
    369379        @echo "compiling $*.so from $*.c" 
     380ifeq ($(SYS), BSD) 
     381        @$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $< 
     382else 
    370383        @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $< 
     384endif 
    371385 
    372386# video plugins 
     
    394408 
    395409# Note on dependancies: each .c file is associated with a .d file, which 
    396 # depends of it. The .o file associated with a .c file depends of the .d, of the  
    397 # .c itself, and of Makefile. The .d files are stored in a separate dep/  
     410# depends of it. The .o file associated with a .c file depends of the .d, of the 
     411# .c itself, and of Makefile. The .d files are stored in a separate .dep/ 
    398412# directory. 
    399413# The dep directory should be ignored by CVS. 
    400414 
    401 # Note on inclusions: depending of the target, the dependancies files must  
     415# Note on inclusions: depending of the target, the dependancies files must 
    402416# or must not be included. The problem is that if we ask make to include a file, 
    403 # and this file does not exist, it is made before it can be included. In a  
    404 # general way, a .d file should be included if and only if the corresponding .o  
     417# and this file does not exist, it is made before it can be included. In a 
     418# general way, a .d file should be included if and only if the corresponding .o 
    405419# needs to be re-made. 
    406420 
  • Makefile.dep

    rb278b2a rec9bf58  
    2727 
    2828-include $(MAKECMDGOALS) 
    29 $(dependancies): dep/%.d: %.c 
    30     @test -d dep/$(dir $*) || mkdir -p dep/$(dir $*) 
     29$(dependancies): .dep/%.d: %.c 
     30    @test -d .dep/$(dir $*) || mkdir -p .dep/$(dir $*) 
    3131    @echo "generating dependancies for $*.c" 
    3232    @$(SHELL) -ec '$(CC) $(DCFLAGS) $(CFLAGS) $< \ 
    3333        | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \ 
    34         dep\/$(subst /,\/,$*).d : /g'\'' > $@; \ 
     34        .dep\/$(subst /,\/,$*).d : /g'\'' > $@; \ 
    3535        [ -s $@ ] || rm -f $@' 
  • include/audio_output.h

    r44bcfed rec9bf58  
    2424/***************************************************************************** 
    2525 * Required headers: 
    26  * - <sys/soundcard.h>                                       ( audio_buf_info ) 
    2726 * - "common.h"                                                   ( boolean_t ) 
    2827 * - "mtime.h"                                                      ( mtime_t ) 
  • include/config.h

    r44bcfed rec9bf58  
    4242 
    4343/* Program version and copyright message */ 
    44 #define COPYRIGHT_MESSAGE               "VideoLAN Client v" PROGRAM_VERSION " - (c)1999-2000 VideoLAN" 
    45 #define VERSION_MESSAGE                 "VideoLAN Client - (c)1999-2000 VideoLAN\n" \ 
    46                                         "version " PROGRAM_VERSION " ( " PROGRAM_BUILD " )\n" \ 
    47                                         "compilation options: " PROGRAM_OPTIONS 
     44#define COPYRIGHT_MESSAGE   "VideoLAN Client - version " PROGRAM_VERSION \ 
     45                            " " PROGRAM_CODENAME " - (c)1996-2000 VideoLAN" 
    4846 
    4947/***************************************************************************** 
  • include/input_netlist.h

    r44bcfed rec9bf58  
    6464        p_input->netlist.i_ts_index--; 
    6565        p_input->netlist.p_ts_free[p_input->netlist.i_ts_index].iov_base 
    66                              = p_ts_packet; 
     66                             = (void *)p_ts_packet; 
    6767#else /* FIFO */ 
    6868        p_input->netlist.p_ts_free[p_input->netlist.i_ts_end].iov_base 
    69                              = p_ts_packet; 
     69                             = (void *)p_ts_packet; 
    7070        p_input->netlist.i_ts_end++; 
    7171        p_input->netlist.i_ts_end &= INPUT_MAX_TS; /* loop */ 
     
    105105#ifdef INPUT_LIFO_TS_NETLIST 
    106106    p_input->netlist.i_ts_index--; 
    107     p_input->netlist.p_ts_free[p_input->netlist.i_ts_index].iov_base = p_ts_packet; 
     107    p_input->netlist.p_ts_free[p_input->netlist.i_ts_index].iov_base 
     108        = (void *)p_ts_packet; 
    108109#else /* FIFO */ 
    109     p_input->netlist.p_ts_free[p_input->netlist.i_ts_end].iov_base = p_ts_packet; 
     110    p_input->netlist.p_ts_free[p_input->netlist.i_ts_end].iov_base 
     111        = (void *)p_ts_packet; 
    110112    p_input->netlist.i_ts_end++; 
    111113    p_input->netlist.i_ts_end &= INPUT_MAX_TS; /* loop */ 
  • src/audio_output/audio_output.c

    r44bcfed rec9bf58  
    4242#include <stdlib.h>                            /* calloc(), malloc(), free() */ 
    4343 
    44 #include <dlfcn.h>                                                /* plugins */ 
    45  
    4644#include "common.h" 
    4745#include "config.h" 
    4846#include "mtime.h"                             /* mtime_t, mdate(), msleep() */ 
    4947#include "threads.h" 
     48#include "plugins.h" 
    5049 
    5150#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */ 
     
    8281    aout_thread_t * p_aout;                             /* thread descriptor */ 
    8382    char * psz_method; 
    84     char * psz_plugin; 
    8583#if 0 
    8684    int             i_status;                                 /* thread status */ 
     
    9492    } 
    9593 
    96     /* Initialize method-dependent functions */ 
     94    /* Request an interface plugin */ 
    9795    psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD ); 
    98  
    99     psz_plugin = malloc( sizeof("./audio_output/aout_.so") + strlen(psz_method) ); 
    100     sprintf( psz_plugin, "./audio_output/aout_%s.so", psz_method ); 
    101  
    102     p_aout->p_aout_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL ); 
    103  
    104     if( p_aout->p_aout_plugin == NULL ) 
    105     { 
    106         intf_ErrMsg( "error: could not open audio plugin %s\n", psz_plugin ); 
    107         free( psz_plugin ); 
     96    p_aout->p_aout_plugin = RequestPlugin( "aout", psz_method ); 
     97 
     98    if( !p_aout->p_aout_plugin ) 
     99    { 
     100        intf_ErrMsg( "error: could not open audio plugin aout_%s.so\n", psz_method ); 
    108101        free( p_aout ); 
    109102        return( NULL ); 
    110103    } 
    111     free( psz_plugin ); 
    112104 
    113105    /* Get plugins */ 
    114     p_aout->p_sys_open =         dlsym(p_aout->p_aout_plugin, "aout_SysOpen"); 
    115     p_aout->p_sys_reset =        dlsym(p_aout->p_aout_plugin, "aout_SysReset"); 
    116     p_aout->p_sys_setformat =    dlsym(p_aout->p_aout_plugin, "aout_SysSetFormat"); 
    117     p_aout->p_sys_setchannels =  dlsym(p_aout->p_aout_plugin, "aout_SysSetChannels"); 
    118     p_aout->p_sys_setrate =      dlsym(p_aout->p_aout_plugin, "aout_SysSetRate"); 
    119     p_aout->p_sys_getbufinfo =   dlsym(p_aout->p_aout_plugin, "aout_SysGetBufInfo"); 
    120     p_aout->p_sys_playsamples =  dlsym(p_aout->p_aout_plugin, "aout_SysPlaySamples"); 
    121     p_aout->p_sys_close =        dlsym(p_aout->p_aout_plugin, "aout_SysClose"); 
     106    p_aout->p_sys_open =         GetPluginFunction( p_aout->p_aout_plugin, "aout_SysOpen" ); 
     107    p_aout->p_sys_reset =        GetPluginFunction( p_aout->p_aout_plugin, "aout_SysReset" ); 
     108    p_aout->p_sys_setformat =    GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetFormat" ); 
     109    p_aout->p_sys_setchannels =  GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetChannels" ); 
     110    p_aout->p_sys_setrate =      GetPluginFunction( p_aout->p_aout_plugin, "aout_SysSetRate" ); 
     111    p_aout->p_sys_getbufinfo =   GetPluginFunction( p_aout->p_aout_plugin, "aout_SysGetBufInfo" ); 
     112    p_aout->p_sys_playsamples =  GetPluginFunction( p_aout->p_aout_plugin, "aout_SysPlaySamples" ); 
     113    p_aout->p_sys_close =        GetPluginFunction( p_aout->p_aout_plugin, "aout_SysClose" ); 
    122114 
    123115    /* 
     
    126118    if ( p_aout->p_sys_open( p_aout ) ) 
    127119    { 
    128         dlclose( p_aout->p_aout_plugin ); 
     120        TrashPlugin( p_aout->p_aout_plugin ); 
    129121        free( p_aout ); 
    130122        return( NULL ); 
     
    137129    { 
    138130        p_aout->p_sys_close( p_aout ); 
    139         dlclose( p_aout->p_aout_plugin ); 
     131        TrashPlugin( p_aout->p_aout_plugin ); 
    140132        free( p_aout ); 
    141133        return( NULL ); 
     
    144136    { 
    145137        p_aout->p_sys_close( p_aout ); 
    146         dlclose( p_aout->p_aout_plugin ); 
     138        TrashPlugin( p_aout->p_aout_plugin ); 
    147139        free( p_aout ); 
    148140        return( NULL ); 
     
    151143    { 
    152144        p_aout->p_sys_close( p_aout ); 
    153         dlclose( p_aout->p_aout_plugin ); 
     145        TrashPlugin( p_aout->p_aout_plugin ); 
    154146        free( p_aout ); 
    155147        return( NULL ); 
     
    158150    { 
    159151        p_aout->p_sys_close( p_aout ); 
    160         dlclose( p_aout->p_aout_plugin ); 
     152        TrashPlugin( p_aout->p_aout_plugin ); 
    161153        free( p_aout ); 
    162154        return( NULL ); 
     
    169161    { 
    170162        p_aout->p_sys_close( p_aout ); 
    171         dlclose( p_aout->p_aout_plugin ); 
     163        TrashPlugin( p_aout->p_aout_plugin ); 
    172164        free( p_aout ); 
    173165        return( NULL ); 
     
    336328 
    337329    /* Close plugin */ 
    338     dlclose( p_aout->p_aout_plugin ); 
     330    TrashPlugin( p_aout->p_aout_plugin ); 
    339331 
    340332    /* Free structure */ 
  • src/input/input_netlist.c

    r44bcfed rec9bf58  
    103103    { 
    104104        p_input->netlist.p_ts_free[i_base + i_packets].iov_base 
    105                               = (p_input->netlist.p_ts_packets + i_packets); 
     105                          = (void *)(p_input->netlist.p_ts_packets + i_packets); 
    106106        /* Initialize TS length. */ 
    107107        (p_input->netlist.p_ts_packets[i_packets]).i_payload_end = TS_PACKET_SIZE; 
  • src/input/input_network.c

    r44bcfed rec9bf58  
    9292                    sizeof( i_socket_option ) ) == (-1) ) 
    9393    { 
    94         intf_ErrMsg("error: can't configure socket (%s)\n", strerror(errno)); 
     94        intf_ErrMsg("error: can't configure socket (SO_REUSEADDR: %s)\n", strerror(errno)); 
    9595        close( p_input->i_handle ); 
    9696        return( 1 ); 
     
    106106                    sizeof( i_socket_option ) ) == (-1) ) 
    107107    { 
    108         intf_ErrMsg("error: can't configure socket (%s)\n", strerror(errno)); 
     108        intf_ErrMsg("error: can't configure socket (SO_RCVBUF: %s)\n", strerror(errno)); 
    109109        close( p_input->i_handle ); 
    110110        return( 1 ); 
  • src/interface/interface.c

    r44bcfed rec9bf58  
    2828 *****************************************************************************/ 
    2929#include <errno.h>                                                 /* ENOMEM */ 
    30 #include <stdio.h>                                              /* sprintf() */ 
    3130#include <stdlib.h>                                      /* free(), strtol() */ 
     31#include <stdio.h>                                                   /* FILE */ 
    3232#include <string.h>                                            /* strerror() */ 
    3333#include <sys/types.h>                        /* on BSD, uio.h needs types.h */ 
    3434#include <sys/uio.h>                                          /* for input.h */ 
    35  
    36 #include <dlfcn.h>                                                /* plugins */ 
    3735 
    3836#include "config.h" 
     
    4038#include "mtime.h" 
    4139#include "threads.h" 
     40#include "plugins.h" 
    4241#include "input.h" 
    4342 
     
    9089    intf_thread_t *p_intf; 
    9190    char * psz_method; 
    92     char * psz_plugin; 
    9391 
    9492    /* Allocate structure */ 
     
    10098    } 
    10199 
    102     /* Initialize method-dependent functions */ 
     100    /* Request an interface plugin */ 
    103101    psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD ); 
    104  
    105     psz_plugin = malloc( sizeof("./interface/intf_.so") + strlen(psz_method) ); 
    106     sprintf( psz_plugin, "./interface/intf_%s.so", psz_method ); 
    107  
    108     p_intf->p_intf_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL ); 
    109  
    110     if( p_intf->p_intf_plugin == NULL ) 
    111     { 
    112         intf_ErrMsg( "error: could not open interface plugin %s\n", psz_plugin ); 
    113         free( psz_plugin ); 
     102    p_intf->p_intf_plugin = RequestPlugin( "intf", psz_method ); 
     103 
     104    if( !p_intf->p_intf_plugin ) 
     105    { 
     106        intf_ErrMsg( "error: could not open interface plugin intf_%s.so\n", psz_method ); 
    114107        free( p_intf ); 
    115108        return( NULL ); 
    116109    } 
    117     free( psz_plugin ); 
    118110 
    119111    /* Get plugins */ 
    120     p_intf->p_sys_create =  dlsym(p_intf->p_intf_plugin, "intf_SysCreate"); 
    121     p_intf->p_sys_manage =  dlsym(p_intf->p_intf_plugin, "intf_SysManage"); 
    122     p_intf->p_sys_destroy = dlsym(p_intf->p_intf_plugin, "intf_SysDestroy"); 
     112    p_intf->p_sys_create =  GetPluginFunction( p_intf->p_intf_plugin, "intf_SysCreate" ); 
     113    p_intf->p_sys_manage =  GetPluginFunction( p_intf->p_intf_plugin, "intf_SysManage" ); 
     114    p_intf->p_sys_destroy = GetPluginFunction( p_intf->p_intf_plugin, "intf_SysDestroy" ); 
    123115 
    124116    /* Initialize structure */ 
     
    137129    { 
    138130        intf_ErrMsg("error: can't create control console\n"); 
    139         dlclose( p_intf->p_intf_plugin ); 
     131        TrashPlugin( p_intf->p_intf_plugin ); 
    140132        free( p_intf ); 
    141133        return( NULL ); 
     
    145137        intf_ErrMsg("error: can't create interface\n"); 
    146138        intf_ConsoleDestroy( p_intf->p_console ); 
    147         dlclose( p_intf->p_intf_plugin ); 
     139        TrashPlugin( p_intf->p_intf_plugin ); 
    148140        free( p_intf ); 
    149141        return( NULL ); 
     
    211203 
    212204    /* Close plugin */ 
    213     dlclose( p_intf->p_intf_plugin ); 
     205    TrashPlugin( p_intf->p_intf_plugin ); 
    214206 
    215207    /* Free structure */ 
  • src/interface/main.c

    r44bcfed rec9bf58  
    7272 
    7373/* Usage fashion */ 
    74 #define SHORT_HELP                0 
    75 #define LONG_HELP                 1 
     74#define USAGE                     0 
     75#define SHORT_HELP                1 
     76#define LONG_HELP                 2 
    7677 
    7778/* Long options */ 
     
    156157    if( !p_main->p_msg )                         /* start messages interface */ 
    157158    { 
    158         fprintf(stderr, "critical error: can't initialize messages interface (%s)\n", 
    159                 strerror(errno)); 
    160         return(errno); 
     159        fprintf( stderr, "critical error: can't initialize messages interface (%s)\n", 
     160                strerror(errno) ); 
     161        return( errno ); 
    161162    } 
    162163    if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) )  /* parse cmd line */ 
    163164    { 
    164165        intf_MsgDestroy(); 
    165         return(errno); 
     166        return( errno ); 
    166167    } 
    167168    intf_MsgImm( COPYRIGHT_MESSAGE "\n" );          /* print welcome message */ 
     
    173174    { 
    174175        /* On error during vlans initialization, switch of vlans */ 
    175         intf_Msg("Virtual LANs initialization failed : vlans management is deactivated\n"); 
     176        intf_Msg( "Virtual LANs initialization failed : vlans management is deactivated\n" ); 
    176177        main_data.b_vlans = 0; 
    177178    } 
     
    186187        { 
    187188            /* On error during audio initialization, switch of audio */ 
    188             intf_Msg("Audio initialization failed : audio is deactivated\n"); 
     189            intf_Msg( "Audio initialization failed : audio is deactivated\n" ); 
    189190            main_data.b_audio = 0; 
    190191        } 
     
    280281    if( psz_env == NULL ) 
    281282    { 
    282         intf_ErrMsg("error: %s\n", strerror(ENOMEM)); 
     283        intf_ErrMsg( "error: %s\n", strerror(ENOMEM) ); 
    283284    } 
    284285    else 
     
    287288        if( putenv( psz_env ) ) 
    288289        { 
    289             intf_ErrMsg("error: %s\n", strerror(errno)); 
     290            intf_ErrMsg( "error: %s\n", strerror(errno) ); 
    290291        } 
    291292    } 
     
    303304    char psz_value[ 256 ];                               /* buffer for value */ 
    304305 
    305     sprintf(psz_value, "%d", i_value ); 
     306    sprintf( psz_value, "%d", i_value ); 
    306307    main_PutPszVariable( psz_name, psz_value ); 
    307308} 
     
    418419        case '?': 
    419420        default: 
    420             intf_ErrMsg("intf error: unknown option '%s'\n", ppsz_argv[optind - 1]); 
     421            intf_ErrMsg( "intf error: unknown option `%s'\n", ppsz_argv[optind - 1] ); 
     422            Usage( USAGE ); 
    421423            return( EINVAL ); 
    422424            break; 
     
    439441static void Usage( int i_fashion ) 
    440442{ 
    441     intf_Msg(COPYRIGHT_MESSAGE "\n"); 
    442  
    443443    /* Usage */ 
    444     intf_Msg("usage: vlc [options...] [parameters]\n" ); 
     444    intf_Msg( "Usage: vlc [options] [parameters]\n" ); 
     445 
     446    if( i_fashion == USAGE ) 
     447    { 
     448        intf_Msg( "Try `vlc --help' for more information.\n" ); 
     449        return; 
     450    } 
     451 
     452    intf_MsgImm( COPYRIGHT_MESSAGE "\n" ); 
    445453 
    446454    /* Options */ 
    447     intf_Msg("Options:\n" \ 
    448              "  -h, --help, -H, --longhelp        \tprint short/long usage\n" \ 
    449              "  -v, --version                     \tprint version information\n"\ 
    450              "  --noaudio, --novideo              \tdisable audio/video\n" \ 
    451              "  --aout {" AUDIO_OPTIONS "}            \taudio output method\n"\ 
    452              "  --stereo, --mono                  \tstereo/mono audio\n" \ 
    453              "  --vout {" VIDEO_OPTIONS "}            \tvideo output method\n"\ 
    454              "  --display <display>               \tdisplay string\n" \ 
    455              "  --width <w>, --height <h>         \tdisplay dimensions\n" \ 
    456              "  -g, --grayscale, --color          \tgrayscale/color video\n" \ 
    457              "  --novlans                         \tdisable vlans\n" \ 
    458              "  --server <host>, --port <port>    \tvideo server adress\n" \ 
    459              ); 
     455    intf_Msg( "\n" 
     456              "Options:\n" 
     457              "      --noaudio                  \tdisable audio\n" 
     458              "      --aout <plugin>            \taudio output method\n" 
     459              "      --stereo, --mono           \tstereo/mono audio\n" 
     460              "\n" 
     461              "      --novideo                  \tdisable audio\n" 
     462              "      --vout <plugin>            \tvideo output method\n" 
     463              "      --display <display>        \tdisplay string\n" 
     464              "      --width <w>, --height <h>  \tdisplay dimensions\n" 
     465              "  -g, --grayscale                \tgrayscale output\n" 
     466              "      --color                    \tcolor output\n" 
     467              "\n" 
     468              "      --novlans                  \tdisable vlans\n" 
     469              "      --server <host>            \tvideo server address\n" 
     470              "      --port <port>              \tvideo server port\n" 
     471              "\n" 
     472              "  -h, --help                     \tprint help and exit\n" 
     473              "  -H, --longhelp                 \tprint long help and exit\n" 
     474              "  -v, --version                  \toutput version information and exit\n" ); 
    460475 
    461476    if( i_fashion == SHORT_HELP ) 
     
    463478 
    464479    /* Interface parameters */ 
    465     intf_Msg("Interface parameters:\n" \ 
    466              "  " INTF_INIT_SCRIPT_VAR "=<filename>             \tinitialization script\n" \ 
    467              "  " INTF_CHANNELS_VAR "=<filename>            \tchannels list\n"\ 
    468              ); 
     480    intf_Msg( "\n" 
     481              "Interface parameters:\n" 
     482              "  " INTF_INIT_SCRIPT_VAR "=<filename>             \tinitialization script\n" 
     483              "  " INTF_CHANNELS_VAR "=<filename>            \tchannels list\n" ); 
    469484 
    470485    /* Audio parameters */ 
    471     intf_Msg("Audio parameters:\n" \ 
    472              "  " AOUT_METHOD_VAR "=<method name>        \taudio method (" AUDIO_OPTIONS ")\n" \ 
    473              "  " AOUT_DSP_VAR "=<filename>              \tdsp device path\n" \ 
    474              "  " AOUT_STEREO_VAR "={1|0}                \tstereo or mono output\n" \ 
    475              "  " AOUT_RATE_VAR "=<rate>             \toutput rate\n" \ 
    476              ); 
     486    intf_Msg( "\n" 
     487              "Audio parameters:\n" 
     488              "  " AOUT_METHOD_VAR "=<method name>        \taudio method\n" 
     489              "  " AOUT_DSP_VAR "=<filename>              \tdsp device path\n" 
     490              "  " AOUT_STEREO_VAR "={1|0}                \tstereo or mono output\n" 
     491              "  " AOUT_RATE_VAR "=<rate>             \toutput rate\n" ); 
    477492 
    478493    /* Video parameters */ 
    479     intf_Msg("Video parameters:\n" \ 
    480              "  " VOUT_METHOD_VAR "=<method name>        \tdisplay method (" VIDEO_OPTIONS ")\n" \ 
    481              "  " VOUT_DISPLAY_VAR "=<display name>      \tdisplay used\n" \ 
    482              "  " VOUT_WIDTH_VAR "=<width>               \tdisplay width\n" \ 
    483              "  " VOUT_HEIGHT_VAR "=<height>             \tdislay height\n" \ 
    484              "  " VOUT_FB_DEV_VAR "=<filename>           \tframebuffer device path\n" \ 
    485              "  " VOUT_GRAYSCALE_VAR "={1|0}             \tgrayscale or color output\n" \ 
    486              ); 
     494    intf_Msg( "\n" 
     495              "Video parameters:\n" 
     496              "  " VOUT_METHOD_VAR "=<method name>        \tdisplay method\n" 
     497              "  " VOUT_DISPLAY_VAR "=<display name>      \tdisplay used\n" 
     498              "  " VOUT_WIDTH_VAR "=<width>               \tdisplay width\n" 
     499              "  " VOUT_HEIGHT_VAR "=<height>             \tdislay height\n" 
     500              "  " VOUT_FB_DEV_VAR "=<filename>           \tframebuffer device path\n" 
     501              "  " VOUT_GRAYSCALE_VAR "={1|0}             \tgrayscale or color output\n" ); 
    487502 
    488503    /* Input parameters */ 
    489     intf_Msg("Input parameters:\n" \ 
    490              "  " INPUT_SERVER_VAR "=<hostname>          \tvideo server\n" \ 
    491              "  " INPUT_PORT_VAR "=<port>            \tvideo server port\n" \ 
    492              "  " INPUT_IFACE_VAR "=<interface>          \tnetwork interface\n"\ 
    493              "  " INPUT_VLAN_SERVER_VAR "=<hostname>     \tvlan server\n" \ 
    494              "  " INPUT_VLAN_PORT_VAR "=<port>           \tvlan server port\n"\ 
    495              ); 
     504    intf_Msg( "\n" 
     505              "Input parameters:\n" 
     506              "  " INPUT_SERVER_VAR "=<hostname>          \tvideo server\n" 
     507              "  " INPUT_PORT_VAR "=<port>            \tvideo server port\n" 
     508              "  " INPUT_IFACE_VAR "=<interface>          \tnetwork interface\n" 
     509              "  " INPUT_VLAN_SERVER_VAR "=<hostname>     \tvlan server\n" 
     510              "  " INPUT_VLAN_PORT_VAR "=<port>           \tvlan server port\n" ); 
    496511} 
    497512 
     
    503518static void Version( void ) 
    504519{ 
    505     intf_Msg(VERSION_MESSAGE "\n\n"); 
    506     intf_Msg("This is free software; see the documentation or contact <videolan@via.ecp.fr>\n" \ 
    507              "for use and copying conditions.\n" \ 
    508              "\n" \ 
    509              "This software is protected by the international copyright laws, and is\n" \ 
    510              "provided without any warranty, including the implied warranties of\n" \ 
    511              "merchantibility and fitness for a particular purpose.\n" \ 
    512             ); 
     520    intf_Msg( "vlc " PROGRAM_VERSION " " PROGRAM_CODENAME 
     521              " (" PROGRAM_BUILD ") (" PROGRAM_OPTIONS ")\n" 
     522              "Copyright 1996-2000 VideoLAN\n" 
     523              "This program comes with NO WARRANTY, to the extent permitted by law.\n" 
     524              "You may redistribute it under the terms of the GNU General Public License;\n" 
     525              "see the file named COPYING for details.\n" 
     526              "Written by the VideoLAN team at Ecole Centrale, Paris.\n" ); 
     527         
    513528} 
    514529 
  • src/misc/mtime.c

    r44bcfed rec9bf58  
    3232 *****************************************************************************/ 
    3333#include <stdio.h>                                              /* sprintf() */ 
     34#include <unistd.h>                                              /* select() */ 
    3435#include <sys/time.h> 
    3536 
  • src/video_output/video_output.c

    r44bcfed rec9bf58  
    3333#include <string.h>                                            /* strerror() */ 
    3434 
    35 #include <dlfcn.h>                                                /* plugins */ 
    36  
    3735#include "common.h" 
    3836#include "config.h" 
    3937#include "mtime.h" 
    4038#include "threads.h" 
     39#include "plugins.h" 
    4140#include "video.h" 
    4241#include "video_output.h" 
     
    9392    int             i_index;               /* index for array initialization */ 
    9493    char *          psz_method; 
    95     char *          psz_plugin; 
    9694 
    9795    /* Allocate descriptor */ 
     
    104102    } 
    105103 
    106     /* Initialize method-dependent functions */ 
     104    /* Request an interface plugin */ 
    107105    psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD ); 
    108  
    109     psz_plugin = malloc( sizeof("./video_output/vout_.so") + strlen(psz_method) ); 
    110     sprintf( psz_plugin, "./video_output/vout_%s.so", psz_method ); 
    111  
    112     p_vout->p_vout_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL ); 
    113  
    114     if( p_vout->p_vout_plugin == NULL ) 
    115     { 
    116         intf_ErrMsg( "error: could not open video plugin %s\n", psz_plugin ); 
    117         free( psz_plugin ); 
     106    p_vout->p_vout_plugin = RequestPlugin( "vout", psz_method ); 
     107 
     108    if( !p_vout->p_vout_plugin ) 
     109    { 
     110        intf_ErrMsg( "error: could not open video plugin vout_%s.so\n", psz_method ); 
    118111        free( p_vout ); 
    119112        return( NULL ); 
    120113    } 
    121     free( psz_plugin ); 
    122114 
    123115    /* Get plugins */ 
    124     p_vout->p_sys_create =  dlsym(p_vout->p_vout_plugin, "vout_SysCreate"); 
    125     p_vout->p_sys_init =    dlsym(p_vout->p_vout_plugin, "vout_SysInit"); 
    126     p_vout->p_sys_end =     dlsym(p_vout->p_vout_plugin, "vout_SysEnd"); 
    127     p_vout->p_sys_destroy = dlsym(p_vout->p_vout_plugin, "vout_SysDestroy"); 
    128     p_vout->p_sys_manage =  dlsym(p_vout->p_vout_plugin, "vout_SysManage"); 
    129     p_vout->p_sys_display = dlsym(p_vout->p_vout_plugin, "vout_SysDisplay"); 
     116    p_vout->p_sys_create =  GetPluginFunction( p_vout->p_vout_plugin, "vout_SysCreate" ); 
     117    p_vout->p_sys_init =    GetPluginFunction( p_vout->p_vout_plugin, "vout_SysInit" ); 
     118    p_vout->p_sys_end =     GetPluginFunction( p_vout->p_vout_plugin, "vout_SysEnd" ); 
     119    p_vout->p_sys_destroy = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDestroy" ); 
     120    p_vout->p_sys_manage =  GetPluginFunction( p_vout->p_vout_plugin, "vout_SysManage" ); 
     121    p_vout->p_sys_display = GetPluginFunction( p_vout->p_vout_plugin, "vout_SysDisplay" ); 
    130122 
    131123    /* Initialize thread properties - thread id and locks will be initialized 
     
    190182    if( p_vout->p_sys_create( p_vout, psz_display, i_root_window ) ) 
    191183    { 
    192         dlclose( p_vout->p_vout_plugin ); 
     184        TrashPlugin( p_vout->p_vout_plugin ); 
    193185        free( p_vout ); 
    194186        return( NULL ); 
     
    216208    { 
    217209        p_vout->p_sys_destroy( p_vout ); 
    218         dlclose( p_vout->p_vout_plugin ); 
     210        TrashPlugin( p_vout->p_vout_plugin ); 
    219211        free( p_vout ); 
    220212        return( NULL ); 
     
    225217        vout_UnloadFont( p_vout->p_default_font ); 
    226218        p_vout->p_sys_destroy( p_vout ); 
    227         dlclose( p_vout->p_vout_plugin ); 
     219        TrashPlugin( p_vout->p_vout_plugin ); 
    228220        free( p_vout ); 
    229221        return( NULL ); 
     
    241233        vout_UnloadFont( p_vout->p_large_font ); 
    242234        p_vout->p_sys_destroy( p_vout ); 
    243         dlclose( p_vout->p_vout_plugin ); 
     235        TrashPlugin( p_vout->p_vout_plugin ); 
    244236        free( p_vout ); 
    245237        return( NULL ); 
     
    12631255 
    12641256    /* Close plugin */ 
    1265     dlclose( p_vout->p_vout_plugin ); 
     1257    TrashPlugin( p_vout->p_vout_plugin );