#include <dvbsi++/ca_program_map_section.h>
#include <dvbsi++/descriptor_tag.h>
#include <dvbsi++/iso639_language_descriptor.h>
-#include <dvbsi++/component_descriptor.h>
+#include <dvbsi++/stream_identifier_descriptor.h>
eDVBServicePMTHandler::eDVBServicePMTHandler(int record)
:m_ca_servicePtr(0)
{
eDebug("ok ... now we start!!");
- /* emit */ m_resourceManager->m_channelRunning(channel);
-
m_PAT.begin(eApp, eDVBPATSpec(), m_demux);
if ( m_service && !m_service->cacheEmpty() )
program.videoStreams.clear();
program.audioStreams.clear();
program.pcrPid = -1;
+ program.isCrypted = false;
if (!m_PMT.getCurrent(ptr))
{
ElementaryStreamInfoConstIterator es;
for (es = pmt.getEsInfo()->begin(); es != pmt.getEsInfo()->end(); ++es)
{
- int isaudio = 0, isvideo = 0;
+ int isaudio = 0, isvideo = 0, cadescriptors = 0;
videoStream video;
audioStream audio;
-
+ audio.component_tag=-1;
+ video.component_tag=-1;
+
video.pid = (*es)->getPid();
audio.pid = (*es)->getPid();
-
+
switch ((*es)->getType())
{
case 0x01: // MPEG 1 video
case 0x02: // MPEG 2 video
isvideo = 1;
- break;
+ //break; fall through !!!
case 0x03: // MPEG 1 audio
case 0x04: // MPEG 2 audio:
- isaudio = 1;
- audio.type = audioStream::atMPEG;
- break;
+ if (!isvideo)
+ {
+ isaudio = 1;
+ audio.type = audioStream::atMPEG;
+ }
+ //break; fall through !!!
case 0x06: // PES Private
/* PES private can contain AC-3, DTS or lots of other stuff.
check descriptors to get the exact type. */
switch ((*desc)->getTag())
{
case AC3_DESCRIPTOR:
- isaudio = 1;
- audio.type = audioStream::atAC3;
+ if (!isvideo)
+ {
+ isaudio = 1;
+ audio.type = audioStream::atAC3;
+ }
+ break;
+ case ISO_639_LANGUAGE_DESCRIPTOR:
+ if (!isvideo)
+ {
+ const Iso639LanguageList *languages = ((Iso639LanguageDescriptor*)*desc)->getIso639Languages();
+ /* use last language code */
+ for (Iso639LanguageConstIterator i(languages->begin()); i != languages->end(); ++i)
+ audio.language_code = (*i)->getIso639LanguageCode();
+ }
+ break;
+ case STREAM_IDENTIFIER_DESCRIPTOR:
+ audio.component_tag =
+ video.component_tag =
+ ((StreamIdentifierDescriptor*)*desc)->getComponentTag();
+ break;
+ case CA_DESCRIPTOR:
+ ++cadescriptors;
break;
}
}
break;
}
if (isaudio)
+ program.audioStreams.push_back(audio);
+ else if (isvideo)
+ program.videoStreams.push_back(video);
+ else
+ continue;
+ if ( cadescriptors > 0 )
+ program.isCrypted=true;
+ }
+ if ( !program.isCrypted )
+ {
+ for (DescriptorConstIterator desc = pmt.getDescriptors()->begin();
+ desc != pmt.getDescriptors()->end(); ++desc)
{
- for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin();
- desc != (*es)->getDescriptors()->end(); ++desc)
+ switch ((*desc)->getTag())
{
- switch ((*desc)->getTag())
- {
- case ISO_639_LANGUAGE_DESCRIPTOR:
- {
- const Iso639LanguageList *languages = ((Iso639LanguageDescriptor*)*desc)->getIso639Languages();
-
- /* use last language code */
- for (Iso639LanguageConstIterator i(languages->begin()); i != languages->end(); ++i)
- audio.language_code = (*i)->getIso639LanguageCode();
-
- break;
- }
- case COMPONENT_DESCRIPTOR:
- audio.component_tag = ((ComponentDescriptor*)*desc)->getComponentTag();
- break;
- }
+ case CA_DESCRIPTOR:
+ program.isCrypted=true;
+ break;
}
-
- program.audioStreams.push_back(audio);
}
- if (isvideo)
- program.videoStreams.push_back(video);
+ break;
}
}
return 0;
else if ( m_service && !m_service->cacheEmpty() )
{
int vpid = m_service->getCachePID(eDVBService::cVPID),
- apid_ac3 = m_service->getCachePID(eDVBService::cAPID),
- apid_mpeg = m_service->getCachePID(eDVBService::cAC3PID),
+ apid_ac3 = m_service->getCachePID(eDVBService::cAC3PID),
+ apid_mpeg = m_service->getCachePID(eDVBService::cAPID),
pcrpid = m_service->getCachePID(eDVBService::cPCRPID),
cnt=0;
if ( vpid != -1 )
{
caservice = (exist[ref]=new eDVBCAService());
caservice->m_service = ref;
- eDebug("[eDVBCAHandler] new service %s", ref.toString().c_str() );
+ eDebug("[eDVBCAService] new service %s", ref.toString().c_str() );
}
// search free demux entry
int iter=0, max_demux_slots = sizeof(caservice->m_used_demux);
if ( iter < max_demux_slots )
{
caservice->m_used_demux[iter] = demux_num & 0xFF;
- eDebug("[eDVBCAHandler] add demux %d to slot %d service %s", demux_num, iter, ref.toString().c_str());
+ eDebug("[eDVBCAService] add demux %d to slot %d service %s", demux_num, iter, ref.toString().c_str());
}
else
{
- eDebug("[eDVBCAHandler] no more demux slots free for service %s!!", ref.toString().c_str());
+ eDebug("[eDVBCAService] no more demux slots free for service %s!!", ref.toString().c_str());
return -1;
}
return 0;
CAServiceMap::iterator it = exist.find(ref);
if ( it == exist.end() )
{
- eDebug("[eDVBCAHandler] try to unregister non registered %s", ref.toString().c_str());
+ eDebug("[eDVBCAService] try to unregister non registered %s", ref.toString().c_str());
return -1;
}
else
if (ptr)
it->second->buildCAPMT(ptr);
else
- eDebug("[eDVBCAHandler] can not send updated demux info");
+ eDebug("[eDVBCAService] can not send updated demux info");
}
}
return 0;
if ( write(m_sock, m_capmt, wp) == wp )
{
m_sendstate=0xFFFFFFFF;
- eDebug("[eDVBCAHandler] send %d bytes",wp);
+ eDebug("[eDVBCAService] send %d bytes",wp);
#if 1
for(int i=0;i<wp;i++)
eDebugNoNewLine("%02x ", m_capmt[i]);
case 0xFFFFFFFF:
++m_sendstate;
m_retryTimer.start(0,true);
-// eDebug("[eDVBCAHandler] send failed .. immediate retry");
+// eDebug("[eDVBCAService] send failed .. immediate retry");
break;
default:
m_retryTimer.start(5000,true);
-// eDebug("[eDVBCAHandler] send failed .. retry in 5 sec");
+// eDebug("[eDVBCAService] send failed .. retry in 5 sec");
break;
}
++m_sendstate;