From a8e6636ef62a84710ec458edf68fd6b65fc878c7 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 5 May 2009 15:54:25 +0200 Subject: [PATCH] add iSubserviceList interface to iRecordableService --- lib/service/iservice.h | 4 +++- lib/service/servicedvbrecord.cpp | 28 ++++++++++++++++++++++++++++ lib/service/servicedvbrecord.h | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 7b85c8fa..8e3cec6f 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -867,7 +867,8 @@ public: evRecordStopped, evNewProgramInfo, evRecordFailed, - evRecordWriteError + evRecordWriteError, + evNewEventInfo }; enum { NoError=0, @@ -899,6 +900,7 @@ public: virtual RESULT stop()=0; virtual SWIG_VOID(RESULT) frontendInfo(ePtr &SWIG_OUTPUT)=0; virtual SWIG_VOID(RESULT) stream(ePtr &SWIG_OUTPUT)=0; + virtual SWIG_VOID(RESULT) subServices(ePtr &SWIG_OUTPUT)=0; }; SWIG_TEMPLATE_TYPEDEF(ePtr, iRecordableServicePtr); diff --git a/lib/service/servicedvbrecord.cpp b/lib/service/servicedvbrecord.cpp index 70783301..d9cdb516 100644 --- a/lib/service/servicedvbrecord.cpp +++ b/lib/service/servicedvbrecord.cpp @@ -503,6 +503,8 @@ void eDVBServiceRecord::gotNewEvent() eDebug("[eDVBServiceRecord] now running: %s (%d seconds)", event_now->getEventName().c_str(), event_now->getDuration()); m_last_event_id = event_id; + + m_event((iRecordableService*)this, evNewEventInfo); } void eDVBServiceRecord::saveCutlist() @@ -548,3 +550,29 @@ void eDVBServiceRecord::saveCutlist() } } + +RESULT eDVBServiceRecord::subServices(ePtr &ptr) +{ + ptr = this; + return 0; +} + +int eDVBServiceRecord::getNumberOfSubservices() +{ + ePtr evt; + if (!m_event_handler.getEvent(evt, 0)) + return evt->getNumOfLinkageServices(); + return 0; +} + +RESULT eDVBServiceRecord::getSubservice(eServiceReference &sub, unsigned int n) +{ + ePtr evt; + if (!m_event_handler.getEvent(evt, 0)) + { + if (!evt->getLinkageService(sub, m_ref, n)) + return 0; + } + sub.type=eServiceReference::idInvalid; + return -1; +} diff --git a/lib/service/servicedvbrecord.h b/lib/service/servicedvbrecord.h index e70547f1..319fbb70 100644 --- a/lib/service/servicedvbrecord.h +++ b/lib/service/servicedvbrecord.h @@ -13,6 +13,7 @@ class eDVBServiceRecord: public eDVBServiceBase, public iRecordableService, public iStreamableService, + public iSubserviceList, public Object { DECLARE_REF(eDVBServiceRecord); @@ -25,10 +26,14 @@ public: RESULT stream(ePtr &ptr); RESULT getError(int &error) { error = m_error; return 0; } RESULT frontendInfo(ePtr &ptr); + RESULT subServices(ePtr &ptr); /* streamable service */ PyObject *getStreamingData(); + // iSubserviceList + int getNumberOfSubservices(); + RESULT getSubservice(eServiceReference &subservice, unsigned int n); private: enum { stateIdle, statePrepared, stateRecording }; bool m_simulate; -- 2.30.2