mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
gui/audio_select.cpp: add PID volume adjusting
Origin commit data
------------------
Branch: ni/coolstream
Commit: b8f78e9c5d
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-08-16 (Thu, 16 Aug 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -40,6 +40,8 @@
|
|||||||
#include <gui/widget/icons.h>
|
#include <gui/widget/icons.h>
|
||||||
#include <gui/widget/menue.h>
|
#include <gui/widget/menue.h>
|
||||||
#include <driver/screen_max.h>
|
#include <driver/screen_max.h>
|
||||||
|
#include <driver/volume.h>
|
||||||
|
#include <zapit/zapit.h>
|
||||||
|
|
||||||
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
|
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
|
||||||
extern CAudioSetupNotifier * audioSetupNotifier;
|
extern CAudioSetupNotifier * audioSetupNotifier;
|
||||||
@@ -83,7 +85,7 @@ int CAudioSelectMenuHandler::exec(CMenuTarget* parent, const std::string &action
|
|||||||
return menu_return::RETURN_EXIT;
|
return menu_return::RETURN_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
parent->hide();
|
parent->hide();
|
||||||
|
|
||||||
return doMenu ();
|
return doMenu ();
|
||||||
@@ -94,7 +96,7 @@ int CAudioSelectMenuHandler::doMenu ()
|
|||||||
CMenuWidget AudioSelector(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width);
|
CMenuWidget AudioSelector(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width);
|
||||||
|
|
||||||
CSubtitleChangeExec SubtitleChanger;
|
CSubtitleChangeExec SubtitleChanger;
|
||||||
|
|
||||||
//show cancel button if configured in usermenu settings
|
//show cancel button if configured in usermenu settings
|
||||||
if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL])
|
if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL])
|
||||||
AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
|
AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
|
||||||
@@ -103,34 +105,31 @@ int CAudioSelectMenuHandler::doMenu ()
|
|||||||
|
|
||||||
unsigned int shortcut_num = 1;
|
unsigned int shortcut_num = 1;
|
||||||
|
|
||||||
|
uint p_count = g_RemoteControl->current_PIDs.APIDs.size();
|
||||||
// -- setup menue due to Audio PIDs
|
// -- setup menue due to Audio PIDs
|
||||||
if (g_RemoteControl->current_PIDs.APIDs.size() > 1)
|
for( uint i=0; i < p_count; i++ )
|
||||||
{
|
{
|
||||||
uint p_count = g_RemoteControl->current_PIDs.APIDs.size();
|
char apid[5];
|
||||||
CMenuForwarderNonLocalized* fw[p_count];
|
sprintf(apid, "%d", i);
|
||||||
|
CMenuForwarderNonLocalized *fw = new CMenuForwarderNonLocalized(g_RemoteControl->current_PIDs.APIDs[i].desc,
|
||||||
for( uint i=0; i < p_count; i++ )
|
true, NULL, this, apid, CRCInput::convertDigitToKey(i + 1));
|
||||||
{
|
fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
|
||||||
char apid[5];
|
AudioSelector.addItem(fw, (i == g_RemoteControl->current_PIDs.PIDs.selected_apid));
|
||||||
sprintf(apid, "%d", i);
|
shortcut_num = i+1;
|
||||||
fw[i] = new CMenuForwarderNonLocalized(g_RemoteControl->current_PIDs.APIDs[i].desc, true, NULL, this, apid, CRCInput::convertDigitToKey(i + 1));
|
|
||||||
fw[i]->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
|
|
||||||
AudioSelector.addItem(fw[i], (i == g_RemoteControl->current_PIDs.PIDs.selected_apid));
|
|
||||||
shortcut_num = i+1;
|
|
||||||
}
|
|
||||||
AudioSelector.addItem(GenericMenuSeparatorLine);
|
|
||||||
}
|
}
|
||||||
|
if (p_count)
|
||||||
|
AudioSelector.addItem(GenericMenuSeparatorLine);
|
||||||
|
|
||||||
// -- setup menue for to Dual Channel Stereo
|
// -- setup menue for to Dual Channel Stereo
|
||||||
CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_MODE,
|
CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_MODE,
|
||||||
&g_settings.audio_AnalogMode,
|
&g_settings.audio_AnalogMode,
|
||||||
AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT,
|
AUDIOMENU_ANALOGOUT_OPTIONS, AUDIOMENU_ANALOGOUT_OPTION_COUNT,
|
||||||
true, audioSetupNotifier, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
|
true, audioSetupNotifier, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
|
||||||
|
|
||||||
AudioSelector.addItem( oj );
|
AudioSelector.addItem( oj );
|
||||||
|
|
||||||
oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out,
|
oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out,
|
||||||
OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT,
|
OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT,
|
||||||
true, audioSetupNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
|
true, audioSetupNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
|
||||||
|
|
||||||
AudioSelector.addItem( oj );
|
AudioSelector.addItem( oj );
|
||||||
@@ -140,15 +139,15 @@ int CAudioSelectMenuHandler::doMenu ()
|
|||||||
CZapitChannel * cc = channelList->getChannel(curnum);
|
CZapitChannel * cc = channelList->getChannel(curnum);
|
||||||
|
|
||||||
bool sep_added = false;
|
bool sep_added = false;
|
||||||
if(cc)
|
if(cc)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i)
|
for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i)
|
||||||
{
|
{
|
||||||
CZapitAbsSub* s = cc->getChannelSub(i);
|
CZapitAbsSub* s = cc->getChannelSub(i);
|
||||||
if (s->thisSubType == CZapitAbsSub::DVB) {
|
if (s->thisSubType == CZapitAbsSub::DVB) {
|
||||||
CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
|
CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(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)
|
if(!sep_added)
|
||||||
{
|
{
|
||||||
sep_added = true;
|
sep_added = true;
|
||||||
AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
|
AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
|
||||||
@@ -160,11 +159,11 @@ int CAudioSelectMenuHandler::doMenu ()
|
|||||||
AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
|
AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
|
||||||
sd->pId != dvbsub_getpid(), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
|
sd->pId != dvbsub_getpid(), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
|
||||||
}
|
}
|
||||||
if (s->thisSubType == CZapitAbsSub::TTX)
|
if (s->thisSubType == CZapitAbsSub::TTX)
|
||||||
{
|
{
|
||||||
CZapitTTXSub* sd = reinterpret_cast<CZapitTTXSub*>(s);
|
CZapitTTXSub* sd = reinterpret_cast<CZapitTTXSub*>(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)
|
if(!sep_added)
|
||||||
{
|
{
|
||||||
sep_added = true;
|
sep_added = true;
|
||||||
AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
|
AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
|
||||||
@@ -172,17 +171,31 @@ int CAudioSelectMenuHandler::doMenu ()
|
|||||||
char spid[64];
|
char spid[64];
|
||||||
int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number;
|
int page = ((sd->teletext_magazine_number & 0xFF) << 8) | sd->teletext_page_number;
|
||||||
int pid = sd->pId;
|
int pid = sd->pId;
|
||||||
snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str());
|
snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str());
|
||||||
char item[64];
|
char item[64];
|
||||||
snprintf(item,sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page);
|
snprintf(item,sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page);
|
||||||
AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
|
AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/,
|
||||||
!tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
|
!tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sep_added)
|
if(sep_added)
|
||||||
AudioSelector.addItem(new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_stop));
|
AudioSelector.addItem(new CMenuForwarder(LOCALE_SUBTITLES_STOP, true, NULL, &SubtitleChanger, "off", CRCInput::RC_stop));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 */
|
||||||
|
CVolume::getInstance()->SetCurrentChannel(0);
|
||||||
|
CVolume::getInstance()->SetCurrentPid(0);
|
||||||
|
int percent[p_count];
|
||||||
|
for (uint i=0; i < p_count; i++) {
|
||||||
|
percent[i] = CZapit::getInstance()->GetPidVolume(0, g_RemoteControl->current_PIDs.APIDs[i].pid);
|
||||||
|
AudioSelector.addItem(new CMenuOptionNumberChooser(NONEXISTANT_LOCALE, &percent[i],
|
||||||
|
i == g_RemoteControl->current_PIDs.PIDs.selected_apid,
|
||||||
|
0, 999, CVolume::getInstance(), 0, 0, NONEXISTANT_LOCALE,
|
||||||
|
g_RemoteControl->current_PIDs.APIDs[i].desc));
|
||||||
|
}
|
||||||
|
|
||||||
return AudioSelector.exec(NULL, "");
|
return AudioSelector.exec(NULL, "");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user