diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-11-28 01:54:35 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-11-28 01:54:35 +0000 |
| commit | 0329b4216112f4591e758ff2407002500abb0bf6 (patch) | |
| tree | 55c0cfdd2bc51663c1e26cc409f5740790abd110 /lib/service | |
| parent | 21baac81361a8a27f980cbcaaf2f97e130cbdef0 (diff) | |
| download | enigma2-0329b4216112f4591e758ff2407002500abb0bf6.tar.gz enigma2-0329b4216112f4591e758ff2407002500abb0bf6.zip | |
service: add info
Diffstat (limited to 'lib/service')
| -rw-r--r-- | lib/service/iservice.h | 39 | ||||
| -rw-r--r-- | lib/service/service.cpp | 9 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 80 | ||||
| -rw-r--r-- | lib/service/servicedvb.h | 5 |
4 files changed, 116 insertions, 17 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h index b7b34fe2..cbfd24a9 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -184,6 +184,36 @@ class iServiceInformation: public iObject public: virtual SWIG_VOID(RESULT) getName(std::string &SWIG_OUTPUT)=0; virtual SWIG_VOID(RESULT) getEvent(ePtr<eServiceEvent> &SWIG_OUTPUT, int nownext); + + enum { + sIsCrypted, /* is encrypted (no indication if decrypt was possible) */ + sAspect, /* aspect ratio: 0=4:3, 1=16:9, 2=whatever we need */ + sIsMultichannel, /* multichannel *available* (probably not selected) */ + + /* "user serviceable info" - they are not reliable. Don't use them for anything except the service menu! + that's also the reason why they are so globally defined. + + + again - if somebody EVER tries to use this information for anything else than simply displaying it, + i will change this to return a user-readable text like "zero x zero three three" (and change the + exact spelling in every version) to stop that! + */ + sVideoPID, + sAudioPID, + sPCRPID, + sPMTPID, + sTXTPID, + + sSID, + sONID, + sTSID, + sNamespace, + sProvider, + }; + enum { resNA = -1, resIsString = -2 }; + + virtual int getInfo(int w); + virtual std::string getInfoString(int w); }; TEMPLATE_TYPEDEF(ePtr<iServiceInformation>, iServiceInformationPtr); @@ -212,7 +242,10 @@ TEMPLATE_TYPEDEF(ePtr<iSeekableService>, iSeekableServicePtr); struct iAudioTrackInfo { std::string m_description; + std::string m_language; /* iso639 */ + std::string getDescription() { return m_description; } + std::string getLanguage() { return m_language; } }; SWIG_ALLOW_OUTPUT_SIMPLE(iAudioTrackInfo); @@ -227,6 +260,7 @@ public: TEMPLATE_TYPEDEF(ePtr<iAudioTrackSelection>, iAudioTrackSelectionPtr); + class iPlayableService: public iObject { friend class iServiceHandler; @@ -237,8 +271,9 @@ public: evEnd, evTuneFailed, - // when iServiceInformation is implemented: - evUpdatedEventInfo + // when iServiceInformation is implemented: + evUpdatedEventInfo, + evUpdatedInfo, }; virtual RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)=0; virtual RESULT start()=0; diff --git a/lib/service/service.cpp b/lib/service/service.cpp index 3a59d444..62bbe12d 100644 --- a/lib/service/service.cpp +++ b/lib/service/service.cpp @@ -139,5 +139,14 @@ RESULT iServiceInformation::getEvent(ePtr<eServiceEvent> &evt, int m_nownext) return -1; } +int iServiceInformation::getInfo(int w) +{ + return -1; +} + +std::string iServiceInformation::getInfoString(int w) +{ + return ""; +} eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter"); diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index d8206b9a..a49ce5c4 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -535,6 +535,7 @@ void eDVBServicePlay::serviceEvent(int event) if (m_decoder) { m_decoder->setVideoPID(vpid); + m_current_audio_stream = 0; m_decoder->setAudioPID(apid, apidtype); if (!m_is_pvr) m_decoder->setSyncPCR(pcrpid); @@ -706,6 +707,43 @@ RESULT eDVBServicePlay::getEvent(ePtr<eServiceEvent> &evt, int nownext) return m_event_handler.getEvent(evt, nownext); } +int eDVBServicePlay::getInfo(int w) +{ + eDVBServicePMTHandler::program program; + + if (m_service_handler.getProgramInfo(program)) + return -1; + + switch (w) + { + case sVideoPID: if (program.videoStreams.empty()) return -1; return program.videoStreams[0].pid; + case sAudioPID: if (program.audioStreams.empty()) return -1; return program.videoStreams[m_current_audio_stream].pid; + case sPCRPID: return program.pcrPid; + case sPMTPID: return program.pmtPid; + case sTXTPID: return -1; + + case sSID: return ((const eServiceReferenceDVB&)m_reference).getServiceID().get(); + case sONID: return ((const eServiceReferenceDVB&)m_reference).getOriginalNetworkID().get(); + case sTSID: return ((const eServiceReferenceDVB&)m_reference).getTransportStreamID().get(); + case sNamespace: return ((const eServiceReferenceDVB&)m_reference).getDVBNamespace().get(); + case sProvider: if (!m_dvb_service) return -1; return -2; + default: + return -1; + } +} + +std::string eDVBServicePlay::getInfoString(int w) +{ + switch (w) + { + case sProvider: + if (!m_dvb_service) return ""; + return m_dvb_service->m_provider_name; + default: + return ""; + } +} + int eDVBServicePlay::getNumberOfTracks() { eDVBServicePMTHandler::program program; @@ -716,24 +754,12 @@ int eDVBServicePlay::getNumberOfTracks() RESULT eDVBServicePlay::selectTrack(unsigned int i) { - eDVBServicePMTHandler::program program; - - if (m_service_handler.getProgramInfo(program)) - return -1; - - if (i >= program.audioStreams.size()) - return -2; - - if (!m_decoder) - return -3; - - if (m_decoder->setAudioPID(program.audioStreams[i].pid, program.audioStreams[i].type)) - return -4; + int ret = selectAudioStream(i); if (m_decoder->start()) return -5; - - return 0; + + return ret; } RESULT eDVBServicePlay::getTrackInfo(struct iAudioTrackInfo &info, unsigned int i) @@ -755,6 +781,30 @@ RESULT eDVBServicePlay::getTrackInfo(struct iAudioTrackInfo &info, unsigned int else info.m_description = "???"; + /* CHECK here for component tag override. */ + info.m_language = program.audioStreams[i].language_code; + + return 0; +} + +int eDVBServicePlay::selectAudioStream(int i) +{ + eDVBServicePMTHandler::program program; + + if (m_service_handler.getProgramInfo(program)) + return -1; + + if (i >= program.audioStreams.size()) + return -2; + + if (!m_decoder) + return -3; + + if (m_decoder->setAudioPID(program.audioStreams[i].pid, program.audioStreams[i].type)) + return -4; + + m_current_audio_stream = i; + return 0; } diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 31eee1fe..44d920f8 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -82,6 +82,8 @@ public: // iServiceInformation RESULT getName(std::string &name); RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext); + int getInfo(int w); + std::string getInfoString(int w); // iAudioTrackSelection int getNumberOfTracks(); @@ -107,6 +109,9 @@ private: Signal2<void,iPlayableService*,int> m_event; int m_is_pvr, m_is_paused; + + int m_current_audio_stream; + int selectAudioStream(int n); }; #endif |
