Commit 60c60513 authored by Damien Lucas's avatar Damien Lucas

. optims

parent 910253ed
......@@ -131,6 +131,7 @@ endif
#
ifeq ($(PROFILING), 1)
CCFLAGS+=-pg
LCFLAGS+=-pg
endif
#
......
......@@ -2,7 +2,7 @@
* hashtable.cpp: Hashtable manipulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: hashtable.cpp,v 1.2 2003/06/09 13:37:12 jpsaman Exp $
* $Id: hashtable.cpp,v 1.3 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -437,9 +437,10 @@ Value* C_HashTable<Key, Value>::Get(const Key& cKey) const
{
u32 uiHashCode = m_cHashMethod.Hash(cKey);
C_Vector< C_HashTableNode<Key, Value> >& cVector = m_avData[uiHashCode];
Value* pResult = NULL;
for(unsigned int iIndex = 0; iIndex < cVector.Size(); iIndex++)
unsigned int uiSize = cVector.Size();
for(unsigned int iIndex = 0; iIndex < uiSize ; iIndex++)
{
bool bFound = m_cPredicate.Compare(cVector[iIndex].m_cKey, cKey);
if(bFound)
......@@ -448,7 +449,7 @@ Value* C_HashTable<Key, Value>::Get(const Key& cKey) const
break;
}
}
return pResult;
}
......
......@@ -2,7 +2,7 @@
* settings.cpp: Application settings management
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: settings.cpp,v 1.14 2003/08/04 09:41:53 nitrox Exp $
* $Id: settings.cpp,v 1.15 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -212,7 +212,7 @@ void C_SettingsHandler::OnProperty(const C_String& strName,
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_Settings::C_Settings() : m_cSettings(31)
C_Settings::C_Settings() : m_cSettings(2311)
{
}
......
......@@ -2,7 +2,7 @@
* string.cpp: Strings manipulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: string.cpp,v 1.4 2002/11/11 09:51:00 nitrox Exp $
* $Id: string.cpp,v 1.5 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -298,7 +298,8 @@ bool C_String::operator == (const char* pszArg) const
//------------------------------------------------------------------------------
bool C_String::operator == (const C_String& strArg) const
{
return !strcmp(m_pszBuff, strArg.m_pszBuff);
return (m_pszBuff[0] == strArg.m_pszBuff[0] &&
!strcmp(m_pszBuff, strArg.m_pszBuff));
}
......
......@@ -2,7 +2,7 @@
* vector.cpp: Vectors manipulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: vector.cpp,v 1.2 2003/06/09 13:37:12 jpsaman Exp $
* $Id: vector.cpp,v 1.3 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -266,17 +266,6 @@ template <class T> void C_Vector<T>::Reserve(unsigned int uiCapacity)
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
template <class T> u32 C_Vector<T>::Size() const
{
return m_uiSize;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* vector.h: Vector container class definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: vector.h,v 1.3 2003/06/09 13:37:12 jpsaman Exp $
* $Id: vector.h,v 1.4 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -62,7 +62,7 @@ template <class T> class C_Vector
void Reserve(unsigned int iNbElem);
unsigned int Capacity() const;
unsigned int Size() const;
inline unsigned int Size() const {return m_uiSize;}
// Removal of elements is done according to the bAutoClean flag
void Empty();
......
......@@ -2,7 +2,7 @@
* filechannel.cpp: file channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: filechannel.cpp,v 1.4 2002/08/09 13:42:32 tooney Exp $
* $Id: filechannel.cpp,v 1.5 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: James Courtier-Dutton <James@superbug.demon.co.uk>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -72,23 +72,10 @@ C_Module* NewBuiltin_filechannel(handle hLog)
//
//------------------------------------------------------------------------------
C_FileChannel::C_FileChannel(C_Module* pModule,
const C_String& strName) : C_Channel(pModule,
strName)
const C_ChannelConfig& cConfig) :
C_Channel(pModule, cConfig)
{
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);
m_pOutput = new C_FileOutput(cConfig.m_strFilename, cConfig.m_bAppend);
}
......@@ -2,7 +2,7 @@
* filechannel.h: file channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: filechannel.h,v 1.1 2001/11/22 01:11:45 bozo Exp $
* $Id: filechannel.h,v 1.2 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: James Courtier-Dutton <James@superbug.demon.co.uk>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -38,11 +38,11 @@
class C_FileChannel : public C_Channel
{
public:
C_FileChannel(C_Module* pModule, const C_String& strName);
C_FileChannel(C_Module* pModule, const C_ChannelConfig& cConfig);
};
DECLARE_MODULE(File, Channel, "file", const C_String&);
DECLARE_MODULE(File, Channel, "file", const C_ChannelConfig&);
#else
......
......@@ -2,11 +2,12 @@
* nativeinterface.cpp:
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: nativeinterface.cpp,v 1.6 2003/08/01 16:07:09 nitrox Exp $
* $Id: nativeinterface.cpp,v 1.7 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Tristan Leteurtre <tristan.leteurtre@videolan.org>
* Damien Lucas <damien.lucas@anevia.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -113,8 +114,9 @@ C_NativeInterfaceSession::C_NativeInterfaceSession(C_Socket* pConnection,
//------------------------------------------------------------------------------
void C_NativeInterfaceSession::HandleMessage()
{
printf("Handling message: \"%s\"\n", m_strMessage.GetString());
unsigned int i;
if((i = m_strMessage.Length()) > 5)
m_strMessage = m_strMessage.SubString(5, i);
C_Message cMessage(m_strMessage);
s32 iType = cMessage.GetType();
if(iType != INVALID_TYPE)
......@@ -224,29 +226,29 @@ void C_NativeInterfaceSession::ProcessData()
if(cData.GetSize() <= 0)
throw E_NativeInterface("Connection reset by peer");
unsigned int iPos = 5;
unsigned int iPos = 0;
unsigned int iRef = 0;
unsigned int iSize = cData.GetSize();
while(iPos < iSize)
{
switch(cData[iPos])
if(cData[iPos] == '\r' || cData[iPos] == '\n')
{
case '\r':
case '\n':
{
HandleMessage();
break;
}
default:
{
m_strMessage += (char)cData[iPos];
break;
}
char msg[iPos-iRef+1];
memcpy(msg, &cData[iRef], iPos-iRef);
msg[iPos-iRef] = '\0';
m_strMessage += msg;
HandleMessage();
iRef = iPos + 1;
}
// Go to next char in input
iPos++;
}
char msg[iPos-iRef+1];
memcpy(msg, &cData[iRef], iPos-iRef);
msg[iPos-iRef] = '\0';
m_strMessage += msg;
}
catch(E_Stream<C_Socket> e)
{
......
......@@ -2,7 +2,7 @@
* netchannel.cpp: network channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: netchannel.cpp,v 1.7 2002/08/09 13:42:32 tooney Exp $
* $Id: netchannel.cpp,v 1.8 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -73,23 +73,19 @@ C_Module* NewBuiltin_netchannel(handle hLog)
//
//------------------------------------------------------------------------------
C_NetChannel::C_NetChannel(C_Module* pModule,
const C_String& strName) : C_Channel(pModule,
strName)
const C_ChannelConfig& cConfig) : C_Channel(pModule,
cConfig)
{
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
C_String strDomain = pApp->GetSetting(m_strName+".Domain", "Inet4").ToLower();
if(strDomain == "inet4")
m_pOutput = new C_Net4Output(m_strName);
if(cConfig.m_strDomain == "inet4")
m_pOutput = new C_Net4Output(cConfig);
#ifdef HAVE_IPV6
else if(strDomain == "inet6")
m_pOutput = new C_Net6Output(m_strName);
else if(cConfig.m_strDomain == "inet6")
m_pOutput = new C_Net6Output(cConfig);
#endif
else
throw E_Exception(GEN_ERR, "Unknown domain \"" + strDomain +
"\" for network channel \"" + m_strName + "\"");
throw E_Exception(GEN_ERR, "Unknown domain \"" + cConfig.m_strDomain +
"\" for network channel \"" + cConfig.m_strName + "\"");
}
......@@ -2,7 +2,7 @@
* netchannel.h: network channel
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: netchannel.h,v 1.1 2001/11/22 01:11:45 bozo Exp $
* $Id: netchannel.h,v 1.2 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -38,11 +38,11 @@
class C_NetChannel : public C_Channel
{
public:
C_NetChannel(C_Module* pModule, const C_String& strName);
C_NetChannel(C_Module* pModule, const C_ChannelConfig& cConfig);
};
DECLARE_MODULE(Net, Channel, "network", const C_String&);
DECLARE_MODULE(Net, Channel, "network", const C_ChannelConfig&);
#else
......
......@@ -2,7 +2,7 @@
* netoutput.cpp: network output
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: netoutput.cpp,v 1.13 2003/06/26 01:00:35 nitrox Exp $
* $Id: netoutput.cpp,v 1.14 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -37,6 +37,7 @@
#include "../../mpeg/rtp.h"
#include "../../server/buffer.h"
#include "../../server/output.h"
#include "../../server/channel.h"
#include "netoutput.h"
......@@ -53,21 +54,18 @@
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_NetOutput::C_NetOutput(const C_String& strChannelName)
C_NetOutput::C_NetOutput(const C_ChannelConfig& cConfig)
: C_Output(TS_IN_ETHER), m_cSocketBuff(TS_IN_ETHER+1)
{
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
m_strSrcHost = pApp->GetSetting(strChannelName+".SrcHost", "");
m_strSrcPort = pApp->GetSetting(strChannelName+".SrcPort", "");
m_strDstHost = pApp->GetSetting(strChannelName+".DstHost", "");
m_strDstPort = pApp->GetSetting(strChannelName+".DstPort", "1234");
m_strType =
pApp->GetSetting(strChannelName+".StreamType", "unicast").ToLower();
m_strInterface = pApp->GetSetting(strChannelName+".Interface", "");
C_String strTTL = pApp->GetSetting(strChannelName+".TTL", "0");
m_iTTL = strTTL.ToInt();
//TODO should add a C_ChannelConfig in the class ;-)
// nitrox
m_strSrcHost = cConfig.m_strSrcHost;
m_strSrcPort = cConfig.m_strSrcPort;
m_strDstHost = cConfig.m_strDstHost;
m_strDstPort = cConfig.m_strDstPort;
m_strType = cConfig.m_strType;
m_strInterface = cConfig.m_strInterface;
m_iTTL = cConfig.m_iTTL;
// Init the buffer
// The first slot is reserved for the Rtp Header
......@@ -316,8 +314,8 @@ void C_NetOutput::WriteToPort(bool RtpEncapsulation, u32 RtpSendTime)
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_Net4Output::C_Net4Output(const C_String& strChannelName) :
C_NetOutput(strChannelName)
C_Net4Output::C_Net4Output(const C_ChannelConfig& cConfig) :
C_NetOutput(cConfig)
{
}
......@@ -417,8 +415,8 @@ int C_Net4Output::PrivateWriteTo(int iBuffLen)
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_Net6Output::C_Net6Output(const C_String& strChannelName) :
C_NetOutput(strChannelName)
C_Net6Output::C_Net6Output(const C_ChannelConfig& cConfig) :
C_NetOutput(cConfig)
{
}
......
......@@ -2,7 +2,7 @@
* netoutput.h: network output
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: netoutput.h,v 1.8 2002/08/09 13:42:32 tooney Exp $
* $Id: netoutput.h,v 1.9 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -41,7 +41,7 @@
class C_NetOutput : public C_Output
{
public:
C_NetOutput(const C_String& strChannelName);
C_NetOutput(const C_ChannelConfig& cConfig);
virtual ~C_NetOutput();
virtual void OnInit();
......@@ -79,7 +79,7 @@ class C_NetOutput : public C_Output
class C_Net4Output : public C_NetOutput
{
public:
C_Net4Output(const C_String& strChannelName);
C_Net4Output(const C_ChannelConfig& cConfig);
virtual ~C_Net4Output();
virtual void OnInit();
......@@ -103,7 +103,7 @@ class C_Net4Output : public C_NetOutput
class C_Net6Output : public C_NetOutput
{
public:
C_Net6Output(const C_String& strChannelName);
C_Net6Output(const C_ChannelConfig& cConfig);
virtual ~C_Net6Output();
virtual void OnInit();
......
......@@ -2,7 +2,7 @@
* channel.cpp: Channel encapsulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: channel.cpp,v 1.5 2002/08/09 13:42:32 tooney Exp $
* $Id: channel.cpp,v 1.6 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -51,8 +51,8 @@
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_Channel::C_Channel(C_Module* pModule,
const C_String& strName) : m_strName(strName)
C_Channel::C_Channel(C_Module* pModule, const C_ChannelConfig& cConfig) :
m_strName(cConfig.m_strName)
{
ASSERT(pModule);
......
......@@ -2,7 +2,7 @@
* channel.h: Channel Encapsulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: channel.h,v 1.3 2001/11/22 01:11:45 bozo Exp $
* $Id: channel.h,v 1.4 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -29,6 +29,27 @@
#ifndef _CHANNEL_H_
#define _CHANNEL_H_
// Yes I know this is properly ugly
// But it avoids 8 lookup in the hashtable when adding a channel
// in real-time which can save precious cpu
// --
// nitrox
struct C_ChannelConfig
{
C_String m_strName;
C_String m_strSrcHost;
C_String m_strSrcPort;
C_String m_strDstHost;
C_String m_strDstPort;
C_String m_strType;
C_String m_strStreamType;
C_String m_strDomain;
C_String m_strInterface;
C_String m_strFilename;
bool m_bAppend;
int m_iTTL;
};
//------------------------------------------------------------------------------
//
......@@ -38,7 +59,7 @@
class C_Channel
{
public:
C_Channel(C_Module* pModule, const C_String& strName);
C_Channel(C_Module* pModule, const C_ChannelConfig& cConfig);
virtual ~C_Channel();
// The corresponding output must be initialised before use and destroyed
......@@ -64,7 +85,7 @@ class C_Channel
};
DECLARE_VIRTUAL_MODULE(Channel, "channel", const C_String&);
DECLARE_VIRTUAL_MODULE(Channel, "channel", const C_ChannelConfig&);
#else
......
......@@ -2,7 +2,7 @@
* manager.cpp: Vls manager
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: manager.cpp,v 1.36 2003/08/05 18:03:52 tooney Exp $
* $Id: manager.cpp,v 1.37 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -76,7 +76,8 @@ typedef C_Answer (C_Manager::*zzzz)(const C_Request&);
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
C_Manager::C_Manager(handle hLog, C_EventHub* pHub) : m_cEventQueued(0)
C_Manager::C_Manager(handle hLog, C_EventHub* pHub) : m_cEventQueued(0),
m_cBroadcastsList(211)
{
ASSERT(hLog);
......@@ -282,7 +283,7 @@ void C_Manager::InitCommands()
AddFunction("channel_add", &C_Manager::Channel_Add);
AddFunction("channel_del", &C_Manager::Channel_Del);
// AddFunction("program_ls", &C_Manager::Program_Ls);
AddFunction("program_ls", &C_Manager::Program_Ls);
}
......@@ -414,7 +415,24 @@ void C_Manager::InitChannels()
->GetModule("channel", strChannelType);
if(pModule)
{
pChannel = pModule->NewChannel(strChannelName);
C_String m_strAppend;
C_ChannelConfig cConfig;
cConfig.m_strName = strChannelName;
#define GETSETTING(x,y,z) \
x = pApp->GetSetting(strChannelName+y,z)
GETSETTING(cConfig.m_strSrcHost,".SrcHost", "");
GETSETTING(cConfig.m_strSrcPort,".SrcPort", "");
GETSETTING(cConfig.m_strDstHost,".DstHost", "");
GETSETTING(cConfig.m_strDstPort,".DstPort", "1234");
GETSETTING(cConfig.m_strType, ".Type", "unicast").ToLower();
GETSETTING(cConfig.m_strInterface, ".Interface", "");
GETSETTING(cConfig.m_iTTL, ".TTL", "0").ToInt();
GETSETTING(cConfig.m_strDomain, ".Domain", "Inet4").ToLower();
GETSETTING(cConfig.m_strFilename, ".FileName", "fileout.ts");
GETSETTING(m_strAppend, ".Append", "No").ToLower();
cConfig.m_bAppend = (m_strAppend == "yes") ? true: false;
pChannel = pModule->NewChannel(cConfig);
ASSERT(pChannel);
m_cChannelList.Add(strChannelName, pChannel);
Log(m_hLog, LOG_NOTE, "Channel '"+strChannelName+"' created");
......@@ -1327,6 +1345,7 @@ C_Answer C_Manager::Input(const C_Request& cRequest)
#include "manager_broadcast.cpp"
#include "manager_channel.cpp"
#include "manager_program.cpp"
#ifdef BACWARD_COMP
#include "manager_old.cpp"
......
......@@ -2,7 +2,7 @@
* manager_channel.cpp: Channel methods for Vls manager
*-------------------------------------------------------------------------------
* (c)1999-2003 VideoLAN
* $Id: manager_channel.cpp,v 1.2 2003/08/05 12:28:46 nitrox Exp $
* $Id: manager_channel.cpp,v 1.3 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Damien Lucas <damien.lucas@anevia.com>
* Benoit Steiner <benny@via.ecp.fr>
......@@ -85,38 +85,32 @@ C_Answer C_Manager::Channel_Ls(const C_Request& cRequest)
C_Answer C_Manager::Channel_Add (const C_Request& cRequest)
{
C_ChannelConfig cConfig;
C_Answer cAnswer("Manager");
cAnswer.SetStatus(ANS_NO_ERR);
C_String strChannelName = cRequest.GetArg("name");
ASSERT(strChannelName != "");
C_String strChannelType = cRequest.GetArg("type");
ASSERT(strChannelType != "");
C_String strDstHost = cRequest.GetArg("dest_host");
ASSERT(strDstHost != "");
C_String strDstPort = cRequest.GetArg("dest_port");
ASSERT(strDstPort != "");
C_String strStreamType = cRequest.GetArg("streamtype");
ASSERT(strStreamType != "");
cConfig.m_strName = cRequest.GetArg("name");
cConfig.m_strType = cRequest.GetArg("type");
cConfig.m_strDstHost = cRequest.GetArg("dest_host");
cConfig.m_strDstPort = cRequest.GetArg("dest_port");
cConfig.m_strStreamType = cRequest.GetArg("streamtype");
// Optional arguments
C_String strDomain = cRequest.GetArg("domain");
if (strDomain == "") strDomain = "inet4";
cConfig.m_strDomain = cRequest.GetArg("domain");
if (cConfig.m_strDomain == "") cConfig.m_strDomain = "inet4";
C_String strTTL = cRequest.GetArg("ttl");
C_String strInterface = cRequest.GetArg("interface");
cConfig.m_iTTL = cRequest.GetArg("ttl").ToInt();
if(cConfig.m_iTTL == 0) cConfig.m_iTTL = 1;
cConfig.m_strInterface = cRequest.GetArg("interface");
// check if channel is already known
C_Channel* pChannel = m_cChannelList.Get(strChannelName);
C_Channel* pChannel = m_cChannelList.Get(cConfig.m_strName);
if(pChannel)
{
cAnswer.SetStatus(ANS_CHANNEL_BUSY);
cAnswer.AddMessage("Channel already present");
m_cChannelList.Release(strChannelName);
m_cChannelList.Release(cConfig.m_strName);
return cAnswer;
}
......@@ -127,50 +121,48 @@ C_Answer C_Manager::Channel_Add (const C_Request& cRequest)
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
C_String strKey = C_String("Channels.") + strChannelName;
pApp->SetSettings( strKey, strChannelType );
strKey = strChannelName+C_String(".DstHost");
pApp->SetSettings( strKey, strDstHost );
strKey = strChannelName+C_String(".DstPort");
pApp->SetSettings( strKey, strDstPort );
if(strStreamType!="")
C_String strKey = C_String("Channels.") + cConfig.m_strName;
pApp->SetSettings( strKey, cConfig.m_strType );
strKey = cConfig.m_strName+C_String(".DstHost");
pApp->SetSettings( strKey, cConfig.m_strDstHost );
strKey = cConfig.m_strName+C_String(".DstPort");
pApp->SetSettings( strKey, cConfig.m_strDstPort );
strKey = cConfig.m_strName+C_String(".Domain");
pApp->SetSettings( strKey, cConfig.m_strDomain );
strKey = cConfig.m_strName+C_String(".TTL");
C_String a=C_String("");
a += cConfig.m_iTTL;
pApp->SetSettings( strKey, a );
if(cConfig.m_strStreamType!="")
{
strKey = strChannelName+C_String(".streamtype");
pApp->SetSettings( strKey, strStreamType );
strKey = cConfig.m_strName+C_String(".streamtype");
pApp->SetSettings( strKey, cConfig.m_strStreamType );
}
if(strDomain!="")
if(cConfig.m_strInterface!="")
{
strKey = strChannelName+C_String(".Domain");
pApp->SetSettings( strKey, strDomain );
}
if(strTTL!="")
{
strKey = strChannelName+C_String(".TTL");
pApp->SetSettings( strKey, strTTL );
}
if(strInterface!="")
{
strKey = strChannelName+C_String(".Interface");
pApp->SetSettings( strKey, strInterface );
strKey = cConfig.m_strName+C_String(".Interface");
pApp->SetSettings( strKey, cConfig.m_strInterface );
}
C_ChannelModule* pModule = (C_ChannelModule*)
C_Application::GetModuleManager()
->GetModule("channel", strChannelType);
->GetModule("channel", cConfig.m_strType);
if(pModule)
{
// Current channel
C_Channel* pChannel = NULL;
pChannel = pModule->NewChannel(strChannelName);
pChannel = pModule->NewChannel(cConfig);
ASSERT(pChannel);
m_cChannelList.Add(strChannelName, pChannel);
Log(m_hLog, LOG_NOTE, "Channel '"+strChannelName+"' created");
m_cChannelList.Add(cConfig.m_strName, pChannel);
Log(m_hLog, LOG_NOTE, "Channel '"+cConfig.m_strName+"' created");
}
else
{
cAnswer.SetStatus(GEN_ERR);
cAnswer.AddMessage("Channel type is invalid.");
Log(m_hLog, LOG_ERROR, "Channel type \"" + strChannelType + "\" invalid");
Log(m_hLog, LOG_ERROR, "Channel type \"" + cConfig.m_strType
+ "\" invalid");
}
// Unlock the chanel list
......
/*******************************************************************************
* manager_broadcast.cpp: Brodacast mtehods for Vls manager
*-------------------------------------------------------------------------------
* (c)1999-2003 VideoLAN
* $Id: manager_program.cpp,v 1.1 2003/08/05 23:18:19 nitrox Exp $
*
* Authors: Damien Lucas <damien.lucas@anevia.com>
* 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.
*
*-------------------------------------------------------------------------------
*
*******************************************************************************/
C_Answer C_Manager::Program_Ls(const C_Request& pRequest)
{
C_Answer cAnswer("Manager");
cAnswer.AddMessage("programs");
m_cProgramList.Lock();
C_PgrmDirectoryBrowser cBrowser = m_cProgramList.CreateBrowser();
while(cBrowser.HasNext())
{
C_PgrmInfo* pPgrmInfo = cBrowser.GetNext();
ASSERT(pPgrmInfo);