]> git.vomp.tv Git - vompclient.git/commitdiff
WIP - Windows implementation
authorChris Tallon <chris@vomp.tv>
Tue, 18 Feb 2020 18:29:44 +0000 (18:29 +0000)
committerChris Tallon <chris@vomp.tv>
Tue, 18 Feb 2020 18:29:44 +0000 (18:29 +0000)
26 files changed:
command.cc
defines.h
dsock.cc
dsock.h
input.cc
input.h
inputman.cc
inputman.h
inputudp.cc
inputudp.h
inputwin.cc [new file with mode: 0644]
inputwin.h [new file with mode: 0644]
log.cc
remotewin.cc [deleted file]
remotewin.h [deleted file]
tcp.cc
threadwin.h
vrecordingmenu.cc
vvideolivetv.cc
vvideorec.cc
winmain.cc
wol.cc
wwinaudiofilter.cc
wwinmp3audiofilter.cc
wwinvideofilter.cc
wwinvideoh264filter.cc

index ab7b75850d9baf09436ff49cbb4a376e088630f4..191011d5cdbbb9342fb676ba547c54fc448227e5 100644 (file)
@@ -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);
   }
 }
index b3bf12e728be663780b430f7a92191296144b6db..01b0f58e42c2bc2433284226e1a6509d8d821f9b 100644 (file)
--- 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
index c298835358f81c3c666d7f8cd015727b9f8cb468..c37100988fa08cc0b052a021716a83e8e9b34a6b 100644 (file)
--- 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<char*>(&allowed), sizeof(allowed));
+#else
   setsockopt(socketnum, SOL_SOCKET, SO_BROADCAST, static_cast<void*>(&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 2fd657d6e0497b93bf1f3cce0f45db413d6dea68..03fe7b46e092a5d96769a006cd5677199480a301 100644 (file)
--- 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
index 1314ca3c319b21218677361aff23f866d0c032af..568fd25824b004b65b7ad75c958d5d8ec2921457 100644 (file)
--- 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 af1fdbbc4770785915aea23042f7bec51a358b2d..dc8e8de1b86e11bce03c331d4263e55f740d5ebf 100644 (file)
--- a/input.h
+++ b/input.h
 #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);
 };
index ef13be5448bc9df2094fe5acbb633784d5f0e5fb..6278a609d60a50d00193b902eff11039f1881a46 100644 (file)
 #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();
 }
index f799afce00aedcf0d148f3936eec2fe390d6ed15..b60002b938ca83b0be927146d132cfcdb8f93c35 100644 (file)
@@ -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
index a052a35f15414ad49fff19467a83bb4da4b3cfb6..1834e1ade0dee56263374e86257ab505ac9c1089 100644 (file)
 */
 
 #include <fcntl.h>
+#ifndef WIN32
 #include <unistd.h>
+#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;
index 3b1805724be1b39c6b9882230d479bf0b903fd29..45a014673f7de59d462a0c1506b98b4b897eeb16 100644 (file)
 #include <thread>
 #include <mutex>
 
