aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2011-02-22 18:47:12 +0100
committerAndreas Oberritter <obi@opendreambox.org>2011-02-22 18:47:12 +0100
commit1b1339127ce152097492d899e401e3c6a2438f2c (patch)
tree24b84dbbb8291eabd3b8d6f45dde919bcf249c42 /lib/dvb
parent1f959e3bd0d5642d8b7381268cc4747028c38e9b (diff)
parent1e4c82ee8d55cd1fc22da279eecdfb6a25521eb5 (diff)
downloadenigma2-1b1339127ce152097492d899e401e3c6a2438f2c.tar.gz
enigma2-1b1339127ce152097492d899e401e3c6a2438f2c.zip
Merge branch 'master' into obi/master
Diffstat (limited to 'lib/dvb')
-rw-r--r--lib/dvb/decoder.cpp6
-rw-r--r--lib/dvb/decoder.h2
-rw-r--r--lib/dvb/demux.cpp7
-rw-r--r--lib/dvb/demux.h3
-rw-r--r--lib/dvb/dvb.cpp28
-rw-r--r--lib/dvb/dvb.h2
-rw-r--r--lib/dvb/epgcache.cpp6
-rw-r--r--lib/dvb/esection.h23
-rw-r--r--lib/dvb/idvb.h3
-rw-r--r--lib/dvb/pmt.cpp126
-rw-r--r--lib/dvb/pmt.h8
-rw-r--r--lib/dvb/pvrparse.cpp2
-rw-r--r--lib/dvb/tstools.cpp27
13 files changed, 190 insertions, 53 deletions
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp
index 88cd3ee1..a89f72bb 100644
--- a/lib/dvb/decoder.cpp
+++ b/lib/dvb/decoder.cpp
@@ -203,6 +203,9 @@ int eDVBAudio::startPid(int pid, int type)
case aLPCM:
bypass = 6;
break;
+ case aDTSHD:
+ bypass = 0x10;
+ break;
}
eDebugNoNewLine("AUDIO_SET_BYPASS(%d) - ", bypass);
@@ -1299,9 +1302,10 @@ RESULT eTSMPEGDecoder::showSinglePic(const char *filename)
if (f >= 0)
{
struct stat s;
+ size_t written=0;
fstat(f, &s);
if (m_video_clip_fd == -1)
- m_video_clip_fd = open("/dev/dvb/adapter0/video0", O_WRONLY|O_NONBLOCK);
+ m_video_clip_fd = open("/dev/dvb/adapter0/video0", O_WRONLY);
if (m_video_clip_fd >= 0)
{
bool seq_end_avail = false;
diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h
index 3a0fbac1..7610b654 100644
--- a/lib/dvb/decoder.h
+++ b/lib/dvb/decoder.h
@@ -13,7 +13,7 @@ private:
ePtr<eDVBDemux> m_demux;
int m_fd, m_fd_demux, m_dev, m_is_freezed;
public:
- enum { aMPEG, aAC3, aDTS, aAAC, aAACHE, aLPCM };
+ enum { aMPEG, aAC3, aDTS, aAAC, aAACHE, aLPCM, aDTSHD };
eDVBAudio(eDVBDemux *demux, int dev);
enum { aMonoLeft, aStereo, aMonoRight };
void setChannel(int channel);
diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp
index 0c736c55..f4d86185 100644
--- a/lib/dvb/demux.cpp
+++ b/lib/dvb/demux.cpp
@@ -85,6 +85,13 @@ int eDVBDemux::openDemux(void)
return ::open(filename, O_RDWR);
}
+int eDVBDemux::openDVR(int flags)
+{
+ char filename[128];
+ snprintf(filename, 128, "/dev/dvb/adapter%d/dvr%d", adapter, demux);
+ return ::open(filename, flags);
+}
+
DEFINE_REF(eDVBDemux)
RESULT eDVBDemux::setSourceFrontend(int fenum)
diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h
index d43c41bb..e73982ec 100644
--- a/lib/dvb/demux.h
+++ b/lib/dvb/demux.h
@@ -26,7 +26,8 @@ public:
RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; }
RESULT flush();
RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
-
+ int openDVR(int flags);
+
int getRefCount() { return ref; }
private:
int adapter, demux, source;
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index cd6c232b..6f9a67fb 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -98,6 +98,8 @@ eDVBResourceManager::eDVBResourceManager()
m_boxtype = DM500HD;
else if (!strncmp(tmp, "dm800se\n", rd))
m_boxtype = DM800SE;
+ else if (!strncmp(tmp, "dm7020hd\n", rd))
+ m_boxtype = DM7020HD;
else {
eDebug("boxtype detection via /proc/stb/info not possible... use fallback via demux count!\n");
if (m_demux.size() == 3)
@@ -464,7 +466,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA
ePtr<eDVBRegisteredDemux> unused;
- if (m_boxtype == DM800 || m_boxtype == DM500HD || m_boxtype == DM800SE) // dm800 / 500hd
+ if (m_boxtype == DM800) // dm800
{
cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
for (; i != m_demux.end(); ++i, ++n)
@@ -520,7 +522,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA
}
}
}
- else if (m_boxtype == DM8000)
+ else if (m_boxtype == DM8000 || m_boxtype == DM500HD || m_boxtype == DM800SE || m_boxtype == DM7020HD)
{
cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
for (; i != m_demux.end(); ++i, ++n)
@@ -1790,14 +1792,28 @@ RESULT eDVBChannel::playSource(ePtr<iTsSource> &source, const char *streaminfo_f
/* (this codepath needs to be improved anyway.) */
#if HAVE_DVB_API_VERSION < 3
m_pvr_fd_dst = open("/dev/pvr", O_WRONLY);
-#else
- m_pvr_fd_dst = open("/dev/misc/pvr", O_WRONLY);
-#endif
if (m_pvr_fd_dst < 0)
{
- eDebug("can't open /dev/misc/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved.
+ eDebug("can't open /dev/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved.
+ return -ENODEV;
+ }
+#else
+ ePtr<eDVBAllocatedDemux> &demux = m_demux ? m_demux : m_decoder_demux;
+ if (demux)
+ {
+ m_pvr_fd_dst = demux->get().openDVR(O_WRONLY);
+ if (m_pvr_fd_dst < 0)
+ {
+ eDebug("can't open /dev/dvb/adapterX/dvrX - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved.
+ return -ENODEV;
+ }
+ }
+ else
+ {
+ eDebug("no demux allocated yet.. so its not possible to open the dvr device!!");
return -ENODEV;
}
+#endif
}
m_pvr_thread = new eDVBChannelFilePush();
diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h
index f612affb..33490148 100644
--- a/lib/dvb/dvb.h
+++ b/lib/dvb/dvb.h
@@ -135,7 +135,7 @@ class eDVBResourceManager: public iObject, public Object
DECLARE_REF(eDVBResourceManager);
int avail, busy;
- enum { DM7025, DM800, DM500HD, DM800SE, DM8000 };
+ enum { DM7025, DM800, DM500HD, DM800SE, DM8000, DM7020HD };
int m_boxtype;
diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp
index 8ac0c718..4d324746 100644
--- a/lib/dvb/epgcache.cpp
+++ b/lib/dvb/epgcache.cpp
@@ -258,7 +258,7 @@ void eEPGCache::timeUpdated()
{
if (it->second->state == -1) {
it->second->state=0;
- messages.send(Message(Message::startChannel, it->second));
+ messages.send(Message(Message::startChannel, it->first));
}
}
} else
@@ -366,6 +366,8 @@ void eEPGCache::DVBChannelRunning(iDVBChannel *chan)
messages.send(Message(Message::startChannel, chan));
// -> gotMessage -> changedService
}
+ else
+ data.state=-1;
}
}
}
@@ -1187,7 +1189,7 @@ void eEPGCache::save()
eEPGCache::channel_data::channel_data(eEPGCache *ml)
:cache(ml)
- ,abortTimer(eTimer::create(ml)), zapTimer(eTimer::create(ml)), state(-1)
+ ,abortTimer(eTimer::create(ml)), zapTimer(eTimer::create(ml)), state(-2)
,isRunning(0), haveData(0)
#ifdef ENABLE_PRIVATE_EPG
,startPrivateTimer(eTimer::create(ml))
diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h
index 833cc93b..3e097ccc 100644
--- a/lib/dvb/esection.h
+++ b/lib/dvb/esection.h
@@ -100,6 +100,10 @@ class eAUTable: public eAUGTable
int first;
ePtr<iDVBDemux> m_demux;
eMainloop *ml;
+
+ /* needed to detect broken table version handling (seen on some m2ts files) */
+ struct timespec m_prev_table_update;
+ int m_table_cnt;
public:
eAUTable()
@@ -119,6 +123,7 @@ public:
int begin(eMainloop *m, const eDVBTableSpec &spec, ePtr<iDVBDemux> demux)
{
+ m_table_cnt = 0;
ml = m;
m_demux = demux;
first= 1;
@@ -197,6 +202,24 @@ public:
if (current && (!current->getSpec(spec)))
{
+ /* detect broken table version handling (seen on some m2ts files) */
+ if (m_table_cnt)
+ {
+ if (abs(timeout_usec(m_prev_table_update)) > 500000)
+ m_table_cnt = -1;
+ else if (m_table_cnt > 1) // two pmt update within one second
+ {
+ eDebug("Seen two consecutive table version changes within 500ms. "
+ "This seems broken, so auto update for pid %04x, table %02x is now disabled!!",
+ spec.pid, spec.tid);
+ m_table_cnt = 0;
+ return;
+ }
+ }
+
+ ++m_table_cnt;
+ clock_gettime(CLOCK_MONOTONIC, &m_prev_table_update);
+
next = new Table();
CONNECT(next->tableReady, eAUTable::slotTableReady);
spec.flags &= ~(eDVBTableSpec::tfAnyVersion|eDVBTableSpec::tfThisVersion|eDVBTableSpec::tfHaveTimeout);
diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h
index f15cd04e..86936f8d 100644
--- a/lib/dvb/idvb.h
+++ b/lib/dvb/idvb.h
@@ -636,6 +636,7 @@ public:
virtual RESULT getSTC(pts_t &pts, int num=0)=0;
virtual RESULT getCADemuxID(uint8_t &id)=0;
virtual RESULT flush()=0;
+ virtual int openDVR(int flags)=0;
};
#if HAVE_DVB_API_VERSION < 3 && !defined(VIDEO_EVENT_SIZE_CHANGED)
@@ -650,7 +651,7 @@ public:
/** Set Displayed Video PID and type */
virtual RESULT setVideoPID(int vpid, int type)=0;
- enum { af_MPEG, af_AC3, af_DTS, af_AAC };
+ enum { af_MPEG, af_AC3, af_DTS, af_AAC, af_DTSHD };
/** Set Displayed Audio PID and type */
virtual RESULT setAudioPID(int apid, int type)=0;
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index ca56141b..e5e63316 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -20,13 +20,14 @@
#include <dvbsi++/registration_descriptor.h>
eDVBServicePMTHandler::eDVBServicePMTHandler()
- :m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF)
+ :m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF), m_no_pat_entry_delay(eTimer::create())
{
m_use_decode_demux = 0;
m_pmt_pid = -1;
eDVBResourceManager::getInstance(m_resourceManager);
CONNECT(m_PMT.tableReady, eDVBServicePMTHandler::PMTready);
CONNECT(m_PAT.tableReady, eDVBServicePMTHandler::PATready);
+ CONNECT(m_no_pat_entry_delay->timeout, eDVBServicePMTHandler::sendEventNoPatEntry);
}
eDVBServicePMTHandler::~eDVBServicePMTHandler()
@@ -43,8 +44,15 @@ void eDVBServicePMTHandler::channelStateChanged(iDVBChannel *channel)
&& (state == iDVBChannel::state_ok) && (!m_demux))
{
if (m_channel)
- if (m_channel->getDemux(m_demux, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode))
+ {
+ if (m_pvr_demux_tmp)
+ {
+ m_demux = m_pvr_demux_tmp;
+ m_pvr_demux_tmp = NULL;
+ }
+ else if (m_channel->getDemux(m_demux, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode))
eDebug("Allocating %s-decoding a demux for now tuned-in channel failed.", m_use_decode_demux ? "" : "non-");
+ }
serviceEvent(eventTuned);
@@ -126,25 +134,55 @@ void eDVBServicePMTHandler::PMTready(int error)
}
}
+void eDVBServicePMTHandler::sendEventNoPatEntry()
+{
+ serviceEvent(eventNoPATEntry);
+}
+
void eDVBServicePMTHandler::PATready(int)
{
+ eDebug("PATready");
ePtr<eTable<ProgramAssociationSection> > ptr;
if (!m_PAT.getCurrent(ptr))
{
+ int service_id_single = -1;
+ int pmtpid_single = -1;
int pmtpid = -1;
+ int cnt=0;
std::vector<ProgramAssociationSection*>::const_iterator i;
for (i = ptr->getSections().begin(); pmtpid == -1 && i != ptr->getSections().end(); ++i)
{
const ProgramAssociationSection &pat = **i;
ProgramAssociationConstIterator program;
for (program = pat.getPrograms()->begin(); pmtpid == -1 && program != pat.getPrograms()->end(); ++program)
+ {
+ ++cnt;
if (eServiceID((*program)->getProgramNumber()) == m_reference.getServiceID())
pmtpid = (*program)->getProgramMapPid();
+ if (++cnt == 1 && pmtpid_single == -1 && pmtpid == -1)
+ {
+ pmtpid_single = (*program)->getProgramMapPid();
+ service_id_single = (*program)->getProgramNumber();
+ }
+ else
+ pmtpid_single = service_id_single = -1;
+ }
}
- if (pmtpid == -1)
- serviceEvent(eventNoPATEntry);
- else
+ if (pmtpid_single != -1) // only one PAT entry .. and not valid pmtpid found
+ {
+ eDebug("use single pat entry!");
+ m_reference.setServiceID(eServiceID(service_id_single));
+ pmtpid = pmtpid_single;
+ }
+ if (pmtpid == -1) {
+ eDebug("no PAT entry found.. start delay");
+ m_no_pat_entry_delay->start(1000, true);
+ }
+ else {
+ eDebug("use pmtpid %04x for service_id %04x", pmtpid, m_reference.getServiceID().get());
+ m_no_pat_entry_delay->stop();
m_PMT.begin(eApp, eDVBPMTSpec(pmtpid, m_reference.getServiceID().get()), m_demux);
+ }
} else
serviceEvent(eventNoPAT);
}
@@ -230,8 +268,29 @@ int eDVBServicePMTHandler::getProgramInfo(program &program)
for (i = ptr->getSections().begin(); i != ptr->getSections().end(); ++i)
{
const ProgramMapSection &pmt = **i;
+ int is_hdmv = 0;
+
program.pcrPid = pmt.getPcrPid();
+ for (DescriptorConstIterator desc = pmt.getDescriptors()->begin();
+ desc != pmt.getDescriptors()->end(); ++desc)
+ {
+ if ((*desc)->getTag() == CA_DESCRIPTOR)
+ {
+ CaDescriptor *descr = (CaDescriptor*)(*desc);
+ program::capid_pair pair;
+ pair.caid = descr->getCaSystemId();
+ pair.capid = descr->getCaPid();
+ program.caids.push_back(pair);
+ }
+ else if ((*desc)->getTag() == REGISTRATION_DESCRIPTOR)
+ {
+ RegistrationDescriptor *d = (RegistrationDescriptor*)(*desc);
+ if (d->getFormatIdentifier() == 0x48444d56) // HDMV
+ is_hdmv = 1;
+ }
+ }
+
ElementaryStreamInfoConstIterator es;
for (es = pmt.getEsInfo()->begin(); es != pmt.getEsInfo()->end(); ++es)
{
@@ -287,25 +346,34 @@ int eDVBServicePMTHandler::getProgramInfo(program &program)
audio.type = audioStream::atAACHE;
forced_audio = 1;
}
- case 0x80: // user private ... but blueray LPCM
- if (!isvideo && !isaudio)
+ case 0x80: // user private ... but bluray LPCM
+ case 0xA0: // bluray secondary LPCM
+ if (!isvideo && !isaudio && is_hdmv)
{
isaudio = 1;
audio.type = audioStream::atLPCM;
}
- case 0x81: // user private ... but blueray AC3
- if (!isvideo && !isaudio)
+ case 0x81: // user private ... but bluray AC3
+ case 0xA1: // bluray secondary AC3
+ if (!isvideo && !isaudio && is_hdmv)
{
isaudio = 1;
audio.type = audioStream::atAC3;
}
- case 0x82: // Blueray DTS (dvb user private...)
- case 0xA2: // Blueray secondary DTS
- if (!isvideo && !isaudio)
+ case 0x82: // bluray DTS (dvb user private...)
+ case 0xA2: // bluray secondary DTS
+ if (!isvideo && !isaudio && is_hdmv)
{
isaudio = 1;
audio.type = audioStream::atDTS;
}
+ case 0x86: // bluray DTS-HD (dvb user private...)
+ case 0xA6: // bluray secondary DTS-HD
+ if (!isvideo && !isaudio && is_hdmv)
+ {
+ isaudio = 1;
+ audio.type = audioStream::atDTSHD;
+ }
case 0x06: // PES Private
case 0xEA: // TS_PSI_ST_SMPTE_VC1
{
@@ -497,9 +565,9 @@ int eDVBServicePMTHandler::getProgramInfo(program &program)
default:
break;
}
- if (isteletext && (isaudio || isvideo))
+ if (isteletext && (isaudio || isvideo))
{
- eDebug("ambiguous streamtype for PID %04x detected.. forced as teletext!", (*es)->getPid());
+ eDebug("ambiguous streamtype for PID %04x detected.. forced as teletext!", (*es)->getPid());
continue; // continue with next PID
}
else if (issubtitle && (isaudio || isvideo))
@@ -537,18 +605,6 @@ int eDVBServicePMTHandler::getProgramInfo(program &program)
else
continue;
}
- for (DescriptorConstIterator desc = pmt.getDescriptors()->begin();
- desc != pmt.getDescriptors()->end(); ++desc)
- {
- if ((*desc)->getTag() == CA_DESCRIPTOR)
- {
- CaDescriptor *descr = (CaDescriptor*)(*desc);
- program::capid_pair pair;
- pair.caid = descr->getCaSystemId();
- pair.capid = descr->getCaPid();
- program.caids.push_back(pair);
- }
- }
}
ret = 0;
@@ -710,8 +766,8 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_dem
{
RESULT res=0;
m_reference = ref;
-
m_use_decode_demux = use_decode_demux;
+ m_no_pat_entry_delay->stop();
/* use given service as backup. This is used for timeshift where we want to clone the live stream using the cache, but in fact have a PVR channel */
m_service = service;
@@ -735,13 +791,12 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_dem
{
if (!ref.getServiceID().get() /* incorrect sid in meta file or recordings.epl*/ )
{
- eWarning("no .meta file found, trying to find PMT pid");
eDVBTSTools tstools;
+ bool b = source || !tstools.openFile(ref.path.c_str(), 1);
+ eWarning("no .meta file found, trying to find PMT pid");
if (source)
- tstools.setSource(source, streaminfo_file ? streaminfo_file : ref.path.c_str());
- else if (tstools.openFile(ref.path.c_str()))
- eWarning("failed to open file");
- else
+ tstools.setSource(source, NULL);
+ if (b)
{
int service_id, pmt_pid;
if (!tstools.findPMT(pmt_pid, service_id))
@@ -751,6 +806,8 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_dem
m_pmt_pid = pmt_pid;
}
}
+ else
+ eWarning("no valid source to find PMT pid!");
}
eDebug("alloc PVR");
/* allocate PVR */
@@ -792,7 +849,10 @@ int eDVBServicePMTHandler::tuneExt(eServiceReferenceDVB &ref, int use_decode_dem
if (m_pvr_channel)
{
m_pvr_channel->setCueSheet(cue);
- if (source)
+
+ if (m_pvr_channel->getDemux(m_pvr_demux_tmp, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode))
+ eDebug("Allocating %s-decoding a demux for PVR channel failed.", m_use_decode_demux ? "" : "non-");
+ else if (source)
m_pvr_channel->playSource(source, streaminfo_file);
else
m_pvr_channel->playFile(ref.path.c_str());
diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h
index 86b634fc..0c44f35a 100644
--- a/lib/dvb/pmt.h
+++ b/lib/dvb/pmt.h
@@ -86,8 +86,8 @@ class eDVBServicePMTHandler: public Object
eUsePtr<iDVBChannel> m_channel;
eUsePtr<iDVBPVRChannel> m_pvr_channel;
ePtr<eDVBResourceManager> m_resourceManager;
- ePtr<iDVBDemux> m_demux;
-
+ ePtr<iDVBDemux> m_demux, m_pvr_demux_tmp;
+
void channelStateChanged(iDVBChannel *);
ePtr<eConnection> m_channelStateChanged_connection;
void channelEvent(iDVBChannel *, int event);
@@ -102,6 +102,7 @@ class eDVBServicePMTHandler: public Object
int m_use_decode_demux;
uint8_t m_decode_demux_num;
+ ePtr<eTimer> m_no_pat_entry_delay;
public:
eDVBServicePMTHandler();
~eDVBServicePMTHandler();
@@ -144,7 +145,7 @@ public:
{
int pid,
rdsPid; // hack for some radio services which transmit radiotext on different pid (i.e. harmony fm, HIT RADIO FFH, ...)
- enum { atMPEG, atAC3, atDTS, atAAC, atAACHE, atLPCM };
+ enum { atMPEG, atAC3, atDTS, atAAC, atAACHE, atLPCM, atDTSHD };
int type; // mpeg2, ac3, dts, ...
int component_tag;
@@ -210,6 +211,7 @@ public:
int getPMT(ePtr<eTable<ProgramMapSection> > &ptr) { return m_PMT.getCurrent(ptr); }
int getChannel(eUsePtr<iDVBChannel> &channel);
void resetCachedProgram() { m_have_cached_program = false; }
+ void sendEventNoPatEntry();
/* deprecated interface */
int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0);
diff --git a/lib/dvb/pvrparse.cpp b/lib/dvb/pvrparse.cpp
index 5cdecbd6..e19dd1e4 100644
--- a/lib/dvb/pvrparse.cpp
+++ b/lib/dvb/pvrparse.cpp
@@ -123,7 +123,7 @@ void eMPEGStreamInformation::fixupDiscontinuties()
pts_t current = i->second - currentDelta;
pts_t diff = current - lastpts_t;
- if (llabs(diff) > (90000*5)) // 5sec diff
+ if (llabs(diff) > (90000*10)) // 10sec diff
{
// eDebug("%llx < %llx, have discont. new timestamp is %llx (diff is %llx)!", current, lastpts_t, i->second, diff);
currentDelta = i->second - lastpts_t; /* FIXME: should be the extrapolated new timestamp, based on the current rate */
diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp
index 1403059f..6cd855cc 100644
--- a/lib/dvb/tstools.cpp
+++ b/lib/dvb/tstools.cpp
@@ -212,6 +212,8 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed)
break;
case 0x71: // AC3 / DTS
break;
+ case 0x72: // DTS - HD
+ break;
default:
eDebug("skip unknwn stream_id_extension %02x\n", payload[9+offs]);
continue;
@@ -700,9 +702,26 @@ int eDVBTSTools::findFrame(off_t &_offset, size_t &len, int &direction, int fram
else if (direction == +1)
direction = 0;
}
- /* let's find the next frame after the given offset */
off_t start = offset;
+#if 0
+ /* backtrack to find the previous sequence start, in case of MPEG2 */
+ if ((data & 0xFF) == 0x00) {
+ do {
+ --start;
+ if (m_streaminfo.getStructureEntry(start, data, 0))
+ {
+ eDebug("get previous failed");
+ return -1;
+ }
+ } while (((data & 0xFF) != 9) && ((data & 0xFF) != 0x00) && ((data & 0xFF) != 0xB3)); /* sequence start or previous frame */
+ if ((data & 0xFF) != 0xB3)
+ start = offset; /* Failed to find corresponding sequence start, so never mind */
+ }
+
+#endif
+
+ /* let's find the next frame after the given offset */
do {
if (m_streaminfo.getStructureEntry(offset, data, 1))
{
@@ -717,9 +736,11 @@ int eDVBTSTools::findFrame(off_t &_offset, size_t &len, int &direction, int fram
// eDebug("%08llx@%llx (next)", data, offset);
} while (((data & 0xFF) != 9) && ((data & 0xFF) != 0x00)); /* next frame */
+#if 0
/* align to TS pkt start */
-// start = start - (start % 188);
-// offset = offset - (offset % 188);
+ start = start - (start % 188);
+ offset = offset - (offset % 188);
+#endif
len = offset - start;
_offset = start;