From: Chris Tallon Date: Thu, 6 Feb 2020 15:22:37 +0000 (+0000) Subject: Rename Remote class to Input, RemoteLinux to InputLinux X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=9edab68c34624c31ff4caa942c5f0f4af06d7d3c;p=vompclient.git Rename Remote class to Input, RemoteLinux to InputLinux --- diff --git a/audioplayer.h b/audioplayer.h index 86aa712..08af3d9 100644 --- a/audioplayer.h +++ b/audioplayer.h @@ -29,7 +29,7 @@ #include #include "audio.h" -#include "remote.h" +#include "input.h" #include "vdr.h" #include "callback.h" #include "message.h" diff --git a/boxstack.cc b/boxstack.cc index 69345a0..5ba9cc8 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -21,7 +21,7 @@ #include "command.h" #include "messagequeue.h" -#include "remote.h" +#include "input.h" #include "log.h" BoxStack* BoxStack::instance = NULL; @@ -513,7 +513,7 @@ int BoxStack::handleCommand(int command) int retVal2 = 0; int i; - if (command != Remote::NA_NONE) + if (command != Input::NA_NONE) { // handle command return values // 0 - drop through to next box diff --git a/command.cc b/command.cc index ac05cc8..edf0974 100644 --- a/command.cc +++ b/command.cc @@ -43,7 +43,7 @@ #include "wol.h" #include "vconnect.h" #include "message.h" -#include "remote.h" +#include "input.h" #include "vinfo.h" #include "boxx.h" #include "boxstack.h" @@ -80,7 +80,7 @@ int Command::init(bool tcrashed, char* tServer) logger = Log::getInstance(); boxstack = BoxStack::getInstance(); - remote = Remote::getInstance(); + remote = Input::getInstance(); remote->InitHWCListwithDefaults(); @@ -192,7 +192,7 @@ void Command::run() // Start method 2 of getting commands in... udp.run(this); - // FIXME Remote::NA_SIGNAL is possibly obsolete now + // FIXME Input::NA_SIGNAL is possibly obsolete now std::unique_lock lockWrapper(messageQueueMutex); // locks. unlocks on out-of-scope @@ -246,7 +246,7 @@ void Command::processMessage(Message* m) // << FIXME OBSELETE case Message::STOP_PLAYBACK: { - handleCommand(Remote::STOP); // an odd way of doing it, but so simple + handleCommand(Input::STOP); // an odd way of doing it, but so simple break; } // Also connection_lost comes from player - anywhere else? @@ -342,9 +342,9 @@ void Command::processMessage(Message* m) void Command::handleCommand(int button) { - if (isStandby && (button != Remote::POWER) - && (button != Remote::POWERON) - && (button != Remote::POWEROFF)) return; + if (isStandby && (button != Input::POWER) + && (button != Input::POWERON) + && (button != Input::POWEROFF)) return; if (!connLost && boxstack->handleCommand(button)) return; // don't send to boxstack if connLost @@ -352,14 +352,14 @@ void Command::handleCommand(int button) switch(button) { - case Remote::DF_LEFT: - case Remote::DF_RIGHT: - case Remote::VOLUMEUP: - case Remote::VOLUMEDOWN: + case Input::DF_LEFT: + case Input::DF_RIGHT: + case Input::VOLUMEUP: + case Input::VOLUMEDOWN: { if (remote->handlesVolume()) { - if (button==Remote::DF_LEFT || button==Remote::VOLUMEDOWN) + if (button==Input::DF_LEFT || button==Input::VOLUMEDOWN) remote->volumeDown(); else remote->volumeUp(); @@ -372,7 +372,7 @@ void Command::handleCommand(int button) } return; } - case Remote::MUTE: + case Input::MUTE: { if (remote->handlesVolume()) { @@ -387,29 +387,29 @@ void Command::handleCommand(int button) } return; } - case Remote::POWER: + case Input::POWER: { doStandby(); return; } - case Remote::POWERON: + case Input::POWERON: { doPowerOn(); return; } - case Remote::POWEROFF: + case Input::POWEROFF: { doPowerOff(); return; } - case Remote::OK: + case Input::OK: { // FIXME - if (!connLost) return; // if connLost, handle Remote::OK + if (!connLost) return; // if connLost, handle Input::OK doFromTheTop(false); return; } - case Remote::GO: + case Input::GO: { VSleeptimer* sleep = new VSleeptimer(); boxstack->add(sleep); @@ -448,7 +448,7 @@ void Command::doPowerOn() { Video::getInstance()->signalOn(); Led::getInstance()->on(); - Remote::getInstance()->changePowerState(true); + Input::getInstance()->changePowerState(true); isStandby = false; VConnect* vconnect = new VConnect(server); @@ -470,7 +470,7 @@ void Command::doPowerOff() logger->unsetExternLogger(); VDR::getInstance()->disconnect(); Led::getInstance()->off(); - Remote::getInstance()->changePowerState(false); + Input::getInstance()->changePowerState(false); isStandby = true; Sleeptimer::getInstance()->shutdown(); #ifdef WIN32 @@ -545,7 +545,7 @@ void Command::doReboot() Osd::getInstance()->shutdown(); Audio::getInstance()->shutdown(); Video::getInstance()->shutdown(); - Remote::getInstance()->shutdown(); + Input::getInstance()->shutdown(); reboot(LINUX_REBOOT_CMD_RESTART); // if reboot is not allowed -> stop @@ -905,19 +905,19 @@ void Command::doJustConnected(VConnect* vconnect) if (!STRCASECMP(config, "New")) { logger->log("Command", Log::INFO, "Switching to New remote type"); - remote->setRemoteType(Remote::NEWREMOTE); + remote->setRemoteType(Input::NEWREMOTE); } else { logger->log("Command", Log::INFO, "Switching to Old remote type"); - remote->setRemoteType(Remote::OLDREMOTE); + remote->setRemoteType(Input::OLDREMOTE); } delete[] config; } else { logger->log("Command", Log::INFO, "Config General/Remote type not found"); - remote->setRemoteType(Remote::OLDREMOTE); + remote->setRemoteType(Input::OLDREMOTE); } @@ -1070,16 +1070,16 @@ void Command::doJustConnected(VConnect* vconnect) boxstack->update(vw); // Enter pre-keys here -// handleCommand(Remote::OK); -// handleCommand(Remote::THREE); -// handleCommand(Remote::SIX); -// handleCommand(Remote::OK); -// handleCommand(Remote::UP); -// handleCommand(Remote::PLAY); -// handleCommand(Remote::DOWN); -// handleCommand(Remote::DOWN); -// handleCommand(Remote::DOWN); - // handleCommand(Remote::OK); -// handleCommand(Remote::RED); +// handleCommand(Input::OK); +// handleCommand(Input::THREE); +// handleCommand(Input::SIX); +// handleCommand(Input::OK); +// handleCommand(Input::UP); +// handleCommand(Input::PLAY); +// handleCommand(Input::DOWN); +// handleCommand(Input::DOWN); +// handleCommand(Input::DOWN); + // handleCommand(Input::OK); +// handleCommand(Input::RED); } } diff --git a/command.h b/command.h index bc42923..6ac4c50 100644 --- a/command.h +++ b/command.h @@ -40,7 +40,7 @@ class VConnect; class Message; -class Remote; +class Input; class Boxx; class BoxStack; class Log; @@ -93,7 +93,7 @@ class Command : public MessageQueue Log* logger; BoxStack* boxstack; - Remote* remote; + Input* remote; bool initted{}; bool irun{}; diff --git a/defines.h b/defines.h index a7b158e..720d2af 100644 --- a/defines.h +++ b/defines.h @@ -107,7 +107,7 @@ int getClockRealTime(struct timespec *tp); // add here defines for plattform specific objects #ifdef VOMP_PLATFORM_RASPBERRY - #define Remote_TYPE RemoteLinux // Generic Remote under Linux (Konsole!, not X) will support in the end: + #define Remote_TYPE InputLinux // Generic Remote under Linux (Konsole!, not X) will support in the end: #define RemoteStartDev ""//No devices passed // Keyboard diff --git a/input.cc b/input.cc new file mode 100644 index 0000000..0e0e947 --- /dev/null +++ b/input.cc @@ -0,0 +1,489 @@ +/* + Copyright 2004-2020 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP. If not, see . +*/ + +#include "wremoteconfig.h" +#include "i18n.h" +#include "log.h" +#include "vdr.h" +#include "wtabbar.h" +#include "input.h" + +Input* Input::instance = NULL; + +Input::Input() +{ + if (instance) return; + instance = this; + remoteType = OLDREMOTE; + learnmode = NOLEARNMODE; +} + +Input::~Input() +{ + instance = NULL; +} + +Input* Input::getInstance() +{ + return instance; +} + +void Input::setRemoteType(UCHAR newType) +{ + if ((newType != OLDREMOTE) && (newType != NEWREMOTE)) return; + remoteType = newType; +} + +void Input::EnterLearningMode(UCHAR command) +{ + learnmode = command; //Armed +} + +void Input::ResetToDefault() +{ + translist.clear(); + InitHWCListwithDefaults(); +} + + +UCHAR Input::TranslateHWCFixed(ULLONG code) +{ + switch (code) + { + case DOWN: + return DOWN; + case UP: + return UP; + case LEFT: + return LEFT; + case RIGHT: + return RIGHT; + case DF_DOWN: + return DOWN; + case DF_UP: + return UP; + case DF_LEFT: + return LEFT; + case DF_RIGHT: + return RIGHT; + case MENU: + return MENU; + case BACK: + return BACK; + case OK: + return OK; + default: + return NA_UNKNOWN; + } +} + +const char* Input::HardcodedTranslateStr(UCHAR command) +{ + switch (command) + { + case DOWN: + return tr("Down"); + case UP: + return tr("Up"); + case LEFT: + return tr("Left"); + case RIGHT: + return tr("Right"); + case MENU: + return tr("Menu"); + case BACK: + return tr("Back"); + case OK: + return tr("Ok"); + default: + return NULL; + } +} + +UCHAR Input::TranslateHWCList(ULLONG code) +{ + if (learnmode != NOLEARNMODE) + { + setHWCtoCommand(code, learnmode); + learnmode = NOLEARNMODE; + return NA_LEARN; + } + RemoteTranslationList::iterator it = translist.find(code); + if (it == translist.end()) + { + return NA_UNKNOWN; + } + else + { + return it->second; + } +} + +UCHAR Input::TranslateHWC(ULLONG code) +{ + UCHAR ret = TranslateHWCFixed(code); + if (ret == NA_UNKNOWN) + { + ret = TranslateHWCList(code); + } + else + { + learnmode = NOLEARNMODE; + } + + if (ret == NA_UNKNOWN) + { + return NA_UNKNOWN; + } + return ret; +} + +void Input::setHWCtoCommand(ULLONG hcw, UCHAR command) +{ + translist[hcw] = command; +} + +void Input::unsetHWC(ULLONG hcw) +{ + translist.erase(hcw); +} + +void Input::LoadKeysConfig(VDR *vdr,const char *cfg) +{ + ULONG number=0; + if (sscanf(cfg,"%ld",&number) != 1) return; + Log::getInstance()->log("Input", Log::INFO, "Config General/Remote keys num keys %d",number); + char keybuf[1024]; + for (ULONG i = 0; i < number; i++) { + sprintf(keybuf, "RemoteKey%lu", i); + const char *keytrans = vdr->configLoad("General", keybuf); + if (keytrans) { + ULONG ul1, ul2; + ULONG uc; + if (sscanf(keytrans, "%lXI%lXK%lX", &ul1, &ul2, &uc) == 3) { + translist[((ULLONG) ul1) | ((ULLONG) ul2) << 32] = (UCHAR) uc; + } + delete[] keytrans; + } + + } +} + +void Input::SaveKeysConfig() +{ + int number=0; + char buffer[1024]; + char keybuf[1024]; + RemoteTranslationList::const_iterator it; + for (it = translist.begin(); it != translist.end(); it++) + { + sprintf(buffer,"%08lXI%08lXK%02X", + (ULONG)it->first ,(ULONG) (it->first >> 32), it->second); + sprintf(keybuf,"RemoteKey%d",number); + VDR::getInstance()->configSave("General",keybuf,buffer); + number++; + } + sprintf(buffer,"%d",number); + VDR::getInstance()->configSave("General","RemoteKeyNum",buffer); +} + + +void Input::InitHWCListwithDefaults() +{ + translist[VOLUMEUP] = VOLUMEUP; + translist[VOLUMEDOWN] = VOLUMEDOWN; + translist[CHANNELUP] = CHANNELUP; + translist[CHANNELDOWN] = CHANNELDOWN; + + // Common buttons + translist[ZERO] = ZERO; + translist[ONE] = ONE; + translist[TWO] = TWO; + translist[THREE] = THREE; + translist[FOUR] = FOUR; + translist[FIVE] = FIVE; + translist[SIX] = SIX; + translist[SEVEN] = SEVEN; + translist[EIGHT] = EIGHT; + translist[NINE] = NINE; + translist[POWER] = POWER; + translist[GO] = GO; + translist[RED] = RED; + translist[GREEN] = GREEN; + translist[YELLOW] = YELLOW; + translist[BLUE] = BLUE; + + translist[MUTE] = MUTE; + translist[RADIO] = RADIO; + translist[REVERSE] = REVERSE; + translist[FORWARD] = FORWARD; + translist[RECORD] = RECORD; + translist[STOP] = STOP; + translist[PAUSE] = PAUSE; + translist[PLAY] = PLAY; + translist[SKIPBACK] = SKIPBACK; + translist[SKIPFORWARD] = SKIPFORWARD; + + // Old remote only + translist[FULL] = FULL; + + // New remote only + translist[TV] = TV; + translist[VIDEOS] = VIDEOS; + translist[MUSIC] = MUSIC; + translist[PICTURES] = PICTURES; + translist[GUIDE] = GUIDE; + translist[PREVCHANNEL] = PREVCHANNEL; + translist[STAR] = STAR; + translist[HASH] = HASH; +} + +const char* Input::CommandDesc(UCHAR number) +{ + switch (number) + { + case VOLUMEUP: + return tr("Volume Up"); + + case VOLUMEDOWN: + return tr("Volume Down"); + case CHANNELUP: + return tr("Channel up"); + case CHANNELDOWN: + return tr("Channel down"); + case ZERO: + return "0"; + case ONE: + return "1"; + case TWO: + return "2"; + case THREE: + return "3"; + case FOUR: + return "4"; + case FIVE: + return "5"; + case SIX: + return "6"; + case SEVEN: + return "7"; + case EIGHT: + return "8"; + case NINE: + return "9"; + case POWER: + return tr("Power"); + case GO: + return tr("Go"); + case BACK: + return tr("Back"); + case MENU: + return tr("Menu"); + case RED: + return tr("Red"); + case GREEN: + return tr("Green"); + case YELLOW: + return tr("Yellow"); + case BLUE: + return tr("Blue"); + case MUTE: + return tr("Mute"); + case RADIO: + return tr("Radio"); + case REVERSE: + return tr("Reverse"); + case PLAY: + return tr("Play"); + case FORWARD: + return tr("Forward"); + case RECORD: + return tr("Record"); + case STOP: + return tr("Stop"); + case PAUSE: + return tr("Pause"); + case SKIPBACK: + return tr("Skip back"); + case SKIPFORWARD: + return tr("Skip forward"); + case OK: + return tr("Ok"); + case FULL: + return tr("Fullscreen"); + case TV: + return tr("TV"); + case VIDEOS: + return tr("Videos"); + case MUSIC: + return tr("Music"); + case PICTURES: + return tr("Pictures"); + case GUIDE: + return tr("Guide"); + case UP: + return tr("Up"); + case DOWN: + return tr("Down"); + case LEFT: + return tr("Left"); + case RIGHT: + return tr("Right"); + case PREVCHANNEL: + return tr("Previous Channel"); + case STAR: + return tr("Star"); + case HASH: + return tr("Hash"); + case PLAYPAUSE: + return tr("Play/Pause"); + + default: + return NULL; + } +} + +char* Input::HCWDesc(ULLONG hcw) +{ + char *dest,*temp; + temp=(char*)CommandDesc((UCHAR)hcw); + if (temp != NULL) + { + dest=new char[strlen(temp)+1]; + strcpy(dest,temp); + } + else + { + dest=new char[20]; + sprintf(dest,"C:%lX",(ULONG)hcw); + } + return dest; +} + +char* Input::CommandTranslateStr(UCHAR command) +{ + char *desc; + int length=5;//:+\t+0 + int keys=0; //max 10; + char *commanddesc=(char*)CommandDesc(command); + if (commanddesc != NULL) + { + length+=strlen(commanddesc); + } + char *preassigneddesc=(char*)HardcodedTranslateStr(command); + if (preassigneddesc != NULL) + { + length+=strlen(preassigneddesc); + } + + char *keydesc[10]; + RemoteTranslationList::const_iterator it; + for (it = translist.begin(); it != translist.end(); it++) + { + if (it->second == command) + { + keydesc[keys] = HCWDesc(it->first); + length += strlen(keydesc[keys])+2; + keys ++; + if (keys == 10) break; + } + } + + desc=new char [length]; + char *current=desc; + if (commanddesc != NULL) + { + current+=sprintf(current,"%s:\t ",commanddesc); + } + else + { + current+=sprintf(current,":\t "); + } + if (preassigneddesc != NULL) + { + current+=sprintf(current,"%s\t",preassigneddesc); + } + else + { + current+=sprintf(current,"\t"); + } + for (int i = 0;i < keys; i++) + { + current += sprintf(current,"%s, ",keydesc[i]); + delete [] keydesc[i]; + } + return desc; +} + +bool Input::addOptionPagesToWTB(WTabBar *wtb) +{ + WRemoteConfig* wrc = new WRemoteConfig(); + wtb->addTab(tr("Remote Control"), wrc); + return true; +} + +bool Input::loadOptionsfromServer(VDR* vdr) +{ + // Set remote keys + char * config; + config = vdr->configLoad("General", "RemoteKeyNum"); + + if (config) + { + Log::getInstance()->log("Input", Log::INFO, "Config General/Remote keys load"); + LoadKeysConfig(vdr,config); + delete[] config; + } + else + { + Log::getInstance()->log("Input", Log::INFO, "Config General/Remote keys not found"); + InitHWCListwithDefaults(); + } + return true; +} + +bool Input::saveOptionstoServer() +{ + SaveKeysConfig(); + return true; +} + +bool Input::start() +{ + Log::getInstance()->log("Input", Log::INFO, "start called"); + + threadStartProtect.lock(); + listenThread = std::thread( [this ] + { + threadStartProtect.lock(); + threadStartProtect.unlock(); + // FIXME block signals + + eventLoop(); + }); + threadStartProtect.unlock(); + return true; +} + +void Input::stop() +{ + listenLoopStop = true; + informStopEventLoop(); + listenThread.join(); +} diff --git a/input.h b/input.h new file mode 100644 index 0000000..169129a --- /dev/null +++ b/input.h @@ -0,0 +1,177 @@ +/* + Copyright 2004-2020 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP. If not, see . +*/ + +#ifndef INPUT_H +#define INPUT_H + +#include +#include +#include +#include + +#include "defines.h" +#include "abstractoption.h" + + +typedef std::map RemoteTranslationList; + +class Input: public AbstractOption +{ + public: + Input(); + virtual ~Input(); + static Input* getInstance(); + + bool start(); + void stop(); + + bool addOptionPagesToWTB(WTabBar *wtb); + bool loadOptionsfromServer(VDR* vdr); + bool saveOptionstoServer(); + + void setRemoteType(UCHAR type); + void setHWCtoCommand(ULLONG hcw,UCHAR command); + void unsetHWC(ULLONG hcw); + void LoadKeysConfig(VDR *vdr,const char*keynum); + void SaveKeysConfig(); + void EnterLearningMode(UCHAR command); + + virtual int init(const char *devName)=0; + virtual int shutdown()=0; + virtual UCHAR getButtonPress(int how)=0; // DEPRECATED + + virtual bool mayHaveFewButtons() {return false;}; + + virtual bool handlesVolume() {return false;}; + virtual void volumeUp() {}; + virtual void volumeDown() {}; + virtual void volumeMute() {}; + + virtual void InitHWCListwithDefaults(); + virtual char* HCWDesc(ULLONG hcw); + const char *CommandDesc(UCHAR number); + char *CommandTranslateStr(UCHAR command); + virtual const char*HardcodedTranslateStr(UCHAR command); + void EnterLearnMode(UCHAR command); + void ResetToDefault(); + + virtual void changePowerState(bool /* poweron */) {}; //informs the remote control, that about vomp's power state, this is important e.g. for cec + + const static ULONG NOLEARNMODE = 256; + // Not buttons + const static UCHAR NA_LEARN = 101; + const static UCHAR NA_NONE = 98; + const static UCHAR NA_UNKNOWN = 99; + const static UCHAR NA_SIGNAL = 100; + const static UCHAR DF_UP = 94; + const static UCHAR DF_DOWN = 95; + const static UCHAR DF_LEFT = 96; + const static UCHAR DF_RIGHT = 97; + + // Problem common buttons + const static UCHAR VOLUMEUP = 16; + const static UCHAR VOLUMEDOWN = 17; + const static UCHAR CHANNELUP = 32; + const static UCHAR CHANNELDOWN = 33; + + // Common buttons + const static UCHAR ZERO = 0; + const static UCHAR ONE = 1; + const static UCHAR TWO = 2; + const static UCHAR THREE = 3; + const static UCHAR FOUR = 4; + const static UCHAR FIVE = 5; + const static UCHAR SIX = 6; + const static UCHAR SEVEN = 7; + const static UCHAR EIGHT = 8; + const static UCHAR NINE = 9; + const static UCHAR POWER = 61; + const static UCHAR GO = 59; + const static UCHAR BACK = 31; + const static UCHAR MENU = 13; + const static UCHAR RED = 11; + const static UCHAR GREEN = 46; + const static UCHAR YELLOW = 56; + const static UCHAR BLUE = 41; + const static UCHAR MUTE = 15; + const static UCHAR RADIO = 12; // The unlabelled button on old + const static UCHAR REVERSE = 50; + const static UCHAR PLAY = 53; + const static UCHAR FORWARD = 52; + const static UCHAR RECORD = 55; + const static UCHAR STOP = 54; + const static UCHAR PAUSE = 48; + const static UCHAR SKIPBACK = 36; + const static UCHAR SKIPFORWARD = 30; + const static UCHAR OK = 37; + + // Old remote only + const static UCHAR FULL = 60; + + // New remote only + const static UCHAR TV = 28; + const static UCHAR VIDEOS = 24; + const static UCHAR MUSIC = 25; + const static UCHAR PICTURES = 26; + const static UCHAR GUIDE = 27; + const static UCHAR UP = 20; + const static UCHAR DOWN = 21; + const static UCHAR LEFT = 22; + const static UCHAR RIGHT = 23; + const static UCHAR PREVCHANNEL = 18; + const static UCHAR STAR = 10; + const static UCHAR HASH = 14; + + // Android only + const static UCHAR PLAYPAUSE = 201; + // cec only + const static UCHAR POWERON = 202; + const static UCHAR POWEROFF = 203; + + + // Remote types + const static UCHAR OLDREMOTE = 1; + const static UCHAR NEWREMOTE = 2; + + protected: + virtual UCHAR TranslateHWCFixed(ULLONG code); + UCHAR TranslateHWCList(ULLONG code); + UCHAR TranslateHWC(ULLONG code); + + static Input* instance; + ULONG learnmode; + UCHAR remoteType; + RemoteTranslationList translist; + + std::thread listenThread; + std::mutex threadStartProtect; + + virtual void eventLoop() {}; // FIXME change to abstract + virtual void informStopEventLoop() {}; // abstract + + bool listenLoopStop{}; +}; + +#endif + +// FIXME rename all remote stuff to some sort of INPUT +// Roll in UDP receiver + +// FIXME have Top remote system create new listeners for various devices? Hot plug? +// Where remotelinux has multi listeners, move that to top? diff --git a/inputlinux.cc b/inputlinux.cc new file mode 100644 index 0000000..8adc479 --- /dev/null +++ b/inputlinux.cc @@ -0,0 +1,1127 @@ +/* + Copyright 2004-2020 Chris Tallon; 2012 Marten Richter + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP. If not, see . +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +using namespace CEC; + +#include "i18n.h" +#include "vdr.h" +#include "woptionpane.h" +#include "message.h" +#include "messagequeue.h" +#include "command.h" // FIXME - get rid after predefined message targets + +#include "inputlinux.h" + +#define W_G_HCW(type,code) ((static_cast(type) << 32) | code) + +#define W_HCW_KC 1 /* key code as defined by kernel for keyboard and remotes through /dev/input */ +#define W_HCW_CEC 2 /* HDMI_CEC */ +#define W_HCW_LIRC 3 /* remote control LIRC*/ + + +InputLinux::InputLinux() +{ +} + +InputLinux::~InputLinux() +{ + for (unsigned int i = 0; i < devices.size(); i++) + { + close(devices[i]); + } +} + +#define test_bit(input,b) ((1 << ((b) % 8))&(input)[b / 8] ) + +int InputLinux::init(const char*) +{ + if (initted) return 0; + initted = 1; + + InitKeymap(); + + for (int eventid = 0; eventid < 100; eventid++) + { + char buffer[1024]; + sprintf(buffer,"/dev/input/event%d", eventid); + + struct stat test_buf; + if (stat(buffer, &test_buf) == 0) + { + Log::getInstance()->log("InputLinux", Log::NOTICE, "Probe /dev/input/event%d", eventid); + // file exists + unsigned long ev_type = 0; + int new_fd = open(buffer, O_RDONLY); + if (new_fd < 0) + { + Log::getInstance()->log("InputLinux", Log::NOTICE, "Can not open /dev/input/event%d", eventid); + continue; + } + + if (ioctl(new_fd, EVIOCGBIT(0, EV_MAX), &ev_type) < 0) + { + Log::getInstance()->log("InputLinux", Log::NOTICE, "Ioctl failed /dev/input/event%d %d", eventid, errno); + close(new_fd); + } + + //Now test if it generates keyboard presses + if (test_bit(reinterpret_cast(&ev_type), EV_KEY)) + { + Log::getInstance()->log("InputLinux", Log::NOTICE, "Add /dev/input/event%d to List", eventid); + devices.push_back(new_fd); + + // Grab the device - make it exclusive to vomp. Fixes rubbish input going to console in background + ioctl(new_fd, EVIOCGRAB, 1); + } + else + { + close(new_fd); + } + } + } + return initCec(); +} + +int InputLinux::initCec() { + + // bcm_host_init(); //may be move to custom hardware init? +// now init cec + Log::getInstance()->log("InputLinux", Log::NOTICE, "Init LibCEC"); + cec_config.Clear(); + cec_callbacks.Clear(); +#if CEC_LIB_VERSION_MAJOR >= 4 + cec_callbacks.logMessage = cecLogMessage; + cec_callbacks.keyPress = cecKeyPress; + cec_callbacks.commandReceived = cecCommand; + cec_callbacks.configurationChanged = cecConfigurationChanged; + cec_callbacks.sourceActivated = cecSourceActivated; +#else + cec_callbacks.CBCecLogMessage = cecLogMessage; + cec_callbacks.CBCecKeyPress = cecKeyPress; + cec_callbacks.CBCecCommand = cecCommand; + cec_callbacks.CBCecConfigurationChanged = cecConfigurationChanged; + cec_callbacks.CBCecSourceActivated = cecSourceActivated; + cec_config.bUseTVMenuLanguage=1; +#endif + cec_config.clientVersion=LIBCEC_VERSION_CURRENT; + cec_config.bActivateSource=1; + //cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); + cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); + //cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_TUNER); + + strncpy(cec_config.strDeviceName,"vomp",sizeof(cec_config.strDeviceName)); + + + cec_config.callbackParam = NULL; // I do not care + cec_config.callbacks = &cec_callbacks; + + cec_adap = LibCecInitialise(&cec_config); + if (!cec_adap) { + Log::getInstance()->log("InputLinux", Log::ERR, "Init LibCEC failed"); + return 1; + } + cec_adap->InitVideoStandalone(); + + +#if CEC_LIB_VERSION_MAJOR >= 4 + cec_adapter_descriptor cec_adapter_descriptors[10]; + int adap_num=cec_adap->DetectAdapters(cec_adapter_descriptors, 10); +#else + cec_adapter cec_devices[10]; + int adap_num=cec_adap->FindAdapters(cec_devices,10,NULL); +#endif + if (adap_num<0) { + Log::getInstance()->log("InputLinux", Log::ERR, "CEC:Failed to find adapter"); + return 1; + + } + if (adap_num==0) { + Log::getInstance()->log("InputLinux", Log::NOTICE, "CEC: No adapter found"); + return 1; + + } +#if CEC_LIB_VERSION_MAJOR >= 4 + if (!cec_adap->Open(cec_adapter_descriptors[0].strComName)) { +#else + if (!cec_adap->Open(cec_devices[0].comm)) { +#endif + Log::getInstance()->log("InputLinux", Log::ERR, "CEC:Failed to open adapter"); + return 1; + } + + if (!cec_adap->SetActiveSource(cec_config.deviceTypes[0])) { + Log::getInstance()->log("InputLinux", Log::ERR, "CEC:Failed set active source"); + return 1; + } + + + + + return 1; +} + +int InputLinux::shutdown() +{ + if (!initted) return 0; + + deinitCec(); + while (devices.size()) + { + int cur_fd = devices.back(); + devices.pop_back(); + ioctl(cur_fd, EVIOCGRAB, 0); + close(cur_fd); + } + + initted = 0; + return 1; +} + +void InputLinux::deinitCec() +{ + if (cec_adap) { + Log::getInstance()->log("InputLinux", Log::NOTICE, "Shutdown libcec begin"); + cec_adap->SetInactiveView(); + cec_adap->Close(); + vc_cec_register_callback(NULL, NULL);//deactivate callback! + UnloadLibCec(cec_adap); + cec_adap = NULL; + Log::getInstance()->log("InputLinux", Log::NOTICE, "Shutdown libcec end"); + } + +} + +UCHAR InputLinux::TranslateHWCFixed(ULLONG code) +{ + switch (code) + { + case W_G_HCW(W_HCW_KC, KEY_DOWN): + return DOWN; + case W_G_HCW(W_HCW_KC, KEY_UP): + return UP; + case W_G_HCW(W_HCW_KC, KEY_LEFT): + return LEFT; + case W_G_HCW(W_HCW_KC, KEY_RIGHT): + return RIGHT; + case W_G_HCW(W_HCW_KC, KEY_M): + case W_G_HCW(W_HCW_KC, KEY_MEDIA): + return MENU; + case W_G_HCW(W_HCW_KC, KEY_BACKSPACE): + case W_G_HCW(W_HCW_KC, KEY_EXIT): + return BACK; + case W_G_HCW(W_HCW_KC, KEY_ENTER): + case W_G_HCW(W_HCW_KC, KEY_SPACE): + case W_G_HCW(W_HCW_KC, KEY_OK): + return OK; + + //CEC + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_DOWN): + return DOWN; + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_UP): + return UP; + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_LEFT): + return LEFT; + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_RIGHT): + return RIGHT; + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_ROOT_MENU): + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_CONTENTS_MENU): + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_SETUP_MENU): + return MENU; + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_EXIT ): + return BACK; + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_ENTER): + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_SELECT): + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_AN_RETURN): + return OK; + case W_G_HCW(W_HCW_KC, KEY_SLEEP): + case W_G_HCW(W_HCW_KC, KEY_POWER): + case W_G_HCW(W_HCW_KC, KEY_ESC): + case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_POWER): + case POWER: + return POWER; + default: + return NA_UNKNOWN; + }; +} + +const char* InputLinux::HardcodedTranslateStr(UCHAR command) +{ + switch (command) + { + case DOWN: + return tr("Down"); + case UP: + return tr("Up"); + case LEFT: + return tr("Left"); + case RIGHT: + return tr("Right"); + case MENU: + return tr("M"); + case BACK: + return tr("Backspace, Back"); + case OK: + return tr("Return, Space"); + default: + return NULL; + } +} + + +void InputLinux::InitHWCListwithDefaults() +{ + // Processing VK_Messages + translist[W_G_HCW(W_HCW_KC,KEY_9)] = NINE; + translist[W_G_HCW(W_HCW_KC,KEY_8)] = EIGHT; + translist[W_G_HCW(W_HCW_KC,KEY_7)] = SEVEN; + translist[W_G_HCW(W_HCW_KC,KEY_6)] = SIX; + translist[W_G_HCW(W_HCW_KC,KEY_5)] = FIVE; + translist[W_G_HCW(W_HCW_KC,KEY_4)] = FOUR; + translist[W_G_HCW(W_HCW_KC,KEY_3)] = THREE; + translist[W_G_HCW(W_HCW_KC,KEY_2)] = TWO; + translist[W_G_HCW(W_HCW_KC,KEY_1)] = ONE; + translist[W_G_HCW(W_HCW_KC,KEY_0)] = ZERO; + translist[W_G_HCW(W_HCW_KC,KEY_KPDOT)] = STAR; + // translist[W_G_HCW(W_HCW_KC,KEY_#)] = HASH; + + translist[W_G_HCW(W_HCW_KC,KEY_KP9)] = NINE; + translist[W_G_HCW(W_HCW_KC,KEY_KP8)] = EIGHT; + translist[W_G_HCW(W_HCW_KC,KEY_KP7)] = SEVEN; + translist[W_G_HCW(W_HCW_KC,KEY_KP6)] = SIX; + translist[W_G_HCW(W_HCW_KC,KEY_KP5)] = FIVE; + translist[W_G_HCW(W_HCW_KC,KEY_KP4)] = FOUR; + translist[W_G_HCW(W_HCW_KC,KEY_KP3)] = THREE; + translist[W_G_HCW(W_HCW_KC,KEY_KP2)] = TWO; + translist[W_G_HCW(W_HCW_KC,KEY_KP1)] = ONE; + translist[W_G_HCW(W_HCW_KC,KEY_KP0)] = ZERO; + + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_9)] = NINE; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_8)] = EIGHT; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_7)] = SEVEN; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_6)] = SIX; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_5)] = FIVE; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_4)] = FOUR; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_3)] = THREE; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_2)] = TWO; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_1)] = ONE; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_0)] = ZERO; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_STAR)] = STAR; + translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_POUND)] = HASH; + + + translist[W_G_HCW(W_HCW_KC,KEY_J)] = GO; //j for JUMP TO instead of go to + translist[W_G_HCW(W_HCW_KC,KEY_R)] = RED; + translist[W_G_HCW(W_HCW_KC,KEY_G)] = GREEN; + translist[W_G_HCW(W_HCW_KC,KEY_Y)] = YELLOW; + translist[W_G_HCW(W_HCW_KC,KEY_B)] = BLUE; + //Processing Remote Style Messages + translist[W_G_HCW(W_HCW_KC,KEY_GREEN)] = GREEN; + translist[W_G_HCW(W_HCW_KC,KEY_RED)] = RED; + translist[W_G_HCW(W_HCW_KC,KEY_YELLOW)] = YELLOW; + translist[W_G_HCW(W_HCW_KC,KEY_BLUE)] = BLUE; + translist[W_G_HCW(W_HCW_KC,KEY_MENU)] = MENU; + + translist[W_G_HCW(W_HCW_KC,KEY_RECORD)] = RECORD; + translist[W_G_HCW(W_HCW_KC,KEY_PLAY)] = PLAY; //Playback Televison + translist[W_G_HCW(W_HCW_KC,KEY_PAUSE)] = PAUSE; + translist[W_G_HCW(W_HCW_KC,KEY_STOP)] = STOP; + translist[W_G_HCW(W_HCW_KC,KEY_PLAYPAUSE)] = PLAYPAUSE; + translist[W_G_HCW(W_HCW_KC,KEY_P)] = PLAYPAUSE; + translist[W_G_HCW(W_HCW_KC,KEY_NEXT)] = SKIPFORWARD; + translist[W_G_HCW(W_HCW_KC,KEY_F2)] = SKIPFORWARD; + translist[W_G_HCW(W_HCW_KC,KEY_PREVIOUS)] = SKIPBACK; + translist[W_G_HCW(W_HCW_KC,KEY_F1)] = SKIPBACK; + translist[W_G_HCW(W_HCW_KC,KEY_FORWARD)] = FORWARD; + translist[W_G_HCW(W_HCW_KC,KEY_FASTFORWARD)] = FORWARD; + translist[W_G_HCW(W_HCW_KC,KEY_F)] = FORWARD; + translist[W_G_HCW(W_HCW_KC,KEY_BACK)] = REVERSE; + translist[W_G_HCW(W_HCW_KC,KEY_REWIND)] = REVERSE; + translist[W_G_HCW(W_HCW_KC,KEY_T)] = REVERSE; + translist[W_G_HCW(W_HCW_KC,KEY_MUTE)] = MUTE; + translist[W_G_HCW(W_HCW_KC,KEY_F8)] = MUTE; + translist[W_G_HCW(W_HCW_KC,KEY_F10)] = VOLUMEUP; + translist[W_G_HCW(W_HCW_KC,KEY_F9)] = VOLUMEDOWN; + translist[W_G_HCW(W_HCW_KC,KEY_VOLUMEUP)] = VOLUMEUP; + translist[W_G_HCW(W_HCW_KC,KEY_VOLUMEDOWN)] = VOLUMEDOWN; + translist[W_G_HCW(W_HCW_KC,KEY_CHANNELUP)] = CHANNELUP; + translist[W_G_HCW(W_HCW_KC,KEY_CHANNELDOWN)] = CHANNELDOWN; + translist[W_G_HCW(W_HCW_KC,KEY_PAGEUP)] = CHANNELUP; + translist[W_G_HCW(W_HCW_KC,KEY_PAGEDOWN)] = CHANNELDOWN; + + + //Processing CEC_Messages + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER9)] = NINE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER8)] = EIGHT; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER7)] = SEVEN; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER6)] = SIX; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER5)] = FIVE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER4)] = FOUR; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER3)] = THREE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER2)] = TWO; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER1)] = ONE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER0)] = ZERO; + //translist[W_G_HCW(W_HCW_CEC,KEY_KPDOT)] = STAR; + + + + //translist[W_G_HCW(W_HCW_CEC,KEY_J)] = GO; //j for JUMP TO instead of go to + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F2_RED)] = RED; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F3_GREEN)] = GREEN; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F4_YELLOW)] = YELLOW; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F1_BLUE)] = BLUE; + //Processing Remote Style Messages + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FAVORITE_MENU)] = MENU; + + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_RECORD)] = RECORD; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PLAY)] = PLAY; //Playback Televison + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PAUSE)] = PAUSE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_STOP)] = STOP; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PAUSE_PLAY_FUNCTION)] = PLAYPAUSE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FORWARD)] = SKIPFORWARD; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_BACKWARD)] = SKIPBACK; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FAST_FORWARD )] = FORWARD; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_REWIND)] = REVERSE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_MUTE)] = MUTE; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_VOLUME_UP)] = VOLUMEUP; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_VOLUME_DOWN)] = VOLUMEDOWN; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_CHANNEL_UP )] = CHANNELUP; + translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_CHANNEL_DOWN)] = CHANNELDOWN; +} + +#define NAMETRICK(pre, code) linux_keymap[pre ## code]= #code +#define NAMETRICK2(pre, code) cec_keymap[pre ## code]= #code +//extracte from linux/input.h + +static const char * linux_keymap[KEY_MAX+1]; +static const char * cec_keymap[CEC_USER_CONTROL_CODE_MAX+1]; + +void InputLinux::InitKeymap() +{ + for (int i=0;i(hcw >> 32); + unsigned int vk = static_cast(hcw); + char* rt = NULL; + + switch(type) + { + case W_HCW_KC: + { + rt = new char[10]; + const char *desc=linux_keymap[vk]; + if (desc) + strncpy(rt, desc, 9); + else + sprintf(rt, "0x%x", vk); + break; + } + case W_HCW_CEC: + { + rt = new char[10]; + const char* desc = cec_keymap[vk]; + if (desc) + strncpy(rt, desc, 9); + else + sprintf(rt, "0x%x", vk); + break; + } + /* + case W_HCW_LIRC:{ + ULONG ri=(ULONG)hcw; + rt=new char[10]; + sprintf(rt,"R: %X",ri); + }break;*/ + } + + return rt; +} + +void InputLinux::changePowerState(bool poweron) +{ + if (cec_adap) + { + if (poweron) + { + //Log::getInstance()->log("InputLinux", Log::DEBUG, "CEC set active source"); + cec_adap->SetActiveSource(cec_config.deviceTypes[0]); + } + else + { + //Log::getInstance()->log("InputLinux", Log::DEBUG, "CEC set inactive view"); + cec_adap->SetInactiveView(); + } + } +} + +#if CEC_LIB_VERSION_MAJOR >= 4 + +// libcec4 API changed these params to pointers rather than copies, and the returns to void +// Otherwise, these two blocks of code are the same + +void InputLinux::cecLogMessage(void* /* param */, const cec_log_message* message) +{ + Log::getInstance()->log("InputLinux", Log::DEBUG, "CECLOG: %lld %d %s", message->time, message->level, message->message); +} + +void InputLinux::cecKeyPress(void* /* param */, const cec_keypress* key) +{ + //Log::getInstance()->log("InputLinux", Log::DEBUG, "Incoming cec key %d %d", key->keycode,key->duration); + if (key->duration == 0) static_cast(Input::getInstance())->incomingCECkey(key->keycode); +} + +void InputLinux::cecCommand(void* /* param */, const cec_command* command) +{ + Log::getInstance()->log("InputLinux", Log::DEBUG, "CECCommand: %d",command->opcode); + switch (command->opcode) { + case CEC_OPCODE_STANDBY: { + if (command->initiator==CECDEVICE_TV) { + static_cast(Input::getInstance())->incomingPowerkey(POWEROFF); + } + } break; + case CEC_OPCODE_DECK_CONTROL: { + if (command->initiator==CECDEVICE_TV && command->parameters.size == 1 + && command->parameters[0]==CEC_DECK_CONTROL_MODE_STOP) { + static_cast(Input::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_STOP); + + } + + } break; + case CEC_OPCODE_PLAY: { + if (command->initiator==CECDEVICE_TV && command->parameters.size == 1) { + if (command->parameters[0]==CEC_PLAY_MODE_PLAY_FORWARD) { + static_cast(Input::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PLAY); + } else if (command->parameters[0]==CEC_PLAY_MODE_PLAY_STILL) { + static_cast(Input::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PAUSE); + } + } + + + } break; + default: + break; + }; +} + +void InputLinux::cecConfigurationChanged(void* /* param */, const libcec_configuration*) +{ + Log::getInstance()->log("InputLinux", Log::DEBUG, "CECConfig:"/*,config->string()*/); +} + +#else + +int InputLinux::cecLogMessage(void *param, const cec_log_message message) +{ + Log::getInstance()->log("InputLinux", Log::DEBUG, "CECLOG: %lld %d %s", message.time, message.level, message.message); + return 0; +} + +int InputLinux::cecKeyPress(void*param, const cec_keypress key) +{ + //Log::getInstance()->log("InputLinux", Log::DEBUG, "Incoming cec key %d %d", key.keycode,key.duration); + if (key.duration == 0) ((InputLinux*)Input::getInstance())->incomingCECkey(key.keycode); + return 1; +} + +int InputLinux::cecCommand(void *param, const cec_command command) +{ + Log::getInstance()->log("InputLinux", Log::DEBUG, "CECCommand: %d",command.opcode); + switch (command.opcode) { + case CEC_OPCODE_STANDBY: { + if (command.initiator==CECDEVICE_TV) { + ((InputLinux*)Input::getInstance())->incomingPowerkey(POWEROFF); + } + } break; + case CEC_OPCODE_DECK_CONTROL: { + if (command.initiator==CECDEVICE_TV && command.parameters.size == 1 + && command.parameters[0]==CEC_DECK_CONTROL_MODE_STOP) { + ((InputLinux*)Input::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_STOP); + + } + + } break; + case CEC_OPCODE_PLAY: { + if (command.initiator==CECDEVICE_TV && command.parameters.size == 1) { + if (command.parameters[0]==CEC_PLAY_MODE_PLAY_FORWARD) { + ((InputLinux*)Input::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PLAY); + } else if (command.parameters[0]==CEC_PLAY_MODE_PLAY_STILL) { + ((InputLinux*)Input::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PAUSE); + } + } + + + } break; + default: + break; + }; + return 1; +} + +int InputLinux::cecConfigurationChanged(void *param, const libcec_configuration config) +{ + Log::getInstance()->log("InputLinux", Log::DEBUG, "CECConfig:"/*,config.string()*/); + return 1; + +} + +#endif + +void InputLinux::cecSourceActivated(void* /* param */, const cec_logical_address address, const uint8_t activated) +{ + Log::getInstance()->log("InputLinux", Log::DEBUG, "CECSourceActivated: %d %d", address, activated); + if (activated == 1) + { + static_cast(Input::getInstance())->incomingPowerkey(POWERON); + } +} + +void InputLinux::incomingCECkey(int keys) +{ + // Send INPUT message + Message* m = new Message(); + m->message = Message::INPUT_EVENT; + m->to = Command::getInstance(); + m->from = this; + m->parameter = static_cast(TranslateHWC(W_G_HCW(W_HCW_CEC, keys))); + MessageQueue::getInstance()->postMessage(m); +} + +void InputLinux::incomingPowerkey(UCHAR key) +{ + // Send INPUT message + Message* m = new Message(); + m->message = Message::INPUT_EVENT; + m->to = Command::getInstance(); + m->from = this; + m->parameter = key; + MessageQueue::getInstance()->postMessage(m); +} + +bool InputLinux::loadOptionsfromServer(VDR* vdr) +{ + // Set remote keys + char* name; + name = vdr->configLoad("InputLinux", "HandleVolume"); + + if (name != NULL) + { + if (STRCASECMP(name, "Vomp") == 0) cechandlesvolume = false; + else if (STRCASECMP(name, "Cec") == 0) cechandlesvolume = true; + delete[] name; + } + return Input::loadOptionsfromServer(vdr); +} + +bool InputLinux::saveOptionstoServer() +{ + if (cechandlesvolume) VDR::getInstance()->configSave("InputLinux", "HandleVolume","Cec"); + else VDR::getInstance()->configSave("InputLinux", "HandleVolume","Vomp"); + + return Input::saveOptionstoServer(); +} + +bool InputLinux::addOptionsToPanes(int panenumber,Options *options,WOptionPane* pane) +{ + if (!Input::addOptionsToPanes(panenumber, options, pane)) return false; + + Option* option; + if (panenumber == 2) + { + static const char* volumeopts[]={"Vomp","Cec"}; + option = new Option(100,tr("Volume handled by"), "InputLinux","HandleVolume",Option::TYPE_TEXT,/*4,2*/2,0,0,volumeopts,NULL,false,this); + options->push_back(option); + pane->addOptionLine(option); + } + + return true; +} + +bool InputLinux::handleOptionChanges(Option* option) +{ + if (Input::handleOptionChanges(option)) + return true; + switch (option->id) { + case 100: { + if (STRCASECMP(option->options[option->userSetChoice], "Vomp") == 0) { + cechandlesvolume=false; + } else if (STRCASECMP(option->options[option->userSetChoice], "Cec") + == 0) { + cechandlesvolume=true; + } + Log::getInstance()->log("InputLinux", Log::DEBUG, "Set volume handling to to %s %d",option->options[option->userSetChoice],cechandlesvolume); + return true; + } + break; + }; + return false; + +} + +void InputLinux::volumeUp() +{ + cec_adap->VolumeUp(); +} + +void InputLinux::volumeDown() +{ + cec_adap->VolumeDown(); +} + +void InputLinux::volumeMute() +{ +#if CEC_LIB_VERSION_MAJOR >= 4 + cec_adap->AudioToggleMute(); +#else + cec_adap->MuteAudio(); +#endif +} + +void InputLinux::informStopEventLoop() +{ + listenLoopStop = true; + write(pfds[1], "1", 1); // break the select in getButtonPress +} + +void InputLinux::eventLoop() +{ + fd_set readfds; + int maxfd; + + if (pipe2(pfds, O_NONBLOCK) == -1) + { + Log::getInstance()->log("InputLinux", Log::ERR, "pipe2() fail"); + return; + } + + Log::getInstance()->log("InputLinux", Log::INFO, "Listen loop"); + + while(1) + { + if (listenLoopStop) break; + + FD_ZERO(&readfds); + + maxfd = 0; + for (unsigned int i = 0; i < devices.size(); i++) + { + int cur_fd = devices[i]; + maxfd = max(cur_fd, maxfd); + FD_SET(cur_fd, &readfds); + } + + FD_SET(pfds[0], &readfds); + maxfd = max(pfds[0], maxfd); + + // 0 = nothing happened and timeout expired + // >0 = num of descriptors that changed + // -1 = error + if (select(maxfd + 1, &readfds, NULL, NULL, NULL) < 1) + { + Log::getInstance()->log("InputLinux", Log::ERR, "Select fail"); + break; + } + + if (FD_ISSET(pfds[0], &readfds)) + { + // assume quit signal + Log::getInstance()->log("InputLinux", Log::NOTICE, "pfds quit"); + break; + + // FUTURE: read the byte and do different things? Read listenLoopStop and maybe other bools? + } + + for (unsigned int i = 0; i < devices.size(); i++) + { + int cur_fd = devices[i]; + if (FD_ISSET(cur_fd, &readfds)) + { + struct input_event ev; + int count = read(cur_fd, &ev, sizeof(ev)); + if (count == sizeof(ev)) + { + if (ev.type == EV_KEY && ev.value == 1) + { + // Send INPUT message + Message* m = new Message(); + m->message = Message::INPUT_EVENT; + m->to = Command::getInstance(); + m->from = this; + m->parameter = static_cast(TranslateHWC(W_G_HCW(W_HCW_KC,ev.code))); + MessageQueue::getInstance()->postMessage(m); + } + } + } + } + } + + close(pfds[1]); + close(pfds[0]); +} + +// FIXME surely NA_SIGNAL can go diff --git a/inputlinux.h b/inputlinux.h new file mode 100644 index 0000000..bfd293f --- /dev/null +++ b/inputlinux.h @@ -0,0 +1,101 @@ +/* + Copyright 2004-2020 Chris Tallon; 2012 Marten Richter + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP. If not, see . +*/ + +#ifndef INPUTLINUX_H +#define INPUTLINUX_H + +#include +#include +#include + +#include "defines.h" +#include "log.h" +#include "input.h" + +class InputLinux : public Input +{ + public: + InputLinux(); + virtual ~InputLinux(); + + int init(const char *devName); + int shutdown(); + int getDevice(); + UCHAR getButtonPress(int) { return NA_UNKNOWN; } // DEPRECATED + // void Signal(); + +// void SendPower(); + void InitHWCListwithDefaults(); + const char*HardcodedTranslateStr(UCHAR command); + char* HCWDesc(ULLONG hcw); + + void changePowerState(bool poweron); + + bool loadOptionsfromServer(VDR* vdr); + bool saveOptionstoServer(); + bool addOptionsToPanes(int panenumber,Options *options,WOptionPane* pane); + bool handleOptionChanges(Option* option); + + bool mayHaveFewButtons() {return true;}; + + virtual bool handlesVolume() { return cechandlesvolume; }; + virtual void volumeUp(); + virtual void volumeDown(); + virtual void volumeMute(); + + int initCec(); + void deinitCec(); + + private: + int initted{}; + bool signal{}; + bool cechandlesvolume{}; + + UCHAR TranslateHWCFixed(ULLONG code); + void InitKeymap(); + std::vector devices; + int num_loop{}; + + CEC::ICECAdapter* cec_adap{}; + CEC::libcec_configuration cec_config; + CEC::ICECCallbacks cec_callbacks; + + void incomingCECkey(int keys); + void incomingPowerkey(UCHAR key); + +#if CEC_LIB_VERSION_MAJOR >= 4 + static void cecLogMessage(void *param, const CEC::cec_log_message* message); + static void cecKeyPress(void*param, const CEC::cec_keypress* key); + static void cecCommand(void *param, const CEC::cec_command* command); + static void cecConfigurationChanged(void *param, const CEC::libcec_configuration* config); +#else + static int cecLogMessage(void *param, const CEC::cec_log_message message); + static int cecKeyPress(void*param, const CEC::cec_keypress key); + static int cecCommand(void *param, const CEC::cec_command command); + static int cecConfigurationChanged(void *param, const CEC::libcec_configuration config); +#endif + static void cecSourceActivated(void*param, const CEC::cec_logical_address address, const uint8_t activated); + + void eventLoop(); + void informStopEventLoop(); + + int pfds[2]; +}; + +#endif diff --git a/main.cc b/main.cc index f005054..70067d2 100644 --- a/main.cc +++ b/main.cc @@ -51,7 +51,7 @@ #ifdef VOMP_PLATFORM_RASPBERRY -#include "remotelinux.h" +#include "inputlinux.h" #include "ledraspberry.h" #include "osdopenvg.h" #include "audioomx.h" @@ -72,7 +72,7 @@ void shutdown(int code); // Global variables -------------------------------------------------------------------------------------------------- Log* logger; -Remote* remote; +Input* remote; Led* led; Osd* osd; Timers* timers; diff --git a/objects.mk b/objects.mk index 45e88d7..2f63097 100644 --- a/objects.mk +++ b/objects.mk @@ -12,7 +12,7 @@ OBJ_COMMON = command.o tcp.o dsock.o thread.o timers.o i18n.o vdp6.o vradiorec.o vaudioselector.o vscreensaver.o vopts.o \ wselectlist.o wjpeg.o wsymbol.o wbutton.o wtextbox.o \ woptionpane.o woptionbox.o wremoteconfig.o wtabbar.o led.o \ - remote.o osd.o surface.o vpicturebanner.o abstractoption.o \ + input.o osd.o surface.o vpicturebanner.o abstractoption.o \ eventdispatcher.o vdrrequestpacket.o vdrresponsepacket.o \ vvideolivetv.o vsleeptimer.o playerlivetv.o playerliveradio.o \ wprogressbar.o bitmap.o dvbsubtitles.o tfeed.o vteletextview.o \ @@ -22,7 +22,7 @@ OBJ_COMMON = command.o tcp.o dsock.o thread.o timers.o i18n.o vdp6.o OBJ_RASPBERRY = main.o threadp.o osdopenvg.o \ ledraspberry.o videoomx.o audioomx.o imageomx.o \ - wjpegsimple.o remotelinux.o signal.o + wjpegsimple.o inputlinux.o signal.o OBJ_WINDOWS = winmain.o threadwin.o remotewin.o ledwin.o videowin.o \ audiowin.o windowsosd.o dsallocator.o dssourcefilter.o dssourcepin.o \ diff --git a/player.cc b/player.cc index be9be81..a65f3df 100644 --- a/player.cc +++ b/player.cc @@ -26,7 +26,7 @@ #include "demuxerts.h" #include "vdr.h" #include "messagequeue.h" -#include "remote.h" +#include "input.h" #include "message.h" #include "dvbsubtitles.h" #include "osdreceiver.h" diff --git a/playerliveradio.cc b/playerliveradio.cc index 95e0f12..54b9c29 100644 --- a/playerliveradio.cc +++ b/playerliveradio.cc @@ -25,7 +25,7 @@ #include "demuxerts.h" #include "vdr.h" #include "messagequeue.h" -#include "remote.h" +#include "input.h" #include "message.h" #include "channel.h" #include "video.h" diff --git a/playerlivetv.cc b/playerlivetv.cc index ce1e5fc..d055dca 100644 --- a/playerlivetv.cc +++ b/playerlivetv.cc @@ -26,7 +26,7 @@ #include "demuxerts.h" #include "vdr.h" #include "messagequeue.h" -#include "remote.h" +#include "input.h" #include "message.h" #include "channel.h" #include "dvbsubtitles.h" diff --git a/playermedia.h b/playermedia.h index 0aac75c..d97e17b 100644 --- a/playermedia.h +++ b/playermedia.h @@ -29,7 +29,7 @@ #include #include "audio.h" -#include "remote.h" +#include "input.h" #include "vdr.h" #include "callback.h" #include "message.h" diff --git a/playerradio.cc b/playerradio.cc index b5f8417..cc184d2 100644 --- a/playerradio.cc +++ b/playerradio.cc @@ -24,7 +24,7 @@ #include "video.h" #include "demuxervdr.h" #include "demuxerts.h" -#include "remote.h" +#include "input.h" #include "vdr.h" #include "message.h" #include "messagequeue.h" diff --git a/remote.cc b/remote.cc deleted file mode 100644 index 1d0041e..0000000 --- a/remote.cc +++ /dev/null @@ -1,570 +0,0 @@ -/* - Copyright 2004-2005 Chris Tallon - - This file is part of VOMP. - - VOMP is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - VOMP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "remote.h" -#include "wremoteconfig.h" -#include "i18n.h" -#include "log.h" -#include "vdr.h" -#include "wtabbar.h" - -Remote* Remote::instance = NULL; - -#ifndef _MSC_VER - -const ULONG Remote::NOLEARNMODE; -// Not buttons -const UCHAR Remote::NA_LEARN; -const UCHAR Remote::NA_NONE; -const UCHAR Remote::NA_UNKNOWN; -const UCHAR Remote::NA_SIGNAL; -const UCHAR Remote::DF_UP; -const UCHAR Remote::DF_DOWN; -const UCHAR Remote::DF_LEFT; -const UCHAR Remote::DF_RIGHT; - -// Problem common buttons -const UCHAR Remote::VOLUMEUP; -const UCHAR Remote::VOLUMEDOWN; -const UCHAR Remote::CHANNELUP; -const UCHAR Remote::CHANNELDOWN; - -// Common buttons -const UCHAR Remote::ZERO; -const UCHAR Remote::ONE; -const UCHAR Remote::TWO; -const UCHAR Remote::THREE; -const UCHAR Remote::FOUR; -const UCHAR Remote::FIVE; -const UCHAR Remote::SIX; -const UCHAR Remote::SEVEN; -const UCHAR Remote::EIGHT; -const UCHAR Remote::NINE; -const UCHAR Remote::POWER; -const UCHAR Remote::GO; -const UCHAR Remote::BACK; -const UCHAR Remote::MENU; -const UCHAR Remote::RED; -const UCHAR Remote::GREEN; -const UCHAR Remote::YELLOW; -const UCHAR Remote::BLUE; -const UCHAR Remote::MUTE; -const UCHAR Remote::RADIO; -const UCHAR Remote::REVERSE; -const UCHAR Remote::PLAY; -const UCHAR Remote::FORWARD; -const UCHAR Remote::RECORD; -const UCHAR Remote::STOP; -const UCHAR Remote::PAUSE; -const UCHAR Remote::SKIPBACK; -const UCHAR Remote::SKIPFORWARD; -const UCHAR Remote::OK; - -// Old remote only -const UCHAR Remote::FULL; - -// New remote only -const UCHAR Remote::TV; -const UCHAR Remote::VIDEOS; -const UCHAR Remote::MUSIC; -const UCHAR Remote::PICTURES; -const UCHAR Remote::GUIDE; -const UCHAR Remote::UP; -const UCHAR Remote::DOWN; -const UCHAR Remote::LEFT; -const UCHAR Remote::RIGHT; -const UCHAR Remote::PREVCHANNEL; -const UCHAR Remote::STAR; -const UCHAR Remote::HASH; - -// Android only -const UCHAR Remote::PLAYPAUSE; - - -// Remote types -const UCHAR Remote::OLDREMOTE; -const UCHAR Remote::NEWREMOTE; - -#endif - -Remote::Remote() -{ - if (instance) return; - instance = this; - remoteType = OLDREMOTE; - learnmode = NOLEARNMODE; -} - -Remote::~Remote() -{ - instance = NULL; -} - -Remote* Remote::getInstance() -{ - return instance; -} - -void Remote::setRemoteType(UCHAR newType) -{ - if ((newType != OLDREMOTE) && (newType != NEWREMOTE)) return; - remoteType = newType; -} - -void Remote::EnterLearningMode(UCHAR command) -{ - learnmode = command; //Armed -} - -void Remote::ResetToDefault() -{ - translist.clear(); - InitHWCListwithDefaults(); -} - - -UCHAR Remote::TranslateHWCFixed(ULLONG code) -{ - switch (code) - { - case DOWN: - return DOWN; - case UP: - return UP; - case LEFT: - return LEFT; - case RIGHT: - return RIGHT; - case DF_DOWN: - return DOWN; - case DF_UP: - return UP; - case DF_LEFT: - return LEFT; - case DF_RIGHT: - return RIGHT; - case MENU: - return MENU; - case BACK: - return BACK; - case OK: - return OK; - default: - return NA_UNKNOWN; - } -} - -const char*Remote::HardcodedTranslateStr(UCHAR command) -{ - switch (command) - { - case DOWN: - return tr("Down"); - case UP: - return tr("Up"); - case LEFT: - return tr("Left"); - case RIGHT: - return tr("Right"); - case MENU: - return tr("Menu"); - case BACK: - return tr("Back"); - case OK: - return tr("Ok"); - default: - return NULL; - } -} - -UCHAR Remote::TranslateHWCList(ULLONG code) -{ - if (learnmode != NOLEARNMODE) - { - setHWCtoCommand(code, learnmode); - learnmode = NOLEARNMODE; - return NA_LEARN; - } - RemoteTranslationList::iterator it = translist.find(code); - if (it == translist.end()) - { - return NA_UNKNOWN; - } - else - { - return it->second; - } -} - -UCHAR Remote::TranslateHWC(ULLONG code) -{ - UCHAR ret = TranslateHWCFixed(code); - if (ret == NA_UNKNOWN) - { - ret = TranslateHWCList(code); - } - else - { - learnmode = NOLEARNMODE; - } - - if (ret == NA_UNKNOWN) - { - return NA_UNKNOWN; - } - return ret; -} - -void Remote::setHWCtoCommand(ULLONG hcw, UCHAR command) -{ - translist[hcw] = command; -} - -void Remote::unsetHWC(ULLONG hcw) -{ - translist.erase(hcw); -} - -void Remote::LoadKeysConfig(VDR *vdr,const char *cfg) -{ - ULONG number=0; - if (sscanf(cfg,"%ld",&number) != 1) return; - Log::getInstance()->log("Remote", Log::INFO, "Config General/Remote keys num keys %d",number); - char keybuf[1024]; - for (ULONG i = 0; i < number; i++) { - sprintf(keybuf, "RemoteKey%lu", i); - const char *keytrans = vdr->configLoad("General", keybuf); - if (keytrans) { - ULONG ul1, ul2; - ULONG uc; - if (sscanf(keytrans, "%lXI%lXK%lX", &ul1, &ul2, &uc) == 3) { - translist[((ULLONG) ul1) | ((ULLONG) ul2) << 32] = (UCHAR) uc; - } - delete[] keytrans; - } - - } -} - -void Remote::SaveKeysConfig() -{ - int number=0; - char buffer[1024]; - char keybuf[1024]; - RemoteTranslationList::const_iterator it; - for (it = translist.begin(); it != translist.end(); it++) - { - sprintf(buffer,"%08lXI%08lXK%02X", - (ULONG)it->first ,(ULONG) (it->first >> 32), it->second); - sprintf(keybuf,"RemoteKey%d",number); - VDR::getInstance()->configSave("General",keybuf,buffer); - number++; - } - sprintf(buffer,"%d",number); - VDR::getInstance()->configSave("General","RemoteKeyNum",buffer); -} - - -void Remote::InitHWCListwithDefaults() -{ - translist[VOLUMEUP] = VOLUMEUP; - translist[VOLUMEDOWN] = VOLUMEDOWN; - translist[CHANNELUP] = CHANNELUP; - translist[CHANNELDOWN] = CHANNELDOWN; - - // Common buttons - translist[ZERO] = ZERO; - translist[ONE] = ONE; - translist[TWO] = TWO; - translist[THREE] = THREE; - translist[FOUR] = FOUR; - translist[FIVE] = FIVE; - translist[SIX] = SIX; - translist[SEVEN] = SEVEN; - translist[EIGHT] = EIGHT; - translist[NINE] = NINE; - translist[POWER] = POWER; - translist[GO] = GO; - translist[RED] = RED; - translist[GREEN] = GREEN; - translist[YELLOW] = YELLOW; - translist[BLUE] = BLUE; - - translist[MUTE] = MUTE; - translist[RADIO] = RADIO; - translist[REVERSE] = REVERSE; - translist[FORWARD] = FORWARD; - translist[RECORD] = RECORD; - translist[STOP] = STOP; - translist[PAUSE] = PAUSE; - translist[PLAY] = PLAY; - translist[SKIPBACK] = SKIPBACK; - translist[SKIPFORWARD] = SKIPFORWARD; - - // Old remote only - translist[FULL] = FULL; - - // New remote only - translist[TV] = TV; - translist[VIDEOS] = VIDEOS; - translist[MUSIC] = MUSIC; - translist[PICTURES] = PICTURES; - translist[GUIDE] = GUIDE; - translist[PREVCHANNEL] = PREVCHANNEL; - translist[STAR] = STAR; - translist[HASH] = HASH; -} - -const char *Remote::CommandDesc(UCHAR number) -{ - switch (number) - { - case VOLUMEUP: - return tr("Volume Up"); - - case VOLUMEDOWN: - return tr("Volume Down"); - case CHANNELUP: - return tr("Channel up"); - case CHANNELDOWN: - return tr("Channel down"); - case ZERO: - return "0"; - case ONE: - return "1"; - case TWO: - return "2"; - case THREE: - return "3"; - case FOUR: - return "4"; - case FIVE: - return "5"; - case SIX: - return "6"; - case SEVEN: - return "7"; - case EIGHT: - return "8"; - case NINE: - return "9"; - case POWER: - return tr("Power"); - case GO: - return tr("Go"); - case BACK: - return tr("Back"); - case MENU: - return tr("Menu"); - case RED: - return tr("Red"); - case GREEN: - return tr("Green"); - case YELLOW: - return tr("Yellow"); - case BLUE: - return tr("Blue"); - case MUTE: - return tr("Mute"); - case RADIO: - return tr("Radio"); - case REVERSE: - return tr("Reverse"); - case PLAY: - return tr("Play"); - case FORWARD: - return tr("Forward"); - case RECORD: - return tr("Record"); - case STOP: - return tr("Stop"); - case PAUSE: - return tr("Pause"); - case SKIPBACK: - return tr("Skip back"); - case SKIPFORWARD: - return tr("Skip forward"); - case OK: - return tr("Ok"); - case FULL: - return tr("Fullscreen"); - case TV: - return tr("TV"); - case VIDEOS: - return tr("Videos"); - case MUSIC: - return tr("Music"); - case PICTURES: - return tr("Pictures"); - case GUIDE: - return tr("Guide"); - case UP: - return tr("Up"); - case DOWN: - return tr("Down"); - case LEFT: - return tr("Left"); - case RIGHT: - return tr("Right"); - case PREVCHANNEL: - return tr("Previous Channel"); - case STAR: - return tr("Star"); - case HASH: - return tr("Hash"); - case PLAYPAUSE: - return tr("Play/Pause"); - - default: - return NULL; - } -} - -char* Remote::HCWDesc(ULLONG hcw) -{ - char *dest,*temp; - temp=(char*)CommandDesc((UCHAR)hcw); - if (temp != NULL) - { - dest=new char[strlen(temp)+1]; - strcpy(dest,temp); - } - else - { - dest=new char[20]; - sprintf(dest,"C:%lX",(ULONG)hcw); - } - return dest; -} - -char *Remote::CommandTranslateStr(UCHAR command) -{ - char *desc; - int length=5;//:+\t+0 - int keys=0; //max 10; - char *commanddesc=(char*)CommandDesc(command); - if (commanddesc != NULL) - { - length+=strlen(commanddesc); - } - char *preassigneddesc=(char*)HardcodedTranslateStr(command); - if (preassigneddesc != NULL) - { - length+=strlen(preassigneddesc); - } - - char *keydesc[10]; - RemoteTranslationList::const_iterator it; - for (it = translist.begin(); it != translist.end(); it++) - { - if (it->second == command) - { - keydesc[keys] = HCWDesc(it->first); - length += strlen(keydesc[keys])+2; - keys ++; - if (keys == 10) break; - } - } - - desc=new char [length]; - char *current=desc; - if (commanddesc != NULL) - { - current+=sprintf(current,"%s:\t ",commanddesc); - } - else - { - current+=sprintf(current,":\t "); - } - if (preassigneddesc != NULL) - { - current+=sprintf(current,"%s\t",preassigneddesc); - } - else - { - current+=sprintf(current,"\t"); - } - for (int i = 0;i < keys; i++) - { - current += sprintf(current,"%s, ",keydesc[i]); - delete [] keydesc[i]; - } - return desc; -} - -bool Remote::addOptionPagesToWTB(WTabBar *wtb) -{ - WRemoteConfig* wrc = new WRemoteConfig(); - wtb->addTab(tr("Remote Control"), wrc); - return true; -} - -bool Remote::loadOptionsfromServer(VDR* vdr) -{ - // Set remote keys - char * config; - config = vdr->configLoad("General", "RemoteKeyNum"); - - if (config) - { - Log::getInstance()->log("Remote", Log::INFO, "Config General/Remote keys load"); - LoadKeysConfig(vdr,config); - delete[] config; - } - else - { - Log::getInstance()->log("Remote", Log::INFO, "Config General/Remote keys not found"); - InitHWCListwithDefaults(); - } - return true; -} - -bool Remote::saveOptionstoServer() -{ - SaveKeysConfig(); - return true; -} - - - - -bool Remote::start() -{ - Log::getInstance()->log("Remote", Log::INFO, "start called"); - - threadStartProtect.lock(); - listenThread = std::thread( [this ] - { - threadStartProtect.lock(); - threadStartProtect.unlock(); - // FIXME block signals - - eventLoop(); - }); - threadStartProtect.unlock(); - return true; -} - -void Remote::stop() -{ - listenLoopStop = true; - informStopEventLoop(); - listenThread.join(); -} diff --git a/remote.h b/remote.h deleted file mode 100644 index 2308ba6..0000000 --- a/remote.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - Copyright 2004-2005 Chris Tallon - - This file is part of VOMP. - - VOMP is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - VOMP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with VOMP. If not, see . -*/ - -#ifndef REMOTE_H -#define REMOTE_H - -#include -#include -#include -#include - -#include "defines.h" -#include "abstractoption.h" - - -typedef std::map RemoteTranslationList; - -class Remote: public AbstractOption -{ - public: - Remote(); - virtual ~Remote(); - static Remote* getInstance(); - - bool start(); - void stop(); - - bool addOptionPagesToWTB(WTabBar *wtb); - bool loadOptionsfromServer(VDR* vdr); - bool saveOptionstoServer(); - - void setRemoteType(UCHAR type); - void setHWCtoCommand(ULLONG hcw,UCHAR command); - void unsetHWC(ULLONG hcw); - void LoadKeysConfig(VDR *vdr,const char*keynum); - void SaveKeysConfig(); - void EnterLearningMode(UCHAR command); - - virtual int init(const char *devName)=0; - virtual int shutdown()=0; - virtual UCHAR getButtonPress(int how)=0; // DEPRECATED - - virtual bool mayHaveFewButtons() {return false;}; - - virtual bool handlesVolume() {return false;}; - virtual void volumeUp() {}; - virtual void volumeDown() {}; - virtual void volumeMute() {}; - - virtual void InitHWCListwithDefaults(); - virtual char* HCWDesc(ULLONG hcw); - const char *CommandDesc(UCHAR number); - char *CommandTranslateStr(UCHAR command); - virtual const char*HardcodedTranslateStr(UCHAR command); - void EnterLearnMode(UCHAR command); - void ResetToDefault(); - - virtual void changePowerState(bool /* poweron */) {}; //informs the remote control, that about vomp's power state, this is important e.g. for cec - - const static ULONG NOLEARNMODE = 256; - // Not buttons - const static UCHAR NA_LEARN = 101; - const static UCHAR NA_NONE = 98; - const static UCHAR NA_UNKNOWN = 99; - const static UCHAR NA_SIGNAL = 100; - const static UCHAR DF_UP = 94; - const static UCHAR DF_DOWN = 95; - const static UCHAR DF_LEFT = 96; - const static UCHAR DF_RIGHT = 97; - - // Problem common buttons - const static UCHAR VOLUMEUP = 16; - const static UCHAR VOLUMEDOWN = 17; - const static UCHAR CHANNELUP = 32; - const static UCHAR CHANNELDOWN = 33; - - // Common buttons - const static UCHAR ZERO = 0; - const static UCHAR ONE = 1; - const static UCHAR TWO = 2; - const static UCHAR THREE = 3; - const static UCHAR FOUR = 4; - const static UCHAR FIVE = 5; - const static UCHAR SIX = 6; - const static UCHAR SEVEN = 7; - const static UCHAR EIGHT = 8; - const static UCHAR NINE = 9; - const static UCHAR POWER = 61; - const static UCHAR GO = 59; - const static UCHAR BACK = 31; - const static UCHAR MENU = 13; - const static UCHAR RED = 11; - const static UCHAR GREEN = 46; - const static UCHAR YELLOW = 56; - const static UCHAR BLUE = 41; - const static UCHAR MUTE = 15; - const static UCHAR RADIO = 12; // The unlabelled button on old - const static UCHAR REVERSE = 50; - const static UCHAR PLAY = 53; - const static UCHAR FORWARD = 52; - const static UCHAR RECORD = 55; - const static UCHAR STOP = 54; - const static UCHAR PAUSE = 48; - const static UCHAR SKIPBACK = 36; - const static UCHAR SKIPFORWARD = 30; - const static UCHAR OK = 37; - - // Old remote only - const static UCHAR FULL = 60; - - // New remote only - const static UCHAR TV = 28; - const static UCHAR VIDEOS = 24; - const static UCHAR MUSIC = 25; - const static UCHAR PICTURES = 26; - const static UCHAR GUIDE = 27; - const static UCHAR UP = 20; - const static UCHAR DOWN = 21; - const static UCHAR LEFT = 22; - const static UCHAR RIGHT = 23; - const static UCHAR PREVCHANNEL = 18; - const static UCHAR STAR = 10; - const static UCHAR HASH = 14; - - // Android only - const static UCHAR PLAYPAUSE = 201; - // cec only - const static UCHAR POWERON = 202; - const static UCHAR POWEROFF = 203; - - - // Remote types - const static UCHAR OLDREMOTE = 1; - const static UCHAR NEWREMOTE = 2; - - protected: - virtual UCHAR TranslateHWCFixed(ULLONG code); - UCHAR TranslateHWCList(ULLONG code); - UCHAR TranslateHWC(ULLONG code); - - - ULONG learnmode; - static Remote* instance; - UCHAR remoteType; - RemoteTranslationList translist; - - - std::thread listenThread; - std::mutex threadStartProtect; - - virtual void eventLoop() {}; // FIXME change to abstract - virtual void informStopEventLoop() {}; // abstract - - bool listenLoopStop{}; -}; - -#endif - -// FIXME rename all remote stuff to some sort of INPUT -// Roll in UDP receiver - -// FIXME have Top remote system create new listeners for various devices? Hot plug? -// Where remotelinux has multi listeners, move that to top? diff --git a/remotelinux.cc b/remotelinux.cc deleted file mode 100644 index 6367355..0000000 --- a/remotelinux.cc +++ /dev/null @@ -1,1231 +0,0 @@ -/* - Copyright 2004-2020 Chris Tallon; 2012 Marten Richter - - This file is part of VOMP. - - VOMP is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - VOMP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with VOMP. If not, see . -*/ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -using namespace CEC; - -#include "i18n.h" -#include "vdr.h" -#include "woptionpane.h" -#include "message.h" -#include "messagequeue.h" -#include "command.h" // FIXME - get rid after predefined message targets - -#include "remotelinux.h" - -#define W_G_HCW(type,code) ((static_cast(type) << 32) | code) - -#define W_HCW_KC 1 /* key code as defined by kernel for keyboard and remotes through /dev/input */ -#define W_HCW_CEC 2 /* HDMI_CEC */ -#define W_HCW_LIRC 3 /* remote control LIRC*/ - - -RemoteLinux::RemoteLinux() -{ -} - -RemoteLinux::~RemoteLinux() -{ - for (unsigned int i = 0; i < devices.size(); i++) - { - close(devices[i]); - } -} - -#define test_bit(input,b) ((1 << ((b) % 8))&(input)[b / 8] ) - -int RemoteLinux::init(const char*) -{ - if (initted) return 0; - initted = 1; - - InitKeymap(); - - for (int eventid = 0; eventid < 100; eventid++) - { - char buffer[1024]; - sprintf(buffer,"/dev/input/event%d", eventid); - - struct stat test_buf; - if (stat(buffer, &test_buf) == 0) - { - Log::getInstance()->log("Remote", Log::NOTICE, "Probe /dev/input/event%d", eventid); - // file exists - unsigned long ev_type = 0; - int new_fd = open(buffer, O_RDONLY); - if (new_fd < 0) - { - Log::getInstance()->log("Remote", Log::NOTICE, "Can not open /dev/input/event%d", eventid); - continue; - } - - if (ioctl(new_fd, EVIOCGBIT(0, EV_MAX), &ev_type) < 0) - { - Log::getInstance()->log("Remote", Log::NOTICE, "Ioctl failed /dev/input/event%d %d", eventid, errno); - close(new_fd); - } - - //Now test if it generates keyboard presses - if (test_bit(reinterpret_cast(&ev_type), EV_KEY)) - { - Log::getInstance()->log("Remote", Log::NOTICE, "Add /dev/input/event%d to List", eventid); - devices.push_back(new_fd); - - // Grab the device - make it exclusive to vomp. Fixes rubbish input going to console in background - ioctl(new_fd, EVIOCGRAB, 1); - } - else - { - close(new_fd); - } - } - } - return initCec(); -} - -int RemoteLinux::initCec() { - - // bcm_host_init(); //may be move to custom hardware init? -// now init cec - Log::getInstance()->log("Remote", Log::NOTICE, "Init LibCEC"); - cec_config.Clear(); - cec_callbacks.Clear(); -#if CEC_LIB_VERSION_MAJOR >= 4 - cec_callbacks.logMessage = cecLogMessage; - cec_callbacks.keyPress = cecKeyPress; - cec_callbacks.commandReceived = cecCommand; - cec_callbacks.configurationChanged = cecConfigurationChanged; - cec_callbacks.sourceActivated = cecSourceActivated; -#else - cec_callbacks.CBCecLogMessage = cecLogMessage; - cec_callbacks.CBCecKeyPress = cecKeyPress; - cec_callbacks.CBCecCommand = cecCommand; - cec_callbacks.CBCecConfigurationChanged = cecConfigurationChanged; - cec_callbacks.CBCecSourceActivated = cecSourceActivated; - cec_config.bUseTVMenuLanguage=1; -#endif - cec_config.clientVersion=LIBCEC_VERSION_CURRENT; - cec_config.bActivateSource=1; - //cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); - cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); - //cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_TUNER); - - strncpy(cec_config.strDeviceName,"vomp",sizeof(cec_config.strDeviceName)); - - - cec_config.callbackParam = NULL; // I do not care - cec_config.callbacks = &cec_callbacks; - - cec_adap = LibCecInitialise(&cec_config); - if (!cec_adap) { - Log::getInstance()->log("Remote", Log::ERR, "Init LibCEC failed"); - return 1; - } - cec_adap->InitVideoStandalone(); - - -#if CEC_LIB_VERSION_MAJOR >= 4 - cec_adapter_descriptor cec_adapter_descriptors[10]; - int adap_num=cec_adap->DetectAdapters(cec_adapter_descriptors, 10); -#else - cec_adapter cec_devices[10]; - int adap_num=cec_adap->FindAdapters(cec_devices,10,NULL); -#endif - if (adap_num<0) { - Log::getInstance()->log("Remote", Log::ERR, "CEC:Failed to find adapter"); - return 1; - - } - if (adap_num==0) { - Log::getInstance()->log("Remote", Log::NOTICE, "CEC: No adapter found"); - return 1; - - } -#if CEC_LIB_VERSION_MAJOR >= 4 - if (!cec_adap->Open(cec_adapter_descriptors[0].strComName)) { -#else - if (!cec_adap->Open(cec_devices[0].comm)) { -#endif - Log::getInstance()->log("Remote", Log::ERR, "CEC:Failed to open adapter"); - return 1; - } - - if (!cec_adap->SetActiveSource(cec_config.deviceTypes[0])) { - Log::getInstance()->log("Remote", Log::ERR, "CEC:Failed set active source"); - return 1; - } - - - - - return 1; -} - -int RemoteLinux::shutdown() -{ - if (!initted) return 0; - - deinitCec(); - while (devices.size()) - { - int cur_fd = devices.back(); - devices.pop_back(); - ioctl(cur_fd, EVIOCGRAB, 0); - close(cur_fd); - } - - initted = 0; - return 1; -} - -void RemoteLinux::deinitCec() -{ - if (cec_adap) { - Log::getInstance()->log("Remote", Log::NOTICE, "Shutdown libcec begin"); - cec_adap->SetInactiveView(); - cec_adap->Close(); - vc_cec_register_callback(NULL, NULL);//deactivate callback! - UnloadLibCec(cec_adap); - cec_adap = NULL; - Log::getInstance()->log("Remote", Log::NOTICE, "Shutdown libcec end"); - } - -} -/* -UCHAR RemoteLinux::getButtonPress(int waitType) { - / * how = 0 - block - how = 1 - start new wait - how = 2 - continue wait - how = 3 - no wait - * / - - //in units of 40 ms - Log::getInstance()->log("Remote", Log::NOTICE, "get button press"); - - int retval; - fd_set readfds; - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = 40000; - if (waitType == 0) { - num_loop = -1; - } else if (waitType == 1) { - - num_loop = 25; - } else if (waitType == 2) { - if (num_loop<=0) num_loop = 25; - } else if (waitType == 3) { - tv.tv_sec = 0; - tv.tv_usec = 0; - num_loop = 0; - } - - - int ret = 0; - while (num_loop!=0) { - ret = NA_UNKNOWN; - FD_ZERO(&readfds); - - int maxfd = 0; - for (unsigned int i = 0; i < devices.size(); i++) { - int cur_fd = devices[i]; - maxfd = max(cur_fd, maxfd); - FD_SET(cur_fd, &readfds); - } - - FD_SET(pfds[0], &readfds); - maxfd = max(pfds[0], maxfd); - - retval = select(maxfd + 1, &readfds, NULL, NULL, &tv); - tv.tv_sec = 0; - tv.tv_usec = 40000; - // 0 = nothing happened - // 1 = data arrived (actually num of descriptors that changed) - // other value = signal or error - if (retval == 0) { - if (hascurcec) { - hascurcec = false; - return (UCHAR) TranslateHWC(W_G_HCW(W_HCW_CEC,curcec)); - } - if (haspower) { - haspower =false; - return powerkey; - } - ret = NA_NONE; - } else { - if (retval == -1) { - Log::getInstance()->log("Remote", Log::NOTICE, "na_signal"); - return NA_SIGNAL; - } - - if (FD_ISSET(pfds[0], &readfds)) - { - // quit signal - Log::getInstance()->log("Remote", Log::NOTICE, "pfds quit"); - return NA_SIGNAL; // use NA_SIGNAL for now - } - - for (unsigned int i = 0; i < devices.size(); i++) { - int cur_fd = devices[i]; - if (FD_ISSET(cur_fd, &readfds)) { - struct input_event ev; - int count = read(cur_fd, &ev, sizeof(ev)); - if (count == sizeof(ev)) { - if (ev.type == EV_KEY && ev.value == 1) { - UCHAR retty=(UCHAR) TranslateHWC( - W_G_HCW(W_HCW_KC,ev.code)); - return retty; - } - } - - } - - } - - } - //Log::getInstance()->log("Remote", Log::NOTICE, "numloop: %d %d",num_loop,retval); - if (num_loop > 0) - num_loop--; - } - if (ret != 0) - return ret; - - return NA_UNKNOWN; - -} -*/ - -UCHAR RemoteLinux::TranslateHWCFixed(ULLONG code) -{ - switch (code) - { - case W_G_HCW(W_HCW_KC, KEY_DOWN): - return DOWN; - case W_G_HCW(W_HCW_KC, KEY_UP): - return UP; - case W_G_HCW(W_HCW_KC, KEY_LEFT): - return LEFT; - case W_G_HCW(W_HCW_KC, KEY_RIGHT): - return RIGHT; - case W_G_HCW(W_HCW_KC, KEY_M): - case W_G_HCW(W_HCW_KC, KEY_MEDIA): - return MENU; - case W_G_HCW(W_HCW_KC, KEY_BACKSPACE): - case W_G_HCW(W_HCW_KC, KEY_EXIT): - return BACK; - case W_G_HCW(W_HCW_KC, KEY_ENTER): - case W_G_HCW(W_HCW_KC, KEY_SPACE): - case W_G_HCW(W_HCW_KC, KEY_OK): - return OK; - - //CEC - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_DOWN): - return DOWN; - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_UP): - return UP; - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_LEFT): - return LEFT; - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_RIGHT): - return RIGHT; - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_ROOT_MENU): - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_CONTENTS_MENU): - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_SETUP_MENU): - return MENU; - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_EXIT ): - return BACK; - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_ENTER): - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_SELECT): - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_AN_RETURN): - return OK; - case W_G_HCW(W_HCW_KC, KEY_SLEEP): - case W_G_HCW(W_HCW_KC, KEY_POWER): - case W_G_HCW(W_HCW_KC, KEY_ESC): - case W_G_HCW(W_HCW_CEC, CEC_USER_CONTROL_CODE_POWER): - case POWER: - return POWER; - default: - return NA_UNKNOWN; - }; -} - -const char*RemoteLinux::HardcodedTranslateStr(UCHAR command) -{ - switch (command) - { - case DOWN: - return tr("Down"); - case UP: - return tr("Up"); - case LEFT: - return tr("Left"); - case RIGHT: - return tr("Right"); - case MENU: - return tr("M"); - case BACK: - return tr("Backspace, Back"); - case OK: - return tr("Return, Space"); - default: - return NULL; - } -} - - -void RemoteLinux::InitHWCListwithDefaults() -{ - // Processing VK_Messages - translist[W_G_HCW(W_HCW_KC,KEY_9)] = NINE; - translist[W_G_HCW(W_HCW_KC,KEY_8)] = EIGHT; - translist[W_G_HCW(W_HCW_KC,KEY_7)] = SEVEN; - translist[W_G_HCW(W_HCW_KC,KEY_6)] = SIX; - translist[W_G_HCW(W_HCW_KC,KEY_5)] = FIVE; - translist[W_G_HCW(W_HCW_KC,KEY_4)] = FOUR; - translist[W_G_HCW(W_HCW_KC,KEY_3)] = THREE; - translist[W_G_HCW(W_HCW_KC,KEY_2)] = TWO; - translist[W_G_HCW(W_HCW_KC,KEY_1)] = ONE; - translist[W_G_HCW(W_HCW_KC,KEY_0)] = ZERO; - translist[W_G_HCW(W_HCW_KC,KEY_KPDOT)] = STAR; - // translist[W_G_HCW(W_HCW_KC,KEY_#)] = HASH; - - translist[W_G_HCW(W_HCW_KC,KEY_KP9)] = NINE; - translist[W_G_HCW(W_HCW_KC,KEY_KP8)] = EIGHT; - translist[W_G_HCW(W_HCW_KC,KEY_KP7)] = SEVEN; - translist[W_G_HCW(W_HCW_KC,KEY_KP6)] = SIX; - translist[W_G_HCW(W_HCW_KC,KEY_KP5)] = FIVE; - translist[W_G_HCW(W_HCW_KC,KEY_KP4)] = FOUR; - translist[W_G_HCW(W_HCW_KC,KEY_KP3)] = THREE; - translist[W_G_HCW(W_HCW_KC,KEY_KP2)] = TWO; - translist[W_G_HCW(W_HCW_KC,KEY_KP1)] = ONE; - translist[W_G_HCW(W_HCW_KC,KEY_KP0)] = ZERO; - - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_9)] = NINE; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_8)] = EIGHT; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_7)] = SEVEN; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_6)] = SIX; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_5)] = FIVE; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_4)] = FOUR; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_3)] = THREE; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_2)] = TWO; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_1)] = ONE; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_0)] = ZERO; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_STAR)] = STAR; - translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_POUND)] = HASH; - - - translist[W_G_HCW(W_HCW_KC,KEY_J)] = GO; //j for JUMP TO instead of go to - translist[W_G_HCW(W_HCW_KC,KEY_R)] = RED; - translist[W_G_HCW(W_HCW_KC,KEY_G)] = GREEN; - translist[W_G_HCW(W_HCW_KC,KEY_Y)] = YELLOW; - translist[W_G_HCW(W_HCW_KC,KEY_B)] = BLUE; - //Processing Remote Style Messages - translist[W_G_HCW(W_HCW_KC,KEY_GREEN)] = GREEN; - translist[W_G_HCW(W_HCW_KC,KEY_RED)] = RED; - translist[W_G_HCW(W_HCW_KC,KEY_YELLOW)] = YELLOW; - translist[W_G_HCW(W_HCW_KC,KEY_BLUE)] = BLUE; - translist[W_G_HCW(W_HCW_KC,KEY_MENU)] = MENU; - - translist[W_G_HCW(W_HCW_KC,KEY_RECORD)] = RECORD; - translist[W_G_HCW(W_HCW_KC,KEY_PLAY)] = PLAY; //Playback Televison - translist[W_G_HCW(W_HCW_KC,KEY_PAUSE)] = PAUSE; - translist[W_G_HCW(W_HCW_KC,KEY_STOP)] = STOP; - translist[W_G_HCW(W_HCW_KC,KEY_PLAYPAUSE)] = PLAYPAUSE; - translist[W_G_HCW(W_HCW_KC,KEY_P)] = PLAYPAUSE; - translist[W_G_HCW(W_HCW_KC,KEY_NEXT)] = SKIPFORWARD; - translist[W_G_HCW(W_HCW_KC,KEY_F2)] = SKIPFORWARD; - translist[W_G_HCW(W_HCW_KC,KEY_PREVIOUS)] = SKIPBACK; - translist[W_G_HCW(W_HCW_KC,KEY_F1)] = SKIPBACK; - translist[W_G_HCW(W_HCW_KC,KEY_FORWARD)] = FORWARD; - translist[W_G_HCW(W_HCW_KC,KEY_FASTFORWARD)] = FORWARD; - translist[W_G_HCW(W_HCW_KC,KEY_F)] = FORWARD; - translist[W_G_HCW(W_HCW_KC,KEY_BACK)] = REVERSE; - translist[W_G_HCW(W_HCW_KC,KEY_REWIND)] = REVERSE; - translist[W_G_HCW(W_HCW_KC,KEY_T)] = REVERSE; - translist[W_G_HCW(W_HCW_KC,KEY_MUTE)] = MUTE; - translist[W_G_HCW(W_HCW_KC,KEY_F8)] = MUTE; - translist[W_G_HCW(W_HCW_KC,KEY_F10)] = VOLUMEUP; - translist[W_G_HCW(W_HCW_KC,KEY_F9)] = VOLUMEDOWN; - translist[W_G_HCW(W_HCW_KC,KEY_VOLUMEUP)] = VOLUMEUP; - translist[W_G_HCW(W_HCW_KC,KEY_VOLUMEDOWN)] = VOLUMEDOWN; - translist[W_G_HCW(W_HCW_KC,KEY_CHANNELUP)] = CHANNELUP; - translist[W_G_HCW(W_HCW_KC,KEY_CHANNELDOWN)] = CHANNELDOWN; - translist[W_G_HCW(W_HCW_KC,KEY_PAGEUP)] = CHANNELUP; - translist[W_G_HCW(W_HCW_KC,KEY_PAGEDOWN)] = CHANNELDOWN; - - - //Processing CEC_Messages - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER9)] = NINE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER8)] = EIGHT; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER7)] = SEVEN; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER6)] = SIX; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER5)] = FIVE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER4)] = FOUR; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER3)] = THREE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER2)] = TWO; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER1)] = ONE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER0)] = ZERO; - //translist[W_G_HCW(W_HCW_CEC,KEY_KPDOT)] = STAR; - - - - //translist[W_G_HCW(W_HCW_CEC,KEY_J)] = GO; //j for JUMP TO instead of go to - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F2_RED)] = RED; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F3_GREEN)] = GREEN; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F4_YELLOW)] = YELLOW; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F1_BLUE)] = BLUE; - //Processing Remote Style Messages - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FAVORITE_MENU)] = MENU; - - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_RECORD)] = RECORD; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PLAY)] = PLAY; //Playback Televison - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PAUSE)] = PAUSE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_STOP)] = STOP; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PAUSE_PLAY_FUNCTION)] = PLAYPAUSE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FORWARD)] = SKIPFORWARD; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_BACKWARD)] = SKIPBACK; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FAST_FORWARD )] = FORWARD; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_REWIND)] = REVERSE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_MUTE)] = MUTE; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_VOLUME_UP)] = VOLUMEUP; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_VOLUME_DOWN)] = VOLUMEDOWN; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_CHANNEL_UP )] = CHANNELUP; - translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_CHANNEL_DOWN)] = CHANNELDOWN; -} - -#define NAMETRICK(pre, code) linux_keymap[pre ## code]= #code -#define NAMETRICK2(pre, code) cec_keymap[pre ## code]= #code -//extracte from linux/input.h - -static const char * linux_keymap[KEY_MAX+1]; -static const char * cec_keymap[CEC_USER_CONTROL_CODE_MAX+1]; - -void RemoteLinux::InitKeymap() -{ - for (int i=0;i(hcw >> 32); - unsigned int vk = static_cast(hcw); - char* rt = NULL; - - switch(type) - { - case W_HCW_KC: - { - rt = new char[10]; - const char *desc=linux_keymap[vk]; - if (desc) - strncpy(rt, desc, 9); - else - sprintf(rt, "0x%x", vk); - break; - } - case W_HCW_CEC: - { - rt = new char[10]; - const char* desc = cec_keymap[vk]; - if (desc) - strncpy(rt, desc, 9); - else - sprintf(rt, "0x%x", vk); - break; - } - /* - case W_HCW_LIRC:{ - ULONG ri=(ULONG)hcw; - rt=new char[10]; - sprintf(rt,"R: %X",ri); - }break;*/ - } - - return rt; -} - -void RemoteLinux::changePowerState(bool poweron) -{ - if (cec_adap) - { - if (poweron) - { - //Log::getInstance()->log("Remote", Log::DEBUG, "CEC set active source"); - cec_adap->SetActiveSource(cec_config.deviceTypes[0]); - } - else - { - //Log::getInstance()->log("Remote", Log::DEBUG, "CEC set inactive view"); - cec_adap->SetInactiveView(); - } - } -} - -#if CEC_LIB_VERSION_MAJOR >= 4 - -// libcec4 API changed these params to pointers rather than copies, and the returns to void -// Otherwise, these two blocks of code are the same - -void RemoteLinux::cecLogMessage(void* /* param */, const cec_log_message* message) -{ - Log::getInstance()->log("Remote", Log::DEBUG, "CECLOG: %lld %d %s", message->time, message->level, message->message); -} - -void RemoteLinux::cecKeyPress(void* /* param */, const cec_keypress* key) -{ - //Log::getInstance()->log("Remote", Log::DEBUG, "Incoming cec key %d %d", key->keycode,key->duration); - if (key->duration == 0) static_cast(Remote::getInstance())->incomingCECkey(key->keycode); -} - -void RemoteLinux::cecCommand(void* /* param */, const cec_command* command) -{ - Log::getInstance()->log("Remote", Log::DEBUG, "CECCommand: %d",command->opcode); - switch (command->opcode) { - case CEC_OPCODE_STANDBY: { - if (command->initiator==CECDEVICE_TV) { - static_cast(Remote::getInstance())->incomingPowerkey(POWEROFF); - } - } break; - case CEC_OPCODE_DECK_CONTROL: { - if (command->initiator==CECDEVICE_TV && command->parameters.size == 1 - && command->parameters[0]==CEC_DECK_CONTROL_MODE_STOP) { - static_cast(Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_STOP); - - } - - } break; - case CEC_OPCODE_PLAY: { - if (command->initiator==CECDEVICE_TV && command->parameters.size == 1) { - if (command->parameters[0]==CEC_PLAY_MODE_PLAY_FORWARD) { - static_cast(Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PLAY); - } else if (command->parameters[0]==CEC_PLAY_MODE_PLAY_STILL) { - static_cast(Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PAUSE); - } - } - - - } break; - default: - break; - }; -} - -void RemoteLinux::cecConfigurationChanged(void* /* param */, const libcec_configuration*) -{ - Log::getInstance()->log("Remote", Log::DEBUG, "CECConfig:"/*,config->string()*/); -} - -#else - -int RemoteLinux::cecLogMessage(void *param, const cec_log_message message) -{ - Log::getInstance()->log("Remote", Log::DEBUG, "CECLOG: %lld %d %s", message.time, message.level, message.message); - return 0; -} - -int RemoteLinux::cecKeyPress(void*param, const cec_keypress key) -{ - //Log::getInstance()->log("Remote", Log::DEBUG, "Incoming cec key %d %d", key.keycode,key.duration); - if (key.duration == 0) ((RemoteLinux*)Remote::getInstance())->incomingCECkey(key.keycode); - return 1; -} - -int RemoteLinux::cecCommand(void *param, const cec_command command) -{ - Log::getInstance()->log("Remote", Log::DEBUG, "CECCommand: %d",command.opcode); - switch (command.opcode) { - case CEC_OPCODE_STANDBY: { - if (command.initiator==CECDEVICE_TV) { - ((RemoteLinux*)Remote::getInstance())->incomingPowerkey(POWEROFF); - } - } break; - case CEC_OPCODE_DECK_CONTROL: { - if (command.initiator==CECDEVICE_TV && command.parameters.size == 1 - && command.parameters[0]==CEC_DECK_CONTROL_MODE_STOP) { - ((RemoteLinux*)Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_STOP); - - } - - } break; - case CEC_OPCODE_PLAY: { - if (command.initiator==CECDEVICE_TV && command.parameters.size == 1) { - if (command.parameters[0]==CEC_PLAY_MODE_PLAY_FORWARD) { - ((RemoteLinux*)Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PLAY); - } else if (command.parameters[0]==CEC_PLAY_MODE_PLAY_STILL) { - ((RemoteLinux*)Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PAUSE); - } - } - - - } break; - default: - break; - }; - return 1; -} - -int RemoteLinux::cecConfigurationChanged(void *param, const libcec_configuration config) -{ - Log::getInstance()->log("Remote", Log::DEBUG, "CECConfig:"/*,config.string()*/); - return 1; - -} - -#endif - -void RemoteLinux::cecSourceActivated(void* /* param */, const cec_logical_address address, const uint8_t activated) -{ - Log::getInstance()->log("Remote", Log::DEBUG, "CECSourceActivated: %d %d", address, activated); - if (activated == 1) - { - static_cast(Remote::getInstance())->incomingPowerkey(POWERON); - } -} - -void RemoteLinux::incomingCECkey(int keys) -{ - // Send INPUT message - Message* m = new Message(); - m->message = Message::INPUT_EVENT; - m->to = Command::getInstance(); - m->from = this; - m->parameter = static_cast(TranslateHWC(W_G_HCW(W_HCW_CEC, keys))); - MessageQueue::getInstance()->postMessage(m); -} - -void RemoteLinux::incomingPowerkey(UCHAR key) -{ - // Send INPUT message - Message* m = new Message(); - m->message = Message::INPUT_EVENT; - m->to = Command::getInstance(); - m->from = this; - m->parameter = key; - MessageQueue::getInstance()->postMessage(m); -} - -bool RemoteLinux::loadOptionsfromServer(VDR* vdr) -{ - // Set remote keys - char* name; - name = vdr->configLoad("RemoteLinux", "HandleVolume"); - - if (name != NULL) - { - if (STRCASECMP(name, "Vomp") == 0) cechandlesvolume = false; - else if (STRCASECMP(name, "Cec") == 0) cechandlesvolume = true; - delete[] name; - } - return Remote::loadOptionsfromServer(vdr); -} - -bool RemoteLinux::saveOptionstoServer() -{ - if (cechandlesvolume) VDR::getInstance()->configSave("RemoteLinux", "HandleVolume","Cec"); - else VDR::getInstance()->configSave("RemoteLinux", "HandleVolume","Vomp"); - - return Remote::saveOptionstoServer(); -} - -bool RemoteLinux::addOptionsToPanes(int panenumber,Options *options,WOptionPane* pane) -{ - if (!Remote::addOptionsToPanes(panenumber, options, pane)) return false; - - Option* option; - if (panenumber == 2) - { - static const char* volumeopts[]={"Vomp","Cec"}; - option = new Option(100,tr("Volume handled by"), "RemoteLinux","HandleVolume",Option::TYPE_TEXT,/*4,2*/2,0,0,volumeopts,NULL,false,this); - options->push_back(option); - pane->addOptionLine(option); - } - - return true; -} - -bool RemoteLinux::handleOptionChanges(Option* option) -{ - if (Remote::handleOptionChanges(option)) - return true; - switch (option->id) { - case 100: { - if (STRCASECMP(option->options[option->userSetChoice], "Vomp") == 0) { - cechandlesvolume=false; - } else if (STRCASECMP(option->options[option->userSetChoice], "Cec") - == 0) { - cechandlesvolume=true; - } - Log::getInstance()->log("Remote", Log::DEBUG, "Set volume handling to to %s %d",option->options[option->userSetChoice],cechandlesvolume); - return true; - } - break; - }; - return false; - -} - -void RemoteLinux::volumeUp() -{ - cec_adap->VolumeUp(); -} - -void RemoteLinux::volumeDown() -{ - cec_adap->VolumeDown(); -} - -void RemoteLinux::volumeMute() -{ -#if CEC_LIB_VERSION_MAJOR >= 4 - cec_adap->AudioToggleMute(); -#else - cec_adap->MuteAudio(); -#endif -} - -void RemoteLinux::informStopEventLoop() -{ - listenLoopStop = true; - write(pfds[1], "1", 1); // break the select in getButtonPress -} - -void RemoteLinux::eventLoop() -{ - fd_set readfds; - int maxfd; - - if (pipe2(pfds, O_NONBLOCK) == -1) - { - Log::getInstance()->log("RemoteLinux", Log::ERR, "pipe2() fail"); - return; - } - - Log::getInstance()->log("RemoteLinux", Log::INFO, "Listen loop"); - - while(1) - { - if (listenLoopStop) break; - - FD_ZERO(&readfds); - - maxfd = 0; - for (unsigned int i = 0; i < devices.size(); i++) - { - int cur_fd = devices[i]; - maxfd = max(cur_fd, maxfd); - FD_SET(cur_fd, &readfds); - } - - FD_SET(pfds[0], &readfds); - maxfd = max(pfds[0], maxfd); - - // 0 = nothing happened and timeout expired - // >0 = num of descriptors that changed - // -1 = error - if (select(maxfd + 1, &readfds, NULL, NULL, NULL) < 1) - { - Log::getInstance()->log("RemoteLinux", Log::ERR, "Select fail"); - break; - } - - if (FD_ISSET(pfds[0], &readfds)) - { - // assume quit signal - Log::getInstance()->log("Remote", Log::NOTICE, "pfds quit"); - break; - - // FUTURE: read the byte and do different things? Read listenLoopStop and maybe other bools? - } - - for (unsigned int i = 0; i < devices.size(); i++) - { - int cur_fd = devices[i]; - if (FD_ISSET(cur_fd, &readfds)) - { - struct input_event ev; - int count = read(cur_fd, &ev, sizeof(ev)); - if (count == sizeof(ev)) - { - if (ev.type == EV_KEY && ev.value == 1) - { - // Send INPUT message - Message* m = new Message(); - m->message = Message::INPUT_EVENT; - m->to = Command::getInstance(); - m->from = this; - m->parameter = static_cast(TranslateHWC(W_G_HCW(W_HCW_KC,ev.code))); - MessageQueue::getInstance()->postMessage(m); - } - } - } - } - } - - close(pfds[1]); - close(pfds[0]); -} - -// FIXME surely NA_SIGNAL can go diff --git a/remotelinux.h b/remotelinux.h deleted file mode 100644 index 7de9e60..0000000 --- a/remotelinux.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright 2004-2020 Chris Tallon; 2012 Marten Richter - - This file is part of VOMP. - - VOMP is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - VOMP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with VOMP. If not, see . -*/ - -#ifndef REMOTELINUX_H -#define REMOTELINUX_H - -#include -#include -#include - -#include "defines.h" -#include "log.h" -#include "remote.h" - -class RemoteLinux : public Remote -{ - public: - RemoteLinux(); - virtual ~RemoteLinux(); - - int init(const char *devName); - int shutdown(); - int getDevice(); - UCHAR getButtonPress(int) { return NA_UNKNOWN; } // DEPRECATED - // void Signal(); - -// void SendPower(); - void InitHWCListwithDefaults(); - const char*HardcodedTranslateStr(UCHAR command); - char* HCWDesc(ULLONG hcw); - - void changePowerState(bool poweron); - - bool loadOptionsfromServer(VDR* vdr); - bool saveOptionstoServer(); - bool addOptionsToPanes(int panenumber,Options *options,WOptionPane* pane); - bool handleOptionChanges(Option* option); - - bool mayHaveFewButtons() {return true;}; - - virtual bool handlesVolume() { return cechandlesvolume; }; - virtual void volumeUp(); - virtual void volumeDown(); - virtual void volumeMute(); - - int initCec(); - void deinitCec(); - - private: - int initted{}; - bool signal{}; - bool cechandlesvolume{}; - - UCHAR TranslateHWCFixed(ULLONG code); - void InitKeymap(); - std::vector devices; - int num_loop{}; - - CEC::ICECAdapter* cec_adap{}; - CEC::libcec_configuration cec_config; - CEC::ICECCallbacks cec_callbacks; - - void incomingCECkey(int keys); - void incomingPowerkey(UCHAR key); - -#if CEC_LIB_VERSION_MAJOR >= 4 - static void cecLogMessage(void *param, const CEC::cec_log_message* message); - static void cecKeyPress(void*param, const CEC::cec_keypress* key); - static void cecCommand(void *param, const CEC::cec_command* command); - static void cecConfigurationChanged(void *param, const CEC::libcec_configuration* config); -#else - static int cecLogMessage(void *param, const CEC::cec_log_message message); - static int cecKeyPress(void*param, const CEC::cec_keypress key); - static int cecCommand(void *param, const CEC::cec_command command); - static int cecConfigurationChanged(void *param, const CEC::libcec_configuration config); -#endif - static void cecSourceActivated(void*param, const CEC::cec_logical_address address, const uint8_t activated); - - void eventLoop(); - void informStopEventLoop(); - - int pfds[2]; -}; - -#endif diff --git a/remotelirc.h b/remotelirc.h index d681b61..44f4fdb 100644 --- a/remotelirc.h +++ b/remotelirc.h @@ -27,7 +27,7 @@ #include #include -#include "remote.h" +#include "input.h" #include "defines.h" class RemoteLirc : public Remote diff --git a/remotewin.h b/remotewin.h index c866333..3fd5434 100644 --- a/remotewin.h +++ b/remotewin.h @@ -25,7 +25,7 @@ #include "defines.h" #include "log.h" -#include "remote.h" +#include "input.h" #define _WIN32_WINNT 0x501 #include diff --git a/vaudioselector.cc b/vaudioselector.cc index fd80800..2e0d260 100644 --- a/vaudioselector.cc +++ b/vaudioselector.cc @@ -20,7 +20,7 @@ #include "vaudioselector.h" -#include "remote.h" +#include "input.h" #include "colour.h" #include "video.h" #include "audio.h" @@ -468,14 +468,14 @@ int VAudioSelector::handleCommand(int command) { switch (command) { - case Remote::BACK: - case Remote::OK: - case Remote::GREEN: + case Input::BACK: + case Input::OK: + case Input::GREEN: { return 4; } - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (editsubtitles) { ssl.up(); @@ -501,8 +501,8 @@ int VAudioSelector::handleCommand(int command) return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { if (editsubtitles) { ssl.down(); @@ -530,8 +530,8 @@ int VAudioSelector::handleCommand(int command) return 2; } - case Remote::LEFT: - case Remote::DF_LEFT: + case Input::LEFT: + case Input::DF_LEFT: { if (editsubtitles && subtitles) { ssl.setDarkSelOption(true); @@ -543,8 +543,8 @@ int VAudioSelector::handleCommand(int command) } return 2; } - case Remote::RIGHT: - case Remote::DF_RIGHT: + case Input::RIGHT: + case Input::DF_RIGHT: { if (!editsubtitles && subtitles) { ssl.setDarkSelOption(false); @@ -619,7 +619,7 @@ void VAudioSelector::processMessage(Message* m) asl.setDarkSelOption(false); asl.draw(); ssl.draw(); - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else if (ssl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { @@ -628,7 +628,7 @@ void VAudioSelector::processMessage(Message* m) asl.setDarkSelOption(true); asl.draw(); ssl.draw(); - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel @@ -636,7 +636,7 @@ void VAudioSelector::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vchannellist.cc b/vchannellist.cc index 8d6573d..7d1edae 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -20,7 +20,7 @@ #include "vchannellist.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "vvideolivetv.h" #include "colour.h" @@ -186,8 +186,8 @@ int VChannelList::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); quickUpdate(); @@ -195,8 +195,8 @@ int VChannelList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); quickUpdate(); @@ -204,7 +204,7 @@ int VChannelList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); quickUpdate(); @@ -212,7 +212,7 @@ int VChannelList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); quickUpdate(); @@ -220,16 +220,16 @@ int VChannelList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::ZERO: - case Remote::ONE: - case Remote::TWO: - case Remote::THREE: - case Remote::FOUR: - case Remote::FIVE: - case Remote::SIX: - case Remote::SEVEN: - case Remote::EIGHT: - case Remote::NINE: + case Input::ZERO: + case Input::ONE: + case Input::TWO: + case Input::THREE: + case Input::FOUR: + case Input::FIVE: + case Input::SIX: + case Input::SEVEN: + case Input::EIGHT: + case Input::NINE: { VChannelSelect* v = new VChannelSelect(this); v->draw(); @@ -238,8 +238,8 @@ int VChannelList::handleCommand(int command) v->handleCommand(command); return 2; } - case Remote::OK: - case Remote::PLAY: + case Input::OK: + case Input::PLAY: { Channel* chan = NULL; if (chanList) chan = (Channel*)sl.getCurrentOptionData(); @@ -251,7 +251,7 @@ int VChannelList::handleCommand(int command) return 2; } - case Remote::BACK: + case Input::BACK: { return 4; } @@ -282,7 +282,7 @@ void VChannelList::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel @@ -290,7 +290,7 @@ void VChannelList::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - boxstack->handleCommand(Remote::BACK); //simulate cancel press + boxstack->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vchannelselect.cc b/vchannelselect.cc index 1fac3f0..f41b311 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -19,7 +19,7 @@ #include "vchannelselect.h" -#include "remote.h" +#include "input.h" #include "message.h" #include "boxstack.h" #include "colour.h" @@ -130,16 +130,16 @@ int VChannelSelect::handleCommand(int command) { switch(command) { - case Remote::ZERO: - case Remote::ONE: - case Remote::TWO: - case Remote::THREE: - case Remote::FOUR: - case Remote::FIVE: - case Remote::SIX: - case Remote::SEVEN: - case Remote::EIGHT: - case Remote::NINE: + case Input::ZERO: + case Input::ONE: + case Input::TWO: + case Input::THREE: + case Input::FOUR: + case Input::FIVE: + case Input::SIX: + case Input::SEVEN: + case Input::EIGHT: + case Input::NINE: { doInput(command); draw(); @@ -148,7 +148,7 @@ int VChannelSelect::handleCommand(int command) else Timers::getInstance()->setTimerD(this, 1, 3); return 2; } - case Remote::OK: + case Input::OK: { changeChannel(); return 2; diff --git a/vcolourtuner.cc b/vcolourtuner.cc index 178c22a..b20a008 100644 --- a/vcolourtuner.cc +++ b/vcolourtuner.cc @@ -20,7 +20,7 @@ #include "vcolourtuner.h" #include "wsymbol.h" -#include "remote.h" +#include "input.h" #include "colour.h" #include "video.h" #include "vinfo.h" @@ -114,56 +114,56 @@ int VColourTuner::handleCommand(int command) { int rt=0; switch(command) { - case Remote::ONE: + case Input::ONE: updateFactor(1,-1); rt=2; hasChanged=true; break; - case Remote::TWO: + case Input::TWO: updateFactor(1,1); rt=2; hasChanged=true; break; - case Remote::FOUR: + case Input::FOUR: updateFactor(2,-1); rt=2; hasChanged=true; break; - case Remote::FIVE: + case Input::FIVE: updateFactor(2,1); rt=2; hasChanged=true; break; - case Remote::SEVEN: + case Input::SEVEN: updateFactor(3,-1); rt=2; hasChanged=true; break; - case Remote::EIGHT: + case Input::EIGHT: updateFactor(3,1); hasChanged=true; rt=2; break; - case Remote::THREE: + case Input::THREE: updateFactor(4,-1); hasChanged=true; rt=2; break; - case Remote::SIX: + case Input::SIX: updateFactor(4,1); hasChanged=true; rt=2; break; - case Remote::NINE: + case Input::NINE: updateFactor(5,0); hasChanged=true; rt=2; break; - case Remote::ZERO: + case Input::ZERO: drawPicture=true; rt=2; break; - case Remote::BACK: + case Input::BACK: vrfactor=rfactor; vgfactor=gfactor; vbfactor=bfactor; @@ -176,7 +176,7 @@ int VColourTuner::handleCommand(int command) #endif rt=4; break; - case Remote::OK: + case Input::OK: rfactor=vrfactor; gfactor=vgfactor; bfactor=vbfactor; @@ -231,7 +231,7 @@ void VColourTuner::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } else if (y>=(int)area.h-24 && y<=(int)area.h-6) { diff --git a/vepg.cc b/vepg.cc index fe338a7..676b896 100644 --- a/vepg.cc +++ b/vepg.cc @@ -32,7 +32,7 @@ #include "vepg.h" -#include "remote.h" +#include "input.h" #include "vchannellist.h" #include "messagequeue.h" #include "video.h" @@ -356,16 +356,16 @@ int VEpg::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { // cursor up the channel list chanListbox.up(); drawData(); boxstack->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { // cursor down the channel list Log::getInstance()->log("VEPG", Log::DEBUG, "Down start"); @@ -376,16 +376,16 @@ int VEpg::handleCommand(int command) return 2; } - case Remote::DF_LEFT: - case Remote::LEFT: + case Input::DF_LEFT: + case Input::LEFT: { // cursor left through time selTime = thisEvent.time - 1; drawData(); boxstack->update(this); return 2; } - case Remote::DF_RIGHT: - case Remote::RIGHT: + case Input::DF_RIGHT: + case Input::RIGHT: { // cursor right through time selTime = thisEvent.time + thisEvent.duration; @@ -393,7 +393,7 @@ int VEpg::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::RED: + case Input::RED: { // cursor up one page chanListbox.pageUp(); @@ -401,7 +401,7 @@ int VEpg::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::GREEN: + case Input::GREEN: { // cursor down one page chanListbox.pageDown(); @@ -409,7 +409,7 @@ int VEpg::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::BLUE: + case Input::BLUE: { // step forward 24 hours selTime += 24 * 60 * 60; @@ -417,7 +417,7 @@ int VEpg::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::YELLOW: + case Input::YELLOW: { // step forward 24 hours selTime -= 24 * 60 * 60; @@ -425,7 +425,7 @@ int VEpg::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::RECORD: + case Input::RECORD: { if (!chanList) return 2; Log::getInstance()->log("VEPG", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", thisEvent.id, thisEvent.time, thisEvent.duration, thisEvent.title); @@ -435,9 +435,9 @@ int VEpg::handleCommand(int command) boxstack->update(vs); return 2; } - case Remote::PLAY: - case Remote::GO: - case Remote::OK: + case Input::PLAY: + case Input::GO: + case Input::OK: { if (!chanList) return 2; @@ -457,16 +457,16 @@ int VEpg::handleCommand(int command) setCurrentChannel(); - if(command == Remote::GO) + if(command == Input::GO) return 2; // GO just changes channel in preview, PLAY changes channel and returns to normal TV } - case Remote::BACK: - case Remote::GUIDE: + case Input::BACK: + case Input::GUIDE: { return 4; } - case Remote::CHANNELUP: + case Input::CHANNELUP: { if (currentChannelIndex == (chanList->size() - 1)) // at the end currentChannelIndex = 0; @@ -487,7 +487,7 @@ int VEpg::handleCommand(int command) return 2; } - case Remote::CHANNELDOWN: + case Input::CHANNELDOWN: { if (currentChannelIndex == 0) // at the start currentChannelIndex = chanList->size() - 1; // so go to end @@ -779,7 +779,7 @@ void VEpg::processMessage(Message* m) { if (chanListbox.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } else { @@ -791,39 +791,39 @@ void VEpg::processMessage(Message* m) if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - boxstack->handleCommand(Remote::BACK); //simulate cancel press + boxstack->handleCommand(Input::BACK); //simulate cancel press } else if (x>=(keyx+72) && y>=(keyy+4) &&x<=(keyx+72+104) &&y<=(keyy+4+getFontHeight() + 2)) { - boxstack->handleCommand(Remote::RED); + boxstack->handleCommand(Input::RED); } else if (x>=(keyx+72) && y>=(keyy+ getFontHeight() + 8) &&x<=(keyx+72+104) &&y<=(keyy+8+2*getFontHeight() + 2)) { - boxstack->handleCommand(Remote::GREEN); + boxstack->handleCommand(Input::GREEN); } else if (x>=(keyx+180) && y>=(keyy+4) &&x<=(keyx+180+104) &&y<=(keyy+4+getFontHeight() + 2)) { - boxstack->handleCommand(Remote::YELLOW); + boxstack->handleCommand(Input::YELLOW); } else if (x>=(keyx+180) && y>=(keyy+ getFontHeight() + 8) &&x<=(keyx+180+104) &&y<=(keyy+8+2*getFontHeight() + 2)) { - boxstack->handleCommand(Remote::BLUE); + boxstack->handleCommand(Input::BLUE); } else if (x>=(keyx+290) && y>=(keyy+4) &&x<=(keyx+180+290) &&y<=(keyy+4+getFontHeight() + 2)) { - boxstack->handleCommand(Remote::BACK); + boxstack->handleCommand(Input::BACK); } else if (x>=(keyx+290) && y>=(keyy+ getFontHeight() + 8) &&x<=(keyx+290+180) &&y<=(keyy+8+2*getFontHeight() + 2)) { - boxstack->handleCommand(Remote::RECORD); + boxstack->handleCommand(Input::RECORD); } else if (x>=(keyx+474) && y>=(keyy+4) &&x<=(keyx+128+474) &&y<=(keyy+4+getFontHeight() + 2)) { - boxstack->handleCommand(Remote::PLAY); + boxstack->handleCommand(Input::PLAY); } else if (x>=(keyx+474) && y>=(keyy+ getFontHeight() + 8) &&x<=(keyx+238+474) &&y<=(keyy+8+2*getFontHeight() + 2)) { - boxstack->handleCommand(Remote::GO); + boxstack->handleCommand(Input::GO); } else if ( x>=(chanListbox.getRootBoxOffsetX()) && y>=(chanListbox.getRootBoxOffsetY() + 5) diff --git a/vepglistadvanced.cc b/vepglistadvanced.cc index 3b6f9f8..48f286e 100644 --- a/vepglistadvanced.cc +++ b/vepglistadvanced.cc @@ -20,7 +20,7 @@ #include "vepglistadvanced.h" #include "boxstack.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "boxstack.h" #include "vdr.h" @@ -769,8 +769,8 @@ int VEpgListAdvanced::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); quickUpdate(); @@ -778,8 +778,8 @@ int VEpgListAdvanced::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); quickUpdate(); @@ -787,7 +787,7 @@ int VEpgListAdvanced::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); quickUpdate(); @@ -795,7 +795,7 @@ int VEpgListAdvanced::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); quickUpdate(); @@ -803,27 +803,27 @@ int VEpgListAdvanced::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::RED: + case Input::RED: { doRed(); return 2; } - case Remote::GREEN: + case Input::GREEN: { doGreen(); return 2; } - case Remote::YELLOW: + case Input::YELLOW: { doYellow(); return 2; } - case Remote::BLUE: + case Input::BLUE: { doBlue(); return 2; } - case Remote::OK: + case Input::OK: { if (sl.getNumOptions() == 0) return 2; @@ -852,7 +852,7 @@ int VEpgListAdvanced::handleCommand(int command) // should not get to here return 1; } - case Remote::BACK: + case Input::BACK: { return 4; } @@ -877,23 +877,23 @@ void VEpgListAdvanced::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } else if (boxRed.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { - boxstack->handleCommand(Remote::RED); + boxstack->handleCommand(Input::RED); } else if (boxGreen.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { - boxstack->handleCommand(Remote::GREEN); + boxstack->handleCommand(Input::GREEN); } else if (boxYellow.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { - boxstack->handleCommand(Remote::GREEN); + boxstack->handleCommand(Input::GREEN); } else if (boxBlue.mouseLBDOWN((m->parameter >> 16) - getScreenX(), (m->parameter & 0xFFFF) - getScreenY())) { - boxstack->handleCommand(Remote::GREEN); + boxstack->handleCommand(Input::GREEN); } else { @@ -902,7 +902,7 @@ void VEpgListAdvanced::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - boxstack->handleCommand(Remote::BACK); //simulate cancel press + boxstack->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vepgsettimer.cc b/vepgsettimer.cc index cc0ded6..0725c08 100644 --- a/vepgsettimer.cc +++ b/vepgsettimer.cc @@ -30,7 +30,7 @@ #include "command.h" #include "messagequeue.h" #include "video.h" -#include "remote.h" +#include "input.h" #include "i18n.h" VEpgSetTimer::VEpgSetTimer(Event* tevent, Channel* tchannel) @@ -210,27 +210,27 @@ int VEpgSetTimer::handleCommand(int command) { switch(command) { - case Remote::DF_LEFT: - case Remote::LEFT: + case Input::DF_LEFT: + case Input::LEFT: { swap(); draw(); boxstack->update(this); return 2; } - case Remote::DF_RIGHT: - case Remote::RIGHT: + case Input::DF_RIGHT: + case Input::RIGHT: { swap(); draw(); boxstack->update(this); return 2; } - case Remote::BACK: + case Input::BACK: { return 4; } - case Remote::OK: + case Input::OK: { if (selectedOption != YES) return 4; doit(); @@ -306,11 +306,11 @@ void VEpgSetTimer::processMessage(Message* m) { if (buttonYes.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } else if (buttonNo.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } else { @@ -319,7 +319,7 @@ void VEpgSetTimer::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - boxstack->handleCommand(Remote::BACK); //simulate cancel press + boxstack->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vepgsummary.cc b/vepgsummary.cc index 75c5a3f..6b99822 100644 --- a/vepgsummary.cc +++ b/vepgsummary.cc @@ -20,7 +20,7 @@ #include "vepgsummary.h" -#include "remote.h" +#include "input.h" #include "vquestion.h" #include "vepgsettimer.h" #include "vinfo.h" @@ -167,10 +167,10 @@ VEpgSummary::~VEpgSummary() int VEpgSummary::handleCommand(int command) { - if (command==Remote::BACK) { + if (command==Input::BACK) { return 4; } - if (command==Remote::RED) + if (command==Input::RED) { if (!channel) return 2; Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", event->id, event->time, event->duration, event->title); @@ -220,7 +220,7 @@ void VEpgSummary::processMessage(Message* m) if ((boxRed.getX() <= x) && (boxRed.getX() + (int)boxRed.getWidth() >= x) && (boxRed.getY() <= y) && (boxRed.getY() + (int)boxRed.getHeight() >= y)) { - BoxStack::getInstance()->handleCommand(Remote::RED); + BoxStack::getInstance()->handleCommand(Input::RED); cancel = false; } @@ -237,7 +237,7 @@ void VEpgSummary::processMessage(Message* m) int checkY=(m->parameter&0xFFFF)-getScreenY(); if (checkX<0 || checkY <0 || checkX>(int)getWidth() || checkY>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } else if (m->message == Message::MOUSE_SCROLL) diff --git a/videoomx.cc b/videoomx.cc index 76b6292..da5f26d 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -25,7 +25,7 @@ #include "woptionpane.h" #include "osdopenvg.h" #include "boxstack.h" -#include "remote.h" +#include "input.h" #include @@ -471,7 +471,7 @@ void VideoOMX::selectVideoMode(int interlaced) } } - Remote::getInstance()->shutdown(); + Input::getInstance()->shutdown(); vc_tv_power_off(); if (mymode) { Log::getInstance()->log("Video", Log::NOTICE, "Switch to optimum mode"); @@ -489,7 +489,7 @@ void VideoOMX::selectVideoMode(int interlaced) } else { /* analog tv case */ Log::getInstance()->log("Video", Log::NOTICE, "Analog tv case"); - Remote::getInstance()->shutdown(); + Input::getInstance()->shutdown(); vc_tv_power_off(); SDTV_MODE_T setmode=SDTV_MODE_PAL; SDTV_OPTIONS_T options; @@ -515,7 +515,7 @@ void VideoOMX::selectVideoMode(int interlaced) hdmi=false; } - Remote::getInstance()->init(""); + Input::getInstance()->init(""); signalon=true; @@ -724,9 +724,9 @@ int VideoOMX::signalOff() //TODO reinit osd Log::getInstance()->log("Video", Log::NOTICE, "signalOff"); Osd::getInstance()->stopUpdate(); // turn off drawing thread - Remote::getInstance()->shutdown(); + Input::getInstance()->shutdown(); vc_tv_power_off(); - Remote::getInstance()->init(""); + Input::getInstance()->init(""); signalon=false; return 1; } diff --git a/vinfo.cc b/vinfo.cc index 2889548..f7b89d6 100644 --- a/vinfo.cc +++ b/vinfo.cc @@ -20,7 +20,7 @@ #include "vinfo.h" -#include "remote.h" +#include "input.h" #include "colour.h" #include "i18n.h" #include "boxstack.h" @@ -93,8 +93,8 @@ int VInfo::handleCommand(int command) switch(command) { - case Remote::OK: - case Remote::BACK: + case Input::OK: + case Input::BACK: { if (exitable) return 4; } @@ -115,6 +115,6 @@ void VInfo::processMessage(Message* m) { if (m->message == Message::MOUSE_LBDOWN) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } } diff --git a/vmedialist.cc b/vmedialist.cc index e1001c4..63db05f 100644 --- a/vmedialist.cc +++ b/vmedialist.cc @@ -58,7 +58,7 @@ #include "vmediaview.h" #include "vvideomedia.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "boxstack.h" #include "colour.h" @@ -715,7 +715,7 @@ int VMediaList::handleCommand(int command) playingAll=false; switch(command) { - case Remote::ONE: + case Input::ONE: { sl.hintSetCurrent(0); sl.draw(); @@ -724,8 +724,8 @@ int VMediaList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); sl.draw(); @@ -735,8 +735,8 @@ int VMediaList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.draw(); @@ -746,7 +746,7 @@ int VMediaList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); sl.draw(); @@ -756,7 +756,7 @@ int VMediaList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); sl.draw(); @@ -766,7 +766,7 @@ int VMediaList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::BLUE: + case Input::BLUE: { switch(sortOrder) { case SORT_NAME: @@ -783,8 +783,8 @@ int VMediaList::handleCommand(int command) return 2; } } - case Remote::OK: - case Remote::PLAY: + case Input::OK: + case Input::PLAY: { Media* media = NULL; if (dirlist) media = getCurrentMedia(dirlist); @@ -797,12 +797,12 @@ int VMediaList::handleCommand(int command) //create child Log::getInstance()->log("VMediaList", Log::DEBUG, "create child for %s",media->getFileName()); if (media->getFileName() == NULL ) return 2; - if (command == Remote::PLAY) { + if (command == Input::PLAY) { dirlist->setStartLevel(); playingAll=true; } bool rt=changeDirectory(media); - if (command == Remote::PLAY && rt) { + if (command == Input::PLAY && rt) { playAll(); } else { @@ -813,10 +813,10 @@ int VMediaList::handleCommand(int command) case MEDIA_TYPE_AUDIO: Log::getInstance()->log("VMediaList", Log::DEBUG, "play audio file %s", media->getFileName()); - if (dirmode != M_NONE && command == Remote::PLAY) + if (dirmode != M_NONE && command == Input::PLAY) playAll(); else - playAudio(command==Remote::PLAY,true,true); + playAudio(command==Input::PLAY,true,true); break; case MEDIA_TYPE_VIDEO: { #ifndef WIN32 //Only DVB style MPEG is supported by the Windows Part! @@ -846,10 +846,10 @@ int VMediaList::handleCommand(int command) case MEDIA_TYPE_PICTURE: Log::getInstance()->log("VMediaList", Log::DEBUG, "show picture file %s", media->getFileName()); - if (dirmode != M_NONE && command == Remote::PLAY) + if (dirmode != M_NONE && command == Input::PLAY) playAll(); else - getViewer()->showPicture(MV_NONE,command==Remote::PLAY,true); + getViewer()->showPicture(MV_NONE,command==Input::PLAY,true); break; default: Log::getInstance()->log("VMediaList", Log::DEBUG, "unknown media type %d file %s", @@ -868,7 +868,7 @@ int VMediaList::handleCommand(int command) return 2; } - case Remote::BACK: + case Input::BACK: { if (dirlist->getLevel() < 1) return 4; dirlist->dropTop(); @@ -1079,7 +1079,7 @@ void VMediaList::processMessage(Message* m) if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { updateSelection(); - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } else { //check if press is outside this view! then simulate cancel @@ -1087,7 +1087,7 @@ void VMediaList::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - boxstack->handleCommand(Remote::BACK); //simulate cancel press + boxstack->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vmediaview.cc b/vmediaview.cc index 6f3f955..cf7874a 100644 --- a/vmediaview.cc +++ b/vmediaview.cc @@ -27,7 +27,7 @@ #include "timers.h" #include "boxx.h" #include "wselectlist.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "boxstack.h" #include "vdr.h" @@ -433,7 +433,7 @@ int VMediaView::handleCommand(int command) Log::getInstance()->log("VMediaView::handleCommand", Log::DEBUG, "cmd=%d,p=%p", command,this); if ( !audioEnabled && ! pictureEnabled ) { //only handle YELLOW - if (command == Remote::YELLOW) { + if (command == Input::YELLOW) { setAudioMode(true); return 1; } @@ -445,29 +445,29 @@ int VMediaView::handleCommand(int command) int rt=1; switch(command) { - case Remote::DF_UP: - case Remote::UP: - case Remote::SKIPBACK: + case Input::DF_UP: + case Input::UP: + case Input::SKIPBACK: rotate=WJpegComplex::ROT_0; showPicture(VMediaList::MV_PREV,slideshow,true); rt= 2; break; - case Remote::FORWARD: + case Input::FORWARD: if (showtime > 1) showtime--; updatePictureBanner(true); break; - case Remote::DF_DOWN: - case Remote::DOWN: - case Remote::SKIPFORWARD: + case Input::DF_DOWN: + case Input::DOWN: + case Input::SKIPFORWARD: rotate=WJpegComplex::ROT_0; showPicture(VMediaList::MV_NEXT,slideshow,true); rt= 2; break; - case Remote::REVERSE: + case Input::REVERSE: if (showtime < 50 ) showtime++; updatePictureBanner(true); break; - case Remote::OK: + case Input::OK: { if (pictureBanner) { destroyPictureBanner(); @@ -481,7 +481,7 @@ int VMediaView::handleCommand(int command) rt= 2; } break; - case Remote::PLAY: + case Input::PLAY: { slideshow=true; rotate=WJpegComplex::ROT_0; @@ -489,7 +489,7 @@ int VMediaView::handleCommand(int command) rt= 2; } break; - case Remote::PAUSE: + case Input::PAUSE: if (slideshow) { stopSlideshow(true); updatePictureBanner(); @@ -501,13 +501,13 @@ int VMediaView::handleCommand(int command) } rt= 2; break; - case Remote::STOP: + case Input::STOP: stopSlideshow(true); showtime=INITIAL_SHOWTIME; updatePictureBanner(); rt= 2; break; - case Remote::RED: + case Input::RED: switch(rotate) { case WJpegComplex::ROT_0: rotate=WJpegComplex::ROT_90; @@ -525,12 +525,12 @@ int VMediaView::handleCommand(int command) showPicture(VMediaList::MV_NONE,slideshow,true); rt=2; break; - case Remote::GREEN: + case Input::GREEN: if (info) destroyInfo(); else showPictureInfo(); rt=2; break; - case Remote::BLUE: + case Input::BLUE: switch (cropmode) { case WJpegComplex::CROP: cropmode=WJpegComplex::LETTER; @@ -545,7 +545,7 @@ int VMediaView::handleCommand(int command) showPicture(VMediaList::MV_NONE,slideshow,true); rt=2; break; - case Remote::MENU: { + case Input::MENU: { stopSlideshow(true); destroyPictureBanner(); destroyInfo(); @@ -556,13 +556,13 @@ int VMediaView::handleCommand(int command) rt=2; } break; - case Remote::BACK: + case Input::BACK: { setPictureMode(false); rt= 2; } break; - case Remote::YELLOW: + case Input::YELLOW: { setAudioMode(true); } @@ -576,78 +576,78 @@ int VMediaView::handleCommand(int command) //------------------------- command in mode AUDIO (i.e. audio is on top) ---------------- switch(command) { - case Remote::YELLOW: + case Input::YELLOW: setAudioMode(false); rt=2; break; - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: play(playall,false,VMediaList::MV_PREV); rt= 2; break; - case Remote::FORWARD: + case Input::FORWARD: if (! audioError) getPlayer()->fastForward(); updateInfo=true; rt=2; break; - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: play(playall,false,VMediaList::MV_NEXT); rt= 2; break; - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: if (! audioError) getPlayer()->skipForward(10); rt=2; break; - case Remote::SKIPBACK: + case Input::SKIPBACK: if (! audioError) getPlayer()->skipBackward(10); rt=2; break; - case Remote::REVERSE: + case Input::REVERSE: rt=2; break; - case Remote::ZERO: + case Input::ZERO: if (! audioError) getPlayer()->jumpToPercent(0); rt=2; break; - case Remote::ONE: + case Input::ONE: if (! audioError) getPlayer()->jumpToPercent(10); rt=2; break; - case Remote::TWO: + case Input::TWO: if (! audioError) getPlayer()->jumpToPercent(20); rt=2; break; - case Remote::THREE: + case Input::THREE: if (! audioError) getPlayer()->jumpToPercent(30); rt=2; break; - case Remote::FOUR: + case Input::FOUR: if (! audioError) getPlayer()->jumpToPercent(40); rt=2; break; - case Remote::FIVE: + case Input::FIVE: if (! audioError) getPlayer()->jumpToPercent(50); rt=2; break; - case Remote::SIX: + case Input::SIX: if (! audioError) getPlayer()->jumpToPercent(60); rt=2; break; - case Remote::SEVEN: + case Input::SEVEN: if (! audioError) getPlayer()->jumpToPercent(70); rt=2; break; - case Remote::EIGHT: + case Input::EIGHT: if (! audioError) getPlayer()->jumpToPercent(80); rt=2; break; - case Remote::NINE: + case Input::NINE: if (! audioError) getPlayer()->jumpToPercent(90); rt=2; break; - case Remote::OK: - case Remote::GREEN: + case Input::OK: + case Input::GREEN: { if (info) { destroyInfo(); @@ -663,7 +663,7 @@ int VMediaView::handleCommand(int command) rt= 2; } break; - case Remote::PLAY: + case Input::PLAY: { if (! audioError) getPlayer()->unpause(); updateInfo=true; @@ -672,18 +672,18 @@ int VMediaView::handleCommand(int command) rt= 2; } break; - case Remote::PAUSE: + case Input::PAUSE: if (! audioError) getPlayer()->pause(); updateInfo=true; rt= 2; break; - case Remote::STOP: + case Input::STOP: getPlayer()->stop(); justPlaying=false; updateInfo=true; rt= 2; break; - case Remote::BACK: + case Input::BACK: { getPlayer()->stop(); playall=false; @@ -715,7 +715,7 @@ void VMediaView::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } else if (m->message = Message::PLAYER_EVENT) { diff --git a/vmute.cc b/vmute.cc index 3691253..b2fd4df 100644 --- a/vmute.cc +++ b/vmute.cc @@ -19,7 +19,7 @@ #include "vmute.h" -#include "remote.h" +#include "input.h" #include "audio.h" #include "video.h" #include "wsymbol.h" @@ -79,7 +79,7 @@ int VMute::handleCommand(int command) { switch(command) { - case Remote::MUTE: + case Input::MUTE: { isMuted = Audio::getInstance()->toggleUserMute(); draw(); diff --git a/vopts.cc b/vopts.cc index 1f3e4a3..0ebd83e 100644 --- a/vopts.cc +++ b/vopts.cc @@ -24,7 +24,7 @@ #include "video.h" #include "osd.h" #include "audio.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" #include "woptionpane.h" #include "wremoteconfig.h" @@ -192,14 +192,14 @@ VOpts::VOpts() options.push_back(option); wop->addOptionLine(option); - Remote::getInstance()->addOptionsToPanes(0,&options,wop); + Input::getInstance()->addOptionsToPanes(0,&options,wop); Video::getInstance()->addOptionsToPanes(0,&options,wop); Audio::getInstance()->addOptionsToPanes(0,&options,wop); /* WRemoteConfig* wrc = new WRemoteConfig(); tabbar.addTab(tr("Remote Control"), wrc);*/ - Remote::getInstance()->addOptionPagesToWTB(&tabbar); + Input::getInstance()->addOptionPagesToWTB(&tabbar); // panes[1] = wrc; Video::getInstance()->addOptionPagesToWTB(&tabbar); @@ -226,7 +226,7 @@ VOpts::VOpts() options.push_back(option); wop->addOptionLine(option); - Remote::getInstance()->addOptionsToPanes(1,&options,wop); + Input::getInstance()->addOptionsToPanes(1,&options,wop); Video::getInstance()->addOptionsToPanes(1,&options,wop); Audio::getInstance()->addOptionsToPanes(1,&options,wop); @@ -264,7 +264,7 @@ VOpts::VOpts() wop->addOptionLine(option); #endif - Remote::getInstance()->addOptionsToPanes(2,&options,wop); + Input::getInstance()->addOptionsToPanes(2,&options,wop); Video::getInstance()->addOptionsToPanes(2,&options,wop); Audio::getInstance()->addOptionsToPanes(2,&options,wop); } @@ -282,7 +282,7 @@ VOpts::~VOpts() int VOpts::handleCommand(int command) { // either is active, handle back - if (command == Remote::BACK) + if (command == Input::BACK) { doSave(); return 4; @@ -311,7 +311,7 @@ void VOpts::doSave() { VDR* vdr = VDR::getInstance(); - Remote::getInstance()->saveOptionstoServer(); //Remote + Input::getInstance()->saveOptionstoServer(); //Remote Video::getInstance()->saveOptionstoServer(); //Video Audio::getInstance()->saveOptionstoServer(); //Remote #ifdef VOMP_PLATTFORM_MVP @@ -511,7 +511,7 @@ void VOpts::processMessage(Message* m) } else if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vpicturebanner.cc b/vpicturebanner.cc index c1ceef6..8976198 100644 --- a/vpicturebanner.cc +++ b/vpicturebanner.cc @@ -21,7 +21,7 @@ #include "vpicturebanner.h" #include "wsymbol.h" -#include "remote.h" +#include "input.h" #include "colour.h" #include "video.h" #include "vinfo.h" @@ -109,18 +109,18 @@ void VPictureBanner::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } else if (y>=(int)area.h-24 && y<=(int)area.h-6) { //y coordinate is right! if (x>=7 &&x<=25) { - BoxStack::getInstance()->handleCommand(Remote::RED); //simulate red press + BoxStack::getInstance()->handleCommand(Input::RED); //simulate red press } else if (x>=110 &&x<=128) { - BoxStack::getInstance()->handleCommand(Remote::GREEN); //simulate red press + BoxStack::getInstance()->handleCommand(Input::GREEN); //simulate red press } } } diff --git a/vquestion.cc b/vquestion.cc index d51e0e5..81bc1ed 100644 --- a/vquestion.cc +++ b/vquestion.cc @@ -19,7 +19,7 @@ #include "vquestion.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" #include "colour.h" #include "i18n.h" @@ -81,27 +81,27 @@ int VQuestion::handleCommand(int command) { switch(command) { - case Remote::DF_LEFT: - case Remote::LEFT: + case Input::DF_LEFT: + case Input::LEFT: { swap(); draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::DF_RIGHT: - case Remote::RIGHT: + case Input::DF_RIGHT: + case Input::RIGHT: { swap(); draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::BACK: + case Input::BACK: { return 4; } - case Remote::OK: + case Input::OK: { if (selectedOption != YES) return 4; @@ -145,11 +145,11 @@ void VQuestion::processMessage(Message* m) { if (buttonYes.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else if (buttonNo.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -158,7 +158,7 @@ void VQuestion::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vradiorec.cc b/vradiorec.cc index 232564c..9b9b5f0 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -32,7 +32,7 @@ #include "timers.h" #include "playerradio.h" #include "boxstack.h" -#include "remote.h" +#include "input.h" #include "vinfo.h" #include "i18n.h" #include "log.h" @@ -186,82 +186,82 @@ int VRadioRec::handleCommand(int command) { switch(command) { - case Remote::PLAY: + case Input::PLAY: { player->play(); doBar(0); return 2; } - case Remote::PLAYPAUSE: + case Input::PLAYPAUSE: { player->playpause(); doBar(0); return 2; } - case Remote::STOP: - case Remote::BACK: - case Remote::MENU: + case Input::STOP: + case Input::BACK: + case Input::MENU: { if (playing) stopPlay(); return 4; } - case Remote::PAUSE: + case Input::PAUSE: { player->pause(); doBar(0); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { doBar(3); player->skipForward(60); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { doBar(4); player->skipBackward(60); return 2; } - case Remote::YELLOW: + case Input::YELLOW: { doBar(2); player->skipBackward(10); return 2; } - case Remote::BLUE: + case Input::BLUE: { doBar(1); player->skipForward(10); return 2; } - case Remote::OK: + case Input::OK: { if (barShowing) removeBar(); else doBar(0); return 2; } - case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2; - case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2; - case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2; - case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2; - case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2; - case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2; - case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2; - case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2; - case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2; - case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2; + case Input::ZERO: player->jumpToPercent(0); doBar(0); return 2; + case Input::ONE: player->jumpToPercent(10); doBar(0); return 2; + case Input::TWO: player->jumpToPercent(20); doBar(0); return 2; + case Input::THREE: player->jumpToPercent(30); doBar(0); return 2; + case Input::FOUR: player->jumpToPercent(40); doBar(0); return 2; + case Input::FIVE: player->jumpToPercent(50); doBar(0); return 2; + case Input::SIX: player->jumpToPercent(60); doBar(0); return 2; + case Input::SEVEN: player->jumpToPercent(70); doBar(0); return 2; + case Input::EIGHT: player->jumpToPercent(80); doBar(0); return 2; + case Input::NINE: player->jumpToPercent(90); doBar(0); return 2; #ifdef DEV - case Remote::RED: + case Input::RED: { //player->test1(); return 2; } - case Remote::GREEN: + case Input::GREEN: { //player->test2(); return 2; @@ -281,7 +281,7 @@ void VRadioRec::processMessage(Message* m) int y=(m->parameter&0xFFFF)-(int)getScreenY(); if (!barShowing) { - boxstack->handleCommand(Remote::OK); //simulate rok press + boxstack->handleCommand(Input::OK); //simulate rok press } else if ((int)barRegion.x<=x && (int)barRegion.y<=y && ((int)barRegion.x+(int)barRegion.w)>=x && ((int)barRegion.y+(int)barRegion.h)>=y) @@ -303,7 +303,7 @@ void VRadioRec::processMessage(Message* m) } else { - boxstack->handleCommand(Remote::OK); //simulate rok press + boxstack->handleCommand(Input::OK); //simulate rok press } } else if (m->message == Message::PLAYER_EVENT) diff --git a/vrecmove.cc b/vrecmove.cc index b84328c..361b1bf 100644 --- a/vrecmove.cc +++ b/vrecmove.cc @@ -22,7 +22,7 @@ #include "defines.h" #include "recording.h" -#include "remote.h" +#include "input.h" #include "vinfo.h" #include "colour.h" #include "video.h" @@ -109,23 +109,23 @@ int VRecMove::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); sl.draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::OK: + case Input::OK: { Message* m = new Message(); m->message = Message::MOVE_RECORDING; @@ -135,7 +135,7 @@ int VRecMove::handleCommand(int command) return 4; } - case Remote::BACK: + case Input::BACK: { return 4; } @@ -158,7 +158,7 @@ void VRecMove::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -167,7 +167,7 @@ void VRecMove::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vrecording.cc b/vrecording.cc index 6666c7a..cb569d9 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -19,7 +19,7 @@ #include "vrecording.h" -#include "remote.h" +#include "input.h" #include "recinfo.h" #include "vquestion.h" #include "vinfo.h" @@ -183,31 +183,31 @@ void VRecording::draw() int VRecording::handleCommand(int command) { - if (command==Remote::BACK) { + if (command==Input::BACK) { return 4; } if (buttons) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { tabbar.activateFocus(false); moveCursor(LEFT); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { tabbar.activateFocus(false); moveCursor(RIGHT); return 2; } - case Remote::LEFT: - case Remote::DF_LEFT: - case Remote::RIGHT: - case Remote::DF_RIGHT: + case Input::LEFT: + case Input::DF_LEFT: + case Input::RIGHT: + case Input::DF_RIGHT: { buttons = false; button[selected].setActive(0); @@ -217,7 +217,7 @@ int VRecording::handleCommand(int command) BoxStack::getInstance()->update(this); return 2; } - case Remote::OK: + case Input::OK: { if (selected == PLAY) @@ -336,8 +336,8 @@ int VRecording::handleCommand(int command) else if (retval == 2) { // command was taken and actively ignored - if (command==Remote::LEFT || command==Remote::DF_LEFT - || command==Remote::RIGHT || command==Remote::DF_RIGHT) + if (command==Input::LEFT || command==Input::DF_LEFT + || command==Input::RIGHT || command==Input::DF_RIGHT) { buttons=true; button[selected].setActive(1); @@ -413,7 +413,7 @@ void VRecording::processMessage(Message* m) { if (button[i].mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press buttons = true; cancel = false; break; @@ -434,7 +434,7 @@ void VRecording::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vrecordinglist.cc b/vrecordinglist.cc index f5a66ad..e683440 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -22,7 +22,7 @@ #include "recman.h" #include "directory.h" #include "recording.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "boxstack.h" #include "vrecordingmenu.h" @@ -66,7 +66,7 @@ void VRecordingList::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } else { @@ -75,7 +75,7 @@ void VRecordingList::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - boxstack->handleCommand(Remote::BACK); //simulate cancel press + boxstack->handleCommand(Input::BACK); //simulate cancel press } } } @@ -321,8 +321,8 @@ int VRecordingList::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); quickUpdate(); @@ -330,8 +330,8 @@ int VRecordingList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); quickUpdate(); @@ -339,7 +339,7 @@ int VRecordingList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); quickUpdate(); @@ -347,7 +347,7 @@ int VRecordingList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); quickUpdate(); @@ -355,7 +355,7 @@ int VRecordingList::handleCommand(int command) boxstack->update(this); return 2; } - case Remote::OK: + case Input::OK: { if (sl.getNumOptions() == 0) return 2; @@ -400,7 +400,7 @@ int VRecordingList::handleCommand(int command) // should not get to here return 1; } - case Remote::BACK: + case Input::BACK: { if (recman->isSubDir()) { @@ -415,15 +415,15 @@ int VRecordingList::handleCommand(int command) return 4; } } - case Remote::PLAYPAUSE: - case Remote::PLAY: + case Input::PLAYPAUSE: + case Input::PLAY: { if (doPlay(true)) return 2; return 1; } - case Remote::LEFT: - case Remote::RIGHT: - case Remote::ZERO: + case Input::LEFT: + case Input::RIGHT: + case Input::ZERO: { reSort(); return 2; diff --git a/vrecordinglistadvanced.cc b/vrecordinglistadvanced.cc index 9007d8a..b4e990b 100644 --- a/vrecordinglistadvanced.cc +++ b/vrecordinglistadvanced.cc @@ -24,7 +24,7 @@ #include "directory.h" #include "recording.h" #include "recinfo.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "boxstack.h" #include "vrecordingmenu.h" diff --git a/vrecordinglistclassic.cc b/vrecordinglistclassic.cc index 4e08a84..7f92a23 100644 --- a/vrecordinglistclassic.cc +++ b/vrecordinglistclassic.cc @@ -23,7 +23,7 @@ #include "recman.h" #include "directory.h" #include "recording.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "boxstack.h" #include "vrecordingmenu.h" diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index 1af32d8..1a10d67 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -19,7 +19,7 @@ #include "vrecordingmenu.h" -#include "remote.h" +#include "input.h" #include "recinfo.h" #include "vquestion.h" #include "vinfo.h" @@ -84,23 +84,23 @@ int VRecordingMenu::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); sl.draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::OK: + case Input::OK: { if (sl.getCurrentOptionData() == 1) { @@ -185,7 +185,7 @@ int VRecordingMenu::handleCommand(int command) [[fallthrough]]; // it won't, as long as sl.getCurrentOptionData() is 1-5, but keep the compiler happy } - case Remote::BACK: + case Input::BACK: { return 4; } @@ -208,7 +208,7 @@ void VRecordingMenu::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -217,7 +217,7 @@ void VRecordingMenu::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vscreensaver.cc b/vscreensaver.cc index fd5d4ea..6e2e6e3 100644 --- a/vscreensaver.cc +++ b/vscreensaver.cc @@ -22,7 +22,7 @@ #include "defines.h" #include "log.h" -#include "remote.h" +#include "input.h" #include "colour.h" #include "video.h" #include "surface.h" diff --git a/vserverselect.cc b/vserverselect.cc index bddee34..2a7fb39 100644 --- a/vserverselect.cc +++ b/vserverselect.cc @@ -21,7 +21,7 @@ #include "vserverselect.h" #include "defines.h" -#include "remote.h" +#include "input.h" #include "colour.h" #include "video.h" #include "boxstack.h" @@ -77,23 +77,23 @@ int VServerSelect::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); sl.draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.draw(); BoxStack::getInstance()->update(this); return 2; } - case Remote::OK: + case Input::OK: { Message* m = new Message(); // Question/Answer mech. Better being messages m->to = replyTo; @@ -121,7 +121,7 @@ void VServerSelect::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } } } diff --git a/vsleeptimer.cc b/vsleeptimer.cc index 85c3872..7402047 100644 --- a/vsleeptimer.cc +++ b/vsleeptimer.cc @@ -19,7 +19,7 @@ #include "vsleeptimer.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "colour.h" #include "video.h" @@ -238,7 +238,7 @@ int VSleeptimer::handleCommand(int command) { switch(command) { - case Remote::GO: + case Input::GO: { displaySleeptimer = Sleeptimer::getInstance()->SetTime(); draw(); diff --git a/vteletextview.cc b/vteletextview.cc index 975a58a..bc765f6 100644 --- a/vteletextview.cc +++ b/vteletextview.cc @@ -22,7 +22,7 @@ #include "video.h" #include "timers.h" #include "boxstack.h" -#include "remote.h" +#include "input.h" #include "playerlivetv.h" @@ -107,21 +107,21 @@ void VTeletextView::draw(bool completedraw, bool onlyfirstline) int VTeletextView::handleCommand(int command) { if (subtitlemode) return 0; //Ok we are in subtitle mode, we are a slave of the player switch (command) { - case Remote::OK: + case Input::OK: return 2; - case Remote::BACK: + case Input::BACK: if(player) player->tellSubtitlesOSDVisible(false); // Only on liveTV return 4; - case Remote::ZERO: - case Remote::ONE: - case Remote::TWO: - case Remote::THREE: - case Remote::FOUR: - case Remote::FIVE: - case Remote::SIX: - case Remote::SEVEN: - case Remote::EIGHT: - case Remote::NINE: + case Input::ZERO: + case Input::ONE: + case Input::TWO: + case Input::THREE: + case Input::FOUR: + case Input::FIVE: + case Input::SIX: + case Input::SEVEN: + case Input::EIGHT: + case Input::NINE: { // key in teletext page doKey(command); diff --git a/vtimeredit.cc b/vtimeredit.cc index b8dd5f6..480c28c 100644 --- a/vtimeredit.cc +++ b/vtimeredit.cc @@ -19,7 +19,7 @@ #include "vtimeredit.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "boxstack.h" #include "vdr.h" @@ -170,23 +170,23 @@ int VTimerEdit::handleCommand(int command) switch(command) { /* - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { ViewMan::getInstance()->updateView(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { ViewMan::getInstance()->updateView(this); return 2; } */ - case Remote::LEFT: - case Remote::DF_RIGHT: + case Input::LEFT: + case Input::DF_RIGHT: { swap(); buttonBack.draw(); @@ -194,8 +194,8 @@ int VTimerEdit::handleCommand(int command) BoxStack::getInstance()->update(this); return 2; } - case Remote::RIGHT: - case Remote::DF_LEFT: + case Input::RIGHT: + case Input::DF_LEFT: { swap(); buttonBack.draw(); @@ -203,7 +203,7 @@ int VTimerEdit::handleCommand(int command) BoxStack::getInstance()->update(this); return 2; } - case Remote::OK: + case Input::OK: { // Back if (selectedButton == 0) return 4; @@ -226,7 +226,7 @@ int VTimerEdit::handleCommand(int command) BoxStack::getInstance()->update(v); return 2; } - case Remote::BACK: + case Input::BACK: { return 4; } @@ -257,7 +257,7 @@ void VTimerEdit::processMessage(Message* m) } else if (m->message == Message::MOUSE_LBDOWN) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else if (m->message == Message::QUESTION_YES) { diff --git a/vtimerlist.cc b/vtimerlist.cc index 2a4f65d..5f4e75e 100644 --- a/vtimerlist.cc +++ b/vtimerlist.cc @@ -21,7 +21,7 @@ #include "vtimerlist.h" #include "message.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "colour.h" #include "video.h" @@ -265,37 +265,37 @@ int VTimerList::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); quickUpdate(); BoxStack::getInstance()->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); quickUpdate(); BoxStack::getInstance()->update(this); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); quickUpdate(); BoxStack::getInstance()->update(this); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); quickUpdate(); BoxStack::getInstance()->update(this); return 2; } - case Remote::OK: + case Input::OK: { RecTimer* recTimer = NULL; if (recTimerList) recTimer = (RecTimer*)sl.getCurrentOptionData(); @@ -309,7 +309,7 @@ int VTimerList::handleCommand(int command) return 2; } - case Remote::BACK: + case Input::BACK: { return 4; } @@ -332,7 +332,7 @@ void VTimerList::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -341,7 +341,7 @@ void VTimerList::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight()) { - BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + BoxStack::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 48a5b71..29abae0 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -32,7 +32,7 @@ #include "command.h" #include "i18n.h" #include "wtextbox.h" -#include "remote.h" +#include "input.h" #include "vaudioselector.h" #include "colour.h" #include "event.h" @@ -304,7 +304,7 @@ int VVideoLiveTV::handleCommand(int command) { switch(command) { - case Remote::BACK: + case Input::BACK: { if (osd.getVisible() && !textUnavailable.getVisible()) { @@ -314,7 +314,7 @@ int VVideoLiveTV::handleCommand(int command) // else drop through to stop } [[fallthrough]]; - case Remote::STOP: + case Input::STOP: { stop(); vchannelList->highlightChannel((*chanList)[currentChannelIndex]); @@ -322,9 +322,9 @@ int VVideoLiveTV::handleCommand(int command) } // NEW REMOTE ONLY - navigate EPG, bring it onscreen if it's not there - case Remote::UP: + case Input::UP: { - if (Remote::getInstance()->mayHaveFewButtons()) + if (Input::getInstance()->mayHaveFewButtons()) { if (okTriggeredOSD) doUpDown(false); else doChanUpDown(UP); @@ -335,9 +335,9 @@ int VVideoLiveTV::handleCommand(int command) } return 2; } - case Remote::DOWN: + case Input::DOWN: { - if (Remote::getInstance()->mayHaveFewButtons()) + if (Input::getInstance()->mayHaveFewButtons()) { if (okTriggeredOSD) doUpDown(true); else doChanUpDown(DOWN); @@ -348,23 +348,23 @@ int VVideoLiveTV::handleCommand(int command) } return 2; } - case Remote::LEFT: + case Input::LEFT: { doLeftRight(false); return 2; } - case Remote::RIGHT: + case Input::RIGHT: { doLeftRight(true); return 2; } // Continue new remote only... - case Remote::CHANNELUP: + case Input::CHANNELUP: { doChanUpDown(UP); return 2; } - case Remote::CHANNELDOWN: + case Input::CHANNELDOWN: { doChanUpDown(DOWN); return 2; @@ -379,14 +379,14 @@ int VVideoLiveTV::handleCommand(int command) // OK was pressed - osd shown manually, use up/down for epg nav // UP/DOWN was pressed to change channel, osd was shown auto, use up/down for ch+/ch- - case Remote::DF_UP: + case Input::DF_UP: { // Old remote, decide what to do based on okTriggeredOSD if (okTriggeredOSD) doUpDown(false); else doChanUpDown(UP); return 2; } - case Remote::DF_DOWN: + case Input::DF_DOWN: { // Old remote, decide what to do based on okTriggeredOSD if (okTriggeredOSD) doUpDown(true); @@ -396,53 +396,53 @@ int VVideoLiveTV::handleCommand(int command) // END NEW/OLD REMOTE STUFF - case Remote::PREVCHANNEL: + case Input::PREVCHANNEL: { channelChange(PREVIOUS, 0); osdChannelIndex = currentChannelIndex; displayOSD(true); return 2; } - case Remote::OK: + case Input::OK: { doOK(); return 2; } - case Remote::RED: - case Remote::MENU: + case Input::RED: + case Input::MENU: { doSummary(); return 2; } - case Remote::FULL: - case Remote::TV: + case Input::FULL: + case Input::TV: { toggleChopSides(); return 2; } - case Remote::ZERO: - case Remote::ONE: - case Remote::TWO: - case Remote::THREE: - case Remote::FOUR: - case Remote::FIVE: - case Remote::SIX: - case Remote::SEVEN: - case Remote::EIGHT: - case Remote::NINE: + case Input::ZERO: + case Input::ONE: + case Input::TWO: + case Input::THREE: + case Input::FOUR: + case Input::FIVE: + case Input::SIX: + case Input::SEVEN: + case Input::EIGHT: + case Input::NINE: { // key in channel number doKey(command); return 2; } - case Remote::GREEN: + case Input::GREEN: { if (streamType == VDR::VIDEO) doAudioSelector(); return 2; } - case Remote::YELLOW: + case Input::YELLOW: { if (streamType ==VDR::VIDEO) { @@ -450,13 +450,13 @@ int VVideoLiveTV::handleCommand(int command) } return 2; } - case Remote::GUIDE: - case Remote::BLUE: + case Input::GUIDE: + case Input::BLUE: { doEPG(); return 2; } - case Remote::RECORD: + case Input::RECORD: if (streamType == VDR::VIDEO) (static_cast(player))->toggleSubtitles(); return 2; @@ -1033,30 +1033,30 @@ void VVideoLiveTV::processMessage(Message* m) if ((boxRed.getX()<=x) && (boxRed.getX()+(int)boxRed.getWidth()>=x ) && (boxRed.getY()<=y) && (boxRed.getY()+(int)boxRed.getHeight()>=y )) { - BoxStack::getInstance()->handleCommand(Remote::RED); + BoxStack::getInstance()->handleCommand(Input::RED); } else if ((boxGreen.getX()<=x) && (boxGreen.getX()+(int)boxGreen.getWidth()>=x ) && (boxGreen.getY()<=y) && (boxGreen.getY()+(int)boxGreen.getHeight()>=y)) { - BoxStack::getInstance()->handleCommand(Remote::GREEN); + BoxStack::getInstance()->handleCommand(Input::GREEN); } else if ((boxYellow.getX()<=x) && (boxYellow.getX()+(int)boxYellow.getWidth()>=x ) && (boxYellow.getY()<=y) && (boxYellow.getY()+(int)boxYellow.getHeight()>=y )){ - BoxStack::getInstance()->handleCommand(Remote::YELLOW); + BoxStack::getInstance()->handleCommand(Input::YELLOW); } else if ((boxBlue.getX()<=x) && (boxBlue.getX()+(int)boxBlue.getWidth()>=x ) && (boxBlue.getY()<=y) && (boxBlue.getY()+(int)boxBlue.getHeight()>=y )) { - BoxStack::getInstance()->handleCommand(Remote::BLUE); + BoxStack::getInstance()->handleCommand(Input::BLUE); } else { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press } } else { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press } } else if (m->message == Message::CHANNEL_CHANGE) diff --git a/vvideomedia.cc b/vvideomedia.cc index c91cda0..d6154f8 100644 --- a/vvideomedia.cc +++ b/vvideomedia.cc @@ -32,7 +32,7 @@ #include "recording.h" #include "vaudioselector.h" #include "message.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" #include "vinfo.h" #include "i18n.h" @@ -202,14 +202,14 @@ int VVideoMedia::handleCommand(int command) { switch(command) { - case Remote::PLAY: + case Input::PLAY: { player->play(); doBar(0); return 2; } - case Remote::BACK: + case Input::BACK: { if (vsummary) { @@ -217,86 +217,86 @@ int VVideoMedia::handleCommand(int command) return 2; } } // DROP THROUGH - case Remote::STOP: - case Remote::MENU: + case Input::STOP: + case Input::MENU: { if (playing) stopPlay(); return 4; } - case Remote::PAUSE: + case Input::PAUSE: { player->pause(); doBar(0); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { doBar(3); player->skipForward(60); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { doBar(4); player->skipBackward(60); return 2; } - case Remote::FORWARD: + case Input::FORWARD: { player->fastForward(); doBar(0); return 2; } - case Remote::REVERSE: + case Input::REVERSE: { player->fastBackward(); doBar(0); return 2; } - case Remote::RED: + case Input::RED: { if (vsummary) removeSummary(); else doSummary(); return 2; } - case Remote::GREEN: + case Input::GREEN: { doAudioSelector(); return 2; } - case Remote::YELLOW: + case Input::YELLOW: { doBar(2); player->skipBackward(10); return 2; } - case Remote::BLUE: + case Input::BLUE: { doBar(1); player->skipForward(10); return 2; } - case Remote::STAR: + case Input::STAR: { doBar(2); player->skipBackward(10); return 2; } - case Remote::HASH: + case Input::HASH: { doBar(1); player->skipForward(10); return 2; } - case Remote::FULL: - case Remote::TV: + case Input::FULL: + case Input::TV: { toggleChopSides(); return 2; } - case Remote::OK: + case Input::OK: { if (vsummary) { @@ -312,16 +312,16 @@ int VVideoMedia::handleCommand(int command) return 2; } - case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2; - case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2; - case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2; - case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2; - case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2; - case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2; - case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2; - case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2; - case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2; - case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2; + case Input::ZERO: player->jumpToPercent(0); doBar(0); return 2; + case Input::ONE: player->jumpToPercent(10); doBar(0); return 2; + case Input::TWO: player->jumpToPercent(20); doBar(0); return 2; + case Input::THREE: player->jumpToPercent(30); doBar(0); return 2; + case Input::FOUR: player->jumpToPercent(40); doBar(0); return 2; + case Input::FIVE: player->jumpToPercent(50); doBar(0); return 2; + case Input::SIX: player->jumpToPercent(60); doBar(0); return 2; + case Input::SEVEN: player->jumpToPercent(70); doBar(0); return 2; + case Input::EIGHT: player->jumpToPercent(80); doBar(0); return 2; + case Input::NINE: player->jumpToPercent(90); doBar(0); return 2; } @@ -340,7 +340,7 @@ void VVideoMedia::processMessage(Message* m) if (!barShowing) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press } else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y) { @@ -361,7 +361,7 @@ void VVideoMedia::processMessage(Message* m) } else { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press } } else if (m->message == Message::PLAYER_EVENT) diff --git a/vvideorec.cc b/vvideorec.cc index 5b15739..43e4b7b 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -30,7 +30,7 @@ #include "recording.h" #include "vaudioselector.h" #include "message.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" #include "vinfo.h" #include "i18n.h" @@ -223,22 +223,22 @@ int VVideoRec::handleCommand(int command) { switch(command) { - case Remote::UP: - case Remote::PLAY: + case Input::UP: + case Input::PLAY: { player->play(); doBar(0); return 2; } - case Remote::PLAYPAUSE: + case Input::PLAYPAUSE: { player->playpause(); doBar(0); return 2; } - case Remote::BACK: + case Input::BACK: { if (vsummary) { @@ -247,58 +247,58 @@ int VVideoRec::handleCommand(int command) } } [[fallthrough]]; - case Remote::STOP: - case Remote::MENU: + case Input::STOP: + case Input::MENU: { if (playing) stopPlay(); return 4; } - case Remote::DOWN: - case Remote::PAUSE: + case Input::DOWN: + case Input::PAUSE: { player->pause(); doBar(0); return 2; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { doBar(3); player->skipForward(60); return 2; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { doBar(4); player->skipBackward(60); return 2; } - case Remote::RIGHT: - case Remote::FORWARD: + case Input::RIGHT: + case Input::FORWARD: { player->fastForward(); doBar(0); return 2; } - case Remote::LEFT: - case Remote::REVERSE: + case Input::LEFT: + case Input::REVERSE: { player->fastBackward(); doBar(0); return 2; } - case Remote::RED: + case Input::RED: { if (vsummary) removeSummary(); else doSummary(); return 2; } - case Remote::GREEN: + case Input::GREEN: { doAudioSelector(); return 2; } - case Remote::YELLOW: + case Input::YELLOW: { if (myRec->hasMarks()) { @@ -322,7 +322,7 @@ int VVideoRec::handleCommand(int command) } return 2; } - case Remote::BLUE: + case Input::BLUE: { if (myRec->hasMarks()) { @@ -346,31 +346,31 @@ int VVideoRec::handleCommand(int command) } return 2; } - case Remote::PREVCHANNEL: + case Input::PREVCHANNEL: { player->skipBackward(2); return 2; } - case Remote::STAR: + case Input::STAR: { doBar(2); player->skipBackward(10); return 2; } - case Remote::HASH: + case Input::HASH: { doBar(1); player->skipForward(10); return 2; } - case Remote::FULL: - case Remote::TV: + case Input::FULL: + case Input::TV: { toggleChopSides(); return 2; } - case Remote::OK: + case Input::OK: { if (vsummary) { @@ -383,20 +383,20 @@ int VVideoRec::handleCommand(int command) return 2; } - case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2; - case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2; - case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2; - case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2; - case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2; - case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2; - case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2; - case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2; - case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2; - case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2; - - case Remote::RECORD: player->toggleSubtitles(); return 2; + case Input::ZERO: player->jumpToPercent(0); doBar(0); return 2; + case Input::ONE: player->jumpToPercent(10); doBar(0); return 2; + case Input::TWO: player->jumpToPercent(20); doBar(0); return 2; + case Input::THREE: player->jumpToPercent(30); doBar(0); return 2; + case Input::FOUR: player->jumpToPercent(40); doBar(0); return 2; + case Input::FIVE: player->jumpToPercent(50); doBar(0); return 2; + case Input::SIX: player->jumpToPercent(60); doBar(0); return 2; + case Input::SEVEN: player->jumpToPercent(70); doBar(0); return 2; + case Input::EIGHT: player->jumpToPercent(80); doBar(0); return 2; + case Input::NINE: player->jumpToPercent(90); doBar(0); return 2; + + case Input::RECORD: player->toggleSubtitles(); return 2; #ifdef DEV -// case Remote::RED: +// case Input::RED: // { //Don't use RED for anything. It will eventually be recording summary @@ -458,7 +458,7 @@ void VVideoRec::processMessage(Message* m) if (!barShowing) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press } else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y) { @@ -516,7 +516,7 @@ void VVideoRec::processMessage(Message* m) } else { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press } } else if (m->from == player) diff --git a/vvolume.cc b/vvolume.cc index bf9dce1..eef3899 100644 --- a/vvolume.cc +++ b/vvolume.cc @@ -19,7 +19,7 @@ #include "vvolume.h" -#include "remote.h" +#include "input.h" #include "audio.h" #include "wsymbol.h" #include "colour.h" @@ -95,8 +95,8 @@ int VVolume::handleCommand(int command) { switch(command) { - case Remote::DF_LEFT: - case Remote::VOLUMEDOWN: + case Input::DF_LEFT: + case Input::VOLUMEDOWN: { displayVolume = Audio::getInstance()->volumeDown(); draw(); @@ -104,8 +104,8 @@ int VVolume::handleCommand(int command) // handled return 2; } - case Remote::DF_RIGHT: - case Remote::VOLUMEUP: + case Input::DF_RIGHT: + case Input::VOLUMEUP: { displayVolume = Audio::getInstance()->volumeUp(); draw(); diff --git a/vwelcome.cc b/vwelcome.cc index 5ce34fd..4e0f1e1 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -19,7 +19,7 @@ #include "vwelcome.h" -#include "remote.h" +#include "input.h" #include "vdr.h" #include "vchannellist.h" #include "vrecordinglistclassic.h" @@ -187,60 +187,60 @@ int VWelcome::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { sl.up(); sl.draw(); boxstack->update(this); return 2; } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.draw(); boxstack->update(this); return 2; } - case Remote::ONE: + case Input::ONE: { doChannelsList(); return 2; } - case Remote::TWO: + case Input::TWO: { doRadioList(); return 2; } - case Remote::THREE: + case Input::THREE: { doRecordingsList(); return 2; } - case Remote::FOUR: + case Input::FOUR: { doTimersList(); return 2; } - case Remote::FIVE: + case Input::FIVE: { #ifdef VOMP_PLATTFORM_MVP doMediaList(); #endif return 2; } - case Remote::SIX: + case Input::SIX: { doOptions(); return 2; } - case Remote::SEVEN: + case Input::SEVEN: { Command::getInstance()->doReboot(); return 2; } - case Remote::OK: + case Input::OK: { ULONG option = sl.getCurrentOptionData(); if (option == 1) @@ -281,7 +281,7 @@ int VWelcome::handleCommand(int command) return 2; // never gets here } //#ifdef DEV - case Remote::NINE: + case Input::NINE: { VScreensaver* vscreensaver = new VScreensaver(); boxstack->add(vscreensaver); @@ -293,7 +293,7 @@ int VWelcome::handleCommand(int command) //#endif // Test -// case Remote::BACK: +// case Input::BACK: // { // return 4; // } @@ -407,7 +407,7 @@ void VWelcome::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - boxstack->handleCommand(Remote::OK); //simulate OK press + boxstack->handleCommand(Input::OK); //simulate OK press } } } diff --git a/winmain.cc b/winmain.cc index 8f1ad64..7b1c0e2 100644 --- a/winmain.cc +++ b/winmain.cc @@ -564,7 +564,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) //TODO: call command logger->log("Core", Log::NOTICE, "Window closed, shutting down..."); - ((RemoteWin*)Remote::getInstance())->SendPower(); + ((RemoteWin*)Input::getInstance())->SendPower(); PostQuitMessage(0); }break; case WM_SIZING: { diff --git a/woptionpane.cc b/woptionpane.cc index d2b053b..c2cdd62 100644 --- a/woptionpane.cc +++ b/woptionpane.cc @@ -24,7 +24,7 @@ #include "woptionbox.h" #include "log.h" #include "vdr.h" -#include "remote.h" +#include "input.h" #include "option.h" WOptionPane::WOptionPane() @@ -120,8 +120,8 @@ int WOptionPane::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (selectedOption > 0) { @@ -142,8 +142,8 @@ int WOptionPane::handleCommand(int command) return 1; } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { if (selectedOption < (numOptions - 1)) { @@ -159,19 +159,19 @@ int WOptionPane::handleCommand(int command) return 4; // Signal return control to parent } } - case Remote::DF_LEFT: - case Remote::LEFT: + case Input::DF_LEFT: + case Input::LEFT: { optionBoxes[selectedOption]->left(); return 1; } - case Remote::DF_RIGHT: - case Remote::RIGHT: + case Input::DF_RIGHT: + case Input::RIGHT: { optionBoxes[selectedOption]->right(); return 1; } - case Remote::OK: + case Input::OK: { optionBoxes[selectedOption]->cycle(); return 1; diff --git a/wpictureview.cc b/wpictureview.cc index 50be37c..8a0bc43 100644 --- a/wpictureview.cc +++ b/wpictureview.cc @@ -22,7 +22,7 @@ #include "wpictureview.h" #include "colour.h" -#include "remote.h" +#include "input.h" #include "osd.h" #include "movieinfo.h" #include "seriesinfo.h" @@ -151,8 +151,8 @@ int WPictureView::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (cur_scroll_line > 0) { @@ -165,8 +165,8 @@ int WPictureView::handleCommand(int command) return 4; // Signal return control to parent } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { if (rem_scroll_line > 0) { @@ -177,10 +177,10 @@ int WPictureView::handleCommand(int command) return 4; } } - case Remote::LEFT: - case Remote::RIGHT: - case Remote::DF_LEFT: - case Remote::DF_RIGHT: + case Input::LEFT: + case Input::RIGHT: + case Input::DF_LEFT: + case Input::DF_RIGHT: { return 5; } diff --git a/wremoteconfig.cc b/wremoteconfig.cc index 0d4497a..cb8ddd9 100644 --- a/wremoteconfig.cc +++ b/wremoteconfig.cc @@ -19,7 +19,7 @@ #include "wremoteconfig.h" -#include "remote.h" +#include "input.h" #include "wsymbol.h" #include "colour.h" #include "i18n.h" @@ -27,7 +27,7 @@ WRemoteConfig::WRemoteConfig() { - remote = Remote::getInstance(); + remote = Input::getInstance(); learnmode = false; active = false; @@ -102,7 +102,7 @@ bool WRemoteConfig::mouseLBDOWN(int x, int y) { if (sl.mouseLBDOWN(x,y)) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press return true; } return false; @@ -136,7 +136,7 @@ void WRemoteConfig::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press + ViewMan::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -145,7 +145,7 @@ void WRemoteConfig::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>getWidth() || y>getHeight()) { - ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } @@ -169,7 +169,7 @@ int WRemoteConfig::handleCommand(int command) if (learnmode) { learnmode = false; - if (command == Remote::NA_LEARN) + if (command == Input::NA_LEARN) { initSelectList(false); } @@ -177,8 +177,8 @@ int WRemoteConfig::handleCommand(int command) } switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (sl.getCurrentOption() != 0) { @@ -192,8 +192,8 @@ int WRemoteConfig::handleCommand(int command) return 4; // return control to vopts } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { if (!active) { @@ -206,23 +206,23 @@ int WRemoteConfig::handleCommand(int command) } return 1; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); return 1; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); return 1; } - case Remote::OK: + case Input::OK: { learnmode = true; remote->EnterLearningMode(sl.getCurrentOptionData()); return 1; } - case Remote::BACK: + case Input::BACK: { return 0; /* @@ -241,7 +241,7 @@ int WRemoteConfig::handleCommand(int command) return 2; */ } - case Remote::MENU: + case Input::MENU: { remote->ResetToDefault(); initSelectList(false); diff --git a/wremoteconfig.h b/wremoteconfig.h index a3caa4c..78006b7 100644 --- a/wremoteconfig.h +++ b/wremoteconfig.h @@ -24,7 +24,7 @@ #include "boxx.h" #include "wselectlist.h" -class Remote; +class Input; class Message; class WRemoteConfig : public Boxx @@ -42,7 +42,7 @@ class WRemoteConfig : public Boxx private: WSelectList sl; - Remote *remote; + Input* remote; bool learnmode; void initSelectList(bool startup); bool active; diff --git a/wtabbar.cc b/wtabbar.cc index dae7390..dd3315e 100644 --- a/wtabbar.cc +++ b/wtabbar.cc @@ -20,7 +20,7 @@ #include "wtabbar.h" #include "surface.h" -#include "remote.h" +#include "input.h" #include "wbutton.h" #include "colour.h" @@ -144,24 +144,24 @@ int WTabBar::handleCommand(int command) { switch(command) { - case Remote::DF_LEFT: - case Remote::LEFT: + case Input::DF_LEFT: + case Input::LEFT: { if (!left()) return 2; draw(); return 1; } - case Remote::DF_RIGHT: - case Remote::RIGHT: + case Input::DF_RIGHT: + case Input::RIGHT: { if (!right()) return 2; draw(); return 1; } - case Remote::UP: - case Remote::DF_UP: - case Remote::DOWN: - case Remote::DF_DOWN: + case Input::UP: + case Input::DF_UP: + case Input::DOWN: + case Input::DF_DOWN: { int handleResult = tabs[visiblePane].pane->handleCommand(command); // A WOptionPane will accept control being passed into it from inactive, up or down (== 1). diff --git a/wtextbox.cc b/wtextbox.cc index a57bfdb..0d1f90e 100644 --- a/wtextbox.cc +++ b/wtextbox.cc @@ -21,7 +21,7 @@ #include "wtextbox.h" #include "colour.h" -#include "remote.h" +#include "input.h" WTextbox::WTextbox(const char* ttext): foreColour(DrawStyle::LIGHTTEXT) @@ -86,8 +86,8 @@ int WTextbox::handleCommand(int command) { switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (cur_scroll_line > 0) { @@ -100,8 +100,8 @@ int WTextbox::handleCommand(int command) return 4; // Signal return control to parent } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { if (rem_scroll_line > 0) { @@ -112,10 +112,10 @@ int WTextbox::handleCommand(int command) return 4; } } - case Remote::LEFT: - case Remote::RIGHT: - case Remote::DF_LEFT: - case Remote::DF_RIGHT: + case Input::LEFT: + case Input::RIGHT: + case Input::DF_LEFT: + case Input::DF_RIGHT: { return 5; } diff --git a/wwinaudiofilter.cc b/wwinaudiofilter.cc index 19a2cd6..c759902 100644 --- a/wwinaudiofilter.cc +++ b/wwinaudiofilter.cc @@ -20,7 +20,7 @@ #include "wwinaudiofilter.h" #include "audiowin.h" #include "i18n.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" WWinAudioFilter::WWinAudioFilter() @@ -112,7 +112,7 @@ bool WWinAudioFilter::mouseLBDOWN(int x, int y) { if (sl.mouseLBDOWN(x,y)) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press return true; } return false; @@ -147,7 +147,7 @@ void WWinAudioFilter::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press + ViewMan::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -156,7 +156,7 @@ void WWinAudioFilter::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>getWidth() || y>getHeight()) { - ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } @@ -180,8 +180,8 @@ int WWinAudioFilter::handleCommand(int command) switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (sl.getCurrentOption() != 0) { @@ -195,34 +195,34 @@ int WWinAudioFilter::handleCommand(int command) return 4; //Control to vopts control } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { Log::getInstance()->log("P", Log::DEBUG, "1"); sl.down(); sl.setShowSelOption(true); return 1; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); sl.draw(); return 1; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); sl.draw(); return 1; } - case Remote::OK: + case Input::OK: { AudioWin*aw=(AudioWin*)Audio::getInstance(); aw->selectAudioFilter(sl.getCurrentOptionData()); return 1; } - case Remote::BACK: + case Input::BACK: { return 0; diff --git a/wwinmp3audiofilter.cc b/wwinmp3audiofilter.cc index 50392c3..85f5644 100644 --- a/wwinmp3audiofilter.cc +++ b/wwinmp3audiofilter.cc @@ -20,7 +20,7 @@ #include "wwinmp3audiofilter.h" #include "audiowin.h" #include "i18n.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" WWinMp3AudioFilter::WWinMp3AudioFilter() @@ -119,7 +119,7 @@ bool WWinMp3AudioFilter::mouseLBDOWN(int x, int y) { if (sl.mouseLBDOWN(x,y)) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press return true; } return false; @@ -155,7 +155,7 @@ void WWinMp3AudioFilter::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press + ViewMan::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -164,7 +164,7 @@ void WWinMp3AudioFilter::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>getWidth() || y>getHeight()) { - ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } @@ -188,8 +188,8 @@ int WWinMp3AudioFilter::handleCommand(int command) switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (sl.getCurrentOption() != 0) { @@ -203,22 +203,22 @@ int WWinMp3AudioFilter::handleCommand(int command) return 4; //Control to vpots control } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.setShowSelOption(true); return 1; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); sl.draw(); return 1; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); sl.draw(); @@ -226,14 +226,14 @@ int WWinMp3AudioFilter::handleCommand(int command) return 1; } - case Remote::OK: + case Input::OK: { AudioWin*aw=(AudioWin*)Audio::getInstance(); aw->selectMp3AudioFilter(sl.getCurrentOptionData()); return 1; } - case Remote::BACK: + case Input::BACK: { return 0; diff --git a/wwinvideofilter.cc b/wwinvideofilter.cc index b91f45b..a179816 100644 --- a/wwinvideofilter.cc +++ b/wwinvideofilter.cc @@ -20,7 +20,7 @@ #include "wwinvideofilter.h" #include "videowin.h" #include "i18n.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" WWinVideoFilter::WWinVideoFilter() @@ -111,7 +111,7 @@ bool WWinVideoFilter::mouseLBDOWN(int x, int y) { if (sl.mouseLBDOWN(x,y)) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press return true; } return false; @@ -147,7 +147,7 @@ void WWinVideoFilter::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press + ViewMan::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -156,7 +156,7 @@ void WWinVideoFilter::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>getWidth() || y>getHeight()) { - ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } @@ -180,8 +180,8 @@ int WWinVideoFilter::handleCommand(int command) switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (sl.getCurrentOption() != 0) { @@ -195,30 +195,30 @@ int WWinVideoFilter::handleCommand(int command) return 4; //Control to vopts control } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.setShowSelOption(true); return 1; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); return 1; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); return 1; } - case Remote::OK: + case Input::OK: { VideoWin*vw=(VideoWin*)Video::getInstance(); vw->selectVideoFilter(sl.getCurrentOptionData()); return 1; } - case Remote::BACK: + case Input::BACK: { return 0; diff --git a/wwinvideoh264filter.cc b/wwinvideoh264filter.cc index 7c6ec07..756cb46 100644 --- a/wwinvideoh264filter.cc +++ b/wwinvideoh264filter.cc @@ -20,7 +20,7 @@ #include "wwinvideoh264filter.h" #include "videowin.h" #include "i18n.h" -#include "remote.h" +#include "input.h" #include "boxstack.h" WWinVideoH264Filter::WWinVideoH264Filter() @@ -111,7 +111,7 @@ bool WWinVideoH264Filter::mouseLBDOWN(int x, int y) { if (sl.mouseLBDOWN(x,y)) { - BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press + BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press return true; } return false; @@ -147,7 +147,7 @@ void WWinVideoH264Filter::processMessage(Message* m) { if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press + ViewMan::getInstance()->handleCommand(Input::OK); //simulate OK press } else { @@ -156,7 +156,7 @@ void WWinVideoH264Filter::processMessage(Message* m) int y=(m->parameter&0xFFFF)-getScreenY(); if (x<0 || y <0 || x>getWidth() || y>getHeight()) { - ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press + ViewMan::getInstance()->handleCommand(Input::BACK); //simulate cancel press } } } @@ -180,8 +180,8 @@ int WWinVideoH264Filter::handleCommand(int command) switch(command) { - case Remote::DF_UP: - case Remote::UP: + case Input::DF_UP: + case Input::UP: { if (sl.getCurrentOption() != 0) { @@ -195,30 +195,30 @@ int WWinVideoH264Filter::handleCommand(int command) return 4; //Control to vopts control } } - case Remote::DF_DOWN: - case Remote::DOWN: + case Input::DF_DOWN: + case Input::DOWN: { sl.down(); sl.setShowSelOption(true); return 1; } - case Remote::SKIPBACK: + case Input::SKIPBACK: { sl.pageUp(); return 1; } - case Remote::SKIPFORWARD: + case Input::SKIPFORWARD: { sl.pageDown(); return 1; } - case Remote::OK: + case Input::OK: { VideoWin*vw=(VideoWin*)Video::getInstance(); vw->selectVideoH264Filter(sl.getCurrentOptionData()); return 1; } - case Remote::BACK: + case Input::BACK: { return 0;