*neutrino mediaplayer: remember audio- and internetplayer contents

create and hold the audio player objects while runtime

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1128 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
thilo
2011-02-09 10:28:45 +00:00
parent 1c400862cd
commit 00b7ca8e08
3 changed files with 34 additions and 8 deletions

View File

@@ -242,8 +242,12 @@ CAudioPlayerGui::~CAudioPlayerGui()
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
{ {
if (actionKey == "init")
Init();
CNeutrinoApp::getInstance()->StopSubtitles(); CNeutrinoApp::getInstance()->StopSubtitles();
CAudioPlayer::getInstance()->init(); CAudioPlayer::getInstance()->init();

View File

@@ -36,7 +36,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include "gui/audioplayer.h"
#include "gui/movieplayer.h" #include "gui/movieplayer.h"
#include "gui/pictureviewer.h" #include "gui/pictureviewer.h"
#include "gui/upnpbrowser.h" #include "gui/upnpbrowser.h"
@@ -48,7 +48,6 @@
#include <system/debug.h> #include <system/debug.h>
CMediaPlayerMenu::CMediaPlayerMenu() CMediaPlayerMenu::CMediaPlayerMenu()
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
@@ -64,6 +63,9 @@ CMediaPlayerMenu::CMediaPlayerMenu()
x = getScreenStartX (width); x = getScreenStartX (width);
y = getScreenStartY (height); y = getScreenStartY (height);
audioPlayer = NULL;
inetPlayer = NULL;
} }
CMediaPlayerMenu* CMediaPlayerMenu::getInstance() CMediaPlayerMenu* CMediaPlayerMenu::getInstance()
@@ -79,10 +81,11 @@ CMediaPlayerMenu* CMediaPlayerMenu::getInstance()
CMediaPlayerMenu::~CMediaPlayerMenu() CMediaPlayerMenu::~CMediaPlayerMenu()
{ {
delete audioPlayer ;
delete inetPlayer ;
} }
int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &/*actionKey*/) int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey)
{ {
printf("init mediaplayer menu in usage mode %d\n", usage_mode); printf("init mediaplayer menu in usage mode %d\n", usage_mode);
int res = menu_return::RETURN_REPAINT; int res = menu_return::RETURN_REPAINT;
@@ -90,6 +93,23 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &/*actionKey*/
if (parent) if (parent)
parent->hide(); parent->hide();
if (actionKey == "audioplayer")
{
if (audioPlayer == NULL)
audioPlayer = new CAudioPlayerGui();
audioPlayer->exec(NULL, "init");
return res;
}
else if (actionKey == "inetplayer")
{
if (inetPlayer == NULL)
inetPlayer = new CAudioPlayerGui(true);
inetPlayer->exec(NULL, "init");
return res;
}
showMenu(); showMenu();
return res; return res;
@@ -110,12 +130,12 @@ void CMediaPlayerMenu::showMenu()
//audio player //audio player
neutrino_msg_t audio_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_audio:CRCInput::RC_red; neutrino_msg_t audio_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_audio:CRCInput::RC_red;
const char* audio_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_RED; const char* audio_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_RED;
CMenuForwarder * fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, true, NULL, new CAudioPlayerGui(), NULL, audio_rc, audio_btn); CMenuForwarder * fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, true, NULL, this, "audioplayer", audio_rc, audio_btn);
//internet player //internet player
neutrino_msg_t inet_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_www : CRCInput::RC_green; neutrino_msg_t inet_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_www : CRCInput::RC_green;
const char* inet_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_GREEN; const char* inet_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_GREEN;
CMenuForwarder * fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, new CAudioPlayerGui(true), NULL, inet_rc, inet_btn); CMenuForwarder * fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, this, "inetplayer", inet_rc, inet_btn);
//movieplayer //movieplayer
CMenuWidget *moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width); CMenuWidget *moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width);

View File

@@ -30,7 +30,7 @@
#define __MEDIAPLAYER__ #define __MEDIAPLAYER__
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include "gui/audioplayer.h"
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <string> #include <string>
@@ -39,6 +39,8 @@ class CMediaPlayerMenu : public CMenuTarget
{ {
private: private:
CFrameBuffer *frameBuffer; CFrameBuffer *frameBuffer;
CAudioPlayerGui *audioPlayer;
CAudioPlayerGui *inetPlayer;
int x, y, width, height, hheight, mheight, selected, usage_mode; int x, y, width, height, hheight, mheight, selected, usage_mode;
neutrino_locale_t menu_title; neutrino_locale_t menu_title;