#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)
int isaudio = 0, isvideo = 0;
videoStream video;
audioStream audio;
+ audio.component_tag=-1;
video.pid = (*es)->getPid();
audio.pid = (*es)->getPid();
break;
}
- case COMPONENT_DESCRIPTOR:
- audio.component_tag = ((ComponentDescriptor*)*desc)->getComponentTag();
+ case STREAM_IDENTIFIER_DESCRIPTOR:
+ audio.component_tag = ((StreamIdentifierDescriptor*)*desc)->getComponentTag();
break;
}
}
-from Screen import Screen
-from Components.ActionMap import ActionMap
-from Components.MenuList import MenuList
-from Components.Label import Label
-from Tools.ISO639 import LanguageCodes
-
-class AudioSelection(Screen):
- def KeyOk(self):
- selection = self["tracks"].getCurrent()
- print "select track " + str(selection[1])
-
- self.audio.selectTrack(selection[1])
- self.close()
- def __init__(self, session, audio):
- Screen.__init__(self, session)
-
- self["actions"] = ActionMap(["OkCancelActions"],
- {
- "cancel": self.close,
- "ok": self.KeyOk,
- })
-
- self.audio = audio
-
- tlist = []
- n = audio.getNumberOfTracks()
- for x in range(n):
- i = audio.getTrackInfo(x)
- langCode = i.getLanguage()
-
- description = i.getDescription();
-
- if langCode in LanguageCodes:
- language = LanguageCodes[langCode][0]
- if len(description):
- description += " (" + language + ")"
- else:
- description = language
-
- tlist.append((description, x))
-
- self["tracks"] = MenuList(tlist)
#include <dvbsi++/short_event_descriptor.h>
#include <dvbsi++/extended_event_descriptor.h>
#include <dvbsi++/linkage_descriptor.h>
+#include <dvbsi++/component_descriptor.h>
#include <dvbsi++/descriptor_tag.h>
DEFINE_REF(eServiceEvent);
+DEFINE_REF(eComponentData);
const char MAX_LANG = 37;
/* OSD language (see /share/locales/locales) to iso639 conversion table */
{
switch ((*desc)->getTag())
{
+ case COMPONENT_DESCRIPTOR:
+ {
+ const ComponentDescriptor *cp = (ComponentDescriptor*)*desc;
+ eComponentData data;
+ data.m_streamContent = cp->getStreamContent();
+ data.m_componentType = cp->getComponentType();
+ data.m_componentTag = cp->getComponentTag();
+ data.m_iso639LanguageCode = cp->getIso639LanguageCode();
+ data.m_text = convertDVBUTF8(cp->getText());
+ m_component_data.push_back(data);
+ break;
+ }
case LINKAGE_DESCRIPTOR:
{
const LinkageDescriptor *ld = (LinkageDescriptor*)*desc;
if ( ld->getLinkageType() == 0xB0 )
{
linkage_service s;
- s.onid = ld->getOriginalNetworkId();
- s.tsid = ld->getTransportStreamId();
- s.sid = ld->getServiceId();
+ s.m_onid = ld->getOriginalNetworkId();
+ s.m_tsid = ld->getTransportStreamId();
+ s.m_sid = ld->getServiceId();
const PrivateDataByteVector *privateData =
ld->getPrivateDataBytes();
- s.description.assign((const char*)&((*privateData)[0]), privateData->size());
+ s.m_description.assign((const char*)&((*privateData)[0]), privateData->size());
m_linkage_services.push_back(s);
}
break;
return 0;
}
-std::string eServiceEvent::getBeginTimeString()
+std::string eServiceEvent::getBeginTimeString() const
{
tm t;
localtime_r(&m_begin, &t);
return std::string(tmp, 12);
}
+RESULT eServiceEvent::getComponentData(ePtr<eComponentData> &dest, int tagnum) const
+{
+ std::list<eComponentData>::const_iterator it =
+ m_component_data.begin();
+ for(;it != m_component_data.end(); ++it)
+ {
+ if ( it->m_componentTag == tagnum )
+ {
+ dest=new eComponentData(*it);
+ return 0;
+ }
+ }
+ dest=0;
+ return -1;
+}
+
DEFINE_REF(eDebugClass);
class Event;
#endif
+struct eComponentData
+{
+DECLARE_REF(eComponentData);
+#ifndef SWIG
+ uint8_t m_streamContent;
+ uint8_t m_componentType;
+ uint8_t m_componentTag;
+ std::string m_iso639LanguageCode;
+ std::string m_text;
+#endif
+ int getStreamContent(void) const { return m_streamContent; }
+ int getComponentType(void) const { return m_componentType; }
+ int getComponentTag(void) const { return m_componentTag; }
+ std::string getIso639LanguageCode(void) const { return m_iso639LanguageCode; }
+ std::string getText(void) const { return m_text; }
+};
+
+TEMPLATE_TYPEDEF(ePtr<eComponentData>, eComponentDataPtr);
+
+struct linkage_service
+{
+ uint16_t m_sid;
+ uint16_t m_onid;
+ uint16_t m_tsid;
+ std::string m_description;
+};
+
class eServiceEvent: public iObject
{
DECLARE_REF(eServiceEvent);
#ifndef SWIG
bool loadLanguage(Event *event, std::string lang, int tsidonid);
+ std::list<eComponentData> m_component_data;
#endif
public:
#ifndef SWIG
- struct linkage_service
- {
- uint16_t sid;
- uint16_t onid;
- uint16_t tsid;
- std::string description;
- };
std::list<linkage_service> m_linkage_services;
time_t m_begin;
int m_duration;
// .. additional info
RESULT parseFrom(Event *evt, int tsidonid=0);
#endif
- time_t getBeginTime() { return m_begin; }
- int getDuration() { return m_duration; }
- std::string getEventName() { return m_event_name; }
- std::string getShortDescription() { return m_short_description; }
- std::string getExtendedDescription() { return m_extended_description; }
- std::string getBeginTimeString();
+ time_t getBeginTime() const { return m_begin; }
+ int getDuration() const { return m_duration; }
+ std::string getEventName() const { return m_event_name; }
+ std::string getShortDescription() const { return m_short_description; }
+ std::string getExtendedDescription() const { return m_extended_description; }
+ std::string getBeginTimeString() const;
+ SWIG_VOID(RESULT) getComponentData(ePtr<eComponentData> &SWIG_OUTPUT, int tagnum) const;
};
TEMPLATE_TYPEDEF(ePtr<eServiceEvent>, eServiceEventPtr);
info.m_description = "DTS";
else
info.m_description = "???";
-
- /* CHECK here for component tag override. */
- info.m_language = program.audioStreams[i].language_code;
+
+ if (program.audioStreams[i].component_tag != -1)
+ {
+ ePtr<eServiceEvent> evt;
+ if (!m_event_handler.getEvent(evt, 0))
+ {
+ ePtr<eComponentData> data;
+ if (!evt->getComponentData(data, program.audioStreams[i].component_tag))
+ info.m_language = data->getText();
+ }
+ }
+
+ if (info.m_language.empty())
+ info.m_language = program.audioStreams[i].language_code;
return 0;
}
if (m_service_handler.getProgramInfo(program))
return -1;
- if (i >= program.audioStreams.size())
+ if ((unsigned int)i >= program.audioStreams.size())
return -2;
if (!m_decoder)