diff --git a/src/gui/audio_select.cpp b/src/gui/audio_select.cpp index 534412c59..d2aae62c7 100644 --- a/src/gui/audio_select.cpp +++ b/src/gui/audio_select.cpp @@ -40,8 +40,8 @@ #include #include #include +#include #include -#include extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ extern CAudioSetupNotifier * audioSetupNotifier; @@ -58,11 +58,7 @@ extern CAudioSetupNotifier * audioSetupNotifier; CAudioSelectMenuHandler::CAudioSelectMenuHandler() { - AudioSelector = NULL; width = 40; - mp = &CMoviePlayerGui::getInstance(); - if (IS_WEBCHAN(g_Zapit->getCurrentServiceID())) - mp = &CMoviePlayerGui::getInstance(true); } CAudioSelectMenuHandler::~CAudioSelectMenuHandler() @@ -70,7 +66,6 @@ CAudioSelectMenuHandler::~CAudioSelectMenuHandler() } -#if !HAVE_SPARK_HARDWARE // -- this is a copy from neutrino.cpp!! #define AUDIOMENU_ANALOGOUT_OPTION_COUNT 3 const CMenuOptionChooser::keyval AUDIOMENU_ANALOGOUT_OPTIONS[AUDIOMENU_ANALOGOUT_OPTION_COUNT] = @@ -79,56 +74,18 @@ const CMenuOptionChooser::keyval AUDIOMENU_ANALOGOUT_OPTIONS[AUDIOMENU_ANALOGOUT { 1, LOCALE_AUDIOMENU_MONOLEFT }, { 2, LOCALE_AUDIOMENU_MONORIGHT } }; -#endif int CAudioSelectMenuHandler::exec(CMenuTarget* parent, const std::string &actionkey) { - int sel = -1; - if (AudioSelector) { - sel = AudioSelector->getSelected(); - sel -= apid_offset; - if (sel < 0 || sel >= p_count) - return menu_return::RETURN_NONE; - } - - if (actionkey == "-" || actionkey == "+") { - if (actionkey == "-") { - if (perc_val[sel] == 0) - return menu_return::RETURN_NONE; - perc_val[sel]--; - } else { - if (perc_val[sel] == 999) - return menu_return::RETURN_NONE; - perc_val[sel]++; - } - perc_str[sel] = to_string(perc_val[sel]) + "%"; - -#if !HAVE_SPARK_HARDWARE - int vol = CZapit::getInstance()->GetVolume(); - /* keep resulting volume = (vol * percent)/100 not more than 115 */ - if (vol * perc_val[sel] > 11500) - perc_val[sel] = 11500 / vol; -#endif - CZapit::getInstance()->SetPidVolume(chan, apid[sel], perc_val[sel]); - if (sel == sel_apid) - CZapit::getInstance()->SetVolumePercent(perc_val[sel]); - - return menu_return::RETURN_REPAINT; - } - - if (actionkey == "s") { - if (mp->Playing()) { - mp->setAPID(sel); - } else if (g_RemoteControl->current_PIDs.PIDs.selected_apid != (unsigned int) sel ) { + int sel= atoi(actionkey.c_str()); + if(sel >= 0) { + if (g_RemoteControl->current_PIDs.PIDs.selected_apid!= (unsigned int) sel ) + { g_RemoteControl->setAPID(sel); } return menu_return::RETURN_EXIT; } - if (actionkey == "x") - return menu_return::RETURN_EXIT; - if (mp->Playing()) - playback = mp->getPlayback(); if (parent) parent->hide(); @@ -137,64 +94,37 @@ int CAudioSelectMenuHandler::exec(CMenuTarget* parent, const std::string &action int CAudioSelectMenuHandler::doMenu () { - AudioSelector = new CMenuWidget(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width); + int mode = CNeutrinoApp::getInstance()->getMode(); + if (mode == NeutrinoModes::mode_webtv) { + CMoviePlayerGui::getInstance(true).selectAudioPid(); + return menu_return::RETURN_EXIT; + } + CMenuWidget AudioSelector(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width); - CSubtitleChangeExec SubtitleChanger(playback); + CSubtitleChangeExec SubtitleChanger; //show cancel button if configured in usermenu settings if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL]) - AudioSelector->addIntroItems(NONEXISTANT_LOCALE, LOCALE_AUDIOSELECTMENUE_VOLUME, CMenuWidget::BTN_TYPE_CANCEL); + AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); else - AudioSelector->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOSELECTMENUE_VOLUME)); - apid_offset = AudioSelector->getItemsCount(); - AudioSelector->addKey(CRCInput::RC_right, this, "+"); - AudioSelector->addKey(CRCInput::RC_left, this, "-"); - AudioSelector->addKey(CRCInput::RC_red, this, "x"); -#if !HAVE_SPARK_HARDWARE - AudioSelector->addKey(CRCInput::RC_green, this, "x"); -#endif - AudioSelector->addKey(CRCInput::RC_yellow, this, "x"); - AudioSelector->addKey(CRCInput::RC_blue, this, "x"); + AudioSelector.addItem(GenericMenuSeparator); - bool is_mp = mp->Playing(); - - p_count = is_mp ? mp->getAPIDCount() : g_RemoteControl->current_PIDs.APIDs.size(); - sel_apid = is_mp ? mp->getAPID() : g_RemoteControl->current_PIDs.PIDs.selected_apid; - - int _apid[p_count]; - int _perc_val[p_count]; - unsigned int _is_ac3[p_count]; - std::string _perc_str[p_count]; - perc_val = _perc_val; - perc_str = _perc_str; - is_ac3 = _is_ac3; - apid = _apid; - chan = is_mp ? mp->getChannelId() : 0; + unsigned int shortcut_num = 1; + uint p_count = g_RemoteControl->current_PIDs.APIDs.size(); // -- setup menue due to Audio PIDs - for (int i = 0; i < p_count; i++) + for( uint i=0; i < p_count; i++ ) { - if (is_mp) { - mp->getAPID(i, apid[i], is_ac3[i]); - perc_val[i] = (is_ac3[i] == 1) ? g_settings.audio_volume_percent_ac3 : g_settings.audio_volume_percent_pcm; - } else { - apid[i] = g_RemoteControl->current_PIDs.APIDs[i].pid; - is_ac3[i] = g_RemoteControl->current_PIDs.APIDs[i].is_ac3; - perc_val[i] = CZapit::getInstance()->GetPidVolume(chan, apid[i], is_ac3[i]); - } - perc_str[i] = to_string(perc_val[i]) + "%"; - - CMenuForwarder *fw = new CMenuForwarder(is_mp ? mp->getAPIDDesc(i).c_str() : g_RemoteControl->current_PIDs.APIDs[i].desc, - true, perc_str[i], this, "s", CRCInput::convertDigitToKey(i + 1)); + char apid[5]; + sprintf(apid, "%d", i); + CMenuForwarder *fw = new CMenuForwarder(g_RemoteControl->current_PIDs.APIDs[i].desc, + true, NULL, this, apid, CRCInput::convertDigitToKey(i + 1)); fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); - fw->setMarked(sel_apid == i); - - AudioSelector->addItem(fw, sel_apid == i); + AudioSelector.addItem(fw, (i == g_RemoteControl->current_PIDs.PIDs.selected_apid)); + shortcut_num = i+1; } - unsigned int shortcut_num = p_count; -#if !HAVE_SPARK_HARDWARE if (p_count) - AudioSelector->addItem(GenericMenuSeparatorLine); + AudioSelector.addItem(GenericMenuSeparatorLine); // -- setup menue for to Dual Channel Stereo CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_MODE, @@ -202,86 +132,65 @@ int CAudioSelectMenuHandler::doMenu () AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT, true, audioSetupNotifier, CRCInput::RC_red); - AudioSelector->addItem( oj ); + AudioSelector.addItem( oj ); oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, audioSetupNotifier, CRCInput::RC_green); - AudioSelector->addItem( oj ); -#endif + AudioSelector.addItem( oj ); - CZapitChannel * cc = NULL; - int subtitleCount = 0; - if (is_mp) { - subtitleCount = mp->getSubtitleCount(); - } else { - CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList; - int curnum = channelList->getActiveChannelNumber(); - cc = channelList->getChannel(curnum); - subtitleCount = (int)cc->getSubtitleCount(); - } + CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList; + int curnum = channelList->getActiveChannelNumber(); + CZapitChannel * cc = channelList->getChannel(curnum); bool sep_added = false; - if (subtitleCount > 0) + if(cc) { - bool sub_active = false; - - for (int i = 0 ; i < subtitleCount ; ++i) + for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i) { - CZapitAbsSub* s = is_mp ? mp->getChannelSub(i, &s) : cc->getChannelSub(i); - if (!s) - continue; - - if (!sep_added) - { - sep_added = true; - AudioSelector->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD)); - } - - bool ena = false; - bool add = true; - char spid[64]; - char item[64]; - + CZapitAbsSub* s = cc->getChannelSub(i); if (s->thisSubType == CZapitAbsSub::DVB) { CZapitDVBSub* sd = reinterpret_cast(s); - // printf("[neutrino] adding DVB subtitle %s pid %x\n", sd->ISO639_language_code.c_str(), sd->pId); + printf("[neutrino] adding DVB subtitle %s pid %x\n", sd->ISO639_language_code.c_str(), sd->pId); + if(!sep_added) + { + sep_added = true; + AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD)); + } + char spid[10]; snprintf(spid,sizeof(spid), "DVB:%d", sd->pId); + char item[64]; snprintf(item,sizeof(item), "DVB: %s (pid %x)", sd->ISO639_language_code.c_str(), sd->pId); - ena = sd->pId != (is_mp ? mp->getCurrentSubPid(CZapitAbsSub::DVB) : dvbsub_getpid()); - } else if (s->thisSubType == CZapitAbsSub::TTX) { + AudioSelector.addItem(new CMenuForwarder(item /*sd->ISO639_language_code.c_str()*/, + sd->pId != dvbsub_getpid(), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num))); + } + if (s->thisSubType == CZapitAbsSub::TTX) + { CZapitTTXSub* sd = reinterpret_cast(s); - // printf("[neutrino] adding TTX subtitle %s pid %x mag %X page %x\n", sd->ISO639_language_code.c_str(), sd->pId, sd->teletext_magazine_number, sd->teletext_page_number); + printf("[neutrino] adding TTX subtitle %s pid %x mag %X page %x\n", sd->ISO639_language_code.c_str(), sd->pId, sd->teletext_magazine_number, sd->teletext_page_number); + if(!sep_added) + { + sep_added = true; + AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD)); + } + char spid[64]; int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number; int pid = sd->pId; snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str()); + char item[64]; snprintf(item,sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page); - ena = !tuxtx_subtitle_running(&pid, &page, NULL); - } else if (is_mp && s->thisSubType == CZapitAbsSub::SUB) { - // printf("[neutrino] adding SUB subtitle %s pid %x\n", s->ISO639_language_code.c_str(), s->pId); - snprintf(spid,sizeof(spid), "SUB:%d", s->pId); - snprintf(item,sizeof(item), "SUB: %s (pid %x)", s->ISO639_language_code.c_str(), s->pId); - ena = s->pId != mp->getCurrentSubPid(CZapitAbsSub::SUB); - } else - add = false; - - if (add) - AudioSelector->addItem(new CMenuForwarder(item, ena, - NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num))); - if (is_mp) - delete s; - - sub_active |= !ena; + AudioSelector.addItem(new CMenuForwarder(item /*sd->ISO639_language_code.c_str()*/, + !tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num))); + } } - if (sub_active) { + if(sep_added) { CMenuForwarder * item = new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_stop); item->setItemButton(NEUTRINO_ICON_BUTTON_STOP, false); - AudioSelector->addItem(item); + AudioSelector.addItem(item); } } -#if 0 AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUST)); /* setting volume percent to zapit with channel_id/apid = 0 means current channel and pid */ @@ -294,20 +203,6 @@ int CAudioSelectMenuHandler::doMenu () &percent[i], i == g_RemoteControl->current_PIDs.PIDs.selected_apid, 0, 999, CVolume::getInstance())); } -#endif - //tonbug - AudioSelector->addItem(GenericMenuSeparatorLine); -#if !HAVE_SPARK_HARDWARE - AudioSelector->addItem(new CMenuForwarder(LOCALE_CI_RESET, true, NULL, CNeutrinoApp::getInstance(), "tonbug", CRCInput::convertDigitToKey(++shortcut_num))); -#else - AudioSelector->addItem(new CMenuForwarder(LOCALE_CI_RESET, true, NULL, CNeutrinoApp::getInstance(), "tonbug", CRCInput::RC_green)); -#endif - - int res = AudioSelector->exec(NULL, ""); - - delete AudioSelector; - AudioSelector = NULL; - - return res; + return AudioSelector.exec(NULL, ""); } diff --git a/src/gui/audio_select.h b/src/gui/audio_select.h index e7c759693..b1177ccbf 100644 --- a/src/gui/audio_select.h +++ b/src/gui/audio_select.h @@ -29,26 +29,14 @@ // #include "widget/menue.h" -#include "movieplayer.h" class CAudioSelectMenuHandler : public CMenuTarget { private: - CMoviePlayerGui *mp; int width; - cPlayback *playback; - - int sel_apid; - int apid_offset; - int *apid; - int p_count; - int *perc_val; - unsigned int *is_ac3; - std::string *perc_str; - CMenuWidget *AudioSelector; - t_channel_id chan; + public: CAudioSelectMenuHandler(); ~CAudioSelectMenuHandler(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c52adfc48..bd76e18fa 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4629,15 +4629,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) InfoClock->switchClockOnOff(); returnval = menu_return::RETURN_EXIT_ALL; } - else if (actionKey=="tonbug") - { - CZapitChannel * chan = CZapit::getInstance()->GetCurrentChannel(); - if (chan) - { - CZapit::getInstance()->ChangeAudioPid(chan->getAudioChannelIndex()); - returnval = menu_return::RETURN_EXIT_ALL; - } - } else if (actionKey=="tv_radio_switch")//used in mainmenu { switchTvRadioMode(); diff --git a/src/system/locals.h b/src/system/locals.h index 21f3e1416..5c2d9764f 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -26,7 +26,6 @@ typedef enum { NONEXISTANT_LOCALE, LOCALE_AUDIOSELECTMENUE_HEAD, - LOCALE_AUDIOSELECTMENUE_VOLUME, LOCALE_EPGMENU_EPGPLUS, LOCALE_EPGMENU_EVENTINFO, LOCALE_EPGMENU_EVENTLIST, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 843d2ce3f..d2f41d68e 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -26,7 +26,6 @@ const char * locale_real_names[] = { "INTERNAL ERROR - PLEASE REPORT", "AUDIOSelectMenue.head", - "AUDIOSelectMenue.volume", "EPGMenu.epgplus", "EPGMenu.eventinfo", "EPGMenu.eventlist", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index b97b14b72..3f6a1ad41 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -53,13 +53,11 @@ #include -#include #include #include #include #include #include -#include #include #include #include @@ -470,19 +468,9 @@ bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *) int CSubtitleChangeExec::exec(CMenuTarget* /*parent*/, const std::string & actionKey) { printf("CSubtitleChangeExec::exec: action %s\n", actionKey.c_str()); - - CMoviePlayerGui *mp = &CMoviePlayerGui::getInstance(); - bool is_mp = mp->Playing(); - if(actionKey == "off") { tuxtx_stop_subtitle(); - if (!is_mp && dvbsub_getpid() > 0) - dvbsub_stop(); - if (is_mp && playback) { - playback->SetSubtitlePid(0); - playback->SetTeletextPid(0); - mp->setCurrentTTXSub(""); - } + dvbsub_stop(); return menu_return::RETURN_EXIT; } if(!strncmp(actionKey.c_str(), "DVB", 3)) { @@ -491,7 +479,7 @@ printf("CSubtitleChangeExec::exec: action %s\n", actionKey.c_str()); tuxtx_stop_subtitle(); dvbsub_pause(); dvbsub_start(pid); - } else if (!strncmp(actionKey.c_str(), "TTX", 3)) { + } else { char const * ptr = strchr(actionKey.c_str(), ':'); ptr++; int pid = atoi(ptr); @@ -504,29 +492,7 @@ printf("CSubtitleChangeExec::exec: TTX, pid %x page %x lang %s\n", pid, page, pt tuxtx_stop_subtitle(); tuxtx_set_pid(pid, page, ptr); dvbsub_stop(); - if (is_mp) { - playback->SetSubtitlePid(0); - playback->SetTeletextPid(pid); - tuxtx_set_pid(pid, page, ptr); -#if HAVE_SPARK_HARDWARE - tuxtx_main(pid, page, 0, true); -#else - tuxtx_main(pid, page, 0); -#endif - mp->setCurrentTTXSub(actionKey.c_str()); - } else { - tuxtx_set_pid(pid, page, ptr); - tuxtx_main(pid, page); - } - } else if (is_mp && !strncmp(actionKey.c_str(), "SUB", 3)) { - tuxtx_stop_subtitle(); - dvbsub_stop(); - playback->SetSubtitlePid(0); - playback->SetTeletextPid(0); - mp->setCurrentTTXSub(""); - char const * pidptr = strchr(actionKey.c_str(), ':'); - int pid = atoi(pidptr+1); - playback->SetSubtitlePid(pid); + tuxtx_main(pid, page); } return menu_return::RETURN_EXIT; } diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index 70a310d2f..c48e9140e 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -35,11 +35,6 @@ #include #include -#include -#include -#if HAVE_SPARK_HARDWARE -#include -#endif #include @@ -116,10 +111,7 @@ class CFontSizeNotifier : public CChangeObserver class CSubtitleChangeExec : public CMenuTarget { - private: - cPlayback *playback; public: - CSubtitleChangeExec(cPlayback *p = NULL) { playback = p; } int exec(CMenuTarget* parent, const std::string & actionKey); };