+#ifdef WIN32
+#include <winsock2.h>
+#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<UCHAR>(code); };
+    UCHAR TranslateHWCFixed(HWC_TYPE code) { return static_cast<UCHAR>(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/inputwin.cc b/inputwin.cc
new file mode 100644 (file)
index 0000000..d40d31c
--- /dev/null
@@ -0,0 +1,525 @@
+/*
+    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 <https://www.gnu.org/licenses/>.
+*/
+
+#include "vompreswin.h"
+#include "i18n.h"
+#include "log.h"
+#include "inputwin.h"
+
+#define W_G_HCW(type,code) ( (((ULLONG)(type))<<32) | code)
+
+#define W_HCW_VK 1 /* virtual key */
+#define W_HCW_AP 2 /* App command */
+#define W_HCW_RI 3 /* remote control */
+#define W_HCW_CH 4 /* char */
+
+const char* InputWin::myModName = "InputWin";
+
+InputWin::InputWin()
+{
+}
+
+InputWin::~InputWin()
+{
+}
+
+bool InputWin::init()
+{
+  if (initted) return false;
+  initted = true;
+  event = CreateEvent(NULL, /*FALSE*/TRUE, FALSE, NULL);
+  return true;
+}
+
+void InputWin::shutdown()
+{
+  if (!initted) return;
+  Log::getInstance()->log("InputWin", Log::DEBUG, "Shutdown called");
+  CloseHandle(event);
+  initted = false;
+}
+
+/*
+UCHAR RemoteWin::getButtonPress(int waitType)
+{
+  / * how = 0 - block
+     how = 1 - start new wait
+     how = 2 - continue wait
+     how = 3 - no wait
+  * /
+  DWORD wait;
+  
+
+  if (hascurevent) {
+         UCHAR temp=curevent;
+      hascurevent=false;
+
+         return temp;
+  }
+  if (waitType==3) {
+         return NA_NONE;
+  }
+  if (waitType==0) {
+         wait=INFINITE;
+  } else { //We do not distingish between 2 and 3
+         wait=1000;
+
+  }
+  WaitForSingleObject(event,wait);
+  ResetEvent(event);
+  if (!hascurevent) {
+         if (signal) {
+                 signal=false;
+                 return NA_SIGNAL; //Since we have no signals on windows, we simulate this
+         } else {
+                 return NA_NONE;
+         }
+  }
+  UCHAR temp2=curevent;
+  hascurevent=false;
+  return temp2;
+  
+}
+*/
+
+UCHAR InputWin::TranslateHWCFixed(HWC_TYPE code)
+{
+  switch (code) 
+  {
+    case W_G_HCW(W_HCW_VK,VK_DOWN):
+      return DOWN;
+    case W_G_HCW(W_HCW_VK,VK_UP):
+      return UP;
+    case W_G_HCW(W_HCW_VK,VK_LEFT):
+      return LEFT;
+    case W_G_HCW(W_HCW_VK,VK_RIGHT):
+      return RIGHT;
+    case W_G_HCW(W_HCW_CH,'m'):
+      return MENU;
+    case W_G_HCW(W_HCW_VK,VK_BACK):
+      return BACK;
+    case W_G_HCW(W_HCW_VK,VK_RETURN):
+    case W_G_HCW(W_HCW_VK,VK_SPACE):
+      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;
+         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* InputWin::getHardCodedHardwareKeyNameForVompKey(UCHAR vompKey)
+{
+    switch (vompKey) 
+    {
+    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");
+    case CHANNELDOWN:
+        return tr("Insrt, C+Insrt, Pg down");
+    case CHANNELUP:
+        return tr("+, C++, Pg up");
+    case VOLUMEUP:
+        return "F10";
+    case VOLUMEDOWN:
+        return "F9";
+    case POWER:
+        return "Esc, A+F4";
+    case MUTE:
+        return "F8";
+    case REVERSE:
+        return"S+C+B";
+    case FORWARD:
+        return "S+C+F";
+    case SKIPBACK:
+        return "C+B";
+    case SKIPFORWARD:
+        return "C+F";
+    case PLAY:
+        return "S+P";
+    case STOP:
+        return "C+S";
+    case PAUSE:
+        return "C+P";
+    default:
+        return NULL;
+    }
+}
+
+void InputWin::InitHWCListwithDefaults()
+{
+    //Processing VK_Messages
+    translist[W_G_HCW(W_HCW_CH,'9')] = NINE;
+    translist[W_G_HCW(W_HCW_CH,'8')] = EIGHT;
+    translist[W_G_HCW(W_HCW_CH,'7')] = SEVEN;
+    translist[W_G_HCW(W_HCW_CH,'6')] = SIX;
+    translist[W_G_HCW(W_HCW_CH,'5')] = FIVE;
+    translist[W_G_HCW(W_HCW_CH,'4')] = FOUR;
+    translist[W_G_HCW(W_HCW_CH,'3')] = THREE;
+    translist[W_G_HCW(W_HCW_CH,'2')] = TWO;
+    translist[W_G_HCW(W_HCW_CH,'1')] = ONE;
+    translist[W_G_HCW(W_HCW_CH,'0')] = ZERO;
+    translist[W_G_HCW(W_HCW_CH,'*')] = STAR;
+    translist[W_G_HCW(W_HCW_CH,'#')] = HASH;
+    translist[W_G_HCW(W_HCW_CH,'j')] = GO; //j for JUMP TO instead of go to
+    translist[W_G_HCW(W_HCW_CH,'r')] = RED; 
+    translist[W_G_HCW(W_HCW_CH,'g')] = GREEN;
+    translist[W_G_HCW(W_HCW_CH,'y')] = YELLOW; 
+    translist[W_G_HCW(W_HCW_CH,'b')] = BLUE; 
+    //Processing RI Messages
+    translist[W_G_HCW(W_HCW_RI,0x35c)] = GREEN;
+    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,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?
+}
+
+std::string InputWin::getHardwareKeyName(HWC_TYPE hardwareKey)
+{
+    //Determine type
+    ULONG type = hardwareKey >> 32;
+    char rt[10];
+
+    switch(type)
+    {
+      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 InputWin::ReceiveButtonVK(UINT button) 
+{
+/*     UCHAR pb=NA_NONE;
+       //should we use a translation table ? No APPCOMMAND iS DWORD!
+       switch (button) { //Processing VK_Messages
+       case VK_DOWN:
+               pb=DOWN; break;
+       case VK_RETURN:
+       case VK_SPACE:
+               pb=OK;break;
+       case VK_LEFT:
+               pb=LEFT;break;
+       case '9':
+       case VK_NUMPAD9:
+               pb=NINE;break;
+       case '8':
+       case VK_NUMPAD8:
+               pb=EIGHT;break;
+       case '7':
+       case VK_NUMPAD7:
+               pb=SEVEN;break;
+       case '6':
+       case VK_NUMPAD6:
+               pb=SIX;break;
+       case '5':
+       case VK_NUMPAD5:
+               pb=FIVE;break;
+       case '4':
+       case VK_NUMPAD4:
+               pb=FOUR;break;
+       case '3':
+       case VK_NUMPAD3:
+               pb=THREE;break;
+       case '2':
+       case VK_NUMPAD2:
+               pb=TWO;break;
+       case '1':
+       case VK_NUMPAD1:
+               pb=ONE;break;
+       case '0':
+       case VK_NUMPAD0:
+               pb=ZERO;break;
+       case VK_RIGHT:
+               pb=RIGHT;break;
+       case VK_UP:
+               pb=UP;break;
+       case VK_MULTIPLY:
+               pb=STAR;break;
+       case 'J'://j for JUMP TO instead of go to
+               pb=GO;break;
+       //case VK_ESCAPE:
+       //      pb=POWER;break;
+       case VK_BACK:
+               pb=BACK;break;
+       case 'M':
+               pb=MENU;break;
+       case 'R':
+               pb=RED;break;
+       case 'G':
+               pb=GREEN;break;
+       case 'Y':
+               pb=YELLOW;break;
+       case 'B':
+               pb=BLUE; break;
+
+
+       }; //All other commands are process via APPCOMMAND_MESSAGES
+       if (pb==NA_NONE) return 0;*/
+
+  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;  */
+}
+
+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; */
+}
+
+int InputWin::ReceiveButtonAP(UINT button) 
+{
+/*     UCHAR pb=NA_NONE;
+       //should we use a translation table ? No APPCOMMAND iS DWORD!
+       switch (button) { //Processing VK_Messages
+       case APPCOMMAND_BROWSER_BACKWARD:
+               pb=BACK;break;
+       case APPCOMMAND_MEDIA_CHANNEL_DOWN:
+               pb=CHANNELDOWN;break;
+       case APPCOMMAND_MEDIA_CHANNEL_UP:
+               pb=CHANNELUP;break;
+       case APPCOMMAND_MEDIA_FAST_FORWARD:
+               pb=FORWARD;break;
+       case APPCOMMAND_VOLUME_MUTE:
+               pb=MUTE;break;
+       case APPCOMMAND_MEDIA_PAUSE:
+               pb=PAUSE;break;
+       case APPCOMMAND_MEDIA_PLAY:
+               pb=PLAY;break;
+       case APPCOMMAND_MEDIA_RECORD:
+               pb=RECORD;break;
+       case APPCOMMAND_MEDIA_PREVIOUSTRACK:
+               pb=SKIPBACK;break;
+       case APPCOMMAND_MEDIA_REWIND:
+               pb=REVERSE;break;
+       case APPCOMMAND_MEDIA_NEXTTRACK:
+               pb=SKIPFORWARD;break;
+       case APPCOMMAND_MEDIA_STOP:
+               pb=STOP;break;
+       case APPCOMMAND_VOLUME_DOWN:
+               pb=VOLUMEDOWN;break;
+       case APPCOMMAND_VOLUME_UP:
+               pb=VOLUMEUP;break;
+       case VOMP_YELLOW:
+               pb=YELLOW; break;
+       case VOMP_BLUE:
+               pb=BLUE;break;
+       case VOMP_RED:
+               pb=RED;break;
+       case VOMP_GREEN:
+               pb=GREEN;break;
+       case VOMP_ENTER:
+               pb=OK;break;
+       case VOMP_CANCEL:
+               pb=BACK;break;
+       case VOMP_UP:
+               pb=UP;break;
+       case VOMP_DOWN:
+               pb=DOWN;break;
+       case VOMP_LEFT:
+               pb=LEFT;break;
+       case VOMP_RIGHT:
+               pb=RIGHT;break;
+       };*/
+    
+       //if (pb==NA_NONE) return 0;
+
+
+  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; */
+}
+
+int InputWin::ReceiveButtonRI(UINT button) 
+{
+       //UCHAR pb=NA_NONE;
+       //Raw Input
+       /* Note Codes above 0x29c are not listed in the specs on usb.org
+          therefore they are used by try, they might be device dependent
+          thus please supply codes of your remote control */
+/*     switch (button) { //Processing VK_Messages
+       case 0x35c: //Green
+               pb=GREEN;break;
+       case 0x35b: //Red
+               pb=RED;break;
+       case 0x35d: //Yellow
+               pb=YELLOW;break;
+       case 0x35e: //Blue
+               pb=BLUE;break;
+       case 0x30d: //MCE Button, used for Menu
+               pb=MENU;break;
+       case 0x348: //Record Television
+               pb=RECORD;break;
+       case 0x28d: //Attach File Mmh, how should we assign this
+               pb=NA_NONE;break;
+       case 0x325: //Playback Televison
+               pb=PLAY;break;
+       case 0x324: //Playback DVD
+               pb=PLAY;break;
+       case 0x209: //Properties
+       case 0x35a: //Teletext?
+               pb=OK;break;
+
+       
+       };
+       if (pb==NA_NONE) return 0;*/
+
+  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; */
+}
+
+/*
+void InputWin::Signal() 
+{
+       signal = true;
+       //PulseEvent(event);
+       SetEvent(event);
+}
+*/
+
+void InputWin::SendPower()
+{
+  /*
+       curevent=POWER;
+  hascurevent=true;
+       SetEvent(event);
+  */
+  sendInputKey(POWER);
+}
diff --git a/inputwin.h b/inputwin.h
new file mode 100644 (file)
index 0000000..629a90c
--- /dev/null
@@ -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 <https://www.gnu.org/licenses/>.
+*/
+
+#ifndef INPUTWIN_H
+#define INPUTWIN_H
+
+#define _WIN32_WINNT 0x501
+#include <winsock2.h>
+#include <windowsx.h> 
+
+#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 cd8e286b31ec11050d11317d6f1a57185b7faf1b..52250bc62ca45defc9dca9b99d3ec4a1cced6c7c 100644 (file)
--- 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.cc b/remotewin.cc
deleted file mode 100644 (file)
index 52d7025..0000000
+++ /dev/null
@@ -1,503 +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 "remotewin.h"
-#include "vompreswin.h"
-#include "i18n.h"
-
-#define W_G_HCW(type,code) ( (((ULLONG)(type))<<32) | code)
-
-#define W_HCW_VK 1 /* virtual key */
-#define W_HCW_AP 2 /* App command */
-#define W_HCW_RI 3 /* remote control */
-#define W_HCW_CH 4 /* char */
-
-RemoteWin::RemoteWin()
-{
-  initted = 0;
-  curevent=0;
-  hascurevent=false;
-  signal=false;
-}
-
-RemoteWin::~RemoteWin()
-{
-}
-
-int RemoteWin::init(const char* devName)
-{
-  if (initted) return 0;
-  initted = 1;
-  event = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL);
-
-
-  return 1;
-}
-
-int RemoteWin::shutdown()
-{
-  if (!initted) return 0;
-  CloseHandle(event);
-  initted = 0;
-  return 1;
-}
-
-UCHAR RemoteWin::getButtonPress(int waitType)
-{
-  /* how = 0 - block
-     how = 1 - start new wait
-     how = 2 - continue wait
-     how = 3 - no wait
-  */
-  DWORD wait;
-  
-
-  if (hascurevent) {
-         UCHAR temp=curevent;
-      hascurevent=false;
-
-         return temp;
-  }
-  if (waitType==3) {
-         return NA_NONE;
-  }
-  if (waitType==0) {
-         wait=INFINITE;
-  } else { //We do not distingish between 2 and 3
-         wait=1000;
-
-  }
-  WaitForSingleObject(event,wait);
-  ResetEvent(event);
-  if (!hascurevent) {
-         if (signal) {
-                 signal=false;
-                 return NA_SIGNAL; //Since we have no signals on windows, we simulate this
-         } else {
-                 return NA_NONE;
-         }
-  }
-  UCHAR temp2=curevent;
-  hascurevent=false;
-  return temp2;
-  
-}
-
-UCHAR RemoteWin::TranslateHWCFixed(ULLONG code)
-{
-    switch (code) 
-    {
-    case W_G_HCW(W_HCW_VK,VK_DOWN):
-        return DOWN;
-    case W_G_HCW(W_HCW_VK,VK_UP):
-        return UP;
-    case W_G_HCW(W_HCW_VK,VK_LEFT):
-        return LEFT;
-    case W_G_HCW(W_HCW_VK,VK_RIGHT):
-        return RIGHT;
-    case W_G_HCW(W_HCW_CH,'m'):
-        return MENU;
-    case W_G_HCW(W_HCW_VK,VK_BACK):
-        return BACK;
-    case W_G_HCW(W_HCW_VK,VK_RETURN):
-    case W_G_HCW(W_HCW_VK,VK_SPACE):
-        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;
-    case POWER:
-        return POWER;
-    default:
-        return NA_UNKNOWN;
-    };
-}
-
-const char*RemoteWin::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");
-    case CHANNELDOWN:
-        return tr("Insrt, C+Insrt, Pg down");
-    case CHANNELUP:
-        return tr("+, C++, Pg up");
-    case VOLUMEUP:
-        return "F10";
-    case VOLUMEDOWN:
-        return "F9";
-    case POWER:
-        return "Esc, A+F4";
-    case MUTE:
-        return "F8";
-    case REVERSE:
-        return"S+C+B";
-    case FORWARD:
-        return "S+C+F";
-    case SKIPBACK:
-        return "C+B";
-    case SKIPFORWARD:
-        return "C+F";
-    case PLAY:
-        return "S+P";
-    case STOP:
-        return "C+S";
-    case PAUSE:
-        return "C+P";
-    default:
-        return NULL;
-    };
-    
-}
-
-
-void RemoteWin::InitHWCListwithDefaults()
-{
-    //Processing VK_Messages
-    translist[W_G_HCW(W_HCW_CH,'9')] = NINE;
-    translist[W_G_HCW(W_HCW_CH,'8')] = EIGHT;
-    translist[W_G_HCW(W_HCW_CH,'7')] = SEVEN;
-    translist[W_G_HCW(W_HCW_CH,'6')] = SIX;
-    translist[W_G_HCW(W_HCW_CH,'5')] = FIVE;
-    translist[W_G_HCW(W_HCW_CH,'4')] = FOUR;
-    translist[W_G_HCW(W_HCW_CH,'3')] = THREE;
-    translist[W_G_HCW(W_HCW_CH,'2')] = TWO;
-    translist[W_G_HCW(W_HCW_CH,'1')] = ONE;
-    translist[W_G_HCW(W_HCW_CH,'0')] = ZERO;
-    translist[W_G_HCW(W_HCW_CH,'*')] = STAR;
-    translist[W_G_HCW(W_HCW_CH,'#')] = HASH;
-    translist[W_G_HCW(W_HCW_CH,'j')] = GO; //j for JUMP TO instead of go to
-    translist[W_G_HCW(W_HCW_CH,'r')] = RED; 
-    translist[W_G_HCW(W_HCW_CH,'g')] = GREEN;
-    translist[W_G_HCW(W_HCW_CH,'y')] = YELLOW; 
-    translist[W_G_HCW(W_HCW_CH,'b')] = BLUE; 
-    //Processing RI Messages
-    translist[W_G_HCW(W_HCW_RI,0x35c)] = GREEN;
-    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,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?
-
-}
-
-char* RemoteWin::HCWDesc(ULLONG hcw)
-{
-    //Determine type
-    ULONG type =  hcw >> 32;
-    char *rt=NULL;
-    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;
-}
-
-
-int RemoteWin::ReceiveButtonVK(UINT button) {
-/*     UCHAR pb=NA_NONE;
-       //should we use a translation table ? No APPCOMMAND iS DWORD!
-       switch (button) { //Processing VK_Messages
-       case VK_DOWN:
-               pb=DOWN; break;
-       case VK_RETURN:
-       case VK_SPACE:
-               pb=OK;break;
-       case VK_LEFT:
-               pb=LEFT;break;
-       case '9':
-       case VK_NUMPAD9:
-               pb=NINE;break;
-       case '8':
-       case VK_NUMPAD8:
-               pb=EIGHT;break;
-       case '7':
-       case VK_NUMPAD7:
-               pb=SEVEN;break;
-       case '6':
-       case VK_NUMPAD6:
-               pb=SIX;break;
-       case '5':
-       case VK_NUMPAD5:
-               pb=FIVE;break;
-       case '4':
-       case VK_NUMPAD4:
-               pb=FOUR;break;
-       case '3':
-       case VK_NUMPAD3:
-               pb=THREE;break;
-       case '2':
-       case VK_NUMPAD2:
-               pb=TWO;break;
-       case '1':
-       case VK_NUMPAD1:
-               pb=ONE;break;
-       case '0':
-       case VK_NUMPAD0:
-               pb=ZERO;break;
-       case VK_RIGHT:
-               pb=RIGHT;break;
-       case VK_UP:
-               pb=UP;break;
-       case VK_MULTIPLY:
-               pb=STAR;break;
-       case 'J'://j for JUMP TO instead of go to
-               pb=GO;break;
-       //case VK_ESCAPE:
-       //      pb=POWER;break;
-       case VK_BACK:
-               pb=BACK;break;
-       case 'M':
-               pb=MENU;break;
-       case 'R':
-               pb=RED;break;
-       case 'G':
-               pb=GREEN;break;
-       case 'Y':
-               pb=YELLOW;break;
-       case 'B':
-               pb=BLUE; break;
-
-
-       }; //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;
-    hascurevent=true;
-       //PulseEvent(event);
-       SetEvent(event);
-       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;
-    hascurevent=true;
-       //PulseEvent(event);
-       SetEvent(event);
-       return 1;
-}
-
-int RemoteWin::ReceiveButtonAP(UINT button) {
-/*     UCHAR pb=NA_NONE;
-       //should we use a translation table ? No APPCOMMAND iS DWORD!
-       switch (button) { //Processing VK_Messages
-       case APPCOMMAND_BROWSER_BACKWARD:
-               pb=BACK;break;
-       case APPCOMMAND_MEDIA_CHANNEL_DOWN:
-               pb=CHANNELDOWN;break;
-       case APPCOMMAND_MEDIA_CHANNEL_UP:
-               pb=CHANNELUP;break;
-       case APPCOMMAND_MEDIA_FAST_FORWARD:
-               pb=FORWARD;break;
-       case APPCOMMAND_VOLUME_MUTE:
-               pb=MUTE;break;
-       case APPCOMMAND_MEDIA_PAUSE:
-               pb=PAUSE;break;
-       case APPCOMMAND_MEDIA_PLAY:
-               pb=PLAY;break;
-       case APPCOMMAND_MEDIA_RECORD:
-               pb=RECORD;break;
-       case APPCOMMAND_MEDIA_PREVIOUSTRACK:
-               pb=SKIPBACK;break;
-       case APPCOMMAND_MEDIA_REWIND:
-               pb=REVERSE;break;
-       case APPCOMMAND_MEDIA_NEXTTRACK:
-               pb=SKIPFORWARD;break;
-       case APPCOMMAND_MEDIA_STOP:
-               pb=STOP;break;
-       case APPCOMMAND_VOLUME_DOWN:
-               pb=VOLUMEDOWN;break;
-       case APPCOMMAND_VOLUME_UP:
-               pb=VOLUMEUP;break;
-       case VOMP_YELLOW:
-               pb=YELLOW; break;
-       case VOMP_BLUE:
-               pb=BLUE;break;
-       case VOMP_RED:
-               pb=RED;break;
-       case VOMP_GREEN:
-               pb=GREEN;break;
-       case VOMP_ENTER:
-               pb=OK;break;
-       case VOMP_CANCEL:
-               pb=BACK;break;
-       case VOMP_UP:
-               pb=UP;break;
-       case VOMP_DOWN:
-               pb=DOWN;break;
-       case VOMP_LEFT:
-               pb=LEFT;break;
-       case VOMP_RIGHT:
-               pb=RIGHT;break;
-       };*/
-    
-       //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;
-    hascurevent=true;
-       //PulseEvent(event);
-       SetEvent(event);
-       return 1;
-}
-
-int RemoteWin::ReceiveButtonRI(UINT button) {
-       //UCHAR pb=NA_NONE;
-       //Raw Input
-       /* Note Codes above 0x29c are not listed in the specs on usb.org
-          therefore they are used by try, they might be device dependent
-          thus please supply codes of your remote control */
-/*     switch (button) { //Processing VK_Messages
-       case 0x35c: //Green
-               pb=GREEN;break;
-       case 0x35b: //Red
-               pb=RED;break;
-       case 0x35d: //Yellow
-               pb=YELLOW;break;
-       case 0x35e: //Blue
-               pb=BLUE;break;
-       case 0x30d: //MCE Button, used for Menu
-               pb=MENU;break;
-       case 0x348: //Record Television
-               pb=RECORD;break;
-       case 0x28d: //Attach File Mmh, how should we assign this
-               pb=NA_NONE;break;
-       case 0x325: //Playback Televison
-               pb=PLAY;break;
-       case 0x324: //Playback DVD
-               pb=PLAY;break;
-       case 0x209: //Properties
-       case 0x35a: //Teletext?
-               pb=OK;break;
-
-       
-       };
-       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;
-    hascurevent=true;
-       //PulseEvent(event);
-       SetEvent(event);
-       return 1;
-}
-
-void RemoteWin::Signal() {
-       signal=true;
-       //PulseEvent(event);
-       SetEvent(event);
-}
-
-void RemoteWin::SendPower()
-{
-
-       curevent=POWER;
-    hascurevent=true;
-       SetEvent(event);
-}
-
diff --git a/remotewin.h b/remotewin.h
deleted file mode 100644 (file)
index 3fd5434..0000000
+++ /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 <stdio.h>
-
-#include "defines.h"
-#include "log.h"
-#include "input.h"
-
-#define _WIN32_WINNT 0x501
-#include <winsock2.h>
-#include <windowsx.h> 
-
-
-
-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 bbee70de92995fdf67c11120292cd8b9021adb1f..74eb7a3ec971d89655c65e14bbf1d931bfa44aa2 100644 (file)
--- 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<char*>(&soError), &soErrorSize);
+#else
   int gso = getsockopt(sock, SOL_SOCKET, SO_ERROR, reinterpret_cast<void*>(&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<char*>(&rxSize), sizeof(size_t));
+#else
   int r = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<void*>(&rxSize), sizeof(size_t));
+#endif
   Log::getInstance()->log("TCP", Log::DEBUG, "Set receive window to %i, success(=0): %i", rxBufferSize, r);
 }
 
index 4d6901dad4e7c5952e855a729189e3095473d0c0..2060307776d1ea85e20f1792cf3a1217c8114850 100644 (file)
@@ -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();
 
index 81cc05ccb17aab9060b4f087d32d5c68354f0894..52dc306f452d421c1de2f02aaeb611dc2482c71f 100644 (file)
@@ -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:
     {
index 019ef52203f8ed2c657aa16c2c79eae9b9407c93..bce617f17d86fea68515938ce680f72a18fa0d50 100644 (file)
@@ -314,7 +314,7 @@ int VVideoLiveTV::handleCommand(int command)
       }
       // else drop through to stop
     }
-    [[fallthrough]];
+    FALLTHROUGH
     case Input::STOP:
     {
       stop();
index 0be0d5cf2edcac94d76220d14b759f35950f3450..478f8a01d4ad8c346881f5c99001d241818aa814 100644 (file)
@@ -246,7 +246,7 @@ int VVideoRec::handleCommand(int command)
         return 2;
       }
     }
-    [[fallthrough]];
+    FALLTHROUGH
     case Input::STOP:
     case Input::MENU:
     {
index 7b1c0e28ed48f1314a51afeceedd2dc031c6527a..cb13e36ef891736fb5d900559ce4d3cf10c700b7 100644 (file)
@@ -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 f54e9e885391fb0d9c8f3feca5c7c0cb23abb0e3..3f9a71aaeb446be8376524e0d5f578c8341ad0c6 100644 (file)
--- 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<void*>(buf), 102, 0, reinterpret_cast<struct sockaddr *>(&sap), sizeof (sap)) < 0)
+#ifdef WIN32
+  if (sendto(packet, reinterpret_cast<const char*>(buf), 102, 0, reinterpret_cast<struct sockaddr *>(&sap), sizeof (sap)) < 0)
+#else
+  if (sendto(packet, static_cast<void*>(buf), 102, 0, reinterpret_cast<struct sockaddr *>(&sap), sizeof(sap)) < 0)
+#endif
   {
     fprintf (stderr, " sendto failed, %s\n",
     strerror(errno));
index de048587b03d56d85f959d452f0edcaccde76a69..bfa48a2fa44dc831343147568cb41dff1986ea03 100644 (file)
@@ -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<ULONG>(sl.getCurrentOptionData()));
      
       return 1;
     }
index f1756ff64ed013e0bd055e9512efaeb417126b73..751cc1edde4ee6ba6343f7313584592f7e191f5e 100644 (file)
@@ -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<void*>(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<ULONG>(sl.getCurrentOptionData()));
        
       return 1;
     }
index 93306c655ec8cfc3653f3b92b5303d4a596c2015..d3a759f7e708666f5b077ba4c61b2c738aa6c2e8 100644 (file)
@@ -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<ULONG>(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<ULONG>(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<ULONG>(sl.getCurrentOptionData()));
       return 1;
     }
     case Input::BACK:
index 6bff0acfc021b06da5c69e919b99c2bc3aee4703..c0c4e188690815eae04c9eb761ba126b9159072b 100644 (file)
@@ -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<void*>(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<ULONG>(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<ULONG>(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<ULONG>(sl.getCurrentOptionData()));
       return 1;
     }
     case Input::BACK: