aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2008-11-17 15:42:54 +0100
committerFelix Domke <tmbinc@elitedvb.net>2008-11-17 15:42:54 +0100
commita34ef895210161a8820e96829ac87806566e7858 (patch)
tree55b9f104dbbdd8a1d72e598b989421f839576b9a /lib/dvb
parent588010098dbcc24b82ea736feec6b6056cffd2e3 (diff)
parent153e0ed5048c79c600e1acd085b62015b7314ba7 (diff)
downloadenigma2-a34ef895210161a8820e96829ac87806566e7858.tar.gz
enigma2-a34ef895210161a8820e96829ac87806566e7858.zip
Merge branch 'master' into tmbinc/FixTimingBugs
Conflicts: lib/dvb/sec.cpp lib/python/Components/Network.py lib/python/Components/Playlist.py lib/python/Plugins/Extensions/DVDBurn/Process.py lib/python/Plugins/Extensions/MediaPlayer/plugin.py lib/python/Screens/TimerEdit.py po/lt.po po/nl.po po/tr.po
Diffstat (limited to 'lib/dvb')
-rw-r--r--lib/dvb/db.cpp13
-rw-r--r--lib/dvb/decoder.cpp51
-rw-r--r--lib/dvb/dvb.cpp22
-rw-r--r--lib/dvb/dvb.h4
-rw-r--r--lib/dvb/frontend.cpp122
-rw-r--r--lib/dvb/idvb.h2
-rw-r--r--lib/dvb/pmt.cpp98
-rw-r--r--lib/dvb/pmt.h2
-rw-r--r--lib/dvb/pvrparse.cpp8
-rw-r--r--lib/dvb/scan.cpp2
-rw-r--r--lib/dvb/sec.cpp13
-rw-r--r--lib/dvb/sec.h2
12 files changed, 232 insertions, 107 deletions
diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp
index 02ecc1d2..1c332033 100644
--- a/lib/dvb/db.cpp
+++ b/lib/dvb/db.cpp
@@ -151,7 +151,7 @@ RESULT eDVBService::getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &
return eEPGCache::getInstance()->lookupEventTime(ref, start_time, ptr);
}
-int eDVBService::isPlayable(const eServiceReference &ref, const eServiceReference &ignore)
+int eDVBService::isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate)
{
ePtr<eDVBResourceManager> res_mgr;
if ( eDVBResourceManager::getInstance( res_mgr ) )
@@ -161,7 +161,7 @@ int eDVBService::isPlayable(const eServiceReference &ref, const eServiceReferenc
eDVBChannelID chid, chid_ignore;
((const eServiceReferenceDVB&)ref).getChannelID(chid);
((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore);
- return res_mgr->canAllocateChannel(chid, chid_ignore);
+ return res_mgr->canAllocateChannel(chid, chid_ignore, simulate);
}
return 0;
}
@@ -497,7 +497,7 @@ void eDVBDB::saveServicelist(const char *file)
{
if (sat.system == eDVBFrontendParametersSatellite::System::DVB_S2)
{
- fprintf(f, "\ts %d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
+ fprintf(f, "\ts %d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
sat.frequency, sat.symbol_rate,
sat.polarisation, sat.fec,
sat.orbital_position > 1800 ? sat.orbital_position - 3600 : sat.orbital_position,
@@ -505,11 +505,8 @@ void eDVBDB::saveServicelist(const char *file)
flags,
sat.system,
sat.modulation,
- sat.rolloff);
- if (sat.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK)
- fprintf(f, ":%d\n", sat.pilot);
- else
- fprintf(f, "\n");
+ sat.rolloff,
+ sat.pilot);
}
else
{
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp
index 0ce59d01..6ad39225 100644
--- a/lib/dvb/decoder.cpp
+++ b/lib/dvb/decoder.cpp
@@ -836,37 +836,40 @@ int eTSMPEGDecoder::setState()
if (m_pcr)
m_pcr->stop();
m_pcr = 0;
- if ((m_pcrpid >= 0) && (m_pcrpid < 0x1FFF))
- {
- m_pcr = new eDVBPCR(m_demux);
- if (m_pcr->startPid(m_pcrpid))
- res = -1;
- }
- m_changed &= ~changePCR;
}
if (m_changed & changeVideo)
{
- eDebug("VIDEO CHANGED (to %04x)", m_vpid);
if (m_video)
{
m_video->stop();
m_video = 0;
m_video_event_conn = 0;
}
- if ((m_vpid >= 0) && (m_vpid < 0x1FFF))
- {
- m_video = new eDVBVideo(m_demux, m_decoder);
- m_video->connectEvent(slot(*this, &eTSMPEGDecoder::video_event), m_video_event_conn);
- if (m_video->startPid(m_vpid, m_vtype))
- res = -1;
- }
- m_changed &= ~changeVideo;
}
if (m_changed & changeAudio)
{
if (m_audio)
m_audio->stop();
m_audio = 0;
+ }
+ if (m_changed & changeText)
+ {
+ if (m_text)
+ m_text->stop();
+ m_text = 0;
+ }
+ if (m_changed & changePCR)
+ {
+ if ((m_pcrpid >= 0) && (m_pcrpid < 0x1FFF))
+ {
+ m_pcr = new eDVBPCR(m_demux);
+ if (m_pcr->startPid(m_pcrpid))
+ res = -1;
+ }
+ m_changed &= ~changePCR;
+ }
+ if (m_changed & changeAudio)
+ {
if ((m_apid >= 0) && (m_apid < 0x1FFF) && !noaudio)
{
m_audio = new eDVBAudio(m_demux, m_decoder);
@@ -875,11 +878,19 @@ int eTSMPEGDecoder::setState()
}
m_changed &= ~changeAudio;
}
+ if (m_changed & changeVideo)
+ {
+ if ((m_vpid >= 0) && (m_vpid < 0x1FFF))
+ {
+ m_video = new eDVBVideo(m_demux, m_decoder);
+ m_video->connectEvent(slot(*this, &eTSMPEGDecoder::video_event), m_video_event_conn);
+ if (m_video->startPid(m_vpid, m_vtype))
+ res = -1;
+ }
+ m_changed &= ~changeVideo;
+ }
if (m_changed & changeText)
{
- if (m_text)
- m_text->stop();
- m_text = 0;
if ((m_textpid >= 0) && (m_textpid < 0x1FFF) && !nott)
{
m_text = new eDVBTText(m_demux);
@@ -1069,6 +1080,7 @@ RESULT eTSMPEGDecoder::setFastForward(int frames_to_skip)
m_is_ff = frames_to_skip != 0;
setState();
+ unfreeze(); // audio might be restarted and still in preroll (freezed) state.
if (m_video)
return m_video->setFastForward(frames_to_skip);
@@ -1081,6 +1093,7 @@ RESULT eTSMPEGDecoder::setSlowMotion(int repeat)
m_is_sm = repeat != 0;
setState();
+ unfreeze(); // audio might be restarted and still in preroll (freezed) state.
if (m_video)
return m_video->setSlowMotion(repeat);
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index 8afa70db..3ad086de 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -713,12 +713,13 @@ RESULT eDVBResourceManager::connectChannelAdded(const Slot1<void,eDVBChannel*> &
return 0;
}
-int eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm)
+int eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm, bool simulate)
{
+ eSmartPtrList<eDVBRegisteredFrontend> &frontends = simulate ? m_simulate_frontend : m_frontend;
ePtr<eDVBRegisteredFrontend> best;
int bestval = 0;
- for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(frontends.begin()); i != frontends.end(); ++i)
if (!i->m_inuse)
{
int c = i->m_frontend->isCompatibleWith(feparm);
@@ -755,10 +756,11 @@ int tuner_type_channel_default(ePtr<iDVBChannelList> &channellist, const eDVBCha
return 0;
}
-int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore)
+int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore, bool simulate)
{
+ std::list<active_channel> &active_channels = simulate ? m_active_simulate_channels : m_active_channels;
int ret=0;
- if (m_cached_channel)
+ if (!simulate && m_cached_channel)
{
eDVBChannel *cache_chan = (eDVBChannel*)&(*m_cached_channel);
if(channelid==cache_chan->getChannelID())
@@ -767,7 +769,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
/* first, check if a channel is already existing. */
// eDebug("allocate channel.. %04x:%04x", channelid.transport_stream_id.get(), channelid.original_network_id.get());
- for (std::list<active_channel>::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i)
+ for (std::list<active_channel>::iterator i(active_channels.begin()); i != active_channels.end(); ++i)
{
// eDebug("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get());
if (i->m_channel_id == channelid)
@@ -780,8 +782,9 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
int *decremented_cached_channel_fe_usecount=NULL,
*decremented_fe_usecount=NULL;
- for (std::list<active_channel>::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i)
+ for (std::list<active_channel>::iterator i(active_channels.begin()); i != active_channels.end(); ++i)
{
+ eSmartPtrList<eDVBRegisteredFrontend> &frontends = simulate ? m_simulate_frontend : m_frontend;
// eDebug("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get());
if (i->m_channel_id == ignore)
{
@@ -795,7 +798,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
ePtr<iDVBFrontend> fe;
if (!i->m_channel->getFrontend(fe))
{
- for (eSmartPtrList<eDVBRegisteredFrontend>::iterator ii(m_frontend.begin()); ii != m_frontend.end(); ++ii)
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator ii(frontends.begin()); ii != frontends.end(); ++ii)
{
if ( &(*fe) == &(*ii->m_frontend) )
{
@@ -822,7 +825,8 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
ePtr<iDVBFrontend> fe;
if (!channel->getFrontend(fe))
{
- for (eSmartPtrList<eDVBRegisteredFrontend>::iterator ii(m_frontend.begin()); ii != m_frontend.end(); ++ii)
+ eSmartPtrList<eDVBRegisteredFrontend> &frontends = simulate ? m_simulate_frontend : m_frontend;
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator ii(frontends.begin()); ii != frontends.end(); ++ii)
{
if ( &(*fe) == &(*ii->m_frontend) )
{
@@ -852,7 +856,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
goto error;
}
- ret = canAllocateFrontend(feparm);
+ ret = canAllocateFrontend(feparm, simulate);
error:
if (decremented_fe_usecount)
diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h
index 1a773efa..13556c26 100644
--- a/lib/dvb/dvb.h
+++ b/lib/dvb/dvb.h
@@ -184,7 +184,7 @@ public:
};
RESULT connectChannelAdded(const Slot1<void,eDVBChannel*> &channelAdded, ePtr<eConnection> &connection);
- int canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore);
+ int canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore, bool simulate=false);
/* allocate channel... */
RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel, bool simulate=false);
@@ -206,7 +206,7 @@ public:
#ifdef SWIG
public:
#endif
- int canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm);
+ int canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm, bool simulate=false);
bool canMeasureFrontendInputPower();
PSignal1<void,int> frontendUseMaskChanged;
SWIG_VOID(RESULT) allocateRawChannel(eUsePtr<iDVBChannel> &SWIG_OUTPUT, int slot_index);
diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp
index 635de8f5..b0e92d39 100644
--- a/lib/dvb/frontend.cpp
+++ b/lib/dvb/frontend.cpp
@@ -81,22 +81,26 @@
if (!m_simulate) \
eDebug(x); \
} while(0)
-// else \
-// { \
-// eDebugNoNewLine("SIMULATE:"); \
-// eDebug(x); \
-// } \
+#if 0
+ else \
+ { \
+ eDebugNoNewLine("SIMULATE:"); \
+ eDebug(x); \
+ }
+#endif
#define eDebugNoSimulateNoNewLine(x...) \
do { \
if (!m_simulate) \
eDebugNoNewLine(x); \
} while(0)
-// else \
-// { \
-// eDebugNoNewLine("SIMULATE:"); \
-// eDebugNoNewLine(x); \
-// } \
+#if 0
+ else \
+ { \
+ eDebugNoNewLine("SIMULATE:"); \
+ eDebugNoNewLine(x); \
+ }
+#endif
void eDVBDiseqcCommand::setCommandString(const char *str)
{
@@ -725,34 +729,58 @@ int eDVBFrontend::readFrontendData(int type)
if (!strcmp(m_description, "BCM4501 (internal)"))
{
unsigned int SDS_SNRE = snr << 16;
+ float snr_in_db;
- static float SNR_COEFF[6] = {
- 100.0 / 4194304.0,
- -7136.0 / 4194304.0,
- 197418.0 / 4194304.0,
- -2602183.0 / 4194304.0,
- 20377212.0 / 4194304.0,
- -37791203.0 / 4194304.0,
- };
-
- float fval1, fval2, snr_in_db;
- int i;
- fval1 = 12.44714 - (2.0 * log10(SDS_SNRE / 256.0));
- fval2 = pow(10.0, fval1)-1;
- fval1 = 10.0 * log10(fval2);
-
- if (fval1 < 10.0)
+ if (parm_u_qpsk_fec_inner <= FEC_AUTO) // DVB-S1 / QPSK
{
- fval2 = SNR_COEFF[0];
- for (i=0; i<6; ++i)
+ static float SNR_COEFF[6] = {
+ 100.0 / 4194304.0,
+ -7136.0 / 4194304.0,
+ 197418.0 / 4194304.0,
+ -2602183.0 / 4194304.0,
+ 20377212.0 / 4194304.0,
+ -37791203.0 / 4194304.0,
+ };
+ float fval1 = 12.44714 - (2.0 * log10(SDS_SNRE / 256.0)),
+ fval2 = pow(10.0, fval1)-1;
+ fval1 = 10.0 * log10(fval2);
+
+ if (fval1 < 10.0)
{
- fval2 *= fval1;
- fval2 += SNR_COEFF[i];
+ fval2 = SNR_COEFF[0];
+ for (int i=0; i<6; ++i)
+ {
+ fval2 *= fval1;
+ fval2 += SNR_COEFF[i];
+ }
+ fval1 = fval2;
}
- fval1 = fval2;
+ snr_in_db = fval1;
}
- snr_in_db = fval1;
+#if HAVE_DVB_API_VERSION >= 3
+ else
+ {
+ float fval1 = SDS_SNRE / 268435456.0,
+ fval2, fval3, fval4;
+ if (parm_u_qpsk_fec_inner <= FEC_S2_QPSK_9_10) // DVB-S2 QPSK
+ {
+ fval2 = 6.76;
+ fval3 = 4.35;
+ }
+ else // 8PSK
+ {
+ fval1 *= 0.5;
+ fval2 = 8.06;
+ fval3 = 6.18;
+ }
+ fval4 = -10.0 * log10(fval1);
+ fval1 = fval4;
+ for (int i=0; i < 5; ++i)
+ fval1 = fval4 - fval2 * log10(1.0+pow(10.0, (fval3-fval1)/fval2));
+ snr_in_db = fval1;
+ }
+#endif
return (int)(snr_in_db * 100.0);
}
else if (strstr(m_description, "Alps BSBE1 C01A") ||
@@ -781,7 +809,6 @@ int eDVBFrontend::readFrontendData(int type)
i;
if(INRANGE(CN_lookup[Imin][REGVAL],regval,CN_lookup[Imax][REGVAL]))
{
- long val;
while((Imax-Imin)>1)
{
i=(Imax+Imin)/2;
@@ -987,22 +1014,19 @@ void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, e
break;
}
PutToDict(dict, "rolloff", tmp);
- if (parm_u_qpsk_fec_inner > FEC_S2_QPSK_9_10)
+ switch(parm_inversion & 0x30)
{
- switch(parm_inversion & 0x30)
- {
- case 0: // pilot off
- tmp = "PILOT_OFF";
- break;
- case 0x10: // pilot on
- tmp = "PILOT_ON";
- break;
- case 0x20: // pilot auto
- tmp = "PILOT_AUTO";
- break;
- }
- PutToDict(dict, "pilot", tmp);
+ case 0: // pilot off
+ tmp = "PILOT_OFF";
+ break;
+ case 0x10: // pilot on
+ tmp = "PILOT_ON";
+ break;
+ case 0x20: // pilot auto
+ tmp = "PILOT_AUTO";
+ break;
}
+ PutToDict(dict, "pilot", tmp);
tmp = "DVB-S2";
}
else
@@ -1283,7 +1307,7 @@ void eDVBFrontend::getTransponderData(ePyObject dest, bool original)
{
const FRONTENDPARAMETERS &parm = original || m_simulate ? this->parm : front;
const char *tmp = "INVERSION_AUTO";
- switch(parm_inversion)
+ switch(parm_inversion & 3)
{
case INVERSION_ON:
tmp = "INVERSION_ON";
@@ -1889,10 +1913,10 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm,
return -EINVAL;
}
parm_inversion |= (feparm.rolloff << 2); // Hack.. we use bit 2..3 of inversion param for rolloff
+ parm_inversion |= (feparm.pilot << 4); // Hack.. we use bit 4..5 of inversion param for pilot
if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK) {
parm_u_qpsk_fec_inner = (fe_code_rate_t)((int)parm_u_qpsk_fec_inner+9);
// 8PSK fec driver values are decimal 9 bigger
- parm_inversion |= (feparm.pilot << 4); // Hack.. we use bit 4..5 of inversion param for pilot
}
}
#endif
diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h
index a2cce94d..cda05894 100644
--- a/lib/dvb/idvb.h
+++ b/lib/dvb/idvb.h
@@ -315,7 +315,7 @@ public:
// iStaticServiceInformation
RESULT getName(const eServiceReference &ref, std::string &name);
RESULT getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &ptr, time_t start_time);
- int isPlayable(const eServiceReference &ref, const eServiceReference &ignore);
+ int isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate=false);
PyObject *getInfoObject(const eServiceReference &ref, int); // implemented in lib/service/servicedvb.h
/* for filtering: */
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index 692428d7..842d6979 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -1,3 +1,4 @@
+#include <lib/base/nconfig.h> // access to python config
#include <lib/base/eerror.h>
#include <lib/dvb/pmt.h>
#include <lib/dvb/specs.h>
@@ -6,6 +7,7 @@
#include <lib/dvb_ci/dvbci.h>
#include <lib/dvb/epgcache.h>
#include <lib/dvb/scan.h>
+#include <lib/dvb_ci/dvbci_session.h>
#include <dvbsi++/ca_descriptor.h>
#include <dvbsi++/ca_program_map_section.h>
#include <dvbsi++/teletext_descriptor.h>
@@ -14,7 +16,6 @@
#include <dvbsi++/stream_identifier_descriptor.h>
#include <dvbsi++/subtitling_descriptor.h>
#include <dvbsi++/teletext_descriptor.h>
-#include <lib/base/nconfig.h> // access to python config
eDVBServicePMTHandler::eDVBServicePMTHandler()
:m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF)
@@ -677,7 +678,7 @@ ChannelMap eDVBCAService::exist_channels;
ePtr<eConnection> eDVBCAService::m_chanAddedConn;
eDVBCAService::eDVBCAService()
- : m_prev_build_hash(0), m_sendstate(0), m_retryTimer(eTimer::create(eApp))
+ :m_buffer(512), m_prev_build_hash(0), m_sendstate(0), m_retryTimer(eTimer::create(eApp))
{
memset(m_used_demux, 0xFF, sizeof(m_used_demux));
CONNECT(m_retryTimer->timeout, eDVBCAService::sendCAPMT);
@@ -864,19 +865,100 @@ channel_data *eDVBCAService::getChannelData(eDVBChannelID &chid)
}
// end static methods
+#define CA_REPLY_DEBUG
+#define MAX_LENGTH_BYTES 4
+#define MIN_LENGTH_BYTES 1
+
void eDVBCAService::socketCB(int what)
{
- if (what & eSocketNotifier::Read)
- /*eDebug("[eDVBCAService] data to read\n")*/;
- if (what & eSocketNotifier::Priority)
- /*eDebug("[eDVBCAService] priority data to read\n")*/;
+ if (what & (eSocketNotifier::Read | eSocketNotifier::Priority))
+ {
+ char msgbuffer[4096];
+ ssize_t length = read(m_sock, msgbuffer, sizeof(msgbuffer));
+ if (length == -1)
+ {
+ if (errno != EAGAIN && errno != EINTR && errno != EBUSY)
+ {
+ eDebug("[eSocketMMIHandler] read (%m)");
+ what |= eSocketNotifier::Error;
+ }
+ } else if (length == 0)
+ {
+ what |= eSocketNotifier::Hungup;
+ } else
+ {
+ int len = length;
+ unsigned char *data = (unsigned char*)msgbuffer;
+ int clear = 1;
+ // If a new message starts, then the previous message
+ // should already have been processed. Otherwise the
+ // previous message was incomplete and should therefore
+ // be deleted.
+ if ((len >= 1) && ((data[0] & 0xFF) != 0x9f))
+ clear = 0;
+ if ((len >= 2) && ((data[1] & 0x80) != 0x80))
+ clear = 0;
+ if ((len >= 3) && ((data[2] & 0x80) != 0x00))
+ clear = 0;
+ if (clear)
+ {
+ m_buffer.clear();
+#ifdef CA_REPLY_DEBUG
+ eDebug("clear buffer");
+#endif
+ }
+#ifdef CA_REPLY_DEBUG
+ eDebug("Put to buffer:");
+ for (int i=0; i < len; ++i)
+ eDebugNoNewLine("%02x ", data[i]);
+ eDebug("\n--------");
+#endif
+ m_buffer.write( data, len );
+
+ while ( m_buffer.size() >= (3 + MIN_LENGTH_BYTES) )
+ {
+ unsigned char tmp[3+MAX_LENGTH_BYTES];
+ m_buffer.peek(tmp, 3+MIN_LENGTH_BYTES);
+ if (((tmp[0] & 0xFF) != 0x9f) || ((tmp[1] & 0x80) != 0x80) || ((tmp[2] & 0x80) != 0x00))
+ {
+ m_buffer.skip(1);
+#ifdef CA_REPLY_DEBUG
+ eDebug("skip %02x", tmp[0]);
+#endif
+ continue;
+ }
+ if (tmp[3] & 0x80)
+ {
+ int peekLength = (tmp[3] & 0x7f) + 4;
+ if (m_buffer.size() < peekLength)
+ continue;
+ m_buffer.peek(tmp, peekLength);
+ }
+ int size=0;
+ int LengthBytes=eDVBCISession::parseLengthField(tmp+3, size);
+ int messageLength = 3+LengthBytes+size;
+ if ( m_buffer.size() >= messageLength )
+ {
+ unsigned char dest[messageLength];
+ m_buffer.read(dest, messageLength);
+#ifdef CA_REPLY_DEBUG
+ eDebug("dump ca reply:");
+ for (int i=0; i < messageLength; ++i)
+ eDebugNoNewLine("%02x ", dest[i]);
+ eDebug("\n--------");
+#endif
+// /*emit*/ mmi_progress(0, dest, (const void*)(dest+3+LengthBytes), messageLength-3-LengthBytes);
+ }
+ }
+ }
+ }
if (what & eSocketNotifier::Hungup) {
- /*eDebug("[eDVBCAService] connection closed\n")*/;
+ /*eDebug("[eDVBCAService] connection closed")*/;
m_sendstate=1;
sendCAPMT();
}
if (what & eSocketNotifier::Error)
- /*eDebug("[eDVBCAService] connection error\n")*/;
+ eDebug("[eDVBCAService] connection error");
}
void eDVBCAService::Connect()
diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h
index 107b071a..ff0ef046 100644
--- a/lib/dvb/pmt.h
+++ b/lib/dvb/pmt.h
@@ -3,6 +3,7 @@
#ifndef SWIG
#include <map>
+#include <lib/base/buffer.h>
#include <lib/dvb/idvb.h>
#include <lib/dvb/dvb.h>
#include <lib/dvb/idemux.h>
@@ -35,6 +36,7 @@ typedef std::map<iDVBChannel*, channel_data*> ChannelMap;
class eDVBCAService: public Object
{
+ eIOBuffer m_buffer;
ePtr<eSocketNotifier> m_sn;
eServiceReferenceDVB m_service;
uint8_t m_used_demux[32];
diff --git a/lib/dvb/pvrparse.cpp b/lib/dvb/pvrparse.cpp
index dfc62249..c7a37460 100644
--- a/lib/dvb/pvrparse.cpp
+++ b/lib/dvb/pvrparse.cpp
@@ -365,9 +365,9 @@ int eMPEGStreamParserTS::processPacket(const unsigned char *pkt, off_t offset)
if (ptsvalid)
{
m_streaminfo.m_access_points[offset] = pts;
- eDebug("Sequence header at %llx, pts %llx", offset, pts);
+// eDebug("Sequence header at %llx, pts %llx", offset, pts);
} else
- eDebug("Sequence header but no valid PTS value.");
+ /*eDebug("Sequence header but no valid PTS value.")*/;
}
if (pkt[3] == 0x09 && /* MPEG4 AVC unit access delimiter */
@@ -376,9 +376,9 @@ int eMPEGStreamParserTS::processPacket(const unsigned char *pkt, off_t offset)
if (ptsvalid)
{
m_streaminfo.m_access_points[offset] = pts;
- eDebug("MPEG4 AVC UAD at %llx, pts %llx", offset, pts);
+// eDebug("MPEG4 AVC UAD at %llx, pts %llx", offset, pts);
} else
- eDebug("MPEG4 AVC UAD but no valid PTS value.");
+ /*eDebug("MPEG4 AVC UAD but no valid PTS value.")*/;
}
}
return 0;
diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp
index 2457763a..71893f95 100644
--- a/lib/dvb/scan.cpp
+++ b/lib/dvb/scan.cpp
@@ -758,7 +758,7 @@ void eDVBScan::channelDone()
SCAN_eDebug("name '%s', provider_name '%s'", sname, pname);
service->m_service_name = convertDVBUTF8(sname);
service->genSortName();
- service->m_provider_name = pname;
+ service->m_provider_name = convertDVBUTF8(pname);
}
if (!(m_flags & scanOnlyFree) || !m_pmt_in_progress->second.scrambled) {
diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp
index 35a8d04a..2b7f717b 100644
--- a/lib/dvb/sec.cpp
+++ b/lib/dvb/sec.cpp
@@ -637,11 +637,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
diseqc.data[2] = 0;
// diseqc reset
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_DISEQC_RESET_CMD]) );
diseqc.data[2] = 3;
// diseqc peripherial powersupply on
sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
- sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 150) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_DISEQC_PERIPHERIAL_POWERON_CMD]) );
}
for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
@@ -894,8 +894,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
csw = band;
}
- if (sendDiSEqC)
- sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
+// if (sendDiSEqC)
+ sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
sec_fe->setData(eDVBFrontend::NEW_CSW, csw);
sec_fe->setData(eDVBFrontend::NEW_UCSW, ucsw);
@@ -923,8 +923,9 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
}
- if (sendDiSEqC)
- sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
+// if (sendDiSEqC)
+ sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
+ sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
frontend.setSecSequence(sec_sequence);
diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h
index 42e53ebe..e68ed167 100644
--- a/lib/dvb/sec.h
+++ b/lib/dvb/sec.h
@@ -267,6 +267,8 @@ public:
MOTOR_COMMAND_RETRIES, // max transmit tries of rotor command when the rotor dont start turning (with power measurement)
MOTOR_RUNNING_TIMEOUT, // max motor running time before timeout
DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS, // delay after change voltage before transmit toneburst/diseqc
+ DELAY_AFTER_DISEQC_RESET_CMD,
+ DELAY_AFTER_DISEQC_PERIPHERIAL_POWERON_CMD,
MAX_PARAMS
};
private: