Commit a9c8fda7 authored by Damien Lucas's avatar Damien Lucas

. configure.in: fixed a typo

. dvbinput: multiple streams support courtesy of Andrew de Quincey
. dvbready: timeout workaround courtesy of Andrew de Quincey
parent ef9b833a
...@@ -2,13 +2,17 @@ ...@@ -2,13 +2,17 @@
# ChangeLog for vls # # ChangeLog for vls #
#===================# #===================#
0.4.5 0.5.0
* application.cpp: search for vls.cfg in current path
* dvbreader: timeout workaround
* dvbinput: multiple stream support
* Makefile configure configure.in: Fixed 'make dist' * Makefile configure configure.in: Fixed 'make dist'
* ALL: Fixed compile issues on OpenBSD. * ALL: Fixed compile issues on OpenBSD.
* ALL: Added a command line launching solution for easy configuration * ALL: Added a command line launching solution for easy configuration
* application.cpp parsers.cpp: stream type audectection when using command line * application.cpp parsers.cpp: stream type audectection when using command
* /cvs/videolan/vls/src/modules/dvbinput/: new dvbinput working with the new line
linuxtv drivers and the libdvb (also prodvide by linuxtv.org) * src/modules/dvbinput/: new dvbinput working with the new linuxtv drivers
and the libdvb (also prodvide by linuxtv.org)
* src/extras/: added GNU getopt functions for command line compilation under * src/extras/: added GNU getopt functions for command line compilation under
Windows and MacOS X Windows and MacOS X
* /cvs/videolan/vls/doc/: Update of the VLS documentation * /cvs/videolan/vls/doc/: Update of the VLS documentation
......
...@@ -369,7 +369,7 @@ then ...@@ -369,7 +369,7 @@ then
DVBINPUT_LCFLAGS="${DVBINPUT_LCFLAGS} -L${with_dvb}/libdvb" DVBINPUT_LCFLAGS="${DVBINPUT_LCFLAGS} -L${with_dvb}/libdvb"
PLUGINS="${PLUGINS} dvbinput dvbreader" PLUGINS="${PLUGINS} dvbinput dvbreader"
else else
AC_MSG_ERROR([cannot find ${with_dvb}/libdvb/libdvb.a, make sure you compiled libdvbpsi in ${with_dvb}/libdvb]) AC_MSG_ERROR([cannot find ${with_dvb}/libdvb/libdvb.a, make sure you compiled libdvb in ${with_dvb}/libdvb])
fi fi
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvbinput.cpp: DVB streams * dvbinput.cpp: DVB streams
*------------------------------------------------------------------------------- *-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN * (c)1999-2002 VideoLAN
* $Id: dvbinput.cpp,v 1.21 2002/12/08 15:55:29 nitrox Exp $ * $Id: dvbinput.cpp,v 1.22 2003/02/03 11:47:32 nitrox Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Damien Lucas <nitrox@videolan.org> * Damien Lucas <nitrox@videolan.org>
...@@ -114,8 +114,9 @@ C_DvbInput::C_DvbInput(C_Module* pModule, ...@@ -114,8 +114,9 @@ C_DvbInput::C_DvbInput(C_Module* pModule,
m_cCurrentPat(0, 0, true) m_cCurrentPat(0, 0, true)
{ {
dvb = new DVB; dvb = new DVB;
m_iGotPat = 0; // Did not get the first PAT yet m_iGotTpid = 0; // Did not set the transponder yet
m_iGotTpid = 0; // Did not set the transponder yet m_iDemuxUsageCount = 0; // Nothing using the demux yet
m_bIgnoreTimeout = false;
m_pConverter = NULL; m_pConverter = NULL;
for(int i =0; i < 512; i++) for(int i =0; i < 512; i++)
m_iDemuxes[i] = -1; m_iDemuxes[i] = -1;
...@@ -137,6 +138,7 @@ void C_DvbInput::OnInit() ...@@ -137,6 +138,7 @@ void C_DvbInput::OnInit()
{ {
int iNumber; int iNumber;
C_String strType; C_String strType;
C_String dvbrc;
char filen[FILELEN]; char filen[FILELEN];
// Retrieve config // Retrieve config
...@@ -144,7 +146,13 @@ void C_DvbInput::OnInit() ...@@ -144,7 +146,13 @@ void C_DvbInput::OnInit()
ASSERT(pApp); ASSERT(pApp);
iNumber = pApp->GetSetting(GetName() + ".DeviceNumber", "0").ToInt(); iNumber = pApp->GetSetting(GetName() + ".DeviceNumber", "0").ToInt();
m_iSendMethod = pApp->GetSetting(GetName() + ".SendMethod", "0").ToInt();
m_bIgnoreTimeout = pApp->GetSetting(GetName()+".IgnoreTimeout", "0").ToInt();
dvbrc = pApp->GetSetting(GetName()+ ".Dvbrc", "");
if(dvbrc.Length() != 0)
{
strncpy(filen, dvbrc.GetString(), dvbrc.Length()+1);
}
dvb->init("", "", iNumber); dvb->init("", "", iNumber);
m_strDVR = C_String(ADAPTER)+iNumber+"/dvr0"; m_strDVR = C_String(ADAPTER)+iNumber+"/dvr0";
...@@ -199,6 +207,7 @@ void C_DvbInput::OnInit() ...@@ -199,6 +207,7 @@ void C_DvbInput::OnInit()
ASSERT(pReaderModule); ASSERT(pReaderModule);
m_cInputBroadcast.SetOption("device", m_strDVR); m_cInputBroadcast.SetOption("device", m_strDVR);
m_cInputBroadcast.SetOption("IgnoreTimeout", m_bIgnoreTimeout);
m_pReader = pReaderModule->NewMpegReader(&m_cInputBroadcast); m_pReader = pReaderModule->NewMpegReader(&m_cInputBroadcast);
ASSERT(m_pReader); ASSERT(m_pReader);
...@@ -219,10 +228,6 @@ void C_DvbInput::OnInit() ...@@ -219,10 +228,6 @@ void C_DvbInput::OnInit()
cConfig.m_pEventHandler = this; cConfig.m_pEventHandler = this;
m_pConverter = pConverterModule->NewMpegConverter(cConfig); m_pConverter = pConverterModule->NewMpegConverter(cConfig);
ASSERT(m_pConverter); ASSERT(m_pConverter);
// Launch the demux
m_pConverter->Create();
} }
...@@ -237,16 +242,19 @@ void C_DvbInput::OnDestroy() ...@@ -237,16 +242,19 @@ void C_DvbInput::OnDestroy()
if(m_pConverter) if(m_pConverter)
{ {
// Stop the input stream // Stop the input converter if necessary
try if(m_pConverter->IsRunning())
{
m_pConverter->Stop();
}
catch(E_Exception e)
{ {
m_cEndInit.Release(); try
delete m_pConverter; {
throw e; m_pConverter->Stop();
}
catch(E_Exception e)
{
m_cEndInit.Release();
delete m_pConverter;
throw e;
}
} }
delete m_pConverter; delete m_pConverter;
...@@ -455,7 +463,6 @@ void C_DvbInput::OnDvbPsiPatEvent(int iEvent) ...@@ -455,7 +463,6 @@ void C_DvbInput::OnDvbPsiPatEvent(int iEvent)
// Kludge: signal the first PAT arrival. // Kludge: signal the first PAT arrival.
m_cEndInit.Protect(); m_cEndInit.Protect();
m_iGotPat = 1;
m_cEndInit.Signal(); m_cEndInit.Signal();
m_cEndInit.Release(); m_cEndInit.Release();
} }
...@@ -471,23 +478,22 @@ void C_DvbInput::OnStartStreaming(C_Broadcast* pBroadcast) ...@@ -471,23 +478,22 @@ void C_DvbInput::OnStartStreaming(C_Broadcast* pBroadcast)
int iIndex=m_vProgramNames.Find(pBroadcast->GetProgram()->GetName()); int iIndex=m_vProgramNames.Find(pBroadcast->GetProgram()->GetName());
LogDbg(m_hLog, "DVB Channel found: "+dvb->chans[iIndex].name); LogDbg(m_hLog, "DVB Channel found: "+dvb->chans[iIndex].name);
// Check that if we have already got one broadcast going that this // Lock the demux usage
// new one is on the same mux (transponder) m_cDemuxUsageM.Lock();
if(m_iGotPat && m_iGotTpid != dvb->chans[iIndex].tpid)
{ //If we have not already started the demux, do so and wait for the first PAT
LogDbg(m_hLog, "Attempting to start reception from different transponder." \ if (m_iDemuxUsageCount == 0)
"Existing transponder is " + m_iGotTpid + " asked transponder is " +
dvb->chans[iIndex].tpid);
return;
}
if (!m_iGotPat)
{ {
// Set the frontend up // Set the frontend up
dvb->SetTP(dvb->chans[iIndex].tpid, dvb->chans[iIndex].satid); dvb->SetTP(dvb->chans[iIndex].tpid, dvb->chans[iIndex].satid);
dvb->set_front(); dvb->set_front();
// Put a filter on PAT sleep(3);
//Launch the demux
m_pConverter->Create();
// Add a filter for PAT
SelectPid(&m_cPatDecoder, 0x0000, TS_TYPE_NULL); SelectPid(&m_cPatDecoder, 0x0000, TS_TYPE_NULL);
// Wait for the first PAT // Wait for the first PAT
...@@ -495,6 +501,23 @@ void C_DvbInput::OnStartStreaming(C_Broadcast* pBroadcast) ...@@ -495,6 +501,23 @@ void C_DvbInput::OnStartStreaming(C_Broadcast* pBroadcast)
m_cEndInit.Release(); m_cEndInit.Release();
m_iGotTpid = dvb->chans[iIndex].tpid; // Remember the transponder m_iGotTpid = dvb->chans[iIndex].tpid; // Remember the transponder
} }
else
{
//Check that if we have already got one broadcast going this
//new one is on the same mux (transponder)
if(m_iGotTpid != dvb->chans[iIndex].tpid)
{
Log(m_hLog, LOG_ERROR, C_String("Attempting to start reception from" \
" different transponder.Existing Transponder is") +m_iGotTpid +
" New transponder is" + dvb->chans[iIndex].tpid);
m_cDemuxUsageM.UnLock();
return;
}
}
// Update Demux Counter and unlock
m_iDemuxUsageCount++;
m_cDemuxUsageM.UnLock();
// Get the program // Get the program
dvbpsi_pat_program_t *pProgram = dvbpsi_pat_program_t *pProgram =
...@@ -520,15 +543,17 @@ void C_DvbInput::OnStartStreaming(C_Broadcast* pBroadcast) ...@@ -520,15 +543,17 @@ void C_DvbInput::OnStartStreaming(C_Broadcast* pBroadcast)
try try
{ {
u16 iNumber = pBroadcast->GetProgram()->GetName().ToInt();
pStreamer->Create(); pStreamer->Create();
pMux->Attach(); pMux->Attach();
pMux->AttachProgram(pProgram->i_number, pProgram->i_pid); pMux->AttachProgram(pProgram->i_number, pProgram->i_pid);
m_cMuxes.Add(pProgram->i_number, pMux); m_cMuxes.Add(iNumber, pMux);
m_cStreamers.Add(pProgram->i_number, pStreamer); m_cStreamers.Add(iNumber, pStreamer);
} }
catch(E_Exception e) catch(E_Exception e)
...@@ -573,8 +598,20 @@ void C_DvbInput::OnStopStreaming(C_Broadcast* pBroadcast) ...@@ -573,8 +598,20 @@ void C_DvbInput::OnStopStreaming(C_Broadcast* pBroadcast)
{ {
m_cLock.Lock(); m_cLock.Lock();
//Unset the filter on PAT //Lock demux counter and decrement usage counter
UnselectPid(&m_cPatDecoder, 0x0000); m_cDemuxUsageM.Lock();
m_iDemuxUsageCount--;
// If the usage counter is 0, we have to remove the PAT filter and suspend
// the demux
if(m_iDemuxUsageCount==0)
{
//Unset the filter on PAT
UnselectPid(&m_cPatDecoder, 0x0000);
m_pConverter->Stop();
}
m_cDemuxUsageM.UnLock();
u16 iNumber = pBroadcast->GetProgram()->GetName().ToInt(); u16 iNumber = pBroadcast->GetProgram()->GetName().ToInt();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvbinput.h: DVB Input class definition * dvbinput.h: DVB Input class definition
*------------------------------------------------------------------------------- *-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN * (c)1999-2002 VideoLAN
* $Id: dvbinput.h,v 1.12 2002/12/08 15:55:29 nitrox Exp $ * $Id: dvbinput.h,v 1.13 2003/02/03 11:47:32 nitrox Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* *
...@@ -73,6 +73,7 @@ private: ...@@ -73,6 +73,7 @@ private:
C_String m_strVIDEO; C_String m_strVIDEO;
bool m_bHasDecoder; bool m_bHasDecoder;
bool m_bIgnoreTimeout;
C_Vector<C_String> m_vProgramNames; C_Vector<C_String> m_vProgramNames;
int m_iFrequency; int m_iFrequency;
...@@ -87,8 +88,9 @@ private: ...@@ -87,8 +88,9 @@ private:
int m_iSendMethod; int m_iSendMethod;
// Kludge: signal the first PAT arrival. // Kludge: signal the first PAT arrival.
int m_iGotPat; int m_iDemuxUsageCount;
int m_iGotTpid; int m_iGotTpid;
C_Mutex m_cDemuxUsageM;
C_Condition m_cEndInit; C_Condition m_cEndInit;
// Demuxes' file descriptors // Demuxes' file descriptors
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvbreader.cpp: file reader * dvbreader.cpp: file reader
*------------------------------------------------------------------------------- *-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN * (c)1999-2002 VideoLAN
* $Id: dvbreader.cpp,v 1.2 2002/11/19 14:08:07 nitrox Exp $ * $Id: dvbreader.cpp,v 1.3 2003/02/03 11:47:32 nitrox Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Tristan Leteurtre <tooney@videolan.org> * Tristan Leteurtre <tooney@videolan.org>
...@@ -85,6 +85,7 @@ C_DvbMpegReader::C_DvbMpegReader(C_Module* pModule, ...@@ -85,6 +85,7 @@ C_DvbMpegReader::C_DvbMpegReader(C_Module* pModule,
C_MpegReader(pModule, pBroadcast) C_MpegReader(pModule, pBroadcast)
{ {
m_strDeviceName=pBroadcast->GetOption("device"); m_strDeviceName=pBroadcast->GetOption("device");
m_bIgnoreTimeout=pBroadcast->GetOption("IgnoreTimeout").ToInt();
} }
...@@ -124,9 +125,9 @@ int C_DvbMpegReader::Read(byte* pBuff, int iSize) ...@@ -124,9 +125,9 @@ int C_DvbMpegReader::Read(byte* pBuff, int iSize)
if(poll(pfd, 1, 10000)) if(poll(pfd, 1, 10000))
{ {
if(pfd[0].revents & POLLIN) { iRc=read(m_hFd, pBuff, 188);} if(pfd[0].revents & POLLIN) { iRc=read(m_hFd, pBuff, 188);}
else return MPEG_STREAMERROR; else if (!m_bIgnoreTimeout)return MPEG_STREAMERROR;
} }
else else if (!m_bIgnoreTimeout)
{ {
printf("Time out !\n"); printf("Time out !\n");
return MPEG_STREAMERROR; return MPEG_STREAMERROR;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvbreader.h: file reader * dvbreader.h: file reader
*------------------------------------------------------------------------------- *-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN * (c)1999-2002 VideoLAN
* $Id: dvbreader.h,v 1.2 2002/12/27 00:18:14 tooney Exp $ * $Id: dvbreader.h,v 1.3 2003/02/03 11:47:32 nitrox Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Tristan Leteutre <tooney@videolan.org> * Tristan Leteutre <tooney@videolan.org>
...@@ -54,6 +54,7 @@ protected: ...@@ -54,6 +54,7 @@ protected:
C_String m_strDeviceName; C_String m_strDeviceName;
int m_hFd; int m_hFd;
bool m_bIgnoreTimeout;
bool m_bLoop; bool m_bLoop;
bool m_bEnd; bool m_bEnd;
}; };
......
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