diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-05-16 14:58:11 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-05-16 14:58:11 +0000 |
| commit | 4e8cae716ad3fdf29a7b2a45e5eec0a530f93277 (patch) | |
| tree | 33cc04ae9577a5dd03dd4a52c9205fcc957236ee /lib/dvb | |
| parent | 193333b7bc72ab13d4dee5750b31c3c33041c696 (diff) | |
| download | enigma2-4e8cae716ad3fdf29a7b2a45e5eec0a530f93277.tar.gz enigma2-4e8cae716ad3fdf29a7b2a45e5eec0a530f93277.zip | |
add ability to selecte the audio channel (mono left, stereo, mono right) from python
store the current selected audio channel then per service in servicelist
TODO: extend the audio track selection screen to make audio channel selection usable :)
Diffstat (limited to 'lib/dvb')
| -rw-r--r-- | lib/dvb/db.cpp | 4 | ||||
| -rw-r--r-- | lib/dvb/decoder.cpp | 25 | ||||
| -rw-r--r-- | lib/dvb/decoder.h | 3 | ||||
| -rw-r--r-- | lib/dvb/idvb.h | 12 | ||||
| -rw-r--r-- | lib/dvb/pmt.cpp | 21 | ||||
| -rw-r--r-- | lib/dvb/pmt.h | 1 |
6 files changed, 50 insertions, 16 deletions
diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index 64ef6ed7..9b2324a6 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -232,14 +232,14 @@ int eDVBService::checkFilter(const eServiceReferenceDVB &ref, const eDVBChannelQ return res; } -int eDVBService::getCachePID(cacheID id) +int eDVBService::getCacheEntry(cacheID id) { if (id >= cacheMax) return -1; return m_cache[id]; } -void eDVBService::setCachePID(cacheID id, int pid) +void eDVBService::setCacheEntry(cacheID id, int pid) { if (id < cacheMax) m_cache[id] = pid; diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index 1bec997d..76d0f504 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -137,6 +137,22 @@ void eDVBAudio::unfreeze() eDebug("video: AUDIO_CONTINUE: %m"); } +void eDVBAudio::setChannel(int channel) +{ + int val = AUDIO_STEREO; + switch (channel) + { + case aMonoLeft: val = AUDIO_MONO_LEFT; break; + case aMonoRight: val = AUDIO_MONO_RIGHT; break; + default: + break; + } + if (::ioctl(m_fd, AUDIO_CHANNEL_SELECT, val) < 0) + eDebug("video: AUDIO_CHANNEL_SELECT: %m"); + else + eDebug("AUDIO_CHANNEL_SELECT ok"); +} + int eDVBAudio::getPTS(pts_t &now) { return ::ioctl(m_fd, AUDIO_GET_PTS, &now); @@ -552,6 +568,15 @@ RESULT eTSMPEGDecoder::setAudioPID(int apid, int type) return 0; } +RESULT eTSMPEGDecoder::setAudioChannel(int channel) +{ + if (m_audio) + m_audio->setChannel(channel); + else + eDebug("eTSMPEGDecoder::setAudioChannel but no audio decoder exist"); + return 0; +} + RESULT eTSMPEGDecoder::setSyncPCR(int pcrpid) { if (m_pcrpid != pcrpid) diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index 834499b0..f8719869 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -14,6 +14,8 @@ public: enum { aMPEG, aAC3, aDTS, aAAC }; eDVBAudio(eDVBDemux *demux, int dev); int startPid(int pid, int type); + enum { aMonoLeft, aStereo, aMonoRight }; + void setChannel(int channel); void stop(); #if HAVE_DVB_API_VERSION < 3 void start(); @@ -107,6 +109,7 @@ public: virtual ~eTSMPEGDecoder(); RESULT setVideoPID(int vpid, int type); RESULT setAudioPID(int apid, int type); + RESULT setAudioChannel(int channel); RESULT setSyncPCR(int pcrpid); RESULT setTextPID(int textpid); RESULT setSyncMaster(int who); diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index ecf8bb92..dff543ca 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -223,11 +223,11 @@ class eDVBService: public iStaticServiceInformation public: enum cacheID { - cVPID, cAPID, cTPID, cPCRPID, cAC3PID, cVTYPE, cacheMax + cVPID, cAPID, cTPID, cPCRPID, cAC3PID, cVTYPE, cACHANNEL, cacheMax }; - int getCachePID(cacheID); - void setCachePID(cacheID, int); + int getCacheEntry(cacheID); + void setCacheEntry(cacheID, int); bool cacheEmpty(); @@ -577,10 +577,14 @@ public: /** Set Displayed Video PID and type */ virtual RESULT setVideoPID(int vpid, int type)=0; - enum { af_MPEG, af_AC3, af_DTS }; + enum { af_MPEG, af_AC3, af_DTS, af_AAC }; /** Set Displayed Audio PID and type */ virtual RESULT setAudioPID(int apid, int type)=0; + enum { ac_left, ac_stereo, ac_right }; + /** Set Displayed Audio Channel */ + virtual RESULT setAudioChannel(int channel)=0; + /** Set Displayed Videotext PID */ virtual RESULT setTextPID(int vpid)=0; diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 11cda125..1032267d 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -216,6 +216,7 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) program.isCrypted = false; program.pmtPid = -1; program.textPid = -1; + program.audioChannel = m_service ? m_service->getCacheEntry(eDVBService::cACHANNEL) : -1; if ( ((m_service && m_service->usePMT()) || !m_service) && !m_PMT.getCurrent(ptr)) { @@ -225,10 +226,10 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) int cached_tpid = -1; if ( m_service && !m_service->cacheEmpty() ) { - cached_vpid = m_service->getCachePID(eDVBService::cVPID); - cached_apid_mpeg = m_service->getCachePID(eDVBService::cAC3PID); - cached_apid_ac3 = m_service->getCachePID(eDVBService::cAPID); - cached_tpid = m_service->getCachePID(eDVBService::cTPID); + cached_vpid = m_service->getCacheEntry(eDVBService::cVPID); + cached_apid_mpeg = m_service->getCacheEntry(eDVBService::cAC3PID); + cached_apid_ac3 = m_service->getCacheEntry(eDVBService::cAPID); + cached_tpid = m_service->getCacheEntry(eDVBService::cTPID); } eDVBTableSpec table_spec; ptr->getSpec(table_spec); @@ -359,12 +360,12 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) return 0; } else if ( m_service && !m_service->cacheEmpty() ) { - int vpid = m_service->getCachePID(eDVBService::cVPID), - apid_ac3 = m_service->getCachePID(eDVBService::cAC3PID), - apid_mpeg = m_service->getCachePID(eDVBService::cAPID), - pcrpid = m_service->getCachePID(eDVBService::cPCRPID), - tpid = m_service->getCachePID(eDVBService::cTPID), - vpidtype = m_service->getCachePID(eDVBService::cVTYPE), + int vpid = m_service->getCacheEntry(eDVBService::cVPID), + apid_ac3 = m_service->getCacheEntry(eDVBService::cAC3PID), + apid_mpeg = m_service->getCacheEntry(eDVBService::cAPID), + pcrpid = m_service->getCacheEntry(eDVBService::cPCRPID), + tpid = m_service->getCacheEntry(eDVBService::cTPID), + vpidtype = m_service->getCacheEntry(eDVBService::cVTYPE), cnt=0; if ( vpidtype == -1 ) vpidtype = videoStream::vtMPEG2; diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index b6a3743f..f4e99a57 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -122,6 +122,7 @@ public: int pmtPid; int textPid; bool isCrypted; + int audioChannel; }; int getProgramInfo(struct program &program); |
