aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@saftware.de>2009-07-10 13:22:05 +0200
committerAndreas Oberritter <obi@saftware.de>2009-07-10 13:22:05 +0200
commit35cc93a57db072be9ca6cf8737bbb120ab215059 (patch)
treeaa9609385c6cb72758a3df387ee3d476c8763624 /lib/dvb
parentdff868466d255a845eed5aae912ebfaaa61d582d (diff)
parentdf4309aea023598d3565a588440b2dc3c5c8eaad (diff)
downloadenigma2-35cc93a57db072be9ca6cf8737bbb120ab215059.tar.gz
enigma2-35cc93a57db072be9ca6cf8737bbb120ab215059.zip
Merge branch 'master' of git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/dvb')
-rw-r--r--lib/dvb/dvb.cpp21
-rw-r--r--lib/dvb/dvb.h2
-rw-r--r--lib/dvb/pmt.cpp270
-rw-r--r--lib/dvb/teletext.cpp7
4 files changed, 151 insertions, 149 deletions
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index e6d9a25d..6b027088 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -438,7 +438,9 @@ alloc_fe_by_id_not_possible:
return err;
}
-RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBAllocatedDemux> &demux, int cap)
+#define capHoldDecodeReference 64
+
+RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBAllocatedDemux> &demux, int &cap)
{
/* find first unused demux which is on same adapter as frontend (or any, if PVR)
never use the first one unless we need a decoding demux. */
@@ -455,6 +457,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA
if (m_boxtype == DM800 || m_boxtype == DM500HD) // dm800 / 500hd
{
+ cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
for (; i != m_demux.end(); ++i, ++n)
{
if (!i->m_inuse)
@@ -510,6 +513,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA
}
else if (m_boxtype == DM8000)
{
+ cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
for (; i != m_demux.end(); ++i, ++n)
{
if (fe)
@@ -1693,17 +1697,24 @@ RESULT eDVBChannel::getDemux(ePtr<iDVBDemux> &demux, int cap)
if (m_mgr->allocateDemux(m_frontend ? (eDVBRegisteredFrontend*)*m_frontend : (eDVBRegisteredFrontend*)0, our_demux, cap))
return -1;
- }
- demux = *our_demux;
+ demux = *our_demux;
+
/* don't hold a reference to the decoding demux, we don't need it. */
/* FIXME: by dropping the 'allocated demux' in favour of the 'iDVBDemux',
the refcount is lost. thus, decoding demuxes are never allocated.
this poses a big problem for PiP. */
- if (cap & capDecode)
- our_demux = 0;
+
+ if (cap & capHoldDecodeReference) // this is set in eDVBResourceManager::allocateDemux for Dm500HD/DM800 and DM8000
+ ;
+ else if (cap & capDecode)
+ our_demux = 0;
+ }
+ else
+ demux = *our_demux;
+
return 0;
}
diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h
index 413462d6..7b320006 100644
--- a/lib/dvb/dvb.h
+++ b/lib/dvb/dvb.h
@@ -209,7 +209,7 @@ public:
RESULT allocateFrontendByIndex(ePtr<eDVBAllocatedFrontend> &fe, int slot_index);
/* allocate a demux able to filter on the selected frontend. */
- RESULT allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBAllocatedDemux> &demux, int cap);
+ RESULT allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBAllocatedDemux> &demux, int &cap);
#ifdef SWIG
public:
#endif
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index 13ed6b98..8e007f8d 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -209,7 +209,7 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
{
const ProgramMapSection &pmt = **i;
program.pcrPid = pmt.getPcrPid();
-
+
ElementaryStreamInfoConstIterator es;
for (es = pmt.getEsInfo()->begin(); es != pmt.getEsInfo()->end(); ++es)
{
@@ -283,176 +283,166 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program)
desc != (*es)->getDescriptors()->end(); ++desc)
{
uint8_t tag = (*desc)->getTag();
- if (!isaudio && !isvideo)
+ /* check descriptors to get the exakt stream type. */
+ switch (tag)
{
- /* PES private can contain AC-3, DTS or lots of other stuff.
- check descriptors to get the exakt type. */
- switch (tag)
- {
- case AUDIO_STREAM_DESCRIPTOR:
- isaudio = 1;
- break;
- case VIDEO_STREAM_DESCRIPTOR:
+ case AUDIO_STREAM_DESCRIPTOR:
+ isaudio = 1;
+ break;
+ case VIDEO_STREAM_DESCRIPTOR:
+ {
+ isvideo = 1;
+ VideoStreamDescriptor *d = (VideoStreamDescriptor*)(*desc);
+ if (d->getMpeg1OnlyFlag())
+ video.type = videoStream::vtMPEG1;
+ break;
+ }
+ case SUBTITLING_DESCRIPTOR:
+ {
+ SubtitlingDescriptor *d = (SubtitlingDescriptor*)(*desc);
+ const SubtitlingList *list = d->getSubtitlings();
+ subtitleStream s;
+ s.pid = (*es)->getPid();
+ for (SubtitlingConstIterator it(list->begin()); it != list->end(); ++it)
{
- isvideo = 1;
- VideoStreamDescriptor *d = (VideoStreamDescriptor*)(*desc);
- if (d->getMpeg1OnlyFlag())
- video.type = videoStream::vtMPEG1;
- break;
+ s.subtitling_type = (*it)->getSubtitlingType();
+ switch(s.subtitling_type)
+ {
+ case 0x10 ... 0x13:
+ case 0x20 ... 0x23: // dvb subtitles
+ break;
+ default:
+ eDebug("dvb subtitle %s PID %04x with wrong subtitling type (%02x)... force 0x10!!",
+ s.language_code.c_str(), s.pid, s.subtitling_type);
+ s.subtitling_type = 0x10;
+ break;
+ }
+ s.composition_page_id = (*it)->getCompositionPageId();
+ s.ancillary_page_id = (*it)->getAncillaryPageId();
+ s.language_code = (*it)->getIso639LanguageCode();
+// eDebug("add dvb subtitle %s PID %04x, type %d, composition page %d, ancillary_page %d",
+// s.language_code.c_str(), s.pid, s.subtitling_type, s.composition_page_id, s.ancillary_page_id);
+ program.subtitleStreams.push_back(s);
}
- case SUBTITLING_DESCRIPTOR:
+ break;
+ }
+ case TELETEXT_DESCRIPTOR:
+ if ( program.textPid == -1 || (*es)->getPid() == cached_tpid )
{
- SubtitlingDescriptor *d = (SubtitlingDescriptor*)(*desc);
- const SubtitlingList *list = d->getSubtitlings();
subtitleStream s;
- s.pid = (*es)->getPid();
- for (SubtitlingConstIterator it(list->begin()); it != list->end(); ++it)
+ s.subtitling_type = 0x01; // EBU TELETEXT SUBTITLES
+ s.pid = program.textPid = (*es)->getPid();
+ TeletextDescriptor *d = (TeletextDescriptor*)(*desc);
+ const VbiTeletextList *list = d->getVbiTeletexts();
+ for (VbiTeletextConstIterator it(list->begin()); it != list->end(); ++it)
{
- s.subtitling_type = (*it)->getSubtitlingType();
- switch(s.subtitling_type)
+ switch((*it)->getTeletextType())
{
- case 0x10 ... 0x13:
- case 0x20 ... 0x23: // dvb subtitles
- break;
- default:
- eDebug("dvb subtitle %s PID %04x with wrong subtitling type (%02x)... force 0x10!!",
- s.language_code.c_str(), s.pid, s.subtitling_type);
- s.subtitling_type = 0x10;
+ case 0x02: // Teletext subtitle page
+ case 0x05: // Teletext subtitle page for hearing impaired pepople
+ s.language_code = (*it)->getIso639LanguageCode();
+ s.teletext_page_number = (*it)->getTeletextPageNumber();
+ s.teletext_magazine_number = (*it)->getTeletextMagazineNumber();
+// eDebug("add teletext subtitle %s PID %04x, page number %d, magazine number %d",
+// s.language_code.c_str(), s.pid, s.teletext_page_number, s.teletext_magazine_number);
+ program.subtitleStreams.push_back(s);
break;
}
- s.composition_page_id = (*it)->getCompositionPageId();
- s.ancillary_page_id = (*it)->getAncillaryPageId();
- s.language_code = (*it)->getIso639LanguageCode();
-// eDebug("add dvb subtitle %s PID %04x, type %d, composition page %d, ancillary_page %d",
-// s.language_code.c_str(), s.pid, s.subtitling_type, s.composition_page_id, s.ancillary_page_id);
- program.subtitleStreams.push_back(s);
}
- break;
}
- case TELETEXT_DESCRIPTOR:
- if ( program.textPid == -1 || (*es)->getPid() == cached_tpid )
- {
- subtitleStream s;
- s.subtitling_type = 0x01; // EBU TELETEXT SUBTITLES
- s.pid = program.textPid = (*es)->getPid();
- TeletextDescriptor *d = (TeletextDescriptor*)(*desc);
- const VbiTeletextList *list = d->getVbiTeletexts();
- for (VbiTeletextConstIterator it(list->begin()); it != list->end(); ++it)
- {
- switch((*it)->getTeletextType())
- {
- case 0x02: // Teletext subtitle page
- case 0x05: // Teletext subtitle page for hearing impaired pepople
- s.language_code = (*it)->getIso639LanguageCode();
- s.teletext_page_number = (*it)->getTeletextPageNumber();
- s.teletext_magazine_number = (*it)->getTeletextMagazineNumber();
-// eDebug("add teletext subtitle %s PID %04x, page number %d, magazine number %d",
-// s.language_code.c_str(), s.pid, s.teletext_page_number, s.teletext_magazine_number);
- program.subtitleStreams.push_back(s);
- break;
- }
- }
- }
+ break;
+ case DTS_DESCRIPTOR:
+ isaudio = 1;
+ audio.type = audioStream::atDTS;
+ break;
+ case 0x2B: // TS_PSI_DT_MPEG2_AAC
+ isaudio = 1;
+ audio.type = audioStream::atAAC; // MPEG2-AAC
+ break;
+ case 0x1C: // TS_PSI_DT_MPEG4_Audio
+ case AAC_DESCRIPTOR:
+ isaudio = 1;
+ audio.type = audioStream::atAACHE; // MPEG4-AAC
+ break;
+ case AC3_DESCRIPTOR:
+ isaudio = 1;
+ audio.type = audioStream::atAC3;
+ break;
+ case REGISTRATION_DESCRIPTOR: /* some services don't have a separate AC3 descriptor */
+ {
+ /* libdvbsi++ doesn't yet support this descriptor type, so work around. */
+ if ((*desc)->getLength() < 4)
break;
- case DTS_DESCRIPTOR:
+ unsigned char descr[6];
+ (*desc)->writeToBuffer(descr);
+ int format_identifier = (descr[2] << 24) | (descr[3] << 16) | (descr[4] << 8) | (descr[5]);
+ switch (format_identifier)
+ {
+ case 0x44545331 ... 0x44545333: // DTS1/DTS2/DTS3
isaudio = 1;
audio.type = audioStream::atDTS;
break;
- case 0x2B: // TS_PSI_DT_MPEG2_AAC
+ case 0x41432d33: // == 'AC-3'
isaudio = 1;
- audio.type = audioStream::atAAC; // MPEG2-AAC
- break;
- case 0x1C: // TS_PSI_DT_MPEG4_Audio
- case AAC_DESCRIPTOR:
- isaudio = 1;
- audio.type = audioStream::atAACHE; // MPEG4-AAC
+ audio.type = audioStream::atAC3;
break;
- case AC3_DESCRIPTOR:
+ case 0x42535344: // == 'BSSD' (LPCM)
isaudio = 1;
- audio.type = audioStream::atAC3;
+ audio.type = audioStream::atLPCM;
break;
- case REGISTRATION_DESCRIPTOR: /* some services don't have a separate AC3 descriptor */
- {
- /* libdvbsi++ doesn't yet support this descriptor type, so work around. */
- if ((*desc)->getLength() < 4)
- break;
- unsigned char descr[6];
- (*desc)->writeToBuffer(descr);
- int format_identifier = (descr[2] << 24) | (descr[3] << 16) | (descr[4] << 8) | (descr[5]);
- switch (format_identifier)
+ case 0x56432d31: // == 'VC-1'
+ if (descr[6] == 0x01) // subdescriptor tag
{
- case 0x44545331 ... 0x44545333: // DTS1/DTS2/DTS3
- isaudio = 1;
- audio.type = audioStream::atDTS;
- break;
- case 0x41432d33: // == 'AC-3'
- isaudio = 1;
- audio.type = audioStream::atAC3;
- break;
- case 0x42535344: // == 'BSSD' (LPCM)
- isaudio = 1;
- audio.type = audioStream::atLPCM;
- break;
- case 0x56432d31: // == 'VC-1'
- if (descr[6] == 0x01) // subdescriptor tag
- {
- if (descr[7] >= 0x90) // profile_level
- video.type = videoStream::vtVC1; // advanced profile
- else
- video.type = videoStream::vtVC1_SM; // simple main
- isvideo = 1;
- }
- break;
- default:
- break;
+ if (descr[7] >= 0x90) // profile_level
+ video.type = videoStream::vtVC1; // advanced profile
+ else
+ video.type = videoStream::vtVC1_SM; // simple main
+ isvideo = 1;
}
break;
- }
- case 0x28: // TS_PSI_DT_AVC
- isvideo = 1;
- video.type = videoStream::vtMPEG4_H264;
- break;
- case 0x1B: // TS_PSI_DT_MPEG4_Video
- isvideo = 1;
- video.type = videoStream::vtMPEG4_Part2;
- break;
default:
break;
}
+ break;
}
- switch (tag)
- {
- case ISO_639_LANGUAGE_DESCRIPTOR:
- if (!isvideo)
+ case 0x28: // TS_PSI_DT_AVC
+ isvideo = 1;
+ video.type = videoStream::vtMPEG4_H264;
+ break;
+ case 0x1B: // TS_PSI_DT_MPEG4_Video
+ isvideo = 1;
+ video.type = videoStream::vtMPEG4_Part2;
+ break;
+ case ISO_639_LANGUAGE_DESCRIPTOR:
+ if (!isvideo)
+ {
+ int cnt=0;
+ const Iso639LanguageList *languages = ((Iso639LanguageDescriptor*)*desc)->getIso639Languages();
+ /* use last language code */
+ for (Iso639LanguageConstIterator i(languages->begin()); i != languages->end(); ++i, ++cnt)
{
- int cnt=0;
- const Iso639LanguageList *languages = ((Iso639LanguageDescriptor*)*desc)->getIso639Languages();
- /* use last language code */
- for (Iso639LanguageConstIterator i(languages->begin()); i != languages->end(); ++i, ++cnt)
- {
- if (cnt == 0)
- audio.language_code = (*i)->getIso639LanguageCode();
- else
- audio.language_code += "/" + (*i)->getIso639LanguageCode();
- }
+ if (cnt == 0)
+ audio.language_code = (*i)->getIso639LanguageCode();
+ else
+ audio.language_code += "/" + (*i)->getIso639LanguageCode();
}
- break;
- case STREAM_IDENTIFIER_DESCRIPTOR:
- audio.component_tag =
- video.component_tag =
- ((StreamIdentifierDescriptor*)*desc)->getComponentTag();
- break;
- case CA_DESCRIPTOR:
- {
- CaDescriptor *descr = (CaDescriptor*)(*desc);
- program.caids.insert(descr->getCaSystemId());
- break;
}
- default:
- break;
+ break;
+ case STREAM_IDENTIFIER_DESCRIPTOR:
+ audio.component_tag =
+ video.component_tag =
+ ((StreamIdentifierDescriptor*)*desc)->getComponentTag();
+ break;
+ case CA_DESCRIPTOR:
+ {
+ CaDescriptor *descr = (CaDescriptor*)(*desc);
+ program.caids.insert(descr->getCaSystemId());
+ break;
+ }
+ default:
+ break;
}
}
- break;
}
if (isaudio)
{
diff --git a/lib/dvb/teletext.cpp b/lib/dvb/teletext.cpp
index 91faf855..40650c01 100644
--- a/lib/dvb/teletext.cpp
+++ b/lib/dvb/teletext.cpp
@@ -669,11 +669,11 @@ void eDVBTeletextParser::addSubtitleString(int color, std::string string, int so
}
// eDebug("color %d, m_subtitle_color %d", color, m_subtitle_color);
- gRGB rgbcol((color & 1) ? 255 : 128, (color & 2) ? 255 : 128, (color & 4) ? 255 : 128);
if ((color != m_subtitle_color || force_cell) && !m_subtitle_text.empty() && ((color == -2) || !string.empty()))
{
+ const gRGB pal[4] = { gRGB(64, 0, 76), gRGB(180, 40, 86), gRGB(160, 170, 105), gRGB(250, 200, 140) };
// eDebug("add text |%s|: %d != %d || %d", m_subtitle_text.c_str(), color, m_subtitle_color, force_cell);
- m_subtitle_page.m_elements.push_back(eDVBTeletextSubtitlePageElement(rgbcol, m_subtitle_text, m_current_source_line));
+ m_subtitle_page.m_elements.push_back(eDVBTeletextSubtitlePageElement(pal[m_subtitle_color & 3], m_subtitle_text, m_current_source_line));
m_current_source_line = -1;
m_subtitle_text = "";
} else if (!m_subtitle_text.empty() && m_subtitle_text[m_subtitle_text.size()-1] != ' ')
@@ -685,7 +685,8 @@ void eDVBTeletextParser::addSubtitleString(int color, std::string string, int so
if (!string.empty())
{
// eDebug("set %d as new color", color);
- m_subtitle_color = color;
+ if (color >= 0)
+ m_subtitle_color = color;
m_subtitle_text += string;
}
}