neutrino multimedia-menu: add singelton,

use singelton for creating or destroying for movieplayer instance

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1066 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: 1125c6ab1f
Author: Thilo Graf <dbt@novatux.de>
Date: 2011-01-26 (Wed, 26 Jan 2011)

Origin message was:
------------------
*neutrino multimedia-menu: add singelton,
use singelton for creating or destroying for movieplayer instance

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1066 e54a6e83-5905-42d5-8d5c-058d10e6a962


------------------
This commit was generated by Migit
This commit is contained in:
2011-01-26 11:05:33 +00:00
parent fd617dd412
commit 32162e4af0
5 changed files with 46 additions and 13 deletions

View File

@@ -101,7 +101,7 @@ void CMediaPlayerMenu::showMenu()
media->addItem(new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, new CAudioPlayerGui(true), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); media->addItem(new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, new CAudioPlayerGui(true), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
//movieplayer //movieplayer
CMenuWidget *moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MOVIEPLAYER, NEUTRINO_ICON_MULTIMEDIA, width); CMenuWidget *moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width);
showMoviePlayer(moviePlayer); showMoviePlayer(moviePlayer);
media->addItem(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));
@@ -120,9 +120,9 @@ void CMediaPlayerMenu::showMenu()
//show movieplayer submenu with selectable items for moviebrowser or filebrowser //show movieplayer submenu with selectable items for moviebrowser or filebrowser
void CMediaPlayerMenu::showMoviePlayer(CMenuWidget *moviePlayer) void CMediaPlayerMenu::showMoviePlayer(CMenuWidget *moviePlayer)
{ {
CMoviePlayerGui *movieplayer_gui = new CMoviePlayerGui(); CMoviePlayerGui *movieplayer_gui = &CMoviePlayerGui::getInstance();
moviePlayer->addIntroItems(); moviePlayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER);
moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, movieplayer_gui, "tsmoviebrowser", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, movieplayer_gui, "tsmoviebrowser", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, movieplayer_gui, "fileplayback", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, movieplayer_gui, "fileplayback", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));

View File

