diff options
Diffstat (limited to 'lib/service')
| -rw-r--r-- | lib/service/iservice.h | 15 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 55 | ||||
| -rw-r--r-- | lib/service/servicedvb.h | 8 | ||||
| -rw-r--r-- | lib/service/servicemp3.h | 1 |
4 files changed, 65 insertions, 14 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h index c93c84a5..a24b8b21 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -374,6 +374,20 @@ public: TEMPLATE_TYPEDEF(ePtr<iAudioTrackSelection>, iAudioTrackSelectionPtr); +class iAudioChannelSelection: public iObject +{ +#ifdef SWIG + iAudioChannelSelection(); + ~iAudioChannelSelection(); +#endif +public: + enum { LEFT, STEREO, RIGHT }; + virtual int getCurrentChannel()=0; + virtual RESULT selectChannel(int i)=0; +}; + +TEMPLATE_TYPEDEF(ePtr<iAudioChannelSelection>, iAudioChannelSelectionPtr); + class iSubserviceList: public iObject { #ifdef SWIG @@ -459,6 +473,7 @@ public: virtual SWIG_VOID(RESULT) pause(ePtr<iPauseableService> &SWIG_OUTPUT)=0; virtual SWIG_VOID(RESULT) info(ePtr<iServiceInformation> &SWIG_OUTPUT)=0; virtual SWIG_VOID(RESULT) audioTracks(ePtr<iAudioTrackSelection> &SWIG_OUTPUT)=0; + virtual SWIG_VOID(RESULT) audioChannel(ePtr<iAudioChannelSelection> &SWIG_OUTPUT)=0; virtual SWIG_VOID(RESULT) subServices(ePtr<iSubserviceList> &SWIG_OUTPUT)=0; virtual SWIG_VOID(RESULT) frontendStatusInfo(ePtr<iFrontendStatusInformation> &SWIG_OUTPUT)=0; virtual SWIG_VOID(RESULT) timeshift(ePtr<iTimeshiftService> &SWIG_OUTPUT)=0; diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index e9aeb8a9..0ec488fe 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -997,6 +997,12 @@ RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr) return 0; } +RESULT eDVBServicePlay::audioChannel(ePtr<iAudioChannelSelection> &ptr) +{ + ptr = this; + return 0; +} + RESULT eDVBServicePlay::audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = this; @@ -1239,12 +1245,12 @@ int eDVBServicePlay::selectAudioStream(int i) { if (program.audioStreams[i].type == eDVBAudio::aMPEG) { - m_dvb_service->setCachePID(eDVBService::cAPID, program.audioStreams[i].pid); - m_dvb_service->setCachePID(eDVBService::cAC3PID, -1); + m_dvb_service->setCacheEntry(eDVBService::cAPID, program.audioStreams[i].pid); + m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1); } else { - m_dvb_service->setCachePID(eDVBService::cAPID, -1); - m_dvb_service->setCachePID(eDVBService::cAC3PID, program.audioStreams[i].pid); + m_dvb_service->setCacheEntry(eDVBService::cAPID, -1); + m_dvb_service->setCacheEntry(eDVBService::cAC3PID, program.audioStreams[i].pid); } } @@ -1253,6 +1259,24 @@ int eDVBServicePlay::selectAudioStream(int i) return 0; } +int eDVBServicePlay::getCurrentChannel() +{ + int curChannel = m_dvb_service->getCacheEntry(eDVBService::cACHANNEL); + return curChannel == -1 ? STEREO : curChannel; +} + +RESULT eDVBServicePlay::selectChannel(int i) +{ + if (i < iAudioChannelSelection::LEFT || i > iAudioChannelSelection::RIGHT) + i = -1; // Stereo + if (m_dvb_service->getCacheEntry(eDVBService::cACHANNEL) != i) + { + m_dvb_service->setCacheEntry(eDVBService::cACHANNEL, i); + if (m_decoder) + m_decoder->setAudioChannel(i); + } +} + int eDVBServicePlay::getFrontendInfo(int w) { if (m_is_pvr) @@ -1560,7 +1584,7 @@ void eDVBServicePlay::switchToTimeshift() void eDVBServicePlay::updateDecoder() { - int vpid = -1, vpidtype = -1, apid = -1, apidtype = -1, pcrpid = -1, tpid = -1; + int vpid = -1, vpidtype = -1, apid = -1, apidtype = -1, pcrpid = -1, tpid = -1, achannel = -1; eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler; bool defaultac3=false; @@ -1619,6 +1643,7 @@ void eDVBServicePlay::updateDecoder() pcrpid = program.pcrPid; eDebug(", and the text pid is %04x", program.textPid); tpid = program.textPid; + achannel = program.audioChannel; } if (!m_decoder) @@ -1651,7 +1676,11 @@ void eDVBServicePlay::updateDecoder() if (!m_is_primary) m_decoder->setTrickmode(1); + m_decoder->start(); + + m_decoder->setAudioChannel(achannel); + // how we can do this better? // update cache pid when the user changed the audio track or video track // TODO handling of difference audio types.. default audio types.. @@ -1661,18 +1690,18 @@ void eDVBServicePlay::updateDecoder() { if (apidtype == eDVBAudio::aMPEG) { - m_dvb_service->setCachePID(eDVBService::cAPID, apid); - m_dvb_service->setCachePID(eDVBService::cAC3PID, -1); + m_dvb_service->setCacheEntry(eDVBService::cAPID, apid); + m_dvb_service->setCacheEntry(eDVBService::cAC3PID, -1); } else { - m_dvb_service->setCachePID(eDVBService::cAPID, -1); - m_dvb_service->setCachePID(eDVBService::cAC3PID, apid); + m_dvb_service->setCacheEntry(eDVBService::cAPID, -1); + m_dvb_service->setCacheEntry(eDVBService::cAC3PID, apid); } - m_dvb_service->setCachePID(eDVBService::cVPID, vpid); - m_dvb_service->setCachePID(eDVBService::cVTYPE, vpidtype); - m_dvb_service->setCachePID(eDVBService::cPCRPID, pcrpid); - m_dvb_service->setCachePID(eDVBService::cTPID, tpid); + m_dvb_service->setCacheEntry(eDVBService::cVPID, vpid); + m_dvb_service->setCacheEntry(eDVBService::cVTYPE, vpidtype); + m_dvb_service->setCacheEntry(eDVBService::cPCRPID, pcrpid); + m_dvb_service->setCacheEntry(eDVBService::cTPID, tpid); } } } diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 01eb0497..79e8d540 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -58,7 +58,8 @@ private: class eDVBServicePlay: public iPlayableService, public iPauseableService, public iSeekableService, public Object, public iServiceInformation, - public iAudioTrackSelection, public iFrontendStatusInformation, + public iAudioTrackSelection, public iAudioChannelSelection, + public iFrontendStatusInformation, public iSubserviceList, public iTimeshiftService, public iCueSheet { @@ -75,6 +76,7 @@ public: RESULT seek(ePtr<iSeekableService> &ptr); RESULT pause(ePtr<iPauseableService> &ptr); RESULT info(ePtr<iServiceInformation> &ptr); + RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr); RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr); RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr); RESULT subServices(ePtr<iSubserviceList> &ptr); @@ -107,6 +109,10 @@ public: RESULT selectTrack(unsigned int i); RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n); + // iAudioChannelSelection + int getCurrentChannel(); + RESULT selectChannel(int i); + // iFrontendStatusInformation int getFrontendInfo(int w); PyObject *getFrontendData(bool); diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index cb400cc6..c6a0df06 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -58,6 +58,7 @@ public: RESULT seek(ePtr<iSeekableService> &ptr); // not implemented (yet) + RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr) { ptr = 0; return -1; } RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr) { ptr = 0; return -1; } RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr) { ptr = 0; return -1; } RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; } |
