TEMPLATE_TYPEDEF(ePtr<iSeekableService>, iSeekableServicePtr);
+struct iAudioTrackInfo
+{
+ std::string m_description;
+ std::string getDescription() { return m_description; }
+};
+
+SWIG_ALLOW_OUTPUT_SIMPLE(iAudioTrackInfo);
+
+class iAudioTrackSelection: public iObject
+{
+public:
+ virtual int getNumberOfTracks()=0;
+ virtual RESULT selectTrack(unsigned int i)=0;
+ virtual SWIG_VOID(RESULT) getTrackInfo(struct iAudioTrackInfo &SWIG_OUTPUT, unsigned int n)=0;
+};
+
+TEMPLATE_TYPEDEF(ePtr<iAudioTrackSelection>, iAudioTrackSelectionPtr);
+
class iPlayableService: public iObject
{
friend class iServiceHandler;
virtual SWIG_VOID(RESULT) seek(ePtr<iSeekableService> &SWIG_OUTPUT)=0;
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;
};
TEMPLATE_TYPEDEF(ePtr<iPlayableService>, iPlayableServicePtr);
}
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.");
i != program.audioStreams.end(); ++i)
{
if (apid == -1)
+ {
apid = i->pid;
+ apidtype = i->type;
+ }
if (i != program.audioStreams.begin())
eDebugNoNewLine(", ");
eDebugNoNewLine("%04x", i->pid);
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
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)
return 0;
}
+RESULT eDVBServicePlay::audioTracks(ePtr<iAudioTrackSelection> &ptr)
+{
+ ptr = this;
+ return 0;
+}
+
RESULT eDVBServicePlay::getName(std::string &name)
{
if (m_dvb_service)
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");
eBouquet *m_bouquet;
};
-class eDVBServicePlay: public iPlayableService, public iPauseableService, public iSeekableService, public Object, public iServiceInformation
+class eDVBServicePlay: public iPlayableService, public iPauseableService,
+ public iSeekableService, public Object, public iServiceInformation,
+ public iAudioTrackSelection
{
DECLARE_REF(eDVBServicePlay);
public:
RESULT seek(ePtr<iSeekableService> &ptr);
RESULT pause(ePtr<iPauseableService> &ptr);
RESULT info(ePtr<iServiceInformation> &ptr);
+ RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
// iPauseableService
RESULT pause();
RESULT getName(std::string &name);
RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
+ // iAudioTrackSelection
+ int getNumberOfTracks();
+ RESULT selectTrack(unsigned int i);
+ RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
+
private:
friend class eServiceFactoryDVB;
eServiceReference m_reference;