Commit 5d8b0775 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Telnet command options implemented:

- channel ... --add and --delete
- program ... --add and --delete
- show [broadcast|channel|program|input]

Remove unused "Program Number" from C_Program. It does not show up in "browse" and "show program" commands.
parent c5dad8f1
......@@ -2,7 +2,7 @@
* dvbinput.cpp: DVB streams
*-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN
* $Id: dvbinput.cpp,v 1.12 2002/09/22 01:38:54 nitrox Exp $
* $Id: dvbinput.cpp,v 1.13 2002/09/26 16:05:32 jpsaman Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -683,3 +683,7 @@ void C_DvbInput::OnUpdateProgram(C_String strProgram,
C_String strFileName, C_String strType)
{
}
void C_DvbInput::OnDeleteProgram(C_String strProgram)
{
}
......@@ -2,7 +2,7 @@
* dvbinput.h: DVB Input class definition
*-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN
* $Id: dvbinput.h,v 1.6 2002/09/22 01:38:54 nitrox Exp $
* $Id: dvbinput.h,v 1.7 2002/09/26 16:05:32 jpsaman Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -50,6 +50,7 @@ protected:
virtual void OnStopStreaming(C_Broadcast* pBroadcast);
virtual void OnUpdateProgram(C_String strProgram,
C_String strFileName, C_String strType);
virtual void OnDeleteProgram(C_String strProgram);
virtual C_List<C_Program> OnGetAvailablePgrms();
// Hardware specific PID selection (demux)
......
......@@ -2,7 +2,7 @@
* localinput.cpp: Local streams
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: localinput.cpp,v 1.9 2002/09/04 10:56:34 jpsaman Exp $
* $Id: localinput.cpp,v 1.10 2002/09/26 16:05:33 jpsaman Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -415,7 +415,7 @@ void C_LocalInput::OnStopStreaming(C_Broadcast* pBroadcast)
}
//------------------------------------------------------------------------------
// Rewind the reception of the given program with specified speed
//
//------------------------------------------------------------------------------
void C_LocalInput::OnUpdateProgram(C_String strProgram,
C_String strFileName, C_String strType)
......@@ -423,6 +423,12 @@ void C_LocalInput::OnUpdateProgram(C_String strProgram,
C_String strPgrmCount = m_cSettings.GetSetting("Input.ProgramCount", "0");
unsigned int uiPgrmCount = strPgrmCount.ToInt();
unsigned int uiId = m_vProgramNames.Find(strProgram) + 1;
if (uiId>0)
{
Log(m_hLog, LOG_WARN, "The program already exists in the list for this input");
}
if(uiPgrmCount)
{
uiPgrmCount++;
......@@ -443,9 +449,99 @@ void C_LocalInput::OnUpdateProgram(C_String strProgram,
}
else
{
Log(m_hLog, LOG_WARN,
throw E_Exception(GEN_ERR,
"The \"ProgramCount\" variable isn't specified in the file \"" +
m_strConfigPath + "/input.cfg\"");
}
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void C_LocalInput::OnDeleteProgram(C_String strProgram)
{
// Get the type of the program
unsigned int uiId = m_vProgramNames.Find(strProgram) + 1;
if (uiId>0)
{
// Delete settings from m_cSettings
C_String strPgrmCount = m_cSettings.GetSetting("Input.ProgramCount", "0");
unsigned int uiPgrmCount = strPgrmCount.ToInt();
if(uiPgrmCount)
{
C_String strDelKey = C_String(uiId)+ ".Name";
m_cSettings.Delete(strDelKey.ToLower());
if (m_cSettings.GetSetting(C_String(uiId)+".FileName", "") != "" )
{
strDelKey = C_String(uiId)+ ".FileName";
m_cSettings.Delete(strDelKey.ToLower());
}
if (m_cSettings.GetSetting(C_String(uiId)+".Device", "") != "" )
{
strDelKey = C_String(uiId)+ ".Device";
m_cSettings.Delete(strDelKey.ToLower());
}
strDelKey = C_String(uiId)+ ".Type";
m_cSettings.Delete(strDelKey.ToLower());
// Move all other settings one item down
for(unsigned int ui = uiId; ui <= uiPgrmCount; ui++)
{
C_String strProgram = m_cSettings.GetSetting(C_String(ui+1) + ".Name",C_String("Pgrm") + ui+1);
C_String strFileName = m_cSettings.GetSetting(C_String(ui+1)+".FileName", "");
C_String strType = m_cSettings.GetSetting(C_String(ui+1) + ".Type", "Mpeg2-TS");
C_String strDevice = m_cSettings.GetSetting(C_String(ui+1)+".Device", "");
// update settings
C_String strKey = C_String(ui)+ ".Name";
m_cSettings.Update(strKey.ToLower(),strProgram);
strKey = C_String(ui)+ ".FileName";
if (strFileName != "")
{
m_cSettings.Update(strKey.ToLower(), strFileName);
}
else
m_cSettings.Update(strKey.ToLower(), "");
strKey = C_String(ui)+ ".Device";
if (strDevice != "")
{
m_cSettings.Update(strKey.ToLower(), strDevice);
}
else
m_cSettings.Update(strKey.ToLower(), "");
strKey = C_String(ui)+ ".Type";
m_cSettings.Update(strKey.ToLower(), strType);
}
// Lower program count
uiPgrmCount--;
strDelKey = C_String("Input.ProgramCount");
m_cSettings.Update(strDelKey.ToLower(), C_String(uiPgrmCount));
m_vProgramNames.Delete(uiId);
// ** DEBUG **
Log(m_hLog, LOG_NOTE, "Debugging inputs m_cSettings list.");
C_String strPgrmCount = m_cSettings.GetSetting("Input.ProgramCount", "0");
unsigned int uiPgrmCount = strPgrmCount.ToInt();
for(unsigned int ui = 1; ui <= uiPgrmCount; ui++)
{
C_String strProgram = m_cSettings.GetSetting(C_String(ui) + ".Name",C_String("Pgrm") + ui);
C_String strFileName = m_cSettings.GetSetting(C_String(ui)+".FileName", "");
C_String strDevice = m_cSettings.GetSetting(C_String(ui)+".Device", "");
C_String strType = m_cSettings.GetSetting(C_String(ui) + ".Type", "Mpeg2-TS").ToLower();
Log(m_hLog, LOG_NOTE, "Program: \"" + strProgram +"\"");
Log(m_hLog, LOG_NOTE, " FileName: \"" + strFileName+"\"");
Log(m_hLog, LOG_NOTE, " Device: \"" + strDevice+"\"");
Log(m_hLog, LOG_NOTE, " Type: \"" + strType+"\"");
}
}
else
{
throw E_Exception(GEN_ERR,"Deleting program information from input failed");
}
}
else
{
throw E_Exception(GEN_ERR, "The program is not known by this input.");
}
}
......@@ -2,7 +2,7 @@
* localinput.h: Local Input class definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: localinput.h,v 1.3 2002/09/04 10:56:34 jpsaman Exp $
* $Id: localinput.h,v 1.4 2002/09/26 16:05:33 jpsaman Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -56,6 +56,7 @@ protected:
virtual void OnSuspendStreaming(C_Broadcast* pBroadcast);
virtual void OnStopStreaming(C_Broadcast* pBroadcast);
virtual void OnUpdateProgram(C_String strProgram,C_String strFileName, C_String strType);
virtual void OnDeleteProgram(C_String strProgram);
virtual C_List<C_Program> OnGetAvailablePgrms();
private:
......
......@@ -2,7 +2,7 @@
* videoinput.cpp: Video4linux streams
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: videoinput.cpp,v 1.11 2002/09/16 20:24:33 asmax Exp $
* $Id: videoinput.cpp,v 1.12 2002/09/26 16:05:33 jpsaman Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -356,3 +356,7 @@ void C_VideoInput::OnUpdateProgram(C_String strProgram,
C_String strFileName, C_String strType)
{
}
void C_VideoInput::OnDeleteProgram(C_String strProgram)
{
}
......@@ -2,7 +2,7 @@
* videoinput.h: Video Input class definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: videoinput.h,v 1.4 2002/09/04 10:56:34 jpsaman Exp $
* $Id: videoinput.h,v 1.5 2002/09/26 16:05:33 jpsaman Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
......@@ -53,6 +53,7 @@ protected:
virtual void OnStopStreaming(C_Broadcast* pBroadcast);
virtual void OnUpdateProgram(C_String strProgram,
C_String strFileName, C_String strType);
virtual void OnDeleteProgram(C_String strProgram);
virtual C_List<C_Program> OnGetAvailablePgrms();
......
......@@ -2,7 +2,7 @@
* rtp.cpp: RTP header manipulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: rtp.cpp,v 1.2 2002/08/13 22:13:46 massiot Exp $
* $Id: rtp.cpp,v 1.3 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Tristan Leteurtre <tooney@via.ecp.fr>
* Jean-Paul Saman <saman@natlab.research.philips.com>
......@@ -66,8 +66,9 @@ u8 C_RtpHeader::BuildHeader(u16 iCounter)
bData[1] = 33; // Mpeg2-TS A/V at 90 kHz, as defined in RFC 1890
// Set sequence number with initial random iCounter
bData[2] = iCounter >> 8;
bData[3] = iCounter;
bData[2] = iCounter >> 8; //msb
bData[3] = iCounter; //lsb
// byte 4,5,6,7 is the PCR time stamp in our case
bData[4]=bData[5]=bData[6]=bData[7]=0xFF;
// byte 8,9,10,11 are the synchronization source (SSRC)
......
......@@ -2,7 +2,7 @@
* admin.cpp:
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: admin.cpp,v 1.13 2002/09/10 11:56:28 tooney Exp $
* $Id: admin.cpp,v 1.14 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
......@@ -245,6 +245,15 @@ int C_Admin::Init()
pCmdDesc->m_vOptionalArgs.Add(pStr);
pCmdDesc->BuildUsage();
m_cCmdDescriptions.Add(pCmdDesc->m_strName, pCmdDesc);
// -- show [broadcast|channel|program|input]
pCmdDesc = new C_CommandDesc("show",
"show running broadcasts, available channels, programs or inputs",
"Called with one argument, \"show\" gives information about "
" running broadcasts or available channels, programs or inputs.");
pStr = new C_String("command");
pCmdDesc->m_vMandatoryArgs.Add(pStr);
pCmdDesc->BuildUsage();
m_cCmdDescriptions.Add(pCmdDesc->m_strName, pCmdDesc);
// -- config <filename> [--load] [--save]
pCmdDesc = new C_CommandDesc("config",
"load and save configuration file.",
......@@ -349,7 +358,7 @@ int C_Admin::Init()
pCmdDesc->m_vBooleans.Add(pStr);
pCmdDesc->BuildUsage();
m_cCmdDescriptions.Add(pCmdDesc->m_strName, pCmdDesc);
// -- start <program> <channel> <input> [--loop] [--end]
// -- start <program> <channel> <input> [--loop] [--end] [--rtp]
pCmdDesc = new C_CommandDesc("start",
"launches a program.",
"\"start\" launches the specified program of the specified input"
......@@ -366,8 +375,6 @@ int C_Admin::Init()
pCmdDesc->m_vBooleans.Add(pStr);
pStr = new C_String("rtp");
pCmdDesc->m_vBooleans.Add(pStr);
pStr = new C_String("end"); // jump to end of file
pCmdDesc->m_vBooleans.Add(pStr);
pCmdDesc->m_bExtendedOptions = true;
pCmdDesc->BuildUsage();
m_cCmdDescriptions.Add(pCmdDesc->m_strName, pCmdDesc);
......
......@@ -2,7 +2,7 @@
* directory.cpp: programs definition and registration
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: directory.cpp,v 1.1 2001/10/06 21:23:37 bozo Exp $
* $Id: directory.cpp,v 1.2 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -82,6 +82,14 @@ void C_PgrmInfo::AddProvider(C_Input* pInput)
}
bool C_PgrmInfo::DeleteProvider(C_Input* pInput)
{
ASSERT(pInput);
ASSERT(!m_cProviders.Find(*pInput) < 0);
//m_cProviders.Delete(pInput);
return false;
}
/*******************************************************************************
* C_PgrmDirectoryBrowser class
......@@ -160,8 +168,20 @@ int C_PgrmDirectory::Add(const C_Program& cProgram, C_Input* pInput)
int C_PgrmDirectory::Remove(const C_Program& cProgram, C_Input* pInput)
{
ASSERT(false);
return GEN_ERR;
ASSERT(pInput);
int iRc = GEN_ERR;
C_String strPgrmName = cProgram.GetName();
C_PgrmInfo* pInfo = m_cPgrmList.Find(strPgrmName);
if(pInfo)
{
//pInfo->DeleteProvider(pInput);
iRc = m_cPgrmList.Remove(strPgrmName);
}
return iRc;
}
......
......@@ -2,7 +2,7 @@
* directory.h: Program description and registration classes definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: directory.h,v 1.1 2001/10/06 21:23:37 bozo Exp $
* $Id: directory.h,v 1.2 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -61,6 +61,7 @@ class C_PgrmInfo
const C_Vector<C_Input>& GetProviders() const;
bool IsProvider(C_Input* pInput) const;
void AddProvider(C_Input* pInput);
bool DeleteProvider(C_Input* pInput);
private:
C_Program m_cProgram;
......
......@@ -2,7 +2,7 @@
* input.cpp: Input streams
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: input.cpp,v 1.7 2002/09/04 14:38:37 jpsaman Exp $
* $Id: input.cpp,v 1.8 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -325,8 +325,8 @@ C_Answer C_Input::UpdateProgram(C_String strProgram, C_String strFileName,
try
{
LogDbg(m_hLog, "Program "+strProgram+" added.");
OnUpdateProgram(strProgram, strFileName, strType);
LogDbg(m_hLog, "Program "+strProgram+" added.");
// Build the answer
cAnswer.SetStatus(NO_ERR);
......@@ -344,6 +344,33 @@ C_Answer C_Input::UpdateProgram(C_String strProgram, C_String strFileName,
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
C_Answer C_Input::DeleteProgram(C_String strProgram)
{
C_Answer cAnswer(GetName());
try
{
OnDeleteProgram(strProgram);
LogDbg(m_hLog, "Configuration Program "+strProgram+" removed.");
// Build the answer
cAnswer.SetStatus(NO_ERR);
cAnswer.AddMessage("Configuration Program " + strProgram + " removed.");
}
catch(E_Exception e)
{
// Build the answer
cAnswer.SetStatus(e.GetCode());
cAnswer.AddMessage("Unable to delete program "+strProgram);
cAnswer.AddMessage(e.Dump());
}
return cAnswer;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* input.h: Input class definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: input.h,v 1.5 2002/09/04 14:38:37 jpsaman Exp $
* $Id: input.h,v 1.6 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -83,6 +83,7 @@ class C_Input
C_Answer SuspendStreaming(C_Broadcast* pBroadcast);
C_Answer StopStreaming(C_Broadcast* pBroadcast);
C_Answer UpdateProgram(C_String strProgram, C_String strFileName, C_String strType);
C_Answer DeleteProgram(C_String strProgram);
// List of available programs
C_List<C_Program> GetAvailablePgrms();
......@@ -103,6 +104,7 @@ class C_Input
virtual void OnStopStreaming(C_Broadcast* pBroadcast) = 0;
virtual void OnUpdateProgram(C_String strProgram, C_String strFileName,
C_String strType) = 0;
virtual void OnDeleteProgram(C_String strProgram) = 0;
// Child program table browsing
virtual C_List<C_Program> OnGetAvailablePgrms() = 0;
// Input internal failure management
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* manager.h: Manager class definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: manager.h,v 1.3 2002/09/04 10:56:35 jpsaman Exp $
* $Id: manager.h,v 1.4 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -63,6 +63,7 @@ class C_Manager : public C_RequestHandler, public C_EventHandler,
// Commands processing
C_Answer Browse(const C_Request& cRequest);
C_Answer Show(const C_Request& cRequest);
C_Answer Start(const C_Request& cRequest);
C_Answer Resume(const C_Request& cRequest);
C_Answer Suspend(const C_Request& cRequest);
......
......@@ -2,7 +2,7 @@
* repository.cpp: Repository class
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: repository.cpp,v 1.1 2001/10/06 21:23:37 bozo Exp $
* $Id: repository.cpp,v 1.2 2002/09/26 16:05:34 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -174,6 +174,7 @@ template <class Key, class Data>
else
{
unsigned int iRefCount = pContainer->GetRefCount();
ASSERT(iRefCount == 0);
if(iRefCount > 0)
iRc = GEN_ERR;
else
......
......@@ -2,7 +2,7 @@
* repository.h: Repository class definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: repository.h,v 1.1 2001/10/06 21:23:37 bozo Exp $
* $Id: repository.h,v 1.2 2002/09/26 16:05:35 jpsaman Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -48,7 +48,8 @@ template <class T> class C_RepositoryItem
{
ASSERT(pItem);
m_pItem = pItem;
m_iRefCounter = 0; }
m_iRefCounter = 0;
}
~C_RepositoryItem()
{
......
......@@ -17,7 +17,7 @@ BEGIN "Groups"
# groupname = "cmd1|cmd2|..."
# --- Example:
monitor = "help|browse|logout"
master = "help|browse|start|resume|suspend|stop|shutdown|logout|config|program|input|channel"
master = "help|browse|start|resume|suspend|stop|shutdown|logout|config|program|input|channel|show"
END
# The section "Users" describes each user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment