]> git.vomp.tv Git - vompclient.git/commitdiff
New Windows remote stuff
authorChris Tallon <chris@vomp.tv>
Mon, 20 Nov 2006 18:05:28 +0000 (18:05 +0000)
committerChris Tallon <chris@vomp.tv>
Mon, 20 Nov 2006 18:05:28 +0000 (18:05 +0000)
readme.win
remotewin.cc
remotewin.h
winmain.cc

index 2ac59dd8624753e35361e6b7de8ec27761e6d023..898a99ebf510741df12444fe69b374147a65190b 100644 (file)
@@ -19,6 +19,7 @@ Requirements
 The vomp client on Windows requires:\r
 \r
 * Windows 2000 or later\r
+* Windows XP for full remote control support\r
 * A DirectShow MPEG2 decoder, which supports Video Mixing Renderer 9 (VMR-9),\r
   mostly included within DVD software player\r
 * A network connection to the vompserver computer\r
@@ -67,9 +68,9 @@ YELLOW          | y
 BLUE            | b\r
 MUTE            | F8\r
 RADIO           | Not implemented\r
-REVERSE         | Not implemented (Can work on Remote Controls)\r
+REVERSE         | Shift + Control + B\r
 PLAY            | Shift + P\r
-FORWARD         | Shift + F\r
+FORWARD         | Shift + Control + F\r
 RECORD          | Ctrl + R\r
 STOP            | Ctrl + S\r
 PAUSE           | Ctrl + P\r
@@ -90,8 +91,19 @@ PREVCHANNEL     | Not implemented
 STAR            | *\r
 HASH            | Not implemented\r
 \r
-(Note: Remote Controls for Windows should work also for most buttons,\r
-but this is an yet untested feature.)\r
+Remote Controls tested with vomp on windows\r
+===========================================\r
+\r
+Compatible\r
+==========\r
+* AR Remote Control MCE (1040050, X10), [All buttons recognized, except POWER]\r
+\r
+Note: Remote Controls for Windows should work also for most buttons,\r
+however full remote control support is restricted to Windows XP and above.\r
+If buttons of your remote control are not supported, please post a message\r
+in the forum at http://www.loggytronic.com and we will add them to vomp.\r
+\r
+\r
 \r
 Usage\r
 =====\r
index c4ca8cb5aee7b9b5b31009385fb68cf25c99fb82..f0aed8fa813d7abdf0253bbaa45da810e8db835f 100644 (file)
@@ -143,8 +143,8 @@ int RemoteWin::ReceiveButtonVK(UINT button) {
                pb=STAR;break;\r
        case 'J'://j for JUMP TO instead of go to\r
                pb=GO;break;\r
-       case VK_ESCAPE:\r
-               pb=POWER;break;\r
+       //case VK_ESCAPE:\r
+       //      pb=POWER;break;\r
        case VK_BACK:\r
                pb=BACK;break;\r
        case 'M':\r
@@ -171,6 +171,8 @@ int RemoteWin::ReceiveButtonAP(UINT button) {
        UCHAR pb=NA_NONE;\r
        //should we use a translation table ? No APPCOMMAND iS DWORD!\r
        switch (button) { //Processing VK_Messages\r
+       case APPCOMMAND_BROWSER_BACKWARD:\r
+               pb=BACK;break;\r
        case APPCOMMAND_MEDIA_CHANNEL_DOWN:\r
                pb=CHANNELDOWN;break;\r
        case APPCOMMAND_MEDIA_CHANNEL_UP:\r
@@ -205,6 +207,44 @@ int RemoteWin::ReceiveButtonAP(UINT button) {
        return 1;\r
 }\r
 \r
+int RemoteWin::ReceiveButtonRI(UINT button) {\r
+       UCHAR pb=NA_NONE;\r
+       //Raw Input\r
+       /* Note Codes above 0x29c are not listed in the specs on usb.org\r
+          therefore they are used by try, they might be device dependent\r
+          thus please supply codes of your remote control */\r
+       switch (button) { //Processing VK_Messages\r
+       case 0x35c: //Green\r
+               pb=GREEN;break;\r
+       case 0x35b: //Red\r
+               pb=RED;break;\r
+       case 0x35d: //Yellow\r
+               pb=YELLOW;break;\r
+       case 0x35e: //Blue\r
+               pb=BLUE;break;\r
+       case 0x30d: //MCE Button, used for Menu\r
+               pb=MENU;break;\r
+       case 0x348: //Record Television\r
+               pb=RECORD;break;\r
+       case 0x28d: //Attach File Mmh, how should we assign this\r
+               pb=NA_NONE;break;\r
+       case 0x325: //Playback Televison\r
+               pb=PLAY;break;\r
+       case 0x324: //Playback DVD\r
+               pb=PLAY;break;\r
+       case 0x209: //Properties\r
+       case 0x35a: //Teletext?\r
+               pb=OK;break;\r
+\r
+       \r
+       };\r
+       if (pb==NA_NONE) return 0;\r
+       curevent=pb;\r
+       //PulseEvent(event);\r
+       SetEvent(event);\r
+       return 1;\r
+}\r
+\r
 void RemoteWin::Signal() {\r
        signal=true;\r
        //PulseEvent(event);\r
@@ -213,6 +253,7 @@ void RemoteWin::Signal() {
 \r
 void RemoteWin::SendPower()\r
 {\r
+\r
        curevent=POWER;\r
        SetEvent(event);\r
 }\r
index a4b11e403e6f4cd00638742d637b199cd6dd8aec..7fe280f0d755d7e5b0a29f686a1171060dcc12cf 100644 (file)
@@ -47,6 +47,7 @@ class RemoteWin : public Remote
     void Signal();\r
     int ReceiveButtonVK(UINT button);//Windows Message from WND_PROC\r
        int     ReceiveButtonAP(UINT button);\r
+       int     ReceiveButtonRI(UINT button);\r
        void SendPower();\r
 \r
   private: \r
index 4bd2d3155bed3621b8c03a3540276c52a28ab0b4..9fc88caf4cf388e44efd9c2ae38ee32a971b920d 100644 (file)
@@ -61,6 +61,7 @@ Audio* audio;
 bool wnd_fullscreen=false;\r
 RECT wnd_fs_rect={20,20,768+20,576+20};\r
 RECT wnd_fs_rect_client={0,0,768,576};\r
+OSVERSIONINFO windows_ver; //attempt to distigsh windows versions\r
 \r
 \r
 void MILLISLEEP(ULONG a)
@@ -443,6 +444,7 @@ void ToggleFullscreen() {
 \r
 LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam)\r
 {\r
+   \r
    switch (msg) {\r
    case WM_DESTROY: {\r
           //TODO: call command\r
@@ -485,6 +487,29 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam)
                        return DefWindowProc(wind, msg, wparam, lparam);\r
                }\r
 \r
+               break;\r
+       case WM_INPUT:\r
+               if ((windows_ver.dwMajorVersion>5 || \r
+                       (windows_ver.dwMajorVersion==5 && windows_ver.dwMinorVersion>=1)) ) {\r
+                       //only on XP!\r
+                        LPRAWINPUT lpit;\r
+                        UINT risize;\r
+                        GetRawInputData((HRAWINPUT)lparam,RID_INPUT,NULL,&risize,sizeof(RAWINPUTHEADER));\r
+                        lpit=(LPRAWINPUT)malloc(risize);\r
+                        GetRawInputData((HRAWINPUT)lparam,RID_INPUT,lpit,&risize,sizeof(RAWINPUTHEADER));\r
+  \r
+                       if (lpit->header.dwType==RIM_TYPEHID && lpit->data.hid.dwSizeHid>=2) {\r
+                               DWORD button=lpit->data.hid.bRawData[1] | (lpit->data.hid.bRawData[0]<< 8);\r
+                               if (((RemoteWin*)remote)->ReceiveButtonRI(button)){\r
+                                       free(lpit);\r
+                                       return 0; //yes we process that message\r
+                               }\r
+                       }\r
+                       free(lpit);\r
+               }\r
+               return DefWindowProc(wind, msg, wparam, lparam);\r
+               \r
+\r
                break;\r
        case WM_COMMAND:\r
                if (LOWORD(wparam)==VOMP_FULL_SCREEN) {\r
@@ -523,6 +548,8 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam)
 \r
 bool InitApp(HINSTANCE hinst,int cmdshow) {\r
        /* main window */\r
+       windows_ver.dwOSVersionInfoSize=sizeof(windows_ver);\r
+       GetVersionEx(&windows_ver);\r
        WNDCLASS wcs;\r
        DWORD flags;\r
        wcs.style = CS_HREDRAW | CS_VREDRAW;\r
@@ -569,6 +596,29 @@ bool InitApp(HINSTANCE hinst,int cmdshow) {
                return FALSE;\r
        ShowWindow(win,SW_SHOWNORMAL);\r
        UpdateWindow(win);\r
+       if (windows_ver.dwMajorVersion>5 || \r
+               ( windows_ver.dwMajorVersion==5 && windows_ver.dwMinorVersion>=1)) {//at least windows XP\r
+               /* We want to support MCE Remote controls*/\r
+               RAWINPUTDEVICE remote_control_data[4];\r
+               ZeroMemory(remote_control_data,sizeof(remote_control_data));\r
+               remote_control_data[0].usUsagePage=0xFFBC; \r
+               remote_control_data[0].usUsage=0x88; \r
+               remote_control_data[0].dwFlags=0;\r
+               remote_control_data[1].usUsagePage=0x0C; \r
+               remote_control_data[1].usUsage=0x80; \r
+               remote_control_data[1].dwFlags=0;\r
+               remote_control_data[2].usUsagePage=0x0C; \r
+               remote_control_data[2].usUsage=0x01; \r
+               remote_control_data[2].dwFlags=0;\r
+               remote_control_data[3].usUsagePage=0x01; \r
+               remote_control_data[3].usUsage=0x80; \r
+               remote_control_data[3].dwFlags=0;\r
+               if (RegisterRawInputDevices(remote_control_data,4,sizeof(remote_control_data[0]))!=TRUE) {\r
+                       MessageBox(0,"Registering remote control failed!","Aborting!",0);\r
+                       return FALSE;\r
+               }\r
+       \r
+       }\r
        return TRUE;\r
 }\r
 \r