From ec9bf58ab3453691a110fcf144d05e18f8b39183 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 4 Mar 2000 11:52:48 +0000 Subject: [PATCH] =?utf8?q?=20-=20=EF=BF=BDa=20compile=20sous=20FreeBSD=20(?= =?utf8?q?mais=20=EF=BF=BDa=20ne=20tourne=20pas)=20=20-=20les=20d=EF=BF=BD?= =?utf8?q?pendances=20sont=20cach=EF=BF=BDes=20dans=20.deps/=20au=20lieu?= =?utf8?q?=20de=20deps/=20=20-=20suppression=20d'encore=20quelques=20#incl?= =?utf8?q?ude=20inutiles.=20=20-=20la=20gestion=20des=20plugins=20est=20ma?= =?utf8?q?intenant=20encapsul=EF=BF=BDe=20dans=20misc/plugin.c=20=20=20un?= =?utf8?q?=20peu=20comme=20les=20threads,=20pour=20faciliter=20le=20portag?= =?utf8?q?e.=20=20-=20l=EF=BF=BDger=20remaniement=20de=20l'output=20pour?= =?utf8?q?=20--help=20et=20--version=20=20-=20les=20p=5Fts=5Fpacket=20sont?= =?utf8?q?=20cast=EF=BF=BDs=20en=20(void=20*)=20pour=20=EF=BF=BDviter=20un?= =?utf8?q?=20warning=20sous=20=20=20certaines=20architectures.=20=20-=20aj?= =?utf8?q?out=20de=20la=20GPL=20dans=20un=20fichier=20COPYING=20=20-=20fic?= =?utf8?q?hier=20README=20avec=20rien=20dedans=20pour=20le=20moment,=20?= =?utf8?q?=EF=BF=BD=20part=20la=20liste=20de=20=20=20toutes=20les=20person?= =?utf8?q?nes=20ayant=20particip=EF=BF=BD=20au=20projet.=20J'en=20ai=20*fo?= =?utf8?q?rc=EF=BF=BDment*=20=20=20oubli=EF=BF=BD=20certains,=20alors=20si?= =?utf8?q?=20vous=20avez=20un=20nom,=20rajoutez-le.=20de=20m=EF=BF=BDme,?= =?utf8?q?=20s'il=20=20=20y=20a=20un=20gros=20con=20que=20j'ai=20mis=20par?= =?utf8?q?=20erreur=20dans=20la=20liste=20et=20qui=20n'a=20jamais=20=20=20?= =?utf8?q?rien=20fait=20pour=20le=20projet,=20n'h=EF=BF=BDsitez=20pas=20?= =?utf8?q?=EF=BF=BD=20le=20supprimer=20sournoisement.=20=20-=20fichier=20A?= =?utf8?q?UTHORS=20avec=20la=20liste=20des=20gens=20ayant=20boss=EF=BF=BD?= =?utf8?q?=20sur=20le=20client.=20j'ai=20=20=20mis=20toutes=20les=20person?= =?utf8?q?nes=20ayant=20fait=20au=20moins=20un=20commit,=20ainsi=20que=20H?= =?utf8?q?enri=20=20=20parce=20que=20je=20sais=20qu'il=20bosse=20sur=20l'a?= =?utf8?q?udio,=20et=20HPReg,=20Steve=20et=20Oli=20parce=20=20=20qu'ils=20?= =?utf8?q?ont=20boss=EF=BF=BD=20dessus=20aussi.=20Par=20contre=20ici=20aus?= =?utf8?q?si=20j'ai=20fort=20probable-=20=20=20ment=20oubli=EF=BF=BD=20des?= =?utf8?q?=20gens.=20Corrigez=20!=20=20-=20r=EF=BF=BDpertoire=20debian/=20?= =?utf8?q?qui=20servira=20=EF=BF=BD=20cr=EF=BF=BDer=20des=20packages=20=20?= =?utf8?q?-=20rajout=20d'une=20entr=EF=BF=BDe=20pour=20faire=20`make=20ins?= =?utf8?q?tall'=20(pas=20encore=20parfait)=20=20-=20nom=20de=20code=20de?= =?utf8?q?=20la=20future=20release=200.2=20:=20`Onatopp'=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- AUTHORS | 22 +++ COPYING | 340 ++++++++++++++++++++++++++++++++ Makefile | 96 +++++---- Makefile.dep | 6 +- README | 86 ++++++++ include/audio_output.h | 1 - include/config.h | 6 +- include/input_netlist.h | 10 +- include/plugins.h | 27 +++ src/audio_output/audio_output.c | 48 ++--- src/input/input_netlist.c | 2 +- src/input/input_network.c | 4 +- src/interface/interface.c | 32 ++- src/interface/main.c | 137 +++++++------ src/misc/mtime.c | 1 + src/misc/plugins.c | 70 +++++++ src/video_output/video_output.c | 40 ++-- 17 files changed, 739 insertions(+), 189 deletions(-) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 README create mode 100644 include/plugins.h create mode 100644 src/misc/plugins.c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000000..9d624e020f --- /dev/null +++ b/AUTHORS @@ -0,0 +1,22 @@ + + Régis Duchesne + Michel Lespinasse + + Olivier Baxa + Eric Estievenart + + Jean-Philippe Grimaldi + Andres Krapf + Christophe Massiot + Vincent Seguin + Benoit Steiner + + Jean-Marc Dressler + Gaël Hendryckx + Samuel Hocevar + Michel Kaempf + + Stéphane Borel + Renaud Dartus + Henri Fallon + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000..d60c31a97a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Makefile b/Makefile index 303a0540e9..e20f485182 100644 --- a/Makefile +++ b/Makefile @@ -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, diff --git a/Makefile.dep b/Makefile.dep index 3bc8479994..fe95e18503 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -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 $@' diff --git a/README b/README new file mode 100644 index 0000000000..d5c3111cfb --- /dev/null +++ b/README @@ -0,0 +1,86 @@ + + 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 + Christophe Arnaud + Antoine Brenner + Régis Duchesne + Alexandre Francois + Hugo Haas + Mikael Journo + Michel Lespinasse + Christophe Ulses + Pierre Vandecasteele + Guillaume Vergnaud + + Olivier Baxa + Patrice Bazerque + Etienne Bernard + Arnaud Bienvenu + Régis Clément + Alexandre Duret + Eric Estievenart + Sébastien Kurz + Olivier Pomel + + Pierre Baillet + Alban Fonrouge + Jean-Philippe Grimaldi + Andres Krapf + Christophe Massiot + Mathieu Poumeyrol + Etienne Roy + Vincent Seguin + Benoit Steiner + + Arnaud de Bossoreille de Ribou + Jean-Marc Dressler + Gaël Hendryckx + Samuel Hocevar + Brieuc Jeunhomme + Michel Kaempf + Florent Rougon + + Stéphane Borel + Renaud Dartus + Henri Fallon + Jean-Michel Grimaldi + Damien Lucas + Rémi Peyronnet + Laurent Rossier + diff --git a/include/audio_output.h b/include/audio_output.h index a1465ced3f..17e9c34f20 100644 --- a/include/audio_output.h +++ b/include/audio_output.h @@ -23,7 +23,6 @@ /***************************************************************************** * Required headers: - * - ( audio_buf_info ) * - "common.h" ( boolean_t ) * - "mtime.h" ( mtime_t ) * - "threads.h" ( vlc_thread_t ) diff --git a/include/config.h b/include/config.h index 09cc1e334f..6a79293e3a 100644 --- a/include/config.h +++ b/include/config.h @@ -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 diff --git a/include/input_netlist.h b/include/input_netlist.h index 07929e32f5..c5b6a0c3d0 100644 --- a/include/input_netlist.h +++ b/include/input_netlist.h @@ -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 diff --git a/include/plugins.h b/include/plugins.h new file mode 100644 index 0000000000..e5d042a97c --- /dev/null +++ b/include/plugins.h @@ -0,0 +1,27 @@ +/***************************************************************************** + * 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 ); + diff --git a/src/audio_output/audio_output.c b/src/audio_output/audio_output.c index e7df979597..ca22fbc391 100644 --- a/src/audio_output/audio_output.c +++ b/src/audio_output/audio_output.c @@ -41,12 +41,11 @@ #include /* "intf_msg.h" */ #include /* calloc(), malloc(), free() */ -#include /* 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 ); diff --git a/src/input/input_netlist.c b/src/input/input_netlist.c index c64f5462b6..e1b2b398dc 100644 --- a/src/input/input_netlist.c +++ b/src/input/input_netlist.c @@ -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; } diff --git a/src/input/input_network.c b/src/input/input_network.c index 9e932ff43e..5781711815 100644 --- a/src/input/input_network.c +++ b/src/input/input_network.c @@ -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 ); } diff --git a/src/interface/interface.c b/src/interface/interface.c index 3636431bd6..cd869c39ab 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -27,18 +27,17 @@ * Preamble *****************************************************************************/ #include /* ENOMEM */ -#include /* sprintf() */ #include /* free(), strtol() */ +#include /* FILE */ #include /* strerror() */ #include /* on BSD, uio.h needs types.h */ #include /* for input.h */ -#include /* 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 ); diff --git a/src/interface/main.c b/src/interface/main.c index 5b6967e930..95dda7794d 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -71,8 +71,9 @@ #define OPT_PORT 172 /* Usage fashion */ -#define SHORT_HELP 0 -#define LONG_HELP 1 +#define USAGE 0 +#define SHORT_HELP 1 +#define LONG_HELP 2 /* Long options */ static const struct option longopts[] = @@ -155,14 +156,14 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) p_main->p_msg = intf_MsgCreate(); if( !p_main->p_msg ) /* start messages interface */ { - fprintf(stderr, "critical error: can't initialize messages interface (%s)\n", - strerror(errno)); - return(errno); + fprintf( stderr, "critical error: can't initialize messages interface (%s)\n", + strerror(errno) ); + return( errno ); } if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) ) /* parse cmd line */ { intf_MsgDestroy(); - return(errno); + return( errno ); } intf_MsgImm( COPYRIGHT_MESSAGE "\n" ); /* print welcome message */ @@ -172,7 +173,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) if( main_data.b_vlans && input_VlanCreate() ) { /* On error during vlans initialization, switch of vlans */ - intf_Msg("Virtual LANs initialization failed : vlans management is deactivated\n"); + intf_Msg( "Virtual LANs initialization failed : vlans management is deactivated\n" ); main_data.b_vlans = 0; } @@ -185,7 +186,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) if( main_data.p_aout == NULL ) { /* On error during audio initialization, switch of audio */ - intf_Msg("Audio initialization failed : audio is deactivated\n"); + intf_Msg( "Audio initialization failed : audio is deactivated\n" ); main_data.b_audio = 0; } } @@ -279,14 +280,14 @@ void main_PutPszVariable( char *psz_name, char *psz_value ) psz_env = malloc( strlen(psz_name) + strlen(psz_value) + 2 ); if( psz_env == NULL ) { - intf_ErrMsg("error: %s\n", strerror(ENOMEM)); + intf_ErrMsg( "error: %s\n", strerror(ENOMEM) ); } else { sprintf( psz_env, "%s=%s", psz_name, psz_value ); if( putenv( psz_env ) ) { - intf_ErrMsg("error: %s\n", strerror(errno)); + intf_ErrMsg( "error: %s\n", strerror(errno) ); } } } @@ -302,7 +303,7 @@ void main_PutIntVariable( char *psz_name, int i_value ) { char psz_value[ 256 ]; /* buffer for value */ - sprintf(psz_value, "%d", i_value ); + sprintf( psz_value, "%d", i_value ); main_PutPszVariable( psz_name, psz_value ); } @@ -417,7 +418,8 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) /* Internal error: unknown option */ case '?': default: - intf_ErrMsg("intf error: unknown option '%s'\n", ppsz_argv[optind - 1]); + intf_ErrMsg( "intf error: unknown option `%s'\n", ppsz_argv[optind - 1] ); + Usage( USAGE ); return( EINVAL ); break; } @@ -438,61 +440,74 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) *****************************************************************************/ static void Usage( int i_fashion ) { - intf_Msg(COPYRIGHT_MESSAGE "\n"); - /* Usage */ - intf_Msg("usage: vlc [options...] [parameters]\n" ); + intf_Msg( "Usage: vlc [options] [parameters]\n" ); + + if( i_fashion == USAGE ) + { + intf_Msg( "Try `vlc --help' for more information.\n" ); + return; + } + + intf_MsgImm( COPYRIGHT_MESSAGE "\n" ); /* Options */ - intf_Msg("Options:\n" \ - " -h, --help, -H, --longhelp \tprint short/long usage\n" \ - " -v, --version \tprint version information\n"\ - " --noaudio, --novideo \tdisable audio/video\n" \ - " --aout {" AUDIO_OPTIONS "} \taudio output method\n"\ - " --stereo, --mono \tstereo/mono audio\n" \ - " --vout {" VIDEO_OPTIONS "} \tvideo output method\n"\ - " --display \tdisplay string\n" \ - " --width , --height \tdisplay dimensions\n" \ - " -g, --grayscale, --color \tgrayscale/color video\n" \ - " --novlans \tdisable vlans\n" \ - " --server , --port \tvideo server adress\n" \ - ); + intf_Msg( "\n" + "Options:\n" + " --noaudio \tdisable audio\n" + " --aout \taudio output method\n" + " --stereo, --mono \tstereo/mono audio\n" + "\n" + " --novideo \tdisable audio\n" + " --vout \tvideo output method\n" + " --display \tdisplay string\n" + " --width , --height \tdisplay dimensions\n" + " -g, --grayscale \tgrayscale output\n" + " --color \tcolor output\n" + "\n" + " --novlans \tdisable vlans\n" + " --server \tvideo server address\n" + " --port \tvideo server port\n" + "\n" + " -h, --help \tprint help and exit\n" + " -H, --longhelp \tprint long help and exit\n" + " -v, --version \toutput version information and exit\n" ); if( i_fashion == SHORT_HELP ) return; /* Interface parameters */ - intf_Msg("Interface parameters:\n" \ - " " INTF_INIT_SCRIPT_VAR "= \tinitialization script\n" \ - " " INTF_CHANNELS_VAR "= \tchannels list\n"\ - ); + intf_Msg( "\n" + "Interface parameters:\n" + " " INTF_INIT_SCRIPT_VAR "= \tinitialization script\n" + " " INTF_CHANNELS_VAR "= \tchannels list\n" ); /* Audio parameters */ - intf_Msg("Audio parameters:\n" \ - " " AOUT_METHOD_VAR "= \taudio method (" AUDIO_OPTIONS ")\n" \ - " " AOUT_DSP_VAR "= \tdsp device path\n" \ - " " AOUT_STEREO_VAR "={1|0} \tstereo or mono output\n" \ - " " AOUT_RATE_VAR "= \toutput rate\n" \ - ); + intf_Msg( "\n" + "Audio parameters:\n" + " " AOUT_METHOD_VAR "= \taudio method\n" + " " AOUT_DSP_VAR "= \tdsp device path\n" + " " AOUT_STEREO_VAR "={1|0} \tstereo or mono output\n" + " " AOUT_RATE_VAR "= \toutput rate\n" ); /* Video parameters */ - intf_Msg("Video parameters:\n" \ - " " VOUT_METHOD_VAR "= \tdisplay method (" VIDEO_OPTIONS ")\n" \ - " " VOUT_DISPLAY_VAR "= \tdisplay used\n" \ - " " VOUT_WIDTH_VAR "= \tdisplay width\n" \ - " " VOUT_HEIGHT_VAR "= \tdislay height\n" \ - " " VOUT_FB_DEV_VAR "= \tframebuffer device path\n" \ - " " VOUT_GRAYSCALE_VAR "={1|0} \tgrayscale or color output\n" \ - ); + intf_Msg( "\n" + "Video parameters:\n" + " " VOUT_METHOD_VAR "= \tdisplay method\n" + " " VOUT_DISPLAY_VAR "= \tdisplay used\n" + " " VOUT_WIDTH_VAR "= \tdisplay width\n" + " " VOUT_HEIGHT_VAR "= \tdislay height\n" + " " VOUT_FB_DEV_VAR "= \tframebuffer device path\n" + " " VOUT_GRAYSCALE_VAR "={1|0} \tgrayscale or color output\n" ); /* Input parameters */ - intf_Msg("Input parameters:\n" \ - " " INPUT_SERVER_VAR "= \tvideo server\n" \ - " " INPUT_PORT_VAR "= \tvideo server port\n" \ - " " INPUT_IFACE_VAR "= \tnetwork interface\n"\ - " " INPUT_VLAN_SERVER_VAR "= \tvlan server\n" \ - " " INPUT_VLAN_PORT_VAR "= \tvlan server port\n"\ - ); + intf_Msg( "\n" + "Input parameters:\n" + " " INPUT_SERVER_VAR "= \tvideo server\n" + " " INPUT_PORT_VAR "= \tvideo server port\n" + " " INPUT_IFACE_VAR "= \tnetwork interface\n" + " " INPUT_VLAN_SERVER_VAR "= \tvlan server\n" + " " INPUT_VLAN_PORT_VAR "= \tvlan server port\n" ); } /***************************************************************************** @@ -502,14 +517,14 @@ static void Usage( int i_fashion ) *****************************************************************************/ static void Version( void ) { - intf_Msg(VERSION_MESSAGE "\n\n"); - intf_Msg("This is free software; see the documentation or contact \n" \ - "for use and copying conditions.\n" \ - "\n" \ - "This software is protected by the international copyright laws, and is\n" \ - "provided without any warranty, including the implied warranties of\n" \ - "merchantibility and fitness for a particular purpose.\n" \ - ); + intf_Msg( "vlc " PROGRAM_VERSION " " PROGRAM_CODENAME + " (" PROGRAM_BUILD ") (" PROGRAM_OPTIONS ")\n" + "Copyright 1996-2000 VideoLAN\n" + "This program comes with NO WARRANTY, to the extent permitted by law.\n" + "You may redistribute it under the terms of the GNU General Public License;\n" + "see the file named COPYING for details.\n" + "Written by the VideoLAN team at Ecole Centrale, Paris.\n" ); + } /***************************************************************************** diff --git a/src/misc/mtime.c b/src/misc/mtime.c index af4809e1b4..2f2b42b359 100644 --- a/src/misc/mtime.c +++ b/src/misc/mtime.c @@ -31,6 +31,7 @@ * Preamble *****************************************************************************/ #include /* sprintf() */ +#include /* select() */ #include #include "common.h" diff --git a/src/misc/plugins.c b/src/misc/plugins.c new file mode 100644 index 0000000000..c0cb7a3708 --- /dev/null +++ b/src/misc/plugins.c @@ -0,0 +1,70 @@ +/***************************************************************************** + * 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 /* free(), strtol() */ +#include /* sprintf() */ +#include /* 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) ); +} + diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index dd54b6b122..0341868ebe 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -32,12 +32,11 @@ #include /* sprintf() */ #include /* strerror() */ -#include /* 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 ); -- 2.39.2