X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4c54cecb6020cde399b564f17dacb048b937018a..984331e8556f07cee27bfb4416c4391ff0c2ce62:/lib/nav/core.cpp diff --git a/lib/nav/core.cpp b/lib/nav/core.cpp index c9dcb502..957983d9 100644 --- a/lib/nav/core.cpp +++ b/lib/nav/core.cpp @@ -1,4 +1,5 @@ #include +#include void eNavigation::serviceEvent(iPlayableService* service, int event) { @@ -9,37 +10,22 @@ void eNavigation::serviceEvent(iPlayableService* service, int event) } switch (event) - { + { case iPlayableService::evEnd: - assert(m_playlist); /* we need to have a playlist */ - - /* at first, kill the running service */ - m_event(this, evStopService); - m_runningService = 0; - m_service_event_conn = 0; - /* our running main service stopped. identify what to do next. */ - - /* unless the playlist current position is invalid (because there was */ - /* playlist, for example when the service was engaged with playService */ - if (m_playlist->m_current != m_playlist->end()) - ++m_playlist->m_current; - - /* was the current service the last one? */ - if (m_playlist->m_current == m_playlist->end()) - { - m_event(this, evPlaylistDone); - break; - } - - /* there is another service in the playlist. play it. */ - RESULT res; - res = playService(*m_playlist->m_current); - if (res) - m_event(this, evPlayFailed); +// m_event(this, ev); break; case iPlayableService::evStart: m_event(this, evNewService); break; + case iPlayableService::evUpdatedEventInfo: + m_event(this, evUpdatedEventInfo); + break; + case iPlayableService::evUpdatedInfo: + m_event(this, evUpdatedInfo); + break; + case iPlayableService::evSeekableStatusChanged: + m_event(this, evSeekableStatusChanged); + break; default: break; } @@ -47,6 +33,8 @@ void eNavigation::serviceEvent(iPlayableService* service, int event) RESULT eNavigation::playService(const eServiceReference &service) { + stopService(); + assert(m_servicehandler); RESULT res = m_servicehandler->play(service, m_runningService); if (m_runningService) @@ -57,25 +45,6 @@ RESULT eNavigation::playService(const eServiceReference &service) return res; } -RESULT eNavigation::enqueueService(const eServiceReference &service) -{ - assert(m_playlist); - /* check if we need to play after the service was enqueued. */ - int doplay = m_playlist->m_current == m_playlist->end(); - - /* add the service to the playlist. the playlist's m_current */ - /* points either to a service before the last or 'doplay' is set. */ - m_playlist->push_back(service); - - if (doplay) - { - m_playlist->m_current = m_playlist->end(); - --m_playlist->m_current; - return playService(*m_playlist->m_current); - } - return 0; -} - RESULT eNavigation::connectEvent(const Slot2 &event, ePtr &connection) { connection = new eConnection(this, m_event.connect(event)); @@ -88,20 +57,36 @@ RESULT eNavigation::getCurrentService(ePtr &service) return 0; } -RESULT eNavigation::getPlaylist(ePtr &playlist) +RESULT eNavigation::stopService(void) { - if (!m_playlist) - return -1; - playlist = m_playlist; + /* check if there is a running service... */ + if (!m_runningService) + return 1; + /* send stop event */ + m_event(this, evStopService); + + /* kill service. */ + m_runningService = 0; + m_service_event_conn = 0; return 0; } +RESULT eNavigation::recordService(const eServiceReference &ref, ePtr &service) +{ + assert(m_servicehandler); + RESULT res = m_servicehandler->record(ref, service); + eDebug("record: %d", res); + if (res) + service = 0; + return res; +} + RESULT eNavigation::pause(int dop) { if (!m_runningService) return -1; ePtr p; - if (m_runningService->getIPausableService(p)) + if (m_runningService->pause(p)) return -2; if (dop) return p->pause(); @@ -109,14 +94,10 @@ RESULT eNavigation::pause(int dop) return p->unpause(); } -eNavigation::eNavigation(iServiceHandler *serviceHandler): ref(0) +eNavigation::eNavigation(iServiceHandler *serviceHandler) { assert(serviceHandler); m_servicehandler = serviceHandler; - m_playlist = new ePlaylist; - - /* start with no current selection */ - m_playlist->m_current = m_playlist->end(); } eNavigation::~eNavigation()