neutrino: fix audio shortcut,

- moved subtitle handling to audioplayer,
- neutrino_menue: changed object handling in mediaplayer forwarder
- mediaplayer: usage modes added

user can now open the mediaplayer menu with audio button,
repeatedly pressing as usual the audio button starts up the audio player,
button 'W' starts the internet player.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1106 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
thilo
2011-02-02 21:42:40 +00:00
parent a2a9c99145
commit dbe50dc9c4
5 changed files with 84 additions and 22 deletions

View File

@@ -244,6 +244,8 @@ CAudioPlayerGui::~CAudioPlayerGui()
//------------------------------------------------------------------------ //------------------------------------------------------------------------
int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &)
{ {
CNeutrinoApp::getInstance()->StopSubtitles();
CAudioPlayer::getInstance()->init(); CAudioPlayer::getInstance()->init();
m_state = CAudioPlayerGui::STOP; m_state = CAudioPlayerGui::STOP;
@@ -334,6 +336,8 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &)
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , m_LastMode ); CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , m_LastMode );
g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 ); g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 );
CNeutrinoApp::getInstance()->StartSubtitles();
// always exit all // always exit all
return menu_return::RETURN_EXIT_ALL; return menu_return::RETURN_EXIT_ALL;
} }

View File

@@ -52,16 +52,31 @@
CMediaPlayerMenu::CMediaPlayerMenu() CMediaPlayerMenu::CMediaPlayerMenu()
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
setMenuTitel();
setUsageMode();
width = w_max (40, 10); //% width = w_max (40, 10); //%
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
height = hheight+13*mheight+ 10; height = hheight+13*mheight+ 10;
selected = -1; selected = -1;
x = getScreenStartX (width); x = getScreenStartX (width);
y = getScreenStartY (height); y = getScreenStartY (height);
} }
CMediaPlayerMenu* CMediaPlayerMenu::getInstance()
{
static CMediaPlayerMenu* mpm = NULL;
if(!mpm) {
mpm = new CMediaPlayerMenu();
printf("[neutrino] mediaplayer menu instance created\n");
}
return mpm;
}
CMediaPlayerMenu::~CMediaPlayerMenu() CMediaPlayerMenu::~CMediaPlayerMenu()
{ {
@@ -69,13 +84,13 @@ CMediaPlayerMenu::~CMediaPlayerMenu()
int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &/*actionKey*/) int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
{ {
dprintf(DEBUG_DEBUG, "init mediaplayer menu\n"); printf("init mediaplayer menu in usage mode %d\n", usage_mode);
int res = menu_return::RETURN_REPAINT; int res = menu_return::RETURN_REPAINT;
if (parent) if (parent)
parent->hide(); parent->hide();
showMenu(); showMenu();
return res; return res;
} }
@@ -89,32 +104,63 @@ void CMediaPlayerMenu::hide()
void CMediaPlayerMenu::showMenu() void CMediaPlayerMenu::showMenu()
{ {
//menue init //menue init
CMenuWidget *media = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width); CMenuWidget *media = new CMenuWidget(menu_title, NEUTRINO_ICON_MULTIMEDIA, width);
media->setSelected(selected); media->setSelected(selected);
media->addIntroItems();
//audio player //audio player
media->addItem(new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, true, NULL, new CAudioPlayerGui(), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_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;
CMenuForwarder * fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, true, NULL, new CAudioPlayerGui(), NULL, audio_rc, audio_btn);
//internet player //internet player
media->addItem(new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, new CAudioPlayerGui(true), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_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;
CMenuForwarder * fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, new CAudioPlayerGui(true), NULL, 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);
showMoviePlayer(moviePlayer); CMenuForwarder * fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, moviePlayer, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW);
media->addItem(new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, moviePlayer, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
//pictureviewer //pictureviewer
media->addItem(new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); CMenuForwarder * fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE);
//upnp browser //upnp browser
media->addItem(new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, true, NULL, new CUpnpBrowserGui(), NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0)); CMenuForwarder * fw_upnp = new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, true, NULL, new CUpnpBrowserGui(), NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0);
media->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, usage_mode == MODE_AUDIO ? CMenuWidget::BTN_TYPE_CANCEL : CMenuWidget::BTN_TYPE_BACK);
if (usage_mode == MODE_AUDIO)
{
//audio player
media->addItem(fw_audio);
//internet player
media->addItem(fw_inet);
}
else
{
//audio player
media->addItem(fw_audio);
//internet player
media->addItem(fw_inet);
//movieplayer
showMoviePlayer(moviePlayer);
media->addItem(fw_mp);
//pictureviewer
media->addItem(fw_pviewer);
//upnp browser
media->addItem(fw_upnp);
}
media->exec(NULL, ""); media->exec(NULL, "");
media->hide(); media->hide();
selected = media->getSelected(); selected = media->getSelected();
delete media; delete media;
setUsageMode();//set default usage_mode
} }
//show movieplayer submenu with selectable items for moviebrowser or filebrowser //show movieplayer submenu with selectable items for moviebrowser or filebrowser

