[svn] / trunk / xvidcore / dshow / src / CXvidDecoder.cpp Repository:
ViewVC logotype

Diff of /trunk/xvidcore/dshow/src/CXvidDecoder.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1890, Tue Aug 10 14:17:40 2010 UTC revision 1896, Sat Oct 16 12:20:30 2010 UTC
# Line 1  Line 1 
1  /*****************************************************************************  /*****************************************************************************
2   *   *
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - XviD Decoder part of the DShow Filter  -   *  - Xvid Decoder part of the DShow Filter  -
5   *   *
6   *  Copyright(C) 2002-2004 Peter Ross <pross@xvid.org>   *  Copyright(C) 2002-2010 Peter Ross <pross@xvid.org>
7     *               2003-2010 Michael Militzer <michael@xvid.org>
8   *   *
9   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
10   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 19  Line 20 
20   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   *   *
23   * $Id: CXvidDecoder.cpp,v 1.18 2010-08-10 14:17:40 Isibaar Exp $   * $Id: CXvidDecoder.cpp,v 1.19 2010-10-16 12:20:30 Isibaar Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 43  Line 44 
44          C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Debug          C:\DX90SDK\Samples\C++\DirectShow\BaseClasses\Debug
45  */  */
46    
47    //#define XVID_USE_TRAYICON
48    
49  #include <windows.h>  #include <windows.h>
50    
# Line 55  Line 56 
56  #endif  #endif
57  #include <dvdmedia.h>   // VIDEOINFOHEADER2  #include <dvdmedia.h>   // VIDEOINFOHEADER2
58    
59  #include <xvid.h>               // XviD API  #include <shellapi.h>
60    
61    #include <xvid.h>               // Xvid API
62    
63    #include "resource.h"
64    
65  #include "IXvidDecoder.h"  #include "IXvidDecoder.h"
66  #include "CXvidDecoder.h"  #include "CXvidDecoder.h"
# Line 149  Line 154 
154    
155  };  };
156    
   
157  /* note: g_cTemplates must be global; used by strmbase.lib(dllentry.cpp,dllsetup.cpp) */  /* note: g_cTemplates must be global; used by strmbase.lib(dllentry.cpp,dllsetup.cpp) */
158  int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate);  int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate);
159    
160    #ifdef XVID_USE_TRAYICON
161    extern HINSTANCE g_xvid_hInst;
162    
163    static int GUI_Page = 0;
164    extern "C" void CALLBACK Configure(HWND hWndParent, HINSTANCE hInstParent, LPSTR lpCmdLine, int nCmdShow );
165    
166    LRESULT CALLBACK msg_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
167    {
168            switch ( uMsg )
169            {
170            case WM_ICONMESSAGE:
171                    switch(lParam)
172                    {
173                    case WM_LBUTTONDBLCLK:
174                            if (!GUI_Page) {
175                                    GUI_Page = 1;
176                                    Configure(hwnd, g_xvid_hInst, "", 1);
177                                    GUI_Page = 0;
178                            }
179                            break;
180                    default:
181                            return DefWindowProc(hwnd, uMsg, wParam, lParam);
182                    };
183                    break;
184    
185            default:
186                    return DefWindowProc(hwnd, uMsg, wParam, lParam);
187            }
188    
189            return TRUE; /* ok */
190    }
191    #endif
192    
193  STDAPI DllRegisterServer()  STDAPI DllRegisterServer()
194  {  {
# Line 212  Line 248 
248      xvid_decore_func = NULL; // Hmm, some strange errors appearing if I try to initialize...      xvid_decore_func = NULL; // Hmm, some strange errors appearing if I try to initialize...
249      xvid_global_func = NULL; // ...this in constructor's init-list. So, they assigned here.      xvid_global_func = NULL; // ...this in constructor's init-list. So, they assigned here.
250    
251    #ifdef XVID_USE_TRAYICON
252            MSG_hwnd = NULL;
253    #endif
254    
255      LoadRegistryInfo();      LoadRegistryInfo();
256    
257      *phr = OpenLib();      *phr = OpenLib();
# Line 353  Line 393 
393  {  {
394      DPRINTF("Destructor");      DPRINTF("Destructor");
395          CloseLib();          CloseLib();
396    
397    #ifdef XVID_USE_TRAYICON
398            if (MSG_hwnd != NULL) {
399                    NOTIFYICONDATA nid;
400                    nid.cbSize = sizeof(NOTIFYICONDATA);
401                    nid.hWnd = MSG_hwnd;
402                    nid.uID = 100;
403    
404                    Shell_NotifyIcon(NIM_DELETE, &nid);
405    
406                    DestroyWindow(MSG_hwnd);
407                    MSG_hwnd = NULL;
408            }
409    #endif
410  }  }
411    
412    
# Line 742  Line 796 
796  HRESULT CXvidDecoder::CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut)  HRESULT CXvidDecoder::CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut)
797  {  {
798          DPRINTF("CheckTransform");          DPRINTF("CheckTransform");
799    
800          return S_OK;          return S_OK;
801  }  }
802    
803    /* input/output pin connection complete */
804    
805    HRESULT CXvidDecoder::CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin)
806    {
807            DPRINTF("CompleteConnect");
808    
809    #ifdef XVID_USE_TRAYICON
810            if ((direction == PINDIR_OUTPUT) && (MSG_hwnd == NULL))
811            {
812                    WNDCLASSEX wc;
813    
814                    wc.cbSize = sizeof(WNDCLASSEX);
815                    wc.lpfnWndProc = msg_proc;
816                    wc.style = CS_HREDRAW | CS_VREDRAW;
817                    wc.cbWndExtra = 0;
818                    wc.cbClsExtra = 0;
819                    wc.hInstance = (HINSTANCE) g_xvid_hInst;
820                    wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);
821                    wc.lpszMenuName = NULL;
822                    wc.lpszClassName = "XVID_MSG_WINDOW";
823                    wc.hIcon = NULL;
824                    wc.hIconSm = NULL;
825                    wc.hCursor = NULL;
826                    RegisterClassEx(&wc);
827    
828                    MSG_hwnd = CreateWindowEx(0, "XVID_MSG_WINDOW", NULL, 0, CW_USEDEFAULT,
829                                      CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL);
830    
831                    /* display the tray icon */
832                    NOTIFYICONDATA nid;
833    
834                    nid.cbSize = sizeof(NOTIFYICONDATA);
835                    nid.hWnd = MSG_hwnd;
836                    nid.uID = 100;
837                    nid.uVersion = NOTIFYICON_VERSION;
838                    nid.uCallbackMessage = WM_ICONMESSAGE;
839                    nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));
840                    strcpy_s(nid.szTip, 19, "Xvid Video Decoder");
841                    nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
842    
843                    Shell_NotifyIcon(NIM_ADD, &nid);
844            }
845    #endif
846    
847            return S_OK;
848    }
849    
850    /* input/output pin disconnected */
851    HRESULT CXvidDecoder::BreakConnect(PIN_DIRECTION direction)
852    {
853            DPRINTF("BreakConnect");
854    
855    #ifdef XVID_USE_TRAYICON
856            if ((direction == PINDIR_OUTPUT) && (MSG_hwnd != NULL)) {
857                    NOTIFYICONDATA nid;
858    
859                    nid.cbSize = sizeof(NOTIFYICONDATA);
860                    nid.hWnd = MSG_hwnd;
861                    nid.uID = 100;
862                    nid.uVersion = NOTIFYICON_VERSION;
863    
864                    if(Shell_NotifyIcon(NIM_DELETE, &nid) == TRUE) {
865                            DestroyWindow(MSG_hwnd);
866                            MSG_hwnd = NULL;
867                    }
868            }
869    #endif
870    
871            return S_OK;
872    }
873    
874  /* alloc output buffer */  /* alloc output buffer */
875    

Legend:
Removed from v.1890  
changed lines
  Added in v.1896

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4