remove faulty debug print
[enigma2.git] / lib / nav / core.cpp
index 2dfe630d165f71ea908be6a6622c133123ea99f5..edc63c1881d9fa84f96ea3777a586509fc8053e5 100644 (file)
@@ -9,43 +9,7 @@ void eNavigation::serviceEvent(iPlayableService* service, int event)
                return;
        }
 
-       switch (event)
-       {
-       case iPlayableService::evEnd:
-               assert(m_playlist); /* we need to have a playlist */
-               
-               /* at first, kill the running service */
-               stopService();
-               
-               /* 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);
-               break;
-       case iPlayableService::evStart:
-               m_event(this, evNewService);
-               break;
-       case iPlayableService::evUpdatedEventInfo:
-               m_event(this, evUpdatedEventInfo);
-               break;
-       default:
-               break;
-       }
+       m_event(this, event);
 }
 
 RESULT eNavigation::playService(const eServiceReference &service)
@@ -62,25 +26,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<void,eNavigation*,int> &event, ePtr<eConnection> &connection)
 {
        connection = new eConnection(this, m_event.connect(event));
@@ -93,53 +38,31 @@ RESULT eNavigation::getCurrentService(ePtr<iPlayableService> &service)
        return 0;
 }
 
-RESULT eNavigation::getPlaylist(ePtr<ePlaylist> &playlist)
-{
-       if (!m_playlist)
-               return -1;
-       playlist = m_playlist;
-       return 0;
-}
-
 RESULT eNavigation::stopService(void)
 {
                /* check if there is a running service... */
        if (!m_runningService)
                return 1;
                        /* send stop event */
-       m_event(this, evStopService);
+       m_event(this, iPlayableService::evEnd);
 
+       m_runningService->stop();
                /* kill service. */
        m_runningService = 0;
        m_service_event_conn = 0;
        return 0;
 }
 
-RESULT eNavigation::recordService(const eServiceReference &service)
+RESULT eNavigation::recordService(const eServiceReference &ref, ePtr<iRecordableService> &service)
 {
-       if (m_recordingService)
-               endRecording();
-       
        assert(m_servicehandler);
-       RESULT res = m_servicehandler->record(service, m_recordingService);
-       if (m_recordingService)
-       {
-               res = m_recordingService->start();
-       }
+       RESULT res = m_servicehandler->record(ref, service);
+       eDebug("record: %d", res);
        if (res)
-               m_recordingService = 0;
+               service = 0;
        return res;
 }
 
-RESULT eNavigation::endRecording()
-{
-       if (!m_recordingService)
-               return -1;
-       m_recordingService->stop();
-       m_recordingService = 0;
-       return 0;
-}
-
 RESULT eNavigation::pause(int dop)
 {
        if (!m_runningService)
@@ -157,14 +80,11 @@ 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()
 {
+       stopService();
 }
 
 DEFINE_REF(eNavigation);