View File

@@ -40,17 +40,27 @@ class CMediaPlayerMenu : public CMenuTarget
private: private:
CFrameBuffer *frameBuffer; CFrameBuffer *frameBuffer;
int x, y, width, height, hheight, mheight, selected; int x, y, width, height, hheight, mheight, selected, usage_mode;
neutrino_locale_t menu_title;
void hide(); void hide();
void showMenu(); void showMenu();
void showMoviePlayer(CMenuWidget *menu_movieplayer); void showMoviePlayer(CMenuWidget *menu_movieplayer);
public: public:
enum MM_MENU_MODES
{
MODE_DEFAULT,
MODE_AUDIO,
};
CMediaPlayerMenu(); CMediaPlayerMenu();
~CMediaPlayerMenu(); ~CMediaPlayerMenu();
static CMediaPlayerMenu* getInstance();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
void setMenuTitel(const neutrino_locale_t title = LOCALE_MAINMENU_MEDIA){menu_title = title;};
void setUsageMode(const int& mm_mode = MODE_DEFAULT){usage_mode = mm_mode;};
}; };

View File

@@ -94,6 +94,7 @@
#include "gui/osd_setup.h" #include "gui/osd_setup.h"
#include "gui/color.h" #include "gui/color.h"
#include "gui/customcolor.h" #include "gui/customcolor.h"
#include "gui/mediaplayer.h"
#include "gui/bedit/bouqueteditor_bouquets.h" #include "gui/bedit/bouqueteditor_bouquets.h"
#include "gui/bouquetlist.h" #include "gui/bouquetlist.h"
@@ -1747,7 +1748,6 @@ void CNeutrinoApp::SetupTiming()
sprintf(g_settings.timing_string[i], "%d", g_settings.timing[i]); sprintf(g_settings.timing_string[i], "%d", g_settings.timing[i]);
} }
CAudioPlayerGui * audioPlayer;
bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata); bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata);
bool sectionsd_getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata); bool sectionsd_getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata);
@@ -2550,10 +2550,11 @@ printf("[neutrino] direct record\n");
StartSubtitles(); StartSubtitles();
} }
else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) { else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) {
StopSubtitles(); //open mediaplayer menu in audio mode, user can select between audioplayer and internetradio
fprintf(stderr, "dbt broke the audioplayershortcut! :-)\n"); CMediaPlayerMenu * media = CMediaPlayerMenu::getInstance();
//audioPlayer->exec(NULL, ""); media->setMenuTitel(LOCALE_MAINMENU_AUDIOPLAYER);
StartSubtitles(); media->setUsageMode(CMediaPlayerMenu::MODE_AUDIO);
media->exec(NULL, "");
} }
else if( msg == CRCInput::RC_video || msg == CRCInput::RC_play ) { else if( msg == CRCInput::RC_video || msg == CRCInput::RC_play ) {
bool show = true; bool show = true;
@@ -4752,6 +4753,7 @@ void CNeutrinoApp::saveKeys(const char * fname)
void CNeutrinoApp::StopSubtitles() void CNeutrinoApp::StopSubtitles()
{ {
printf("[neutrino] %s\n", __FUNCTION__);
int ttx, dvbpid, ttxpid, ttxpage; int ttx, dvbpid, ttxpid, ttxpage;
dvbpid = dvbsub_getpid(); dvbpid = dvbsub_getpid();
@@ -4767,6 +4769,7 @@ void CNeutrinoApp::StopSubtitles()
void CNeutrinoApp::StartSubtitles() void CNeutrinoApp::StartSubtitles()
{ {
printf("[neutrino] %s\n", __FUNCTION__);
dvbsub_start(0); dvbsub_start(0);
tuxtx_pause_subtitle(false); tuxtx_pause_subtitle(false);
} }

View File

@@ -194,8 +194,7 @@ void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings
mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_GAMES, true, NULL, new CPluginList(LOCALE_MAINMENU_GAMES,CPlugins::P_TYPE_GAME), "", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_GAMES, true, NULL, new CPluginList(LOCALE_MAINMENU_GAMES,CPlugins::P_TYPE_GAME), "", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
//multimedia menu //multimedia menu
mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_MEDIA, true, NULL, new CMediaPlayerMenu(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_MEDIA, true, NULL, CMediaPlayerMenu::getInstance(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
if (g_PluginList->hasPlugin(CPlugins::P_TYPE_SCRIPT)) if (g_PluginList->hasPlugin(CPlugins::P_TYPE_SCRIPT))
mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SCRIPTS, true, NULL, new CPluginList(LOCALE_MAINMENU_SCRIPTS,CPlugins::P_TYPE_SCRIPT), "", mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SCRIPTS, true, NULL, new CPluginList(LOCALE_MAINMENU_SCRIPTS,CPlugins::P_TYPE_SCRIPT), "",