Channels are now modules.

parent 0763b552
......@@ -2,7 +2,7 @@
# vls (VideoLAN Server) main Makefile
#-------------------------------------------------------------------------------
# (c)1999-2001 VideoLAN
# $Id: Makefile,v 1.70 2001/11/21 18:51:02 bozo Exp $
# $Id: Makefile,v 1.71 2001/11/22 01:11:45 bozo Exp $
################################################################################
......@@ -61,6 +61,12 @@ SERVERSRC= src/server/admin.cpp \
src/server/tsstreamer.cpp \
#
# Module libraries
#
MODULES= netchannel filechannel
MODULETARGETS:=$(MODULES:%:bin/%.so)
#
# Input libraries
#
......@@ -107,7 +113,7 @@ export
#
# Build rules
#
all: Makefile.opts vls $(INPUTS)
all: Makefile.opts vls $(INPUTS) $(MODULES)
Makefile.opts:
@echo "**** No configuration found, please run ./configure..."
......@@ -115,7 +121,9 @@ Makefile.opts:
clean:
rm -Rf obj
for input in "$(INPUTS)" ; do \
for module in $(MODULES) ; do \
( cd src/modules/$$module && $(MAKE) clean ) ; done
for input in $(INPUTS) ; do \
( cd src/inputs/$$input && $(MAKE) clean ) ; done
distclean: clean
......@@ -124,7 +132,9 @@ distclean: clean
rm -f Makefile.opts src/core/defs.h src/server/config.h
rm -Rf dep
rm -Rf *.log *.dbg
for input in "$(INPUTS)" ; do \
for module in $(MODULES) ; do \
( cd src/modules/$$module && $(MAKE) distclean ) ; done
for input in $(INPUTS) ; do \
( cd src/inputs/$$input && $(MAKE) distclean ) ; done
install:
......@@ -151,6 +161,10 @@ vls: Makefile.opts $(OBJ)
$(CXX) $(LCFLAGS) -o bin/$@ $(OBJ) $(LIB)
chmod 755 bin/$@
$(MODULES): %: Makefile.opts
$(MODULES): %: src/modules/%/Makefile
cd src/modules/$* && $(MAKE) ../../../bin/$*.so
$(INPUTS): %: Makefile.opts
$(INPUTS): %: src/inputs/%/Makefile
cd src/inputs/$* && $(MAKE) ../../../bin/$*.so
......@@ -186,13 +200,16 @@ snapshot:
# Copy .c .h .in .cpp and files
find src -type f -name '*.[chi]*' | while read i ; \
do cp $$i tmp/vls/$$i ; done
# Copy module Makefiles
find src/modules -type f -name Makefile | while read i ; \
do cp $$i tmp/vls/$$i ; done
# Copy input Makefiles
find src/inputs -type f -name Makefile | while read i ; \
do cp $$i tmp/vls/$$i ; done
# Copy misc files
cp AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* HOWTO \
vls.cfg Makefile Makefile.dep Makefile.input \
Makefile.input.dep Makefile.opts.in\
vls.cfg Makefile Makefile.dep Makefile.module \
Makefile.module.dep Makefile.opts.in\
configure configure.in install-sh config.sub config.guess \
tmp/vls/
# Build archives
......
################################################################################
# vls (VideoLAN Server) input Makefile
# vls (VideoLAN Server) module Makefile
# (c)1999-2001 VideoLAN
################################################################################
# Makefile skeleton for inputs building
# Makefile skeleton for modules building
# The Makefile which includes this file at the end must define at least
# - INPUT which is the name of the input;
# - MODULE which is the name of the module;
# - SRC which contains the files to be built.
......@@ -47,16 +47,16 @@ clean:
rm -Rf obj
distclean: clean
rm -f ../../../bin/$(INPUT).so
rm -f ../../../bin/$(MODULE).so
rm -Rf dep
rm -Rf *.log *.dbg
dep: $(DEP)
../../../bin/$(INPUT).so: $(OBJ)
../../../bin/$(MODULE).so: $(OBJ)
@echo "Linking $@..."
@test -d ../../../bin || mkdir -p ../../../bin
$(CXX) $(LCFLAGS) $(INPUT_LCFLAGS) -o $@ $^ $(LIB)
$(CXX) $(LCFLAGS) $(MODULE_LCFLAGS) -o $@ $^ $(LIB)
chmod 755 $@
$(OBJ): obj/%.o: dep/%.d
......@@ -65,10 +65,10 @@ $(OBJ): obj/%.o: %.cpp
@echo "Compiling $<..."
$(CXX) $(CCFLAGS) $(INCLUDE) -fPIC -o $@ -c $<
$(DEP): ../../../Makefile.input FORCE
$(DEP): ../../../Makefile.module FORCE
$(DEP): dep/%.d: %.cpp
@$(MAKE) -s --no-print-directory -f \
../../../Makefile.input.dep $@
../../../Makefile.module.dep $@
FORCE:
......@@ -2,7 +2,7 @@
# vls (VideoLAN Server) input's dependencies makefile
#-------------------------------------------------------------------------------
# (c)1999-2001 VideoLAN
# $Id: Makefile.input.dep,v 1.2 2001/10/22 12:41:28 bozo Exp $
# $Id: Makefile.module.dep,v 1.1 2001/11/22 01:11:45 bozo Exp $
################################################################################
......
......@@ -44,7 +44,7 @@ LCFLAGS+=-D_REENTRANT
VLS_LCFLAGS= @VLS_LCFLAGS@
VLS_LIB= @VLS_LIB@
INPUT_LCFLAGS= @INPUT_LCFLAGS@
MODULE_LCFLAGS= @MODULE_LCFLAGS@
#
# Common options
......
......@@ -2652,7 +2652,7 @@ fi
echo "$ac_t""$ac_cv_ld_plugins" 1>&6
if test x"$ac_cv_ld_plugins" != x"no"; then
INPUT_LCFLAGS="${INPUT_LCFLAGS} -shared"
MODULE_LCFLAGS="${MODULE_LCFLAGS} -shared"
fi
echo $ac_n "checking if \$CXX accepts -rdynamic""... $ac_c" 1>&6
......@@ -3148,7 +3148,7 @@ s%@PROFILING@%$PROFILING%g
s%@CCFLAGS@%$CCFLAGS%g
s%@DCFLAGS@%$DCFLAGS%g
s%@LCFLAGS@%$LCFLAGS%g
s%@INPUT_LCFLAGS@%$INPUT_LCFLAGS%g
s%@MODULE_LCFLAGS@%$MODULE_LCFLAGS%g
s%@VLS_LCFLAGS@%$VLS_LCFLAGS%g
s%@VLS_LIB@%$VLS_LIB%g
s%@HAVE_DVDREAD@%$HAVE_DVDREAD%g
......
......@@ -179,7 +179,7 @@ AC_CACHE_CHECK([if \$CXX accepts -shared],
[CFLAGS="${save_CFLAGS} -shared"
AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
if test x"$ac_cv_ld_plugins" != x"no"; then
INPUT_LCFLAGS="${INPUT_LCFLAGS} -shared"
MODULE_LCFLAGS="${MODULE_LCFLAGS} -shared"
fi
AC_CACHE_CHECK([if \$CXX accepts -rdynamic],
......@@ -250,7 +250,7 @@ AC_SUBST(CCFLAGS)
AC_SUBST(DCFLAGS)
AC_SUBST(LCFLAGS)
AC_SUBST(INPUT_LCFLAGS)
AC_SUBST(MODULE_LCFLAGS)
AC_SUBST(VLS_LCFLAGS)
AC_SUBST(VLS_LIB)
......
......@@ -2,7 +2,7 @@
* module.cpp: Module management
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: module.cpp,v 1.1 2001/11/21 18:51:02 bozo Exp $
* $Id: module.cpp,v 1.2 2001/11/22 01:11:45 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -219,7 +219,11 @@ void C_ModuleManager::RegisterModule(C_Module* pModule)
C_Module* C_ModuleManager::GetModule(const C_String& strType,
const C_String& strName)
{
return m_cModuleTypes.Get(strType)->Get(strName);
C_HashTable<C_String, C_Module>* pTable = m_cModuleTypes.Get(strType);
if(pTable)
return pTable->Get(strName);
else
return NULL;
}
......@@ -2,14 +2,16 @@
# "local" input Makefile
#-------------------------------------------------------------------------------
# (c)1999-2001 VideoLAN
# $Id: Makefile,v 1.1 2001/10/06 21:23:36 bozo Exp $
# $Id: Makefile,v 1.2 2001/11/22 01:11:45 bozo Exp $
################################################################################
################################################################################
# Common options
################################################################################
-include ../../../Makefile.opts
ifeq ($(shell [ ! -r ../../../Makefile.opts ] && echo 1),)
include ../../../Makefile.opts
endif
################################################################################
......@@ -20,7 +22,7 @@
# Input name
#
INPUT=local
MODULE=local
#
# Source files
......@@ -42,12 +44,12 @@ endif
# Makefile skeleton
################################################################################
-include ../../../Makefile.input
include ../../../Makefile.module
################################################################################
# Notes
################################################################################
# Look at the Makefile.input file for more information.
# Look at the Makefile.module file for more information.
......@@ -2,14 +2,16 @@
# "video" input Makefile
#-------------------------------------------------------------------------------
# (c)1999-2001 VideoLAN
# $Id: Makefile,v 1.1 2001/11/02 22:59:01 asmax Exp $
# $Id: Makefile,v 1.2 2001/11/22 01:11:45 bozo Exp $
################################################################################
################################################################################
# Common options
################################################################################
-include ../../../Makefile.opts
ifeq ($(shell [ ! -r ../../../Makefile.opts ] && echo 1),)
include ../../../Makefile.opts
endif
################################################################################
......@@ -20,26 +22,26 @@
# Input name
#
INPUT=video
MODULE=video
#
# Source files
#
SRC= reader.cpp \
videoinput.cpp \
converter.cpp
SRC= reader.cpp \
videoinput.cpp \
converter.cpp \
################################################################################
# Makefile skeleton
################################################################################
-include ../../../Makefile.input
include ../../../Makefile.module
################################################################################
# Notes
################################################################################
# Look at the Makefile.input file for more information.
# Look at the Makefile.module file for more information.
################################################################################
# "file" channel Makefile
#-------------------------------------------------------------------------------
# (c)1999-2001 VideoLAN
# $Id: Makefile,v 1.1 2001/11/22 01:11:45 bozo Exp $
################################################################################
################################################################################
# Common options
################################################################################
ifeq ($(shell [ ! -r ../../../Makefile.opts ] && echo 1),)
include ../../../Makefile.opts
endif
################################################################################
# Files description
################################################################################
#
# Module name
#
MODULE=filechannel
#
# Source files
#
SRC= filechannel.cpp \
################################################################################
# Makefile skeleton
################################################################################
include ../../../Makefile.module
################################################################################
# Notes
################################################################################
# Look at the Makefile.module file for more information.
/*******************************************************************************
* filechannel.cpp: file channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: filechannel.cpp,v 1.1 2001/11/22 01:11:45 bozo Exp $
*
* Authors: James Courtier-Dutton <James@superbug.demon.co.uk>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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.
*
*-------------------------------------------------------------------------------
*
*******************************************************************************/
//------------------------------------------------------------------------------
// Preamble
//------------------------------------------------------------------------------
#include "../../core/defs.h"
#include "../../core/core.h"
#include "../../mpeg/mpeg.h"
#include "../../mpeg/ts.h"
#include "../../server/buffer.h"
#include "../../server/output.h"
#include "../../server/channel.h"
#include "filechannel.h"
//------------------------------------------------------------------------------
// Library declaration
//------------------------------------------------------------------------------
GENERATE_LIB_ARGS(C_FileChannelModule, handle);
//******************************************************************************
// class C_FileChannel
//******************************************************************************
//
//******************************************************************************
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_FileChannel::C_FileChannel(C_Module* pModule,
const C_String& strName) : C_Channel(pModule,
strName)
{
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
C_String strFilename = pApp->GetSetting(m_strName+".FileName", "fileout.ts");
C_String strAppend = pApp->GetSetting(m_strName+".Append", "No");
bool bAppend;
if(strAppend.ToLower() == "yes")
bAppend = true;
else
bAppend = false;
m_pOutput = new C_FileOutput(strFilename, bAppend);
}
/*******************************************************************************
* filechannel.h: file channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: filechannel.h,v 1.1 2001/11/22 01:11:45 bozo Exp $
*
* Authors: James Courtier-Dutton <James@superbug.demon.co.uk>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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.
*
*-------------------------------------------------------------------------------
*
*******************************************************************************/
#ifndef _FILECHANNEL_H_
#define _FILECHANNEL_H_
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
class C_FileChannel : public C_Channel
{
public:
C_FileChannel(C_Module* pModule, const C_String& strName);
};
DECLARE_MODULE(File, Channel, "file", const C_String&);
#else
#error "Multiple inclusions of filechannel.h"
#endif
################################################################################
# "network" channel Makefile
#-------------------------------------------------------------------------------
# (c)1999-2001 VideoLAN
# $Id: Makefile,v 1.1 2001/11/22 01:11:45 bozo Exp $
################################################################################
################################################################################
# Common options
################################################################################
ifeq ($(shell [ ! -r ../../../Makefile.opts ] && echo 1),)
include ../../../Makefile.opts
endif
################################################################################
# Files description
################################################################################
#
# Module name
#
MODULE=netchannel
#
# Source files
#
SRC= netchannel.cpp \
################################################################################
# Makefile skeleton
################################################################################
include ../../../Makefile.module
################################################################################
# Notes
################################################################################
# Look at the Makefile.module file for more information.
/*******************************************************************************
* netchannel.cpp: network channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: netchannel.cpp,v 1.1 2001/11/22 01:11:45 bozo Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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.
*
*-------------------------------------------------------------------------------
*
*******************************************************************************/
//------------------------------------------------------------------------------
// Preamble
//------------------------------------------------------------------------------
#include "../../core/defs.h"
#include "../../core/core.h"
#include "../../mpeg/mpeg.h"
#include "../../mpeg/ts.h"
#include "../../server/buffer.h"
#include "../../server/output.h"
#include "../../server/channel.h"
#include "netchannel.h"
//------------------------------------------------------------------------------
// Library declaration
//------------------------------------------------------------------------------
GENERATE_LIB_ARGS(C_NetChannelModule, handle);
//******************************************************************************
// class C_NetChannel
//******************************************************************************
//
//******************************************************************************
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_NetChannel::C_NetChannel(C_Module* pModule,
const C_String& strName) : C_Channel(pModule,
strName)
{
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
C_String strInterface = pApp->GetSetting(m_strName+".Interface", "");
C_String strSrcHost = pApp->GetSetting(m_strName+".SrcHost", "0.0.0.0");
C_String strSrcPort = pApp->GetSetting(m_strName+".SrcPort", "1234");
C_String strDstHost = pApp->GetSetting(m_strName+".DstHost", "239.0.0.3");
C_String strDstPort = pApp->GetSetting(m_strName+".DstPort", "1234");
m_pOutput = new C_NetOutput(strInterface,
strSrcHost, strSrcPort, strDstHost, strDstPort);
}
/*******************************************************************************
* netchannel.h: network channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: netchannel.h,v 1.1 2001/11/22 01:11:45 bozo Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* 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.
*
*-------------------------------------------------------------------------------
*
*******************************************************************************/
#ifndef _NETCHANNEL_H_
#define _NETCHANNEL_H_
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
class C_NetChannel : public C_Channel
{
public:
C_NetChannel(C_Module* pModule, const C_String& strName);
};
DECLARE_MODULE(Net, Channel, "network", const C_String&);
#else
#error "Multiple inclusions of netchannel.h"
#endif
......@@ -2,7 +2,7 @@
* channel.cpp: Channel encapsulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: channel.cpp,v 1.2 2001/11/18 15:42:00 bozo Exp $
* $Id: channel.cpp,v 1.3 2001/11/22 01:11:45 bozo Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -50,9 +50,13 @@
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_Channel::C_Channel(const C_String& strName) : m_strName(strName)
C_Channel::C_Channel(C_Module* pModule,
const C_String& strName) : m_strName(strName)
{
ASSERT(pModule);
m_bIsFree = true;
m_pModule = pModule;
}
......@@ -91,58 +95,3 @@ void C_Channel::ReleaseOutput()
}
//******************************************************************************
// class C_NetChannel
//******************************************************************************
//
//******************************************************************************
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_NetChannel::C_NetChannel(const C_String& strName) : C_Channel(strName)
{
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
C_String strInterface = pApp->GetSetting(m_strName+".Interface", "");
C_String strSrcHost = pApp->GetSetting(m_strName+".SrcHost", "0.0.0.0");
C_String strSrcPort = pApp->GetSetting(m_strName+".SrcPort", "1234");
C_String strDstHost = pApp->GetSetting(m_strName+".DstHost", "239.0.0.3");
C_String strDstPort = pApp->GetSetting(m_strName+".DstPort", "1234");
m_pOutput = new C_NetOutput(strInterface,
strSrcHost, strSrcPort, strDstHost, strDstPort);
}
//******************************************************************************
// class C_FileChannel
//******************************************************************************
//
//******************************************************************************
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_FileChannel::C_FileChannel(const C_String& strName) : C_Channel(strName)
{
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
C_String strFilename = pApp->GetSetting(m_strName+".FileName", "fileout.ts");
C_String strAppend = pApp->GetSetting(m_strName+".Append", "No");
bool bAppend;
if(strAppend.ToLower() == "yes")
bAppend = true;
else
bAppend = false;
m_pOutput = new C_FileOutput(strFilename, bAppend);
}
......@@ -2,7 +2,7 @@
* channel.h: Channel Encapsulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: channel.h,v 1.2 2001/11/18 15:42:00 bozo Exp $
* $Id: channel.h,v 1.3 2001/11/22 01:11:45 bozo Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -38,7 +38,7 @@
class C_Channel
{
public:
C_Channel(const C_String& strName);
C_Channel(C_Module* pModule, const C_String& strName);
virtual ~C_Channel();
// The corresponding output must be initialised before use and destroyed
......@@ -60,31 +60,11 @@ class C_Channel
C_String m_strName;
C_Output* m_pOutput;