+int eDVBServicePlay::getInfo(int w)
+{
+ eDVBServicePMTHandler::program program;
+
+ if (m_service_handler.getProgramInfo(program))
+ return -1;
+
+ switch (w)
+ {
+ case sAspect:
+ if (!program.videoStreams.empty() && program.videoStreams[0].component_tag != -1)
+ {
+ ePtr<eServiceEvent> evt;
+ if (!m_event_handler.getEvent(evt, 0))
+ {
+ ePtr<eComponentData> data;
+ if (!evt->getComponentData(data, program.videoStreams[0].component_tag))
+ {
+ if ( data->getStreamContent() == 1 )
+ {
+ switch(data->getComponentType())
+ {
+ // SD
+ case 1: // 4:3 SD PAL
+ case 2:
+ case 3: // 16:9 SD PAL
+ case 4: // > 16:9 PAL
+ case 5: // 4:3 SD NTSC
+ case 6:
+ case 7: // 16:9 SD NTSC
+ case 8: // > 16:9 NTSC
+
+ // HD
+ case 9: // 4:3 HD PAL
+ case 0xA:
+ case 0xB: // 16:9 HD PAL
+ case 0xC: // > 16:9 HD PAL
+ case 0xD: // 4:3 HD NTSC
+ case 0xE:
+ case 0xF: // 16:9 HD NTSC
+ case 0x10: // > 16:9 HD PAL
+ return data->getComponentType();
+ }
+ }
+ }
+ }
+ }
+ return -1;
+ case sIsCrypted: return program.isCrypted;
+ case sVideoPID: if (program.videoStreams.empty()) return -1; return program.videoStreams[0].pid;
+ case sAudioPID: if (program.audioStreams.empty()) return -1; return program.audioStreams[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;
+ if (m_service_handler.getProgramInfo(program))
+ return 0;
+ return program.audioStreams.size();
+}
+
+RESULT eDVBServicePlay::selectTrack(unsigned int i)
+{
+ int ret = selectAudioStream(i);
+
+ if (m_decoder->start())
+ return -5;
+
+ return ret;
+}
+
+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 = "???";
+
+ 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;
+}
+
+int eDVBServicePlay::selectAudioStream(int i)
+{
+ eDVBServicePMTHandler::program program;
+
+ if (m_service_handler.getProgramInfo(program))
+ return -1;
+
+ if ((unsigned int)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;
+}
+
+int eDVBServicePlay::getFrontendInfo(int w)
+{
+ if (m_is_pvr)
+ return 0;
+ eUsePtr<iDVBChannel> channel;
+ if(m_service_handler.getChannel(channel))
+ return 0;
+ ePtr<iDVBFrontend> fe;
+ if(channel->getFrontend(fe))
+ return 0;
+ return fe->readFrontendData(w);
+}
+
+int eDVBServicePlay::getNumberOfSubservices()
+{
+ ePtr<eServiceEvent> evt;
+ if (!m_event_handler.getEvent(evt, 0))
+ return evt->getNumOfLinkageServices();
+ return 0;
+}
+
+RESULT eDVBServicePlay::getSubservice(eServiceReference &sub, unsigned int n)
+{
+ ePtr<eServiceEvent> evt;
+ if (!m_event_handler.getEvent(evt, 0))
+ {
+ if (!evt->getLinkageService(sub, n))
+ {
+ eServiceReferenceDVB &subservice = (eServiceReferenceDVB&) sub;
+ eServiceReferenceDVB ¤t = (eServiceReferenceDVB&) m_reference;
+ subservice.setDVBNamespace(current.getDVBNamespace());
+ if ( current.getParentTransportStreamID().get() )
+ {
+ subservice.setParentTransportStreamID( current.getParentTransportStreamID() );
+ subservice.setParentServiceID( current.getParentServiceID() );
+ }
+ else
+ {
+ subservice.setParentTransportStreamID( current.getTransportStreamID() );
+ subservice.setParentServiceID( current.getServiceID() );
+ }
+ if ( subservice.getParentTransportStreamID() == subservice.getTransportStreamID() &&
+ subservice.getParentServiceID() == subservice.getServiceID() )
+ {
+ subservice.setParentTransportStreamID( eTransportStreamID(0) );
+ subservice.setParentServiceID( eServiceID(0) );
+ }
+ return 0;
+ }
+ }
+ sub.type=eServiceReference::idInvalid;
+ return -1;
+}
+
+RESULT eDVBServicePlay::startTimeshift()
+{
+ if (m_timeshift_enabled)
+ return -1;
+ eDebug("TIMESHIFT - start!");
+ return 0;
+}
+
+RESULT eDVBServicePlay::stopTimeshift()
+{
+ if (!m_timeshift_enabled)
+ return -1;
+ m_timeshift_enabled = 0;
+ eDebug("timeshift disabled");
+ return 0;
+}
+