@@ -78,6 +78,7 @@
#include <playback.h> #include <playback.h>
#include "libtuxtxt/teletext.h" #include "libtuxtxt/teletext.h"
int dvbsub_start(int pid); int dvbsub_start(int pid);
int dvbsub_pause(); int dvbsub_pause();
@@ -141,6 +142,31 @@ int CAPIDSelectExec::exec(CMenuTarget * /*parent*/, const std::string & actionKe
return menu_return::RETURN_EXIT; return menu_return::RETURN_EXIT;
} }
CMoviePlayerGui* CMoviePlayerGui::instance_mp = NULL;
CMoviePlayerGui& CMoviePlayerGui::getInstance()
{
if ( !instance_mp )
{
instance_mp = new CMoviePlayerGui();
printf("[neutrino CMoviePlayerGui] Instance created...\n");
}
return *instance_mp;
}
void CMoviePlayerGui::Delete()
{
if ( instance_mp )
{
delete instance_mp;
printf("[neutrino CMoviePlayerGui] Instance removed...\n");
}
instance_mp = NULL;
}
CMoviePlayerGui::CMoviePlayerGui() CMoviePlayerGui::CMoviePlayerGui()
{ {
Init(); Init();

View File

@@ -111,9 +111,17 @@ class CMoviePlayerGui : public CMenuTarget
void showHelpVLC(void); void showHelpVLC(void);
void callInfoViewer(const std::string & epg_title, const std::string & epg_info1, void callInfoViewer(const std::string & epg_title, const std::string & epg_info1,
const std::string & epg_channel, const int duration, const int pos); const std::string & epg_channel, const int duration, const int pos);
static CMoviePlayerGui* instance_mp;
CMoviePlayerGui(const CMoviePlayerGui&) {};
public: public:
CMoviePlayerGui(); CMoviePlayerGui();
~CMoviePlayerGui(); ~CMoviePlayerGui();
static CMoviePlayerGui& getInstance();
static void Delete();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
void updateLcd(const std::string & sel_filename); void updateLcd(const std::string & sel_filename);
bool Playing(); bool Playing();

View File

@@ -236,7 +236,6 @@ CBouquetList * RADIOallList;
CPlugins * g_PluginList; CPlugins * g_PluginList;
CRemoteControl * g_RemoteControl; CRemoteControl * g_RemoteControl;
SMSKeyInput * c_SMSKeyInput; SMSKeyInput * c_SMSKeyInput;
CMoviePlayerGui* moviePlayerGui;
CAudioSelectMenuHandler *audio_menu; CAudioSelectMenuHandler *audio_menu;
CPictureViewer * g_PicViewer; CPictureViewer * g_PicViewer;
CCAMMenuHandler * g_CamHandler; CCAMMenuHandler * g_CamHandler;
@@ -2523,7 +2522,7 @@ printf("[neutrino] timeshift try, recordingstatus %d, rec dir %s, timeshift dir
if(g_RemoteControl->is_video_started) { if(g_RemoteControl->is_video_started) {
if(recordingstatus) { if(recordingstatus) {
//StopSubtitles(); //StopSubtitles();
moviePlayerGui->exec(NULL, tmode); CMoviePlayerGui::getInstance().exec(NULL, tmode);
//StartSubtitles(); //StartSubtitles();
} else if(msg != CRCInput::RC_rewind) { } else if(msg != CRCInput::RC_rewind) {
//StopSubtitles(); //StopSubtitles();
@@ -2535,7 +2534,7 @@ printf("[neutrino] timeshift try, recordingstatus %d, rec dir %s, timeshift dir
} }
if(recordingstatus) { if(recordingstatus) {
//StopSubtitles(); //StopSubtitles();
moviePlayerGui->exec(NULL, tmode); CMoviePlayerGui::getInstance().exec(NULL, tmode);
//StartSubtitles(); //StartSubtitles();
} }
} }
@@ -2590,7 +2589,7 @@ printf("[neutrino] direct record\n");
//StopSubtitles(); //StopSubtitles();
if( mode == mode_radio ) if( mode == mode_radio )
videoDecoder->StopPicture(); videoDecoder->StopPicture();
moviePlayerGui->exec(NULL, "tsmoviebrowser"); CMoviePlayerGui::getInstance().exec(NULL, "tsmoviebrowser");
if( mode == mode_radio ) if( mode == mode_radio )
videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg"); videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg");
//StartSubtitles(); //StartSubtitles();
@@ -3380,7 +3379,7 @@ skip_message:
lastMode=mode; lastMode=mode;
mode=mode_pic; mode=mode_pic;
} }
if((data & mode_mask)== mode_ts && moviePlayerGui->Playing()) { if((data & mode_mask)== mode_ts && CMoviePlayerGui::getInstance().Playing()) {
if(mode == mode_radio) if(mode == mode_radio)
videoDecoder->StopPicture(); videoDecoder->StopPicture();
lastMode=mode; lastMode=mode;
@@ -3529,7 +3528,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode)
delete powerManager; delete powerManager;
} }
delete moviePlayerGui; delete &CMoviePlayerGui::getInstance();
shutdown_cs_api(); shutdown_cs_api();
system("/etc/init.d/rcK"); system("/etc/init.d/rcK");
@@ -4465,7 +4464,7 @@ void stop_daemons(bool stopall)
printf("zapit shutdown done\n"); printf("zapit shutdown done\n");
CVFD::getInstance()->Clear(); CVFD::getInstance()->Clear();
if(stopall) { if(stopall) {
delete moviePlayerGui; CMoviePlayerGui::Delete(); //remove instance
if (cpuFreq) if (cpuFreq)
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
if (powerManager) { if (powerManager) {

View File

@@ -1499,7 +1499,7 @@ bool CNeutrinoApp::showUserMenu(int button)
menu_items++; menu_items++;
menu_prev = SNeutrinoSettings::ITEM_MOVIEPLAYER_MB; menu_prev = SNeutrinoSettings::ITEM_MOVIEPLAYER_MB;
keyhelper.get(&key,&icon,CRCInput::RC_green); keyhelper.get(&key,&icon,CRCInput::RC_green);
menu_item = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, new CMoviePlayerGui(), "tsmoviebrowser", key, icon); menu_item = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, &CMoviePlayerGui::getInstance(), "tsmoviebrowser", key, icon);
menu->addItem(menu_item, false); menu->addItem(menu_item, false);
break; break;