Commit a0cac584 authored by Damien Lucas's avatar Damien Lucas

. Broke the dvb input in order to make it work with new driver

  and future libdvd

  Wait for my next commit to try anything, this one may not work.
parent 07fc0626
......@@ -87,6 +87,7 @@ MODULE_LCFLAGS = @MODULE_LCFLAGS@
DVDREADER_LIB = @DVDREADER_LIB@
DVBINPUT_LIB = @DVBINPUT_LIB@
BUILTINS_LIB = $(patsubst %,$$%_LIB,$(shell echo ${BUILTINS} | tr '[a-z]' '[A-Z]'))
VLS_LIB += $(BUILTINS_LIB)
......
......@@ -6668,23 +6668,23 @@ then
fi
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
if test "${ac_cv_header_ost_sec_h+set}" = set; then
echo "$as_me:$LINENO: checking for ost/sec.h" >&5
echo $ECHO_N "checking for ost/sec.h... $ECHO_C" >&6
if test "${ac_cv_header_ost_sec_h+set}" = set; then
if test "${ac_cv_header_dvb_channel_h+set}" = set; then
echo "$as_me:$LINENO: checking for dvb/channel.h" >&5
echo $ECHO_N "checking for dvb/channel.h... $ECHO_C" >&6
if test "${ac_cv_header_dvb_channel_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: $ac_cv_header_ost_sec_h" >&5
echo "${ECHO_T}$ac_cv_header_ost_sec_h" >&6
echo "$as_me:$LINENO: result: $ac_cv_header_dvb_channel_h" >&5
echo "${ECHO_T}$ac_cv_header_dvb_channel_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking ost/sec.h usability" >&5
echo $ECHO_N "checking ost/sec.h usability... $ECHO_C" >&6
echo "$as_me:$LINENO: checking dvb/channel.h usability" >&5
echo $ECHO_N "checking dvb/channel.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
$ac_includes_default
#include <ost/sec.h>
#include <dvb/channel.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
......@@ -6709,12 +6709,12 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking ost/sec.h presence" >&5
echo $ECHO_N "checking ost/sec.h presence... $ECHO_C" >&6
echo "$as_me:$LINENO: checking dvb/channel.h presence" >&5
echo $ECHO_N "checking dvb/channel.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <ost/sec.h>
#include <dvb/channel.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
......@@ -6746,50 +6746,53 @@ echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
{ echo "$as_me:$LINENO: WARNING: ost/sec.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: ost/sec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: ost/sec.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: ost/sec.h: proceeding with the preprocessor's result" >&2;};;
{ echo "$as_me:$LINENO: WARNING: dvb/channel.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: dvb/channel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: dvb/channel.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: dvb/channel.h: proceeding with the preprocessor's result" >&2;};;
no:yes )
{ echo "$as_me:$LINENO: WARNING: ost/sec.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: ost/sec.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: ost/sec.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: ost/sec.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: ost/sec.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: ost/sec.h: proceeding with the preprocessor's result" >&2;};;
{ echo "$as_me:$LINENO: WARNING: dvb/channel.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: dvb/channel.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: dvb/channel.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: dvb/channel.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: dvb/channel.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: dvb/channel.h: proceeding with the preprocessor's result" >&2;};;
esac
echo "$as_me:$LINENO: checking for ost/sec.h" >&5
echo $ECHO_N "checking for ost/sec.h... $ECHO_C" >&6
if test "${ac_cv_header_ost_sec_h+set}" = set; then
echo "$as_me:$LINENO: checking for dvb/channel.h" >&5
echo $ECHO_N "checking for dvb/channel.h... $ECHO_C" >&6
if test "${ac_cv_header_dvb_channel_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_ost_sec_h=$ac_header_preproc
ac_cv_header_dvb_channel_h=$ac_header_preproc
fi
echo "$as_me:$LINENO: result: $ac_cv_header_ost_sec_h" >&5
echo "${ECHO_T}$ac_cv_header_ost_sec_h" >&6
echo "$as_me:$LINENO: result: $ac_cv_header_dvb_channel_h" >&5
echo "${ECHO_T}$ac_cv_header_dvb_channel_h" >&6
fi
if test $ac_cv_header_ost_sec_h = yes; then
if test $ac_cv_header_dvb_channel_h = yes; then
HAVE_DVB_LIB=1
else
HAVE_DVB_LIB=0
fi
if test ${HAVE_DVB_LIB}=1
then
PLUGINS="${PLUGINS} dvbinput dvbreader"
DVBINPUT_LIB="${DVBINPUT_LIB} -ldvb"
if test x${with_dvb} != x
then
CCFLAGS="${CCFLAGS} -I${with_dvb}"
DCFLAGS="${DCFLAGS} -I${with_dvb}"
fi
NEEDSRC_mpegmux=1
else
{ { echo "$as_me:$LINENO: error: The development package for DVB is not installed.
else
{ { echo "$as_me:$LINENO: error: The development library package for DVB is not installed.
Please install it and try again" >&5
echo "$as_me: error: The development package for DVB is not installed.
echo "$as_me: error: The development library package for DVB is not installed.
Please install it and try again" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
CPPFLAGS=$save_CPPFLAGS
fi
......@@ -7081,7 +7084,7 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
VLS_LIB="${VLS_LIB} ${test_LDFLAGS} -ldvbpsi"
VLS_LIB="${VLS_LIB} -ldvbpsi"
CCFLAGS="${CCFLAGS} ${test_CFLAGS}"
DCFLAGS="${DCFLAGS} ${test_CFLAGS}"
......@@ -7126,6 +7129,7 @@ fi
ac_config_files="$ac_config_files Makefile.opts src/server/config.h"
......@@ -7734,6 +7738,7 @@ s,@DCFLAGS@,$DCFLAGS,;t t
s,@LCFLAGS@,$LCFLAGS,;t t
s,@MODULE_LCFLAGS@,$MODULE_LCFLAGS,;t t
s,@DVDREADER_LIB@,$DVDREADER_LIB,;t t
s,@DVBINPUT_LIB@,$DVBINPUT_LIB,;t t
s,@VLS_LCFLAGS@,$VLS_LCFLAGS,;t t
s,@VLS_LIB@,$VLS_LIB,;t t
CEOF
......
......@@ -316,18 +316,21 @@ then
fi
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
AC_CHECK_HEADER([ost/sec.h],[
AC_CHECK_HEADER([dvb/channel.h],HAVE_DVB_LIB=1, HAVE_DVB_LIB=0)
if test ${HAVE_DVB_LIB}=1
then
PLUGINS="${PLUGINS} dvbinput dvbreader"
DVBINPUT_LIB="${DVBINPUT_LIB} -ldvb"
if test x${with_dvb} != x
then
CCFLAGS="${CCFLAGS} -I${with_dvb}"
DCFLAGS="${DCFLAGS} -I${with_dvb}"
fi
NEEDSRC_mpegmux=1
],[
AC_MSG_ERROR([The development package for DVB is not installed.
else
AC_MSG_ERROR([The development library package for DVB is not installed.
Please install it and try again])
])
fi
CPPFLAGS=$save_CPPFLAGS
fi
......@@ -387,7 +390,7 @@ then
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
AC_CHECK_HEADERS([dvbpsi/dvbpsi.h],[
VLS_LIB="${VLS_LIB} ${test_LDFLAGS} -ldvbpsi"
VLS_LIB="${VLS_LIB} -ldvbpsi"
CCFLAGS="${CCFLAGS} ${test_CFLAGS}"
DCFLAGS="${DCFLAGS} ${test_CFLAGS}"
],[
......@@ -425,6 +428,7 @@ AC_SUBST(LCFLAGS)
AC_SUBST(MODULE_LCFLAGS)
AC_SUBST(DVDREADER_LIB)
AC_SUBST(DVBINPUT_LIB)
AC_SUBST(VLS_LCFLAGS)
AC_SUBST(VLS_LIB)
......
......@@ -2,7 +2,7 @@
* application.cpp: Application class
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: application.cpp,v 1.13 2002/11/05 19:54:07 nitrox Exp $
* $Id: application.cpp,v 1.14 2002/11/11 09:51:00 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -55,7 +55,8 @@
" target:\n" \
" dvd:<device> for streaming of a dvd\n" \
" dvd:<dir> for streaming of a dvd stored on hard drive\n" \
" file:<file> for streaming of a file\n"
" file:<file> for streaming of a file\n" \
" dvb:<channel> for streaming of a dvb channel\n"
//------------------------------------------------------------------------------
// Preamble
......
......@@ -2,7 +2,7 @@
* parsers.cpp: Command line and configuration files parsers
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: parsers.cpp,v 1.6 2002/11/05 19:54:07 nitrox Exp $
* $Id: parsers.cpp,v 1.7 2002/11/11 09:51:00 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
......@@ -284,7 +284,6 @@ void C_CfgFileParser::AddCmdLineSetting(unsigned char sOption, C_String sValue)
}
else if (sMeth=="file")
{
printf("**** method: file -- Filename: %s\n", sDest1.GetString());
if(sDest1=="") throw E_Parser(GEN_ERR, "No Filname specified");
m_pCallBack->OnStartSection("Channels");
m_pCallBack->OnProperty("output1", "file");
......@@ -329,8 +328,9 @@ void C_CfgFileParser::AddCmdLineSetting(unsigned char sOption, C_String sValue)
void C_CfgFileParser::AddCmdLineTarget(C_String sTarget, C_String sTags)
{
C_String sMeth;
C_String sFile;
C_String sMeth; /* First part of the tager definition */
C_String sFile; /* Second part of the target definition */
C_String sProgramLaunch; /* Name of the program to be launch at startup */
/* Target Parsing */
if(sTarget.Find(':', 1)!=GEN_ERR)
......@@ -355,6 +355,10 @@ void C_CfgFileParser::AddCmdLineTarget(C_String sTarget, C_String sTags)
{
m_pCallBack->OnProperty("input1", "local");
}
else if(sMeth=="dvb")
{
m_pCallBack->OnProperty("input1", "dvb");
}
m_pCallBack->OnEndSection("Inputs");
/* 1 Section */
......@@ -364,8 +368,16 @@ void C_CfgFileParser::AddCmdLineTarget(C_String sTarget, C_String sTags)
{
m_pCallBack->OnProperty("Device", sFile);
m_pCallBack->OnProperty("Type", "Dvd");
sProgramLaunch = "program1";
}
else if(sMeth == "dvb")
{
// TODO user may specify in target the device number
m_pCallBack->OnProperty("DeviceNumber", "0");
sProgramLaunch = sFile;
sProgramLaunch.Replace(' ', '_');
}
else if(sMeth== "file")
else if(sMeth == "file")
{
m_pCallBack->OnProperty("FileName", sFile);
C_File fFile = C_File(sFile);
......@@ -378,11 +390,13 @@ void C_CfgFileParser::AddCmdLineTarget(C_String sTarget, C_String sTags)
if(bFormat==0x01) m_pCallBack->OnProperty("Type", "MPEG1-PS");
else if(bFormat==0x04) m_pCallBack->OnProperty("Type", "MPEG2-PS");
fFile.Close();
sProgramLaunch = "program1";
}
m_pCallBack->OnEndSection("1");
/* Automatic start section */
m_pCallBack->OnStartSection("LaunchOnStartUp");
m_pCallBack->OnProperty("command1", "start program1 output1 input1 "+sTags);
m_pCallBack->OnProperty("command1", "start "+sProgramLaunch
+" output1 input1 "+sTags);
m_pCallBack->OnEndSection("LaunchOnStartUp");
}
......@@ -2,7 +2,7 @@
* string.cpp: Strings manipulation
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: string.cpp,v 1.3 2002/09/09 14:02:34 jpsaman Exp $
* $Id: string.cpp,v 1.4 2002/11/11 09:51:00 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -583,7 +583,25 @@ int C_String::Find(char cChar, unsigned int iStart) const
return GEN_ERR;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
// Replace all occurences of the char returns number of occurences
//------------------------------------------------------------------------------
int C_String::Replace(char cChar, char cChar2, unsigned int iStart)
{
int count=0;
for(unsigned int i = iStart; i < m_iLength; i++)
{
if(m_pszBuff[i] == cChar)
{
m_pszBuff[i] = cChar2;
count++;
}
}
return count;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* string.h: String class definition
*-------------------------------------------------------------------------------
* (c)1999-2001 VideoLAN
* $Id: string.h,v 1.2 2002/03/24 18:54:10 asmax Exp $
* $Id: string.h,v 1.3 2002/11/11 09:51:00 nitrox Exp $
*
* Authors: Benoit Steiner <benny@via.ecp.fr>
*
......@@ -88,6 +88,7 @@ class C_String
// Substring lookup
int Find(char cChar, unsigned int iStart = 0) const;
int Replace(char cChar, char cChar2, unsigned int iStart = 0);
int Find(const C_String& strItem, unsigned int iStart = 0) const;
bool StartsWith(const C_String& strItem) const;
bool EndsWith(const C_String& strItem) const;
......
......@@ -2,7 +2,7 @@
# "dvb" input Makefile
#-------------------------------------------------------------------------------
# (c)1999-2002 VideoLAN
# $Id: Makefile,v 1.1 2002/03/21 14:09:19 bozo Exp $
# $Id: Makefile,v 1.2 2002/11/11 09:51:01 nitrox Exp $
################################################################################
......@@ -27,8 +27,9 @@ MODULE=dvbinput
#
# Source files
#
MODULE_SRC= dvbinput.cpp \
MODULE_SRC=dvbinput.cpp \
MODULE_LIB+=$(DVBINPUT_LIB)
################################################################################
# Makefile skeleton
......
......@@ -2,7 +2,7 @@
* dvbinput.cpp: DVB streams
*-------------------------------------------------------------------------------
* (c)1999-2002 VideoLAN
* $Id: dvbinput.cpp,v 1.17 2002/10/17 00:47:29 nitrox Exp $
* $Id: dvbinput.cpp,v 1.18 2002/11/11 09:51:01 nitrox Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Damien Lucas <nitrox@videolan.org>
......@@ -46,10 +46,7 @@
# include "src/tables/pat.h"
# include "src/tables/pmt.h"
#endif
#include <ost/sec.h>
#include <ost/frontend.h>
#include <ost/dmx.h>
#include <dvb/DVB.hh>
#include "../../mpeg/mpeg.h"
#include "../../mpeg/ts.h"
......@@ -70,8 +67,9 @@
#include "../../mpeg/dvbpsi.h"
#include "../../mpeg/tsmux.h"
#include "dvbinput.h"
#include "dvbinput.h"
#define FILELEN 256
//------------------------------------------------------------------------------
// Library declaration
......@@ -91,7 +89,6 @@ C_Module* NewBuiltin_dvbinput(handle hLog)
}
#endif
/*******************************************************************************
* C_DvbInput class
********************************************************************************
......@@ -111,9 +108,13 @@ C_DvbInput::C_DvbInput(C_Module* pModule,
m_cPatDecoder(&m_cTsProvider, this),
m_cCurrentPat(0, 0, true)
{
m_pConverter = NULL;
for(int i =0; i < 512; i++)
m_iDemuxes[i] = -1;
// Init of the dvb object
dvb = new DVB;
dvb->init("","",0);
// Notify that we will use OUT_TS_TAP
dvb->enable_DVR();
}
......@@ -130,61 +131,61 @@ C_DvbInput::~C_DvbInput()
//------------------------------------------------------------------------------
void C_DvbInput::OnInit()
{
// Retrieve config
C_List<C_Program> cPgrmList;
C_String m_strVideo;
C_String m_strDev;
C_String strType;
int dummy1;
char filen[FILELEN];
// Retrieve config
C_Application* pApp = C_Application::GetApp();
ASSERT(pApp);
//Getting common parameters
C_String strNumber = pApp->GetSetting(GetName() + ".DeviceNumber", "");
m_strDvbType = pApp->GetSetting(GetName() + ".DvbType" , "sat").ToLower();
m_strDeviceType = pApp->GetSetting(GetName() + ".DeviceType", "nova").ToLower();
m_strSec = "/dev/ost/sec" + strNumber;
m_strFrontend = "/dev/ost/frontend" + strNumber;
m_strDemux = "/dev/ost/demux" + strNumber;
m_strDvr = "/dev/ost/dvr" + strNumber;
m_iFrequency = pApp->GetSetting(GetName() + ".Frequency", "0").ToInt();
m_iSendMethod = pApp->GetSetting(GetName() + ".SendMethod", "0").ToInt();
//Getting pecial parameters -- setting special devices
if(m_strDvbType=="sat")
//Get the devices path
m_iNumber = pApp->GetSetting(GetName() + ".DeviceNumber", "0").ToInt();
m_strDev = "/dev/dvb/adapter";
m_strDev = m_strDev+m_iNumber;
m_strDvr = m_strDev+"/dvr0";
m_strVideo = m_strDev + "/video0";
//Check whether card has a decoder:
//When opening the video device, we should get an error
//TODO Maybe we should write to it too
dummy1=open(m_strVideo.GetString(), O_RDWR|O_NONBLOCK);
m_bHasDecoder=(dummy1<0) ? false : true;
close(dummy1);
switch(dvb->front_type)
{
m_iPolarization = pApp->GetSetting(GetName() + ".Polarization", "0").ToInt();
m_iSymbolRate = pApp->GetSetting(GetName() + ".SymbolRate", "0").ToInt();
m_iDiSEqC = pApp->GetSetting(GetName() + ".DiSEqC", "0").ToInt();
m_iLnbLof1 = pApp->GetSetting(GetName() + ".LNB_Lof1", "0").ToInt();
m_iLnbLof2 = pApp->GetSetting(GetName() + ".LNB_Lof2", "0").ToInt();
m_iLnbSLof = pApp->GetSetting(GetName() + ".LNB_SLof", "0").ToInt();
m_dFecInner = GetCodeRate(pApp->GetSetting(GetName() + ".LNB_SLof", "AUTO"));
SecControl();
}
else if(m_strDvbType=="cable")
{
m_iSymbolRate = pApp->GetSetting(GetName() + ".SymbolRate", "0").ToInt();
m_dModulation = GetModulation(pApp->GetSetting(GetName() + ".Modulation", "QPSK"));
m_dFecInner = GetCodeRate(pApp->GetSetting(GetName() + ".LNB_SLof", "AUTO"));
case FE_QPSK:
strType = "DVB-S";
break;
case FE_QAM:
strType= "DVB-C";
break;
case FE_OFDM:
strType = "DVB_T";
break;
default:
// XXX throw E_Exception(GEN_ERR, "No DVB card found");
break;
}
else if(m_strDvbType=="ter")
Log(m_hLog, LOG_NOTE, strType + " Card registered "+
(m_bHasDecoder ? "with decoder\n" : "without decoder\n"));
//Get the .dvbrc file
if (!get_dvbrc(filen,*dvb,m_iNumber,FILELEN))
throw E_Exception(GEN_ERR, "Unable to find any dvbrc file");
for(int i=0; i<dvb->NumChannel(); i++)
{
m_dBandwidth = GetBandwidth(pApp->GetSetting(GetName() + ".Bandwidth", "6").ToInt());
m_dCodeRateHP = GetCodeRate(pApp->GetSetting(GetName() + ".CodeRateHP", "AUTO"));
m_dCodeRateLP = GetCodeRate(pApp->GetSetting(GetName() + ".CodeRateLP", "AUTO"));
m_dModulation = GetModulation(pApp->GetSetting(GetName() + ".Modulation", "QPSK"));
m_dTransmitMode = GetTransmitMode(pApp->GetSetting(GetName() + ".TransmitMode", "2").ToInt());
m_dGuardInterval = GetGuardInterval(pApp->GetSetting(GetName() + ".GuardInterval", "1/32"));
m_dHierarchy = GetHierarchy(pApp->GetSetting(GetName() + ".Hierarchy", "0").ToInt());
C_String* pStr=new C_String(dvb->chans[i].name);
/* Let's replace all spaces by '_' */
pStr->Replace(' ', '_');
m_vProgramNames.Add(pStr);
Log(m_hLog, LOG_NOTE, "Added program '" + *pStr+"'");
}
// Hardware initialization
SetFrontend();
// PAT decoder initialization
m_cPatDecoder.Attach();
// Select the PAT PID
SelectPid(&m_cPatDecoder, 0x0000, TS_TYPE_NULL);
// Reader
C_MpegReaderModule* pReaderModule = (C_MpegReaderModule*)
C_Application::GetModuleManager()
......@@ -214,13 +215,6 @@ void C_DvbInput::OnInit()
m_pConverter = pConverterModule->NewMpegConverter(cConfig);
ASSERT(m_pConverter);
m_cEndInit.Protect();
// Launch the demux
m_pConverter->Create();
// Kludge: wait for the first PAT arrival.
m_cEndInit.Wait();
}
......@@ -229,13 +223,6 @@ void C_DvbInput::OnInit()
//------------------------------------------------------------------------------
void C_DvbInput::OnDestroy()
{
// Unselect the PAT PID
C_TsDemux::Lock();
UnselectPid(&m_cPatDecoder, 0x0000);
C_TsDemux::UnLock();
// PAT Decoder destruction
m_cPatDecoder.Detach();
if(m_pConverter)
{
......@@ -246,7 +233,6 @@ void C_DvbInput::OnDestroy()
}
catch(E_Exception e)
{
m_cEndInit.Release();
delete m_pConverter;
throw e;
}
......@@ -254,7 +240,6 @@ void C_DvbInput::OnDestroy()
delete m_pConverter;
}
m_cEndInit.Release();
}
......@@ -265,127 +250,17 @@ C_List<C_Program> C_DvbInput::OnGetAvailablePgrms()
{
C_List<C_Program> cPgrmList;
m_cLock.Lock();
dvbpsi_pat_program_t *pPatProgram =
m_cCurrentPat.GetLowLevelPat()->p_first_program;
while(pPatProgram)
for(unsigned int ui = 0; ui < m_vProgramNames.Size(); ui++)
{
C_Program* pProgram = new C_Program(pPatProgram->i_number,
pPatProgram->i_number);
C_Program* pProgram = new C_Program(/*ui + 1,*/ m_vProgramNames[ui]);
ASSERT(pProgram);
cPgrmList.PushEnd(pProgram);
pPatProgram = pPatProgram->p_next;
}
m_cLock.UnLock();
return cPgrmList;
}
//------------------------------------------------------------------------------
// Hardware PID selection
//------------------------------------------------------------------------------
void C_DvbInput::OnSelectPid(u16 iPid, u8 iType)
{
int i;
for(i = 0; (i < 256) && (m_iDemuxes[2 * i] != -1); i++);
if(i < 256)
{
// We don't always need to send PES unknown by vlc
// Thx to Marian Durkovic
// but we may want to have private datas like subtitles
if((m_iSendMethod == 0) || (iType < TS_TYPE_MPEG2_PRIVATE))
{
int iFd = open(m_strDemux.GetString(), O_RDWR|O_NONBLOCK);
if(iFd < 0)
Log(m_hLog, LOG_ERROR, "Unable to open demux");
else
{
struct dmxPesFilterParams pesFilterParams;
pesFilterParams.pid = iPid;
pesFilterParams.input = DMX_IN_FRONTEND;
pesFilterParams.output = DMX_OUT_TS_TAP;
// With Nova Cards, putting DMX_PES_VIDEO & DMX_PES_AUDIO
// doesn't work when receiving severals programs
// Putting DMX_PES_OTHER everywhere seems to work...
//
// But, with DVB-S Cards, you should put the exact type ...
// It implicates that can receive only 1 audio channel
if(m_strDeviceType=="nova") pesFilterParams.pesType = DMX_PES_OTHER;
else
{
switch(iType)
{
case TS_TYPE_MPEG1_VIDEO:
case TS_TYPE_MPEG2_VIDEO:
pesFilterParams.pesType = DMX_PES_VIDEO;
break;
case TS_TYPE_MPEG1_AUDIO:
case TS_TYPE_MPEG2_AUDIO:
pesFilterParams.pesType = DMX_PES_AUDIO;
break;
default:
pesFilterParams.pesType = DMX_PES_OTHER;
break;
}
}
pesFilterParams.flags = DMX_IMMEDIATE_START;
if(ioctl(iFd, DMX_SET_PES_FILTER, &pesFilterParams) < 0)
{
Log(m_hLog, LOG_ERROR, C_String("Unable to set demux filter for PID ")
+ iPid + C_String("type : ") + pesFilterParams.pesType);
close(iFd);
}
else
{
LogDbg(m_hLog, C_String("Demux filter n")+i+ C_String(" type: ") +
pesFilterParams.pesType + C_String(" set for PID ") + iPid);
m_iDemuxes[2 * i] = iPid;
m_iDemuxes[2 * i + 1] = iFd;
}
}
}
else
{
LogDbg(m_hLog, C_String("Demux filter not started for PID ")
+ iPid + C_String(" ES type: ") + iType);
}
}
else
{
LogDbg(m_hLog, C_String("Too many Demux filter set"));
}
}
//------------------------------------------------------------------------------
// Harware PID unselection
//------------------------------------------------------------------------------
void C_DvbInput::OnUnselectPid(u16 iPid)
{
int i;
for(i = 0; (i < 256) && (m_iDemuxes[2 * i] != iPid); i++);
if(i < 256)
{
ASSERT(m_iDemuxes[2 * i] == iPid);
ioctl(m_iDemuxes[2 * i + 1], DMX_STOP);
close(m_iDemuxes[2 * i + 1]);
m_iDemuxes[2 * i] = -1;
LogDbg(m_hLog, C_String("Demux filter unset for PID ") + iPid);
}
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
......@@ -400,243 +275,42 @@ void C_DvbInput::HandleEvent(const C_Event& cEvent)
//------------------------------------------------------------------------------
void C_DvbInput::OnDvbPsiPatEvent(int iEvent)
{
if(iEvent == DVBPSI_EVENT_CURRENT)
{
dvbpsi_pat_t *pLLPat = m_pCurrentPat->GetLowLevelPat();
dvbpsi_pat_program_t* p_program = pLLPat->p_first_program;
printf( "\n");
printf( "New PAT\n");
printf( " transport_stream_id : %d\n", pLLPat->i_ts_id);
printf( " version_number : %d\n", pLLPat->i_version);
printf( " | program_number @ [NIT|PMT]_PID\n");
while(p_program)
{
printf(" | %14d @ 0x%x (%d)\n",
p_program->i_number, p_program->i_pid, p_program->i_pid);
p_program = p_program->p_next;
}
printf( " active : %d\n", pLLPat->b_current_next);
C_DvbPsiPat DiffPatSub(0, 0, false);
C_DvbPsiPat DiffPatAdd(0, 0, false);
if(m_pPreviousPat)
{
DiffPatSub = *m_pPreviousPat - *m_pCurrentPat;
DiffPatAdd = *m_pCurrentPat - *m_pPreviousPat;
}
else
{
DiffPatAdd = *m_pCurrentPat;
}