X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/02da1f586ef7945fef385e6d4743ef53441bc2fa..7bc4a59528ab13f3062dc1520e76f9ecedd87400:/lib/service/servicemp3.cpp diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index a6d19287..a5f1b773 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -9,13 +9,15 @@ // eServiceFactoryMP3 -eServiceFactoryMP3::eServiceFactoryMP3(): ref(0) +eServiceFactoryMP3::eServiceFactoryMP3() { ePtr sc; eServiceCenter::getInstance(sc); if (sc) sc->addServiceFactory(eServiceFactoryMP3::id, this); + + m_service_info = new eStaticServiceMP3Info(); } eServiceFactoryMP3::~eServiceFactoryMP3() @@ -49,8 +51,35 @@ RESULT eServiceFactoryMP3::list(const eServiceReference &, ePtr &ptr) +{ + ptr = m_service_info; + return 0; +} + +// eStaticServiceMP3Info + + +// eStaticServiceMP3Info is seperated from eServiceMP3 to give information +// about unopened files. + +// probably eServiceMP3 should use this class as well, and eStaticServiceMP3Info +// should have a database backend where ID3-files etc. are cached. +// this would allow listing the mp3 database based on certain filters. +DEFINE_REF(eStaticServiceMP3Info) + +eStaticServiceMP3Info::eStaticServiceMP3Info() +{ +} + +RESULT eStaticServiceMP3Info::getName(const eServiceReference &ref, std::string &name) +{ + name = "MP3 file: " + ref.path; + return 0; +} + +// eServiceMP3 void eServiceMP3::test_end() { @@ -58,7 +87,7 @@ void eServiceMP3::test_end() stop(); } -eServiceMP3::eServiceMP3(const char *filename): ref(0), filename(filename), test(eApp) +eServiceMP3::eServiceMP3(const char *filename): filename(filename), test(eApp) { m_state = stIdle; eDebug("SERVICEMP3 construct!"); @@ -75,7 +104,7 @@ DEFINE_REF(eServiceMP3); RESULT eServiceMP3::connectEvent(const Slot2 &event, ePtr &connection) { - connection = new eConnection(this, m_event.connect(event)); + connection = new eConnection((iPlayableService*)this, m_event.connect(event)); return 0; } @@ -105,15 +134,15 @@ RESULT eServiceMP3::stop() return 0; } -RESULT eServiceMP3::getIPausableService(ePtr &ptr) { ptr=this; return 0; } +RESULT eServiceMP3::pause(ePtr &ptr) { ptr=this; return 0; } // iPausableService RESULT eServiceMP3::pause() { printf("mp3 pauses!\n"); return 0; } RESULT eServiceMP3::unpause() { printf("mp3 unpauses!\n"); return 0; } -RESULT eServiceMP3::getIServiceInformation(ePtr&i) { i = this; return 0; } +RESULT eServiceMP3::info(ePtr&i) { i = this; return 0; } -RESULT eServiceMP3::getName(eString &name) +RESULT eServiceMP3::getName(const eServiceReference &ref, std::string &name) { name = "MP3 File: " + filename; return 0;