diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-11-14 21:39:48 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-11-14 21:39:48 +0000 |
| commit | 3353982034f151f4615cb1842873d99a7a6fa0ca (patch) | |
| tree | 101d5cee09123df815c41bd10cea5e2308b730d8 /lib/service/servicedvb.cpp | |
| parent | 847b6c20d19ba1f97eb096063dad2a910f5afa03 (diff) | |
| download | enigma2-3353982034f151f4615cb1842873d99a7a6fa0ca.tar.gz enigma2-3353982034f151f4615cb1842873d99a7a6fa0ca.zip | |
add audio track selection
Diffstat (limited to 'lib/service/servicedvb.cpp')
| -rw-r--r-- | lib/service/servicedvb.cpp | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 77fe3faf..39c4407d 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -478,7 +478,7 @@ void eDVBServicePlay::serviceEvent(int event) } case eDVBServicePMTHandler::eventNewProgramInfo: { - int vpid = -1, apid = -1, pcrpid = -1; + int vpid = -1, apid = -1, apidtype = -1, pcrpid = -1; eDVBServicePMTHandler::program program; if (m_service_handler.getProgramInfo(program)) eDebug("getting program info failed."); @@ -509,7 +509,10 @@ void eDVBServicePlay::serviceEvent(int event) i != program.audioStreams.end(); ++i) { if (apid == -1) + { apid = i->pid; + apidtype = i->type; + } if (i != program.audioStreams.begin()) eDebugNoNewLine(", "); eDebugNoNewLine("%04x", i->pid); @@ -532,7 +535,7 @@ void eDVBServicePlay::serviceEvent(int event) if (m_decoder) { m_decoder->setVideoPID(vpid); - m_decoder->setAudioPID(apid, 0); + m_decoder->setAudioPID(apid, apidtype); if (!m_is_pvr) m_decoder->setSyncPCR(pcrpid); else @@ -649,7 +652,8 @@ RESULT eDVBServicePlay::seekRelative(int direction, pts_t to) if (m_service_handler.getPVRChannel(pvr_channel)) return -1; - return pvr_channel->seekToPosition(SEEK_CUR, to); + /* this is of couse wrong: PTS values don't match with bytes. */ + return pvr_channel->seekToPosition(SEEK_CUR, direction * to); } RESULT eDVBServicePlay::getPlayPosition(pts_t &pos) @@ -668,6 +672,12 @@ RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr) return 0; } +RESULT eDVBServicePlay::audioTracks(ePtr<iAudioTrackSelection> &ptr) +{ + ptr = this; + return 0; +} + RESULT eDVBServicePlay::getName(std::string &name) { if (m_dvb_service) @@ -685,6 +695,55 @@ RESULT eDVBServicePlay::getEvent(ePtr<eServiceEvent> &evt, int nownext) return m_event_handler.getEvent(evt, nownext); } +int eDVBServicePlay::getNumberOfTracks() +{ + eDVBServicePMTHandler::program program; + if (m_service_handler.getProgramInfo(program)) + return 0; + return program.audioStreams.size(); +} + +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; + + return 0; +} + +RESULT eDVBServicePlay::getTrackInfo(struct iAudioTrackInfo &info, unsigned int i) +{ + eDVBServicePMTHandler::program program; + + if (m_service_handler.getProgramInfo(program)) + return -1; + + if (i >= program.audioStreams.size()) + return -2; + + if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atMPEG) + info.m_description = "MPEG"; + else if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atAC3) + info.m_description = "AC3"; + else if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atDTS) + info.m_description = "DTS"; + else + info.m_description = "???"; + + return 0; +} + DEFINE_REF(eDVBServicePlay) eAutoInitPtr<eServiceFactoryDVB> init_eServiceFactoryDVB(eAutoInitNumbers::service+1, "eServiceFactoryDVB"); |
