mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-01 01:41:12 +02:00
audio_select: copy full code from TangoCash
Just compile tested. Maybe some more alignments needed.
Signed-off-by: Thilo Graf <dbt@novatux.de>
Additional changes on cs playback_cs.h, because broken build
Signed-off-by: Thilo Graf <dbt@novatux.de>
Origin commit data
------------------
Commit: 5fd7ec68ac
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-10-12 (Thu, 12 Oct 2017)
Origin message was:
------------------
- audio_select: copy full code from TangoCash
Just compile tested. Maybe some more alignments needed.
Signed-off-by: Thilo Graf <dbt@novatux.de>
Additional changes on cs playback_cs.h, because broken build
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
AUDIOSelectMenue.head Tonoptionen
|
||||
AUDIOSelectMenue.volume Tonspur und Lautstärkeanpassung
|
||||
EPGMenu.epgplus EPG-Zeitlinen (EPG-Plus)
|
||||
EPGMenu.eventinfo Info zur Sendung
|
||||
EPGMenu.eventlist Vorschau aktuelles Programm
|
||||
|
@@ -1,4 +1,5 @@
|
||||
AUDIOSelectMenue.head Audio Options
|
||||
AUDIOSelectMenue.volume Audio selection and volume adjustment
|
||||
EPGMenu.epgplus EPG-Timelines (EPG-Plus)
|
||||
EPGMenu.eventinfo Details current program
|
||||
EPGMenu.eventlist Eventlist current programm
|
||||
|
@@ -57,6 +57,7 @@ public:
|
||||
bool Start(std::string filename, std::string headers = "");
|
||||
bool Stop(void);
|
||||
bool SetAPid(unsigned short pid, int audio_flag);
|
||||
bool SetSubtitlePid(int /*pid*/){return true;}
|
||||
bool SetSpeed(int speed);
|
||||
bool GetSpeed(int &speed) const;
|
||||
bool GetPosition(int &position, int &duration);
|
||||
|
@@ -58,6 +58,7 @@ public:
|
||||
bool Start(std::string filename, std::string headers = "");
|
||||
bool Stop(void);
|
||||
bool SetAPid(unsigned short pid, int audio_flag);
|
||||
bool SetSubtitlePid(int /*pid*/){return true;}
|
||||
bool SetSpeed(int speed);
|
||||
bool GetSpeed(int &speed) const;
|
||||
bool GetPosition(int &position, int &duration);
|
||||
|
@@ -40,8 +40,8 @@
|
||||
#include <gui/widget/icons.h>
|
||||
#include <gui/widget/menue.h>
|
||||
#include <driver/screen_max.h>
|
||||
#include <driver/volume.h>
|
||||
#include <zapit/zapit.h>
|
||||
#include <system/helpers.h>
|
||||
|
||||
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
|
||||
extern CAudioSetupNotifier * audioSetupNotifier;
|
||||
@@ -58,7 +58,11 @@ extern CAudioSetupNotifier * audioSetupNotifier;
|
||||
|
||||
CAudioSelectMenuHandler::CAudioSelectMenuHandler()
|
||||
{
|
||||
AudioSelector = NULL;
|
||||
width = 40;
|
||||
mp = &CMoviePlayerGui::getInstance();
|
||||
if (IS_WEBTV(g_Zapit->getCurrentServiceID()))
|
||||
mp = &CMoviePlayerGui::getInstance(true);
|
||||
}
|
||||
|
||||
CAudioSelectMenuHandler::~CAudioSelectMenuHandler()
|
||||
@@ -66,6 +70,7 @@ CAudioSelectMenuHandler::~CAudioSelectMenuHandler()
|
||||
|
||||
}
|
||||
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_HARDWARE
|
||||
// -- this is a copy from neutrino.cpp!!
|
||||
#define AUDIOMENU_ANALOGOUT_OPTION_COUNT 3
|
||||
const CMenuOptionChooser::keyval AUDIOMENU_ANALOGOUT_OPTIONS[AUDIOMENU_ANALOGOUT_OPTION_COUNT] =
|
||||
@@ -74,18 +79,56 @@ 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= atoi(actionkey.c_str());
|
||||
if(sel >= 0) {
|
||||
if (g_RemoteControl->current_PIDs.PIDs.selected_apid!= (unsigned int) sel )
|
||||
{
|
||||
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 && !HAVE_DUCKBOX_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 ) {
|
||||
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();
|
||||
|
||||
@@ -94,37 +137,64 @@ int CAudioSelectMenuHandler::exec(CMenuTarget* parent, const std::string &action
|
||||
|
||||
int CAudioSelectMenuHandler::doMenu ()
|
||||
{
|
||||
int mode = CNeutrinoApp::getInstance()->getMode();
|
||||
if (mode == NeutrinoMessages::mode_webtv) {
|
||||
CMoviePlayerGui::getInstance(true).selectAudioPid();
|
||||
return menu_return::RETURN_EXIT;
|
||||
}
|
||||
CMenuWidget AudioSelector(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width);
|
||||
AudioSelector = new CMenuWidget(LOCALE_AUDIOSELECTMENUE_HEAD, NEUTRINO_ICON_AUDIO, width);
|
||||
|
||||
CSubtitleChangeExec SubtitleChanger;
|
||||
CSubtitleChangeExec SubtitleChanger(playback);
|
||||
|
||||
//show cancel button if configured in usermenu settings
|
||||
if (g_settings.personalize[SNeutrinoSettings::P_UMENU_SHOW_CANCEL])
|
||||
AudioSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
|
||||
AudioSelector->addIntroItems(NONEXISTANT_LOCALE, LOCALE_AUDIOSELECTMENUE_VOLUME, CMenuWidget::BTN_TYPE_CANCEL);
|
||||
else
|
||||
AudioSelector.addItem(GenericMenuSeparator);
|
||||
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 && !HAVE_DUCKBOX_HARDWARE
|
||||
AudioSelector->addKey(CRCInput::RC_green, this, "x");
|
||||
#endif
|
||||
AudioSelector->addKey(CRCInput::RC_yellow, this, "x");
|
||||
AudioSelector->addKey(CRCInput::RC_blue, this, "x");
|
||||
|
||||
unsigned int shortcut_num = 1;
|
||||
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;
|
||||
|
||||
uint p_count = g_RemoteControl->current_PIDs.APIDs.size();
|
||||
// -- setup menue due to Audio PIDs
|
||||
for( uint i=0; i < p_count; i++ )
|
||||
for (int i = 0; i < p_count; i++)
|
||||
{
|
||||
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);
|
||||
AudioSelector.addItem(fw, (i == g_RemoteControl->current_PIDs.PIDs.selected_apid));
|
||||
shortcut_num = i+1;
|
||||
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));
|
||||
fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
|
||||
fw->setMarked(sel_apid == i);
|
||||
|
||||
AudioSelector->addItem(fw, sel_apid == i);
|
||||
}
|
||||
unsigned int shortcut_num = p_count;
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_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,
|
||||
@@ -132,65 +202,86 @@ 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 );
|
||||
AudioSelector->addItem( oj );
|
||||
#endif
|
||||
|
||||
CZapitChannel * cc = NULL;
|
||||
int subtitleCount = 0;
|
||||
if (is_mp) {
|
||||
subtitleCount = mp->getSubtitleCount();
|
||||
} else {
|
||||
CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList;
|
||||
int curnum = channelList->getActiveChannelNumber();
|
||||
CZapitChannel * cc = channelList->getChannel(curnum);
|
||||
cc = channelList->getChannel(curnum);
|
||||
subtitleCount = (int)cc->getSubtitleCount();
|
||||
}
|
||||
|
||||
bool sep_added = false;
|
||||
if(cc)
|
||||
if (subtitleCount > 0)
|
||||
{
|
||||
for (int i = 0 ; i < (int)cc->getSubtitleCount() ; ++i)
|
||||
bool sub_active = false;
|
||||
|
||||
for (int i = 0 ; i < subtitleCount ; ++i)
|
||||
{
|
||||
CZapitAbsSub* s = cc->getChannelSub(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];
|
||||
|
||||
if (s->thisSubType == CZapitAbsSub::DVB) {
|
||||
CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
|
||||
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];
|
||||
// printf("[neutrino] adding DVB subtitle %s pid %x\n", sd->ISO639_language_code.c_str(), sd->pId);
|
||||
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);
|
||||
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)
|
||||
{
|
||||
ena = sd->pId != (is_mp ? mp->getCurrentSubPid(CZapitAbsSub::DVB) : dvbsub_getpid());
|
||||
} else if (s->thisSubType == CZapitAbsSub::TTX) {
|
||||
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);
|
||||
if(!sep_added)
|
||||
{
|
||||
sep_added = true;
|
||||
AudioSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SUBTITLES_HEAD));
|
||||
}
|
||||
char spid[64];
|
||||
// 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);
|
||||
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);
|
||||
AudioSelector.addItem(new CMenuForwarder(item /*sd->ISO639_language_code.c_str()*/,
|
||||
!tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num)));
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
if(sep_added) {
|
||||
if (sub_active) {
|
||||
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 */
|
||||
@@ -203,6 +294,20 @@ int CAudioSelectMenuHandler::doMenu ()
|
||||
&percent[i], i == g_RemoteControl->current_PIDs.PIDs.selected_apid,
|
||||
0, 999, CVolume::getInstance()));
|
||||
}
|
||||
#endif
|
||||
|
||||
return AudioSelector.exec(NULL, "");
|
||||
//tonbug
|
||||
AudioSelector->addItem(GenericMenuSeparatorLine);
|
||||
#if !HAVE_SPARK_HARDWARE && !HAVE_DUCKBOX_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;
|
||||
}
|
||||
|
@@ -29,14 +29,26 @@
|
||||
//
|
||||
|
||||
#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();
|
||||
|
@@ -4329,6 +4329,15 @@ 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();
|
||||
|
@@ -26,6 +26,7 @@ typedef enum
|
||||
{
|
||||
NONEXISTANT_LOCALE,
|
||||
LOCALE_AUDIOSELECTMENUE_HEAD,
|
||||
LOCALE_AUDIOSELECTMENUE_VOLUME,
|
||||
LOCALE_EPGMENU_EPGPLUS,
|
||||
LOCALE_EPGMENU_EVENTINFO,
|
||||
LOCALE_EPGMENU_EVENTLIST,
|
||||
|
@@ -26,6 +26,7 @@ const char * locale_real_names[] =
|
||||
{
|
||||
"INTERNAL ERROR - PLEASE REPORT",
|
||||
"AUDIOSelectMenue.head",
|
||||
"AUDIOSelectMenue.volume",
|
||||
"EPGMenu.epgplus",
|
||||
"EPGMenu.eventinfo",
|
||||
"EPGMenu.eventlist",
|
||||
|
@@ -49,11 +49,13 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <playback.h>
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <gui/widget/stringinput.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/infoviewer.h>
|
||||
#include <gui/movieplayer.h>
|
||||
#include <driver/display.h>
|
||||
#include <driver/volume.h>
|
||||
#include <system/helpers.h>
|
||||
@@ -338,9 +340,19 @@ 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("");
|
||||
}
|
||||
return menu_return::RETURN_EXIT;
|
||||
}
|
||||
if(!strncmp(actionKey.c_str(), "DVB", 3)) {
|
||||
@@ -349,7 +361,7 @@ printf("CSubtitleChangeExec::exec: action %s\n", actionKey.c_str());
|
||||
tuxtx_stop_subtitle();
|
||||
dvbsub_pause();
|
||||
dvbsub_start(pid);
|
||||
} else {
|
||||
} else if (!strncmp(actionKey.c_str(), "TTX", 3)) {
|
||||
char const * ptr = strchr(actionKey.c_str(), ':');
|
||||
ptr++;
|
||||
int pid = atoi(ptr);
|
||||
@@ -362,8 +374,30 @@ 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 || HAVE_DUCKBOX_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);
|
||||
}
|
||||
return menu_return::RETURN_EXIT;
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,11 @@
|
||||
|
||||
#include <global.h>
|
||||
#include <gui/widget/menue.h>
|
||||
#include <zapit/client/zapittypes.h>
|
||||
#include <playback.h>
|
||||
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE
|
||||
#include <audio.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -103,7 +108,10 @@ 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);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user