- mediaplayer: formatting code using astyle

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-10-20 19:31:13 +02:00
committed by Thilo Graf
parent 45cf7e0698
commit 24897213a0
2 changed files with 60 additions and 60 deletions

View File

@@ -52,22 +52,23 @@
#include <system/debug.h> #include <system/debug.h>
#include <hardware/video.h> #include <hardware/video.h>
extern cVideo * videoDecoder; extern cVideo *videoDecoder;
CMediaPlayerMenu::CMediaPlayerMenu() CMediaPlayerMenu::CMediaPlayerMenu()
{ {
width = 40; width = 40;
audioPlayer = NULL; audioPlayer = NULL;
inetPlayer = NULL; inetPlayer = NULL;
} }
CMediaPlayerMenu* CMediaPlayerMenu::getInstance() CMediaPlayerMenu *CMediaPlayerMenu::getInstance()
{ {
static CMediaPlayerMenu* mpm = NULL; static CMediaPlayerMenu *mpm = NULL;
if(!mpm) { if (!mpm)
{
mpm = new CMediaPlayerMenu(); mpm = new CMediaPlayerMenu();
printf("[neutrino] mediaplayer menu instance created\n"); printf("[neutrino] mediaplayer menu instance created\n");
} }
@@ -76,119 +77,119 @@ CMediaPlayerMenu* CMediaPlayerMenu::getInstance()
CMediaPlayerMenu::~CMediaPlayerMenu() CMediaPlayerMenu::~CMediaPlayerMenu()
{ {
delete audioPlayer ; delete audioPlayer;
delete inetPlayer ; delete inetPlayer;
} }
int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) int CMediaPlayerMenu::exec(CMenuTarget *parent, const std::string &actionKey)
{ {
if (parent) if (parent)
parent->hide(); parent->hide();
CAudioMute *audiomute = CAudioMute::getInstance(); CAudioMute *audiomute = CAudioMute::getInstance();
if (actionKey == "audioplayer") if (actionKey == "audioplayer")
{ {
if (audioPlayer == NULL) if (audioPlayer == NULL)
audioPlayer = new CAudioPlayerGui(); audioPlayer = new CAudioPlayerGui();
int res = audioPlayer->exec(NULL, "init"); int res = audioPlayer->exec(NULL, "init");
return res /*menu_return::RETURN_REPAINT*/; return res;
} }
else if (actionKey == "inetplayer") else if (actionKey == "inetplayer")
{ {
if (inetPlayer == NULL) if (inetPlayer == NULL)
inetPlayer = new CAudioPlayerGui(true); inetPlayer = new CAudioPlayerGui(true);
int res = inetPlayer->exec(NULL, "init"); int res = inetPlayer->exec(NULL, "init");
return res; //menu_return::RETURN_REPAINT; return res;
} }
else if (actionKey == "moviebrowser") else if (actionKey == "moviebrowser")
{ {
audiomute->enableMuteIcon(false); audiomute->enableMuteIcon(false);
CInfoClock::getInstance()->enableInfoClock(false); CInfoClock::getInstance()->enableInfoClock(false);
int mode = CNeutrinoApp::getInstance()->getMode(); int mode = CNeutrinoApp::getInstance()->getMode();
if( mode == NeutrinoModes::mode_radio ) if (mode == NeutrinoModes::mode_radio)
CFrameBuffer::getInstance()->stopFrame(); CFrameBuffer::getInstance()->stopFrame();
int res = CMoviePlayerGui::getInstance().exec(NULL, "tsmoviebrowser"); int res = CMoviePlayerGui::getInstance().exec(NULL, "tsmoviebrowser");
if( mode == NeutrinoModes::mode_radio ) if (mode == NeutrinoModes::mode_radio)
CFrameBuffer::getInstance()->showFrame("radiomode.jpg"); CFrameBuffer::getInstance()->showFrame("radiomode.jpg");
audiomute->enableMuteIcon(true); audiomute->enableMuteIcon(true);
CInfoClock::getInstance()->enableInfoClock(true); CInfoClock::getInstance()->enableInfoClock(true);
return res; return res;
} }
int res = initMenuMedia(); int res = initMenuMedia();
return res; return res;
} }
//show selectable mediaplayer items // show selectable mediaplayer items
int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p)
{ {
CPersonalizeGui *personalize = p; CPersonalizeGui *personalize = p;
CMenuWidget *multimedia_menu = m; CMenuWidget *multimedia_menu = m;
bool show = (personalize == NULL || multimedia_menu == NULL); bool show = (personalize == NULL || multimedia_menu == NULL);
if (personalize == NULL) if (personalize == NULL)
personalize = new CPersonalizeGui(); personalize = new CPersonalizeGui();
if (multimedia_menu == NULL) if (multimedia_menu == NULL)
multimedia_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA); multimedia_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA);
personalize->addWidget(multimedia_menu); personalize->addWidget(multimedia_menu);
personalize->addIntroItems(multimedia_menu); personalize->addIntroItems(multimedia_menu);
bool enabled = !CMoviePlayerGui::getInstance().Playing(); bool enabled = !CMoviePlayerGui::getInstance().Playing();
//audio player // audio player
CMenuForwarder *fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, enabled, NULL, this, "audioplayer", CRCInput::RC_red); CMenuForwarder *fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, enabled, NULL, this, "audioplayer", CRCInput::RC_red);
fw_audio->setHint(NEUTRINO_ICON_HINT_APLAY, LOCALE_MENU_HINT_APLAY); fw_audio->setHint(NEUTRINO_ICON_HINT_APLAY, LOCALE_MENU_HINT_APLAY);
personalize->addItem(multimedia_menu, fw_audio, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_AUDIO]); personalize->addItem(multimedia_menu, fw_audio, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_AUDIO]);
//internet player // internet player
CMenuForwarder *fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, enabled, NULL, this, "inetplayer", CRCInput::RC_green); CMenuForwarder *fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, enabled, NULL, this, "inetplayer", CRCInput::RC_green);
fw_inet->setHint(NEUTRINO_ICON_HINT_INET_RADIO, LOCALE_MENU_HINT_INET_RADIO); fw_inet->setHint(NEUTRINO_ICON_HINT_INET_RADIO, LOCALE_MENU_HINT_INET_RADIO);
personalize->addItem(multimedia_menu, fw_inet, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_INETPLAY]); personalize->addItem(multimedia_menu, fw_inet, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_INETPLAY]);
//init movieplayer submenu // init movieplayer submenu
CMenuWidget *movieplayer_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIAPLAYER, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA_MOVIEPLAYER); CMenuWidget *movieplayer_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIAPLAYER, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA_MOVIEPLAYER);
personalize->addWidget(movieplayer_menu); personalize->addWidget(movieplayer_menu);
personalize->addIntroItems(movieplayer_menu); personalize->addIntroItems(movieplayer_menu);
//moviebrowser // moviebrowser
CMenuForwarder *fw_mbrowser = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, this, "moviebrowser", CRCInput::RC_red); CMenuForwarder *fw_mbrowser = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, this, "moviebrowser", CRCInput::RC_red);
fw_mbrowser->setHint(NEUTRINO_ICON_HINT_MB, LOCALE_MENU_HINT_MB); fw_mbrowser->setHint(NEUTRINO_ICON_HINT_MB, LOCALE_MENU_HINT_MB);
personalize->addItem(movieplayer_menu, fw_mbrowser, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_MBROWSER]); personalize->addItem(movieplayer_menu, fw_mbrowser, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_MBROWSER]);
//fileplayback video // fileplayback video
CMenuForwarder *fw_fileplay_video = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_VIDEO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_video", CRCInput::RC_green); CMenuForwarder *fw_fileplay_video = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_VIDEO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_video", CRCInput::RC_green);
fw_fileplay_video->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_VIDEO); fw_fileplay_video->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_VIDEO);
personalize->addItem(movieplayer_menu, fw_fileplay_video, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_VIDEO]); personalize->addItem(movieplayer_menu, fw_fileplay_video, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_VIDEO]);
#if !HAVE_CST_HARDWARE #if !HAVE_CST_HARDWARE
//fileplayback audio // fileplayback audio
CMenuForwarder *fw_fileplay_audio = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_AUDIO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_audio", CRCInput::RC_yellow); CMenuForwarder *fw_fileplay_audio = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_AUDIO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_audio", CRCInput::RC_yellow);
fw_fileplay_audio->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_AUDIO); fw_fileplay_audio->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_AUDIO);
personalize->addItem(movieplayer_menu, fw_fileplay_audio, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_AUDIO]); personalize->addItem(movieplayer_menu, fw_fileplay_audio, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_AUDIO]);
#endif #endif
#if ENABLE_YOUTUBE_PLAYER #if ENABLE_YOUTUBE_PLAYER
//ytplayback // ytplayback
CMenuForwarder *fw_ytplay = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, g_settings.youtube_enabled, NULL, &CMoviePlayerGui::getInstance(), "ytplayback", CRCInput::RC_blue); CMenuForwarder *fw_ytplay = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, g_settings.youtube_enabled, NULL, &CMoviePlayerGui::getInstance(), "ytplayback", CRCInput::RC_blue);
fw_ytplay->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY); fw_ytplay->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY);
personalize->addItem(movieplayer_menu, fw_ytplay, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_YTPLAY]); personalize->addItem(movieplayer_menu, fw_ytplay, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_YTPLAY]);
#endif #endif
//add movieplayer submenu // add movieplayer submenu
CMenuForwarder *fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MEDIAPLAYER, enabled, NULL, movieplayer_menu, NULL, CRCInput::RC_yellow); CMenuForwarder *fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MEDIAPLAYER, enabled, NULL, movieplayer_menu, NULL, CRCInput::RC_yellow);
fw_mp->setHint(NEUTRINO_ICON_HINT_MOVIE, LOCALE_MENU_HINT_MOVIE); fw_mp->setHint(NEUTRINO_ICON_HINT_MOVIE, LOCALE_MENU_HINT_MOVIE);
personalize->addItem(multimedia_menu, fw_mp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_MPLAYER], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); personalize->addItem(multimedia_menu, fw_mp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_MPLAYER], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION);
//pictureviewer // pictureviewer
CMenuForwarder *fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue); CMenuForwarder *fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue);
fw_pviewer->setHint(NEUTRINO_ICON_HINT_PICVIEW, LOCALE_MENU_HINT_PICVIEW); fw_pviewer->setHint(NEUTRINO_ICON_HINT_PICVIEW, LOCALE_MENU_HINT_PICVIEW);
personalize->addItem(multimedia_menu, fw_pviewer, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_PVIEWER]); personalize->addItem(multimedia_menu, fw_pviewer, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_PVIEWER]);
#if ENABLE_UPNP #if ENABLE_UPNP
//upnp browser // upnp browser
static CUpnpBrowserGui *upnpbrowsergui = NULL; static CUpnpBrowserGui *upnpbrowsergui = NULL;
if (!upnpbrowsergui) if (!upnpbrowsergui)
upnpbrowsergui = new CUpnpBrowserGui(); upnpbrowsergui = new CUpnpBrowserGui();
@@ -199,13 +200,13 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p)
#endif #endif
int res = menu_return::RETURN_NONE; int res = menu_return::RETURN_NONE;
if (show) if (show)
{ {
//adding personalized items // adding personalized items
personalize->addPersonalizedItems(); personalize->addPersonalizedItems();
//add PLUGIN_INTEGRATION_MULTIMEDIA plugins // add PLUGIN_INTEGRATION_MULTIMEDIA plugins
unsigned int nextShortcut = (unsigned int)multimedia_menu->getNextShortcut(); unsigned int nextShortcut = (unsigned int)multimedia_menu->getNextShortcut();
multimedia_menu->integratePlugins(PLUGIN_INTEGRATION_MULTIMEDIA, nextShortcut, enabled); multimedia_menu->integratePlugins(PLUGIN_INTEGRATION_MULTIMEDIA, nextShortcut, enabled);

View File

@@ -39,20 +39,19 @@ class CMediaPlayerMenu : public CMenuTarget
{ {
private: private:
int width; int width;
CAudioPlayerGui *audioPlayer; CAudioPlayerGui *audioPlayer;
CAudioPlayerGui *inetPlayer; CAudioPlayerGui *inetPlayer;
public: public:
CMediaPlayerMenu(); CMediaPlayerMenu();
~CMediaPlayerMenu(); ~CMediaPlayerMenu();
static CMediaPlayerMenu* getInstance(); static CMediaPlayerMenu *getInstance();
int initMenuMedia(CMenuWidget *m = NULL, CPersonalizeGui *p = NULL); int initMenuMedia(CMenuWidget *m = NULL, CPersonalizeGui *p = NULL);
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget *parent, const std::string &actionKey);
CAudioPlayerGui *getPlayerInstance() { if (audioPlayer != NULL) return audioPlayer; else if (inetPlayer != NULL) return inetPlayer; else return NULL; } CAudioPlayerGui *getPlayerInstance() { if (audioPlayer != NULL) return audioPlayer; else if (inetPlayer != NULL) return inetPlayer; else return NULL; }
}; };
#endif #endif