From 5be71fade49ced3a685e909ca176ee5b23a1781e Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 18 Feb 2020 18:29:44 +0000 Subject: [PATCH] WIP - Windows implementation --- command.cc | 6 +- defines.h | 4 + dsock.cc | 9 + dsock.h | 4 + input.cc | 4 +- input.h | 19 ++- inputman.cc | 57 ++++++- inputman.h | 2 + inputudp.cc | 36 +++- inputudp.h | 15 +- remotewin.cc => inputwin.cc | 316 +++++++++++++++++++----------------- inputwin.h | 62 +++++++ log.cc | 4 +- remotewin.h | 67 -------- tcp.cc | 9 + threadwin.h | 2 +- vrecordingmenu.cc | 3 +- vvideolivetv.cc | 2 +- vvideorec.cc | 2 +- winmain.cc | 27 +-- wol.cc | 6 +- wwinaudiofilter.cc | 2 +- wwinmp3audiofilter.cc | 4 +- wwinvideofilter.cc | 6 +- wwinvideoh264filter.cc | 8 +- 25 files changed, 412 insertions(+), 264 deletions(-) rename remotewin.cc => inputwin.cc (64%) create mode 100644 inputwin.h delete mode 100644 remotewin.h diff --git a/command.cc b/command.cc index ab7b758..191011d 100644 --- a/command.cc +++ b/command.cc @@ -466,7 +466,7 @@ void Command::doPowerOff() isStandby = true; Sleeptimer::getInstance()->shutdown(); #ifdef WIN32 - stop(); //different behavoiur on windows, we exit + stop(); //different behavoiur on windows, we exit // FIXME - stop() now called directly from winmain #endif } } @@ -1038,14 +1038,14 @@ void Command::doJustConnected(VConnect* vconnect) // Enter pre-keys here // handleCommand(Input::OK); // handleCommand(Input::THREE); - handleCommand(Input::SIX); +// handleCommand(Input::SIX); // handleCommand(Input::OK); // handleCommand(Input::UP); // handleCommand(Input::PLAY); // handleCommand(Input::DOWN); // handleCommand(Input::DOWN); // handleCommand(Input::DOWN); - handleCommand(Input::RIGHT); +// handleCommand(Input::RIGHT); // handleCommand(Input::RED); } } diff --git a/defines.h b/defines.h index b3bf12e..01b0f58 100644 --- a/defines.h +++ b/defines.h @@ -76,6 +76,8 @@ int getClockRealTime(struct timespec *tp); #define VOMP_HAS_EXIT + #define FALLTHROUGH + #else int max(int, int); @@ -153,6 +155,8 @@ int getClockRealTime(struct timespec *tp); #define VOMP_LINUX_CLOCK CLOCK_MONOTONIC +#define FALLTHROUGH [[fallthrough]]; + #endif #ifdef VOMP_PLATTFORM_MVP // FIXME OBSOLETE #define Remote_TYPE RemoteMVP diff --git a/dsock.cc b/dsock.cc index c298835..c371009 100644 --- a/dsock.cc +++ b/dsock.cc @@ -51,7 +51,12 @@ int DatagramSocket::init() tv.tv_usec = 0; int allowed = 1; + +#ifdef WIN32 + setsockopt(socketnum, SOL_SOCKET, SO_BROADCAST, reinterpret_cast(&allowed), sizeof(allowed)); +#else setsockopt(socketnum, SOL_SOCKET, SO_BROADCAST, static_cast(&allowed), sizeof(allowed)); +#endif initted = true; @@ -65,7 +70,11 @@ void DatagramSocket::shutdown() initted = false; } +#ifdef WIN32 +unsigned char DatagramSocket::waitforMessage(unsigned char how, SOCKET quitPipe) +#else unsigned char DatagramSocket::waitforMessage(unsigned char how, int quitPipe) +#endif { if (!initted) return 0; diff --git a/dsock.h b/dsock.h index 2fd657d..03fe7b4 100644 --- a/dsock.h +++ b/dsock.h @@ -50,7 +50,11 @@ class DatagramSocket ~DatagramSocket(); int init(); void shutdown(); +#ifdef WIN32 + unsigned char waitforMessage(unsigned char, SOCKET quitPipe = 0); // uchar =0-block =1-new wait =2-continue wait +#else unsigned char waitforMessage(unsigned char, int quitPipe = 0); // uchar =0-block =1-new wait =2-continue wait +#endif UINT getDataLength() const; const void* getData() const; // returns a pointer to the data const char* getFromIPA() const; // returns a pointer to from IP address diff --git a/input.cc b/input.cc index 1314ca3..568fd25 100644 --- a/input.cc +++ b/input.cc @@ -34,7 +34,7 @@ void Input::ResetToDefault() InitHWCListwithDefaults(); } -UCHAR Input::TranslateHWC(int code) +UCHAR Input::TranslateHWC(HWC_TYPE code) { UCHAR ret = TranslateHWCFixed(code); @@ -47,7 +47,7 @@ UCHAR Input::TranslateHWC(int code) return TranslateHWCList(code); } -UCHAR Input::TranslateHWCList(int code) +UCHAR Input::TranslateHWCList(HWC_TYPE code) { if (learnMode != NOLEARNMODE) { diff --git a/input.h b/input.h index af1fdbb..dc8e8de 100644 --- a/input.h +++ b/input.h @@ -26,7 +26,12 @@ #include "defines.h" #include "abstractoption.h" -// FIXME make common base class sendKey function +#ifdef WIN32 +#define HWC_TYPE ULLONG +#else +#define HWC_TYPE int +#endif + class VDR; @@ -44,8 +49,8 @@ class Input: public AbstractOption virtual bool loadOptionsFromServer(VDR* vdr); virtual bool saveOptionstoServer(); - void setHWCtoCommand(ULLONG hcw, UCHAR command); - void unsetHWC(ULLONG hcw); + void setHWCtoCommand(HWC_TYPE hcw, UCHAR command); + void unsetHWC(HWC_TYPE hcw); void LoadKeysConfig(VDR* vdr, const char* keynum); void SaveKeysConfig(); @@ -64,7 +69,7 @@ class Input: public AbstractOption void EnterLearnMode(UCHAR /* command */ ) {}; // Override and set lernMode to command void cancelLearnMode() { learnMode = NOLEARNMODE; } void ResetToDefault(); - virtual std::string getHardwareKeyName(int hardwareKey)=0; + virtual std::string getHardwareKeyName(HWC_TYPE hardwareKey) = 0; const static ULONG NOLEARNMODE = 256; @@ -139,9 +144,9 @@ class Input: public AbstractOption RemoteTranslationList translist; int learnMode{NOLEARNMODE}; - virtual UCHAR TranslateHWCFixed(int code)=0; - UCHAR TranslateHWCList(int code); - UCHAR TranslateHWC(int code); + virtual UCHAR TranslateHWCFixed(HWC_TYPE code) = 0; + UCHAR TranslateHWCList(HWC_TYPE code); + UCHAR TranslateHWC(HWC_TYPE code); void sendInputKey(int key); }; diff --git a/inputman.cc b/inputman.cc index ef13be5..6278a60 100644 --- a/inputman.cc +++ b/inputman.cc @@ -20,9 +20,12 @@ #include "log.h" #include "wremoteconfig.h" #include "wtabbar.h" +#ifdef VOMP_PLATFORM_RASPBERRY #include "inputlinux.h" #include "inputcec.h" +#endif #include "inputudp.h" +#include "inputwin.h" #include "i18n.h" #include "input.h" @@ -47,7 +50,7 @@ InputMan* InputMan::getInstance() bool InputMan::init() { - bool i1{}, i2{}, i3{}; + bool i1{}, i2{}, i3{}, i4{}; #ifdef VOMP_PLATFORM_RASPBERRY inputLinux = new InputLinux(); @@ -63,8 +66,13 @@ bool InputMan::init() i3 = inputUDP->init(); if (!i3) { delete inputUDP; inputUDP = NULL; } +#ifdef WIN32 + inputWin = new InputWin(); + i4 = inputWin->init(); + if (!i4) { delete inputWin; inputWin = NULL; } +#endif - if (!i1 && !i2 && !i3) + if (!i1 && !i2 && !i3 && !i4) { Log::getInstance()->log("InputMan", Log::CRIT, "InputMan could not init any input module"); return false; @@ -80,10 +88,12 @@ bool InputMan::start() bool i1{}, i3{}; +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) { i1 = inputLinux->start(); } +#endif if (inputUDP) { @@ -95,7 +105,11 @@ bool InputMan::start() void InputMan::stop() { + Log::getInstance()->log("InputMan", Log::DEBUG, "Stop called"); + +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) inputLinux->stop(); +#endif if (inputUDP) inputUDP->stop(); } @@ -103,6 +117,8 @@ void InputMan::shutdown() { Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start"); +#ifdef VOMP_PLATFORM_RASPBERRY + if (inputLinux) { Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - Linux"); @@ -120,6 +136,8 @@ void InputMan::shutdown() inputCEC = NULL; } +#endif + if (inputUDP) { Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - UDP"); @@ -142,34 +160,48 @@ bool InputMan::mayHaveFewButtons() bool InputMan::handlesVolume() { +#ifdef VOMP_PLATFORM_RASPBERRY if (!inputCEC) return false; return inputCEC->handlesVolume(); +#else + return false; +#endif } void InputMan::volumeUp() { - if (inputCEC) inputCEC->volumeUp(); +#ifdef VOMP_PLATFORM_RASPBERRY + if (inputCEC) inputCEC->volumeUp(); +#endif } void InputMan::volumeDown() { - if (inputCEC) inputCEC->volumeDown(); +#ifdef VOMP_PLATFORM_RASPBERRY + if (inputCEC) inputCEC->volumeDown(); +#endif } void InputMan::volumeMute() { +#ifdef VOMP_PLATFORM_RASPBERRY if (inputCEC) inputCEC->volumeMute(); +#endif } void InputMan::changePowerState(bool powerOn) { +#ifdef VOMP_PLATFORM_RASPBERRY if (inputCEC) inputCEC->changePowerState(powerOn); +#endif } bool InputMan::addOptionsToPanes(int panenumber, Options* options, WOptionPane* pane) { +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) inputLinux->addOptionsToPanes(panenumber, options, pane); if (inputCEC) inputCEC->addOptionsToPanes(panenumber, options, pane); +#endif return true; // FIXME } @@ -184,17 +216,20 @@ bool InputMan::addOptionPagesToWTB(WTabBar *wtb) bool InputMan::loadOptionsFromServer(VDR* vdr) { +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) inputLinux->loadOptionsFromServer(vdr); if (inputCEC) inputCEC->loadOptionsFromServer(vdr); +#endif return true; // FIXME } bool InputMan::saveOptionstoServer() { +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) inputLinux->saveOptionstoServer(); if (inputCEC) inputCEC->saveOptionstoServer(); - +#endif return true; // FIXME } @@ -310,6 +345,7 @@ std::string InputMan::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey) std::string keyNames; +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) { std::string k = inputLinux->getHardCodedHardwareKeyNamesForVompKey(vompKey); @@ -321,6 +357,7 @@ std::string InputMan::getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey) std::string k = inputCEC->getHardCodedHardwareKeyNamesForVompKey(vompKey); if (k.size()) { keyNames += ", "; keyNames += k; } } +#endif if (inputUDP) { @@ -335,6 +372,7 @@ std::string InputMan::getAllHardwareKeyNamesAssignedToVompKey(UCHAR vompKey) { std::string keyNames; +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) { std::string k = inputLinux->getAllHardwareKeyNamesAssignedToVompKey(vompKey); @@ -346,6 +384,7 @@ std::string InputMan::getAllHardwareKeyNamesAssignedToVompKey(UCHAR vompKey) std::string k = inputCEC->getAllHardwareKeyNamesAssignedToVompKey(vompKey); if (k.size()) { keyNames += ", "; keyNames += k; } } +#endif if (inputUDP) { @@ -358,23 +397,31 @@ std::string InputMan::getAllHardwareKeyNamesAssignedToVompKey(UCHAR vompKey) void InputMan::ResetToDefault() { +#ifdef VOMP_PLATFORM_RASPBERRY + if (inputLinux) inputLinux->ResetToDefault(); if (inputCEC) inputCEC->ResetToDefault(); +#endif + if (inputUDP) inputUDP->ResetToDefault(); } void InputMan::EnterLearningMode(UCHAR vompKey) { +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) inputLinux->EnterLearningMode(vompKey); // if (inputCEC) inputCEC->EnterLearningMode(); FIXME - is there any such thing? +#endif } void InputMan::cancelLearnMode() { +#ifdef VOMP_PLATFORM_RASPBERRY if (inputLinux) inputLinux->cancelLearnMode(); if (inputCEC) inputCEC->cancelLearnMode(); +#endif if (inputUDP) inputUDP->cancelLearnMode(); } diff --git a/inputman.h b/inputman.h index f799afc..b60002b 100644 --- a/inputman.h +++ b/inputman.h @@ -100,6 +100,8 @@ class InputMan: public AbstractOption bool start(); // MessageQueue should be ready before this is called void stop(); // Nothing should be sent to MQ after this + InputWin* getInputWin() { return inputWin; }; + bool mayHaveFewButtons(); bool handlesVolume(); // Returns true if we have an InputCEC willing to handle volume diff --git a/inputudp.cc b/inputudp.cc index a052a35..1834e1a 100644 --- a/inputudp.cc +++ b/inputudp.cc @@ -18,13 +18,17 @@ */ #include +#ifndef WIN32 #include +#endif #include "dsock.h" #include "log.h" #include "inputudp.h" +const char* InputUDP::myModName = "InputUDP"; + bool InputUDP::init() { if (initted) return false; @@ -41,9 +45,16 @@ bool InputUDP::init() return false; } +#ifdef WIN32 + quitPipe = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (quitPipe == INVALID_SOCKET) + { + Log::getInstance()->log("InputUDP", Log::ERR, "Win32 socket fail"); +#else if (pipe2(pfds, O_NONBLOCK) == -1) { Log::getInstance()->log("InputUDP", Log::ERR, "pipe2() fail"); +#endif ds->shutdown(); delete ds; initted = false; @@ -55,11 +66,18 @@ bool InputUDP::init() void InputUDP::shutdown() { +#ifdef WIN32 + CLOSESOCKET(quitPipe); +#endif + + ds->shutdown(); delete ds; - close(pfds[1]); - close(pfds[0]); +#ifndef WIN32 + CLOSESOCKET(pfds[1]); + CLOSESOCKET(pfds[0]); +#endif initted = false; } @@ -87,7 +105,13 @@ void InputUDP::stop() if (listenThread.joinable()) { +#ifdef WIN32 + Log::getInstance()->log("InputUDP", Log::DEBUG, "Calling CLOSESOCKET on WIN32 quitPipe"); + + CLOSESOCKET(quitPipe); +#else write(pfds[1], "1", 1); // break the select in listenLoop +#endif listenThread.join(); } } @@ -97,7 +121,12 @@ void InputUDP::listenLoop() int retval; while(1) { +#ifdef WIN32 + retval = ds->waitforMessage(3, quitPipe); +#else retval = ds->waitforMessage(3, pfds[0]); +#endif + Log::getInstance()->log("InputUDP", Log::DEBUG, "Back from waitForMessage"); if (retval == 2) { @@ -105,6 +134,7 @@ void InputUDP::listenLoop() } else if (retval == 3) // quit { + Log::getInstance()->log("InputUDP", Log::DEBUG, "quit"); break; } else @@ -134,7 +164,7 @@ const char* InputUDP::getHardCodedHardwareKeyNamesForVompKey(UCHAR /* vompKey */ return ""; } -std::string InputUDP::getHardwareKeyName(int /* hardwareKey */) +std::string InputUDP::getHardwareKeyName(HWC_TYPE /* hardwareKey */) { std::string retval; return retval; diff --git a/inputudp.h b/inputudp.h index 3b18057..45a0146 100644 --- a/inputudp.h +++ b/inputudp.h @@ -24,6 +24,10 @@ #include #include +#ifdef WIN32 +#include +#endif + #include "defines.h" #include "input.h" @@ -41,12 +45,12 @@ class InputUDP : public Input // InputUDP doesn't do any translation stuff so just keep everything happy here void InitHWCListwithDefaults() {}; - UCHAR TranslateHWCFixed(int code) { return static_cast(code); }; + UCHAR TranslateHWCFixed(HWC_TYPE code) { return static_cast(code); }; const char* getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey); - std::string getHardwareKeyName(int hardwareKey); + std::string getHardwareKeyName(HWC_TYPE hardwareKey); private: - static constexpr const char* myModName = "InputUDP"; + static const char* myModName; const char* modName() { return myModName; } bool initted{}; @@ -57,7 +61,12 @@ class InputUDP : public Input std::mutex threadStartProtect; void listenLoop(); bool listenLoopStop{}; + +#ifdef WIN32 + SOCKET quitPipe; +#else int pfds[2]; +#endif void processRequest(const void* data, UINT length); }; diff --git a/remotewin.cc b/inputwin.cc similarity index 64% rename from remotewin.cc rename to inputwin.cc index 52d7025..d40d31c 100644 --- a/remotewin.cc +++ b/inputwin.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2020 Chris Tallon This file is part of VOMP. @@ -13,14 +13,14 @@ 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. + You should have received a copy of the GNU General Public License + along with VOMP. If not, see . */ -#include "remotewin.h" #include "vompreswin.h" #include "i18n.h" +#include "log.h" +#include "inputwin.h" #define W_G_HCW(type,code) ( (((ULLONG)(type))<<32) | code) @@ -29,43 +29,40 @@ #define W_HCW_RI 3 /* remote control */ #define W_HCW_CH 4 /* char */ -RemoteWin::RemoteWin() +const char* InputWin::myModName = "InputWin"; + +InputWin::InputWin() { - initted = 0; - curevent=0; - hascurevent=false; - signal=false; } -RemoteWin::~RemoteWin() +InputWin::~InputWin() { } -int RemoteWin::init(const char* devName) +bool InputWin::init() { - if (initted) return 0; - initted = 1; - event = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL); - - - return 1; + if (initted) return false; + initted = true; + event = CreateEvent(NULL, /*FALSE*/TRUE, FALSE, NULL); + return true; } -int RemoteWin::shutdown() +void InputWin::shutdown() { - if (!initted) return 0; + if (!initted) return; + Log::getInstance()->log("InputWin", Log::DEBUG, "Shutdown called"); CloseHandle(event); - initted = 0; - return 1; + initted = false; } +/* UCHAR RemoteWin::getButtonPress(int waitType) { - /* how = 0 - block + / * how = 0 - block how = 1 - start new wait how = 2 - continue wait how = 3 - no wait - */ + * / DWORD wait; @@ -99,85 +96,86 @@ UCHAR RemoteWin::getButtonPress(int waitType) return temp2; } +*/ -UCHAR RemoteWin::TranslateHWCFixed(ULLONG code) +UCHAR InputWin::TranslateHWCFixed(HWC_TYPE code) { - switch (code) - { + switch (code) + { case W_G_HCW(W_HCW_VK,VK_DOWN): - return DOWN; + return DOWN; case W_G_HCW(W_HCW_VK,VK_UP): - return UP; + return UP; case W_G_HCW(W_HCW_VK,VK_LEFT): - return LEFT; + return LEFT; case W_G_HCW(W_HCW_VK,VK_RIGHT): - return RIGHT; + return RIGHT; case W_G_HCW(W_HCW_CH,'m'): - return MENU; + return MENU; case W_G_HCW(W_HCW_VK,VK_BACK): - return BACK; + return BACK; case W_G_HCW(W_HCW_VK,VK_RETURN): case W_G_HCW(W_HCW_VK,VK_SPACE): - return OK; + return OK; /* Menu IDs, no sense to make it user selectable */ case W_G_HCW(W_HCW_AP,APPCOMMAND_BROWSER_BACKWARD): - return BACK; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_CHANNEL_DOWN): - return CHANNELDOWN;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_CHANNEL_UP): - return CHANNELUP;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_FAST_FORWARD): - return FORWARD;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_VOLUME_MUTE): - return MUTE;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_PAUSE): - return PAUSE;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_PLAY): - return PLAY;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_RECORD): - return RECORD;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_PREVIOUSTRACK): - return SKIPBACK;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_REWIND): - return REVERSE;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_NEXTTRACK): - return SKIPFORWARD;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_STOP): - return STOP;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_VOLUME_DOWN): - return VOLUMEDOWN;break; - case W_G_HCW(W_HCW_AP,APPCOMMAND_VOLUME_UP): - return VOLUMEUP;break; - case W_G_HCW(W_HCW_AP,VOMP_YELLOW): - return YELLOW; break; - case W_G_HCW(W_HCW_AP,VOMP_BLUE): - return BLUE;break; - case W_G_HCW(W_HCW_AP,VOMP_RED): - return RED;break; - case W_G_HCW(W_HCW_AP,VOMP_GREEN): - return GREEN;break; - case W_G_HCW(W_HCW_AP,VOMP_ENTER): - return OK;break; - case W_G_HCW(W_HCW_AP,VOMP_CANCEL): - return BACK;break; - case W_G_HCW(W_HCW_AP,VOMP_UP): - return UP;break; - case W_G_HCW(W_HCW_AP,VOMP_DOWN): - return DOWN;break; - case W_G_HCW(W_HCW_AP,VOMP_LEFT): - return LEFT;break; - case W_G_HCW(W_HCW_AP,VOMP_RIGHT): - return RIGHT;break; + return BACK; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_CHANNEL_DOWN): + return CHANNELDOWN; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_CHANNEL_UP): + return CHANNELUP; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_FAST_FORWARD): + return FORWARD; + case W_G_HCW(W_HCW_AP,APPCOMMAND_VOLUME_MUTE): + return MUTE; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_PAUSE): + return PAUSE; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_PLAY): + return PLAY; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_RECORD): + return RECORD; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_PREVIOUSTRACK): + return SKIPBACK; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_REWIND): + return REVERSE; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_NEXTTRACK): + return SKIPFORWARD; + case W_G_HCW(W_HCW_AP,APPCOMMAND_MEDIA_STOP): + return STOP; + case W_G_HCW(W_HCW_AP,APPCOMMAND_VOLUME_DOWN): + return VOLUMEDOWN; + case W_G_HCW(W_HCW_AP,APPCOMMAND_VOLUME_UP): + return VOLUMEUP; + case W_G_HCW(W_HCW_AP,VOMP_YELLOW): + return YELLOW; + case W_G_HCW(W_HCW_AP,VOMP_BLUE): + return BLUE; + case W_G_HCW(W_HCW_AP,VOMP_RED): + return RED; + case W_G_HCW(W_HCW_AP,VOMP_GREEN): + return GREEN; + case W_G_HCW(W_HCW_AP,VOMP_ENTER): + return OK; + case W_G_HCW(W_HCW_AP,VOMP_CANCEL): + return BACK; + case W_G_HCW(W_HCW_AP,VOMP_UP): + return UP; + case W_G_HCW(W_HCW_AP,VOMP_DOWN): + return DOWN; + case W_G_HCW(W_HCW_AP,VOMP_LEFT): + return LEFT; + case W_G_HCW(W_HCW_AP,VOMP_RIGHT): + return RIGHT; case POWER: return POWER; default: return NA_UNKNOWN; - }; + } } -const char*RemoteWin::HardcodedTranslateStr(UCHAR command) +const char* InputWin::getHardCodedHardwareKeyNameForVompKey(UCHAR vompKey) { - switch (command) + switch (vompKey) { case DOWN: return tr("Down"); @@ -221,12 +219,10 @@ const char*RemoteWin::HardcodedTranslateStr(UCHAR command) return "C+P"; default: return NULL; - }; - + } } - -void RemoteWin::InitHWCListwithDefaults() +void InputWin::InitHWCListwithDefaults() { //Processing VK_Messages translist[W_G_HCW(W_HCW_CH,'9')] = NINE; @@ -251,47 +247,50 @@ void RemoteWin::InitHWCListwithDefaults() translist[W_G_HCW(W_HCW_RI,0x35b)] = RED; translist[W_G_HCW(W_HCW_RI,0x35d)] = YELLOW; translist[W_G_HCW(W_HCW_RI,0x35e)] = BLUE; - translist[W_G_HCW(W_HCW_RI,0x30d)] = MENU;//MCE Button, used for Menu + translist[W_G_HCW(W_HCW_RI,0x30d)] = MENU; //MCE Button, used for Menu translist[W_G_HCW(W_HCW_RI,0x348)] = RECORD; //Record Television translist[W_G_HCW(W_HCW_RI,0x325)] = PLAY; //Playback Televison translist[W_G_HCW(W_HCW_RI,0x324)] = PLAY; //Playback DVD - translist[W_G_HCW(W_HCW_RI,0x209)] = OK;//Properties - translist[W_G_HCW(W_HCW_RI,0x35a)] = OK;//Teletext? - + translist[W_G_HCW(W_HCW_RI,0x209)] = OK; //Properties + translist[W_G_HCW(W_HCW_RI,0x35a)] = OK; //Teletext? } -char* RemoteWin::HCWDesc(ULLONG hcw) +std::string InputWin::getHardwareKeyName(HWC_TYPE hardwareKey) { //Determine type - ULONG type = hcw >> 32; - char *rt=NULL; + ULONG type = hardwareKey >> 32; + char rt[10]; + switch(type) { - case W_HCW_VK:{ - ULONG vk=(ULONG)hcw; - ULONG scancode=MapVirtualKey(vk,0); - rt=new char[10]; - GetKeyNameText(scancode << 16,rt,10); - }break; - case W_HCW_CH:{ - ULONG ch=(ULONG)hcw; - ULONG scancode=OemKeyScan(ch); - - rt=new char[10]; - GetKeyNameText(scancode << 16,rt,10); - }break; - case W_HCW_RI:{ - ULONG ri=(ULONG)hcw; - rt=new char[10]; - sprintf(rt,"R: %X",ri); - }break; - - }; - return rt; -} + case W_HCW_VK: + { + ULONG vk = (ULONG)hardwareKey; + ULONG scancode = MapVirtualKey(vk,0); + GetKeyNameText(scancode << 16, rt, 10); + break; + } + case W_HCW_CH: + { + ULONG ch = (ULONG)hardwareKey; + ULONG scancode = OemKeyScan(ch); + GetKeyNameText(scancode << 16, rt, 10); + break; + } + case W_HCW_RI: + { + ULONG ri = (ULONG)hardwareKey; + sprintf(rt, "R: %X", ri); + break; + } + } + std::string retval = rt; + return retval; +} -int RemoteWin::ReceiveButtonVK(UINT button) { +int InputWin::ReceiveButtonVK(UINT button) +{ /* UCHAR pb=NA_NONE; //should we use a translation table ? No APPCOMMAND iS DWORD! switch (button) { //Processing VK_Messages @@ -358,28 +357,38 @@ int RemoteWin::ReceiveButtonVK(UINT button) { }; //All other commands are process via APPCOMMAND_MESSAGES if (pb==NA_NONE) return 0;*/ - UCHAR pb=NA_NONE; - pb=TranslateHWC(W_G_HCW(W_HCW_VK,button)); - if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; - curevent=pb; + + UCHAR pb = TranslateHWC(W_G_HCW(W_HCW_VK,button)); + if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; + sendInputKey(pb); + return 1; + + /* + curevent=pb; hascurevent=true; //PulseEvent(event); SetEvent(event); - return 1; + return 1; */ } -int RemoteWin::ReceiveButtonCH(UINT button) { - UCHAR pb=NA_NONE; - pb=TranslateHWC(W_G_HCW(W_HCW_CH,button)); - if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; - curevent=pb; +int InputWin::ReceiveButtonCH(UINT button) +{ + UCHAR pb = TranslateHWC(W_G_HCW(W_HCW_CH,button)); + if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; + sendInputKey(pb); + return 1; + + + /* + curevent=pb; hascurevent=true; //PulseEvent(event); SetEvent(event); - return 1; + return 1; */ } -int RemoteWin::ReceiveButtonAP(UINT button) { +int InputWin::ReceiveButtonAP(UINT button) +{ /* UCHAR pb=NA_NONE; //should we use a translation table ? No APPCOMMAND iS DWORD! switch (button) { //Processing VK_Messages @@ -434,17 +443,23 @@ int RemoteWin::ReceiveButtonAP(UINT button) { };*/ //if (pb==NA_NONE) return 0; - UCHAR pb=NA_NONE; - pb=TranslateHWC(W_G_HCW(W_HCW_AP,button)); - if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; - curevent=pb; + + + UCHAR pb = TranslateHWC(W_G_HCW(W_HCW_AP,button)); + if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; + sendInputKey(pb); + return 1; + + /* + curevent=pb; hascurevent=true; //PulseEvent(event); SetEvent(event); - return 1; + return 1; */ } -int RemoteWin::ReceiveButtonRI(UINT button) { +int InputWin::ReceiveButtonRI(UINT button) +{ //UCHAR pb=NA_NONE; //Raw Input /* Note Codes above 0x29c are not listed in the specs on usb.org @@ -477,27 +492,34 @@ int RemoteWin::ReceiveButtonRI(UINT button) { }; if (pb==NA_NONE) return 0;*/ - UCHAR pb=NA_NONE; - pb=TranslateHWC(W_G_HCW(W_HCW_RI,button)); - if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; - curevent=pb; + UCHAR pb = TranslateHWC(W_G_HCW(W_HCW_RI,button)); + if (pb==NA_UNKNOWN || pb==NA_NONE) return 0; + sendInputKey(pb); + return 1; + + /* + curevent=pb; hascurevent=true; //PulseEvent(event); SetEvent(event); - return 1; + return 1; */ } -void RemoteWin::Signal() { - signal=true; +/* +void InputWin::Signal() +{ + signal = true; //PulseEvent(event); SetEvent(event); } +*/ -void RemoteWin::SendPower() +void InputWin::SendPower() { - + /* curevent=POWER; - hascurevent=true; + hascurevent=true; SetEvent(event); + */ + sendInputKey(POWER); } - diff --git a/inputwin.h b/inputwin.h new file mode 100644 index 0000000..629a90c --- /dev/null +++ b/inputwin.h @@ -0,0 +1,62 @@ +/* + 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 INPUTWIN_H +#define INPUTWIN_H + +#define _WIN32_WINNT 0x501 +#include +#include + +#include "defines.h" +#include "input.h" + +class InputWin : public Input +{ + public: + InputWin(); + ~InputWin(); + + bool init(); + void shutdown(); + //int getDevice(); + //UCHAR getButtonPress(int how); + // void Signal(); + int ReceiveButtonVK(UINT button); //Windows Message from WND_PROC (Virtual Key) + int ReceiveButtonCH(UINT button); //Windows Message from WND_PROC (char) + int ReceiveButtonAP(UINT button); // (App command) + int ReceiveButtonRI(UINT button); // (Remote control) + void SendPower(); + void InitHWCListwithDefaults(); + const char* getHardCodedHardwareKeyNameForVompKey(UCHAR vompKey); + std::string getHardwareKeyName(HWC_TYPE hardwareKey); + + private: + static const char* myModName; + const char* modName() { return myModName; } + + bool initted{}; + bool signal{}; + UCHAR curevent{}; + bool hascurevent{}; + HANDLE event; + UCHAR TranslateHWCFixed(HWC_TYPE code); +}; + +#endif diff --git a/log.cc b/log.cc index cd8e286..52250bc 100644 --- a/log.cc +++ b/log.cc @@ -80,9 +80,9 @@ int Log::init(int startLogLevel, const char* fileName, int tenabled) initted = 1; logLevel = startLogLevel; enabled = tenabled; -// logfile = fopen(fileName, "a"); + logfile = fopen(fileName, "a"); // logfile = fopen(stdout, "a"); - logfile = stdout; + //logfile = stdout; // logfile = fopen("/log", "a"); if (logfile) return 1; diff --git a/remotewin.h b/remotewin.h deleted file mode 100644 index 3fd5434..0000000 --- a/remotewin.h +++ /dev/null @@ -1,67 +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. -*/ - -#ifndef REMOTEWIN_H -#define REMOTEWIN_H - -#include - -#include "defines.h" -#include "log.h" -#include "input.h" - -#define _WIN32_WINNT 0x501 -#include -#include - - - -class RemoteWin : public Remote -{ - public: - RemoteWin(); - ~RemoteWin(); - - int init(const char *devName); - int shutdown(); - int getDevice(); - UCHAR getButtonPress(int how); - void Signal(); - int ReceiveButtonVK(UINT button);//Windows Message from WND_PROC - int ReceiveButtonCH(UINT button);//Windows Message from WND_PROC - int ReceiveButtonAP(UINT button); - int ReceiveButtonRI(UINT button); - void SendPower(); - void InitHWCListwithDefaults(); - const char*HardcodedTranslateStr(UCHAR command); - char* HCWDesc(ULLONG hcw); - - - private: - int initted; - bool signal; - UCHAR curevent; - bool hascurevent; - HANDLE event; - UCHAR TranslateHWCFixed(ULLONG code); -}; - -#endif - diff --git a/tcp.cc b/tcp.cc index bbee70d..74eb7a3 100644 --- a/tcp.cc +++ b/tcp.cc @@ -229,7 +229,12 @@ int TCP::connectTo(char* host, unsigned short port) int soError; // SO_ERROR optval is int socklen_t soErrorSize = sizeof(soError); + +#ifdef WIN32 + int gso = getsockopt(sock, SOL_SOCKET, SO_ERROR, reinterpret_cast(&soError), &soErrorSize); +#else int gso = getsockopt(sock, SOL_SOCKET, SO_ERROR, reinterpret_cast(&soError), &soErrorSize); +#endif if ((gso == 0) && (soError == 0)) { @@ -265,7 +270,11 @@ void TCP::setReceiveWindow(size_t rxBufferSize) // Set receive window // According to docs, optval in setsockopt is a pointer to int unless otherwise noted int rxSize = rxBufferSize; +#ifdef WIN32 + int r = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&rxSize), sizeof(size_t)); +#else int r = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&rxSize), sizeof(size_t)); +#endif Log::getInstance()->log("TCP", Log::DEBUG, "Set receive window to %i, success(=0): %i", rxBufferSize, r); } diff --git a/threadwin.h b/threadwin.h index 4d6901d..2060307 100644 --- a/threadwin.h +++ b/threadwin.h @@ -39,7 +39,7 @@ class ThreadWin : public Thread // Override this method in derived classes virtual void threadMethod()=0; - virtual void threadPostStopCleanup()=0; + virtual void threadPostStopCleanup() {}; ThreadWin(); ~ThreadWin(); diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index 81cc05c..52dc306 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -182,7 +182,8 @@ int VRecordingMenu::handleCommand(int command) return 2; } - [[fallthrough]]; // it won't, as long as sl.getCurrentOptionData() is 1-5, but keep the compiler happy + FALLTHROUGH + // it won't, as long as sl.getCurrentOptionData() is 1-5, but keep the compiler happy } case Input::BACK: { diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 019ef52..bce617f 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -314,7 +314,7 @@ int VVideoLiveTV::handleCommand(int command) } // else drop through to stop } - [[fallthrough]]; + FALLTHROUGH case Input::STOP: { stop(); diff --git a/vvideorec.cc b/vvideorec.cc index 0be0d5c..478f8a0 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -246,7 +246,7 @@ int VVideoRec::handleCommand(int command) return 2; } } - [[fallthrough]]; + FALLTHROUGH case Input::STOP: case Input::MENU: { diff --git a/winmain.cc b/winmain.cc index 7b1c0e2..cb13e36 100644 --- a/winmain.cc +++ b/winmain.cc @@ -1,5 +1,6 @@ /* Copyright 2004-2005 Chris Tallon + Copyright 2012 Marten Richter This file is part of VOMP. @@ -30,7 +31,8 @@ #include "defines.h" #include "log.h" -#include "remotewin.h" +#include "inputman.h" +#include "inputwin.h" #include "ledwin.h" #include "timers.h" #include "videowin.h" @@ -54,7 +56,8 @@ void shutdown(int code); // Global variables -------------------------------------------------------------------------------------------------- int debugEnabled = 0; Log* logger; -Remote* remote; +InputMan* remote; +InputWin* inputWin; Led* led; Osd* osd; Timers* timers; @@ -158,7 +161,7 @@ INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmd // Init global vars ------------------------------------------------------------------------------------------------ logger = new Log(); - remote = new RemoteWin(); + remote = new InputMan(); led = new LedWin(); timers = new Timers(); osd = new Osd_TYPE(); @@ -197,7 +200,7 @@ INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmd // Init modules ---------------------------------------------------------------------------------------------------- int success; - success = remote->init("/dev/rawir"); + success = remote->init(); if (success) { logger->log("Core", Log::INFO, "Remote module initialised"); @@ -210,6 +213,8 @@ INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmd return 0; } + inputWin = remote->getInputWin(); + success = led->init(0); if (success) { @@ -564,7 +569,9 @@ 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*)Input::getInstance())->SendPower(); + //inputWin->SendPower(); // FIXME this could be the only call + command->stop(); + PostQuitMessage(0); }break; case WM_SIZING: { @@ -595,7 +602,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) } break; case WM_KEYDOWN: - if (((RemoteWin*)remote)->ReceiveButtonVK(wparam)) { + if (inputWin->ReceiveButtonVK(wparam)) { return 0L; //We process that Key } else { return DefWindowProc(wind, msg, wparam, lparam); @@ -603,7 +610,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) break; case WM_CHAR: - if (((RemoteWin*)remote)->ReceiveButtonCH(wparam)) { + if (inputWin->ReceiveButtonCH(wparam)) { return 0L; //We process that Key } else { return DefWindowProc(wind, msg, wparam, lparam); @@ -611,7 +618,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) break; case WM_APPCOMMAND: - if (((RemoteWin*)remote)->ReceiveButtonAP(GET_APPCOMMAND_LPARAM(lparam))){ + if (inputWin->ReceiveButtonAP(GET_APPCOMMAND_LPARAM(lparam))){ return TRUE; //yes we process that message } else { return DefWindowProc(wind, msg, wparam, lparam); @@ -629,7 +636,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) if (lpit->header.dwType==RIM_TYPEHID && lpit->data.hid.dwSizeHid>=2) { DWORD button=lpit->data.hid.bRawData[1] | (lpit->data.hid.bRawData[0]<< 8); - if (((RemoteWin*)remote)->ReceiveButtonRI(button)){ + if (inputWin->ReceiveButtonRI(button)){ free(lpit); return 0; //yes we process that message } @@ -649,7 +656,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) ToggleTopmost(); return 0; } - if (((RemoteWin*)remote)->ReceiveButtonAP(LOWORD(wparam))){ + if (inputWin->ReceiveButtonAP(LOWORD(wparam))){ return 0; //yes we process that message } else { return DefWindowProc(wind, msg, wparam, lparam); diff --git a/wol.cc b/wol.cc index f54e9e8..3f9a71a 100644 --- a/wol.cc +++ b/wol.cc @@ -273,7 +273,11 @@ int Wol::doWakeUp() *ptr++ = ethaddr [i]; /* Send the packet out */ - if (sendto (packet, static_cast(buf), 102, 0, reinterpret_cast(&sap), sizeof (sap)) < 0) +#ifdef WIN32 + if (sendto(packet, reinterpret_cast(buf), 102, 0, reinterpret_cast(&sap), sizeof (sap)) < 0) +#else + if (sendto(packet, static_cast(buf), 102, 0, reinterpret_cast(&sap), sizeof(sap)) < 0) +#endif { fprintf (stderr, " sendto failed, %s\n", strerror(errno)); diff --git a/wwinaudiofilter.cc b/wwinaudiofilter.cc index de04858..bfa48a2 100644 --- a/wwinaudiofilter.cc +++ b/wwinaudiofilter.cc @@ -216,7 +216,7 @@ int WWinAudioFilter::handleCommand(int command) case Input::OK: { AudioWin*aw=(AudioWin*)Audio::getInstance(); - aw->selectAudioFilter(sl.getCurrentOptionData()); + aw->selectAudioFilter(reinterpret_cast(sl.getCurrentOptionData())); return 1; } diff --git a/wwinmp3audiofilter.cc b/wwinmp3audiofilter.cc index f1756ff..751cc1e 100644 --- a/wwinmp3audiofilter.cc +++ b/wwinmp3audiofilter.cc @@ -62,7 +62,7 @@ void WWinMp3AudioFilter::initSelectList(bool startup) { char * desc=new char [strlen(name)+1]; strcpy(desc,name); - sl.addOption(desc,i,0); + sl.addOption(desc, reinterpret_cast(i), 0); } } @@ -227,7 +227,7 @@ int WWinMp3AudioFilter::handleCommand(int command) case Input::OK: { AudioWin*aw=(AudioWin*)Audio::getInstance(); - aw->selectMp3AudioFilter(sl.getCurrentOptionData()); + aw->selectMp3AudioFilter(reinterpret_cast(sl.getCurrentOptionData())); return 1; } diff --git a/wwinvideofilter.cc b/wwinvideofilter.cc index 93306c6..d3a759f 100644 --- a/wwinvideofilter.cc +++ b/wwinvideofilter.cc @@ -87,12 +87,12 @@ void WWinVideoFilter::draw() if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT); sl.draw(); - if (!(*list)[sl.getCurrentOptionData()].vmr9tested) + if (!(*list)[reinterpret_cast(sl.getCurrentOptionData())].vmr9tested) { rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW); drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT); } - else if ((*list)[sl.getCurrentOptionData()].vmr9) + else if ((*list)[reinterpret_cast(sl.getCurrentOptionData())].vmr9) { rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN); drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT); @@ -213,7 +213,7 @@ int WWinVideoFilter::handleCommand(int command) case Input::OK: { VideoWin*vw=(VideoWin*)Video::getInstance(); - vw->selectVideoFilter(sl.getCurrentOptionData()); + vw->selectVideoFilter(reinterpret_cast(sl.getCurrentOptionData())); return 1; } case Input::BACK: diff --git a/wwinvideoh264filter.cc b/wwinvideoh264filter.cc index 6bff0ac..c0c4e18 100644 --- a/wwinvideoh264filter.cc +++ b/wwinvideoh264filter.cc @@ -59,7 +59,7 @@ void WWinVideoH264Filter::initSelectList(bool startup) { char * desc=new char [strlen(name)+1]; strcpy(desc,name); - sl.addOption(desc,i,0); + sl.addOption(desc, reinterpret_cast(i), 0); } } @@ -87,12 +87,12 @@ void WWinVideoH264Filter::draw() if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT); sl.draw(); - if (!(*list)[sl.getCurrentOptionData()].vmr9tested) + if (!(*list)[reinterpret_cast(sl.getCurrentOptionData())].vmr9tested) { rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW); drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT); } - else if ((*list)[sl.getCurrentOptionData()].vmr9) + else if ((*list)[reinterpret_cast(sl.getCurrentOptionData())].vmr9) { rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN); drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT); @@ -213,7 +213,7 @@ int WWinVideoH264Filter::handleCommand(int command) case Input::OK: { VideoWin*vw=(VideoWin*)Video::getInstance(); - vw->selectVideoH264Filter(sl.getCurrentOptionData()); + vw->selectVideoH264Filter(reinterpret_cast(sl.getCurrentOptionData())); return 1; } case Input::BACK: -- 2.39.2