[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 2001, Thu May 19 12:09:03 2011 UTC revision 2022, Wed Jul 6 13:50:28 2011 UTC
# Line 20  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.29 2011-03-17 15:11:32 Isibaar Exp $   * $Id$
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 40  Line 40 
40  #define XVID_USE_MFT  #define XVID_USE_MFT
41  #endif  #endif
42    
 #define XVID_USE_TRAYICON  
   
43  #include <windows.h>  #include <windows.h>
44    
45  #include <streams.h>  #include <streams.h>
# Line 177  Line 175 
175  /* 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) */
176  int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate);  int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate);
177    
 #ifdef XVID_USE_TRAYICON  
178  extern HINSTANCE g_xvid_hInst;  extern HINSTANCE g_xvid_hInst;
179    
180  static int GUI_Page = 0;  static int GUI_Page = 0;
# Line 219  Line 216 
216    
217          return TRUE; /* ok */          return TRUE; /* ok */
218  }  }
 #endif  
219    
220  STDAPI DllRegisterServer()  STDAPI DllRegisterServer()
221  {  {
# Line 314  Line 310 
310  /* constructor */  /* constructor */
311    
312  CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) :  CXvidDecoder::CXvidDecoder(LPUNKNOWN punk, HRESULT *phr) :
313      CVideoTransformFilter(NAME("CXvidDecoder"), punk, CLSID_XVID), m_hdll (NULL)      CVideoTransformFilter(TEXT("CXvidDecoder"), punk, CLSID_XVID), m_hdll (NULL)
314  {  {
315          DPRINTF("Constructor");          DPRINTF("Constructor");
316    
# Line 356  Line 352 
352          m_hdll = LoadLibrary(XVID_DLL_NAME);          m_hdll = LoadLibrary(XVID_DLL_NAME);
353          if (m_hdll == NULL) {          if (m_hdll == NULL) {
354                  DPRINTF("dll load failed");                  DPRINTF("dll load failed");
355                  MessageBox(0, XVID_DLL_NAME " not found","Error", MB_TOPMOST);                  MessageBox(0, XVID_DLL_NAME TEXT(" not found"), TEXT("Error"), MB_TOPMOST);
356                  return E_FAIL;                  return E_FAIL;
357          }          }
358    
# Line 364  Line 360 
360          if (xvid_global_func == NULL) {          if (xvid_global_func == NULL) {
361          FreeLibrary(m_hdll);          FreeLibrary(m_hdll);
362          m_hdll = NULL;          m_hdll = NULL;
363                  MessageBox(0, "xvid_global() not found", "Error", MB_TOPMOST);                  MessageBox(0, TEXT("xvid_global() not found"), TEXT("Error"), MB_TOPMOST);
364                  return E_FAIL;                  return E_FAIL;
365          }          }
366    
# Line 373  Line 369 
369          xvid_global_func = NULL;          xvid_global_func = NULL;
370          FreeLibrary(m_hdll);          FreeLibrary(m_hdll);
371          m_hdll = NULL;          m_hdll = NULL;
372                  MessageBox(0, "xvid_decore() not found", "Error", MB_TOPMOST);                  MessageBox(0, TEXT("xvid_decore() not found"), TEXT("Error"), MB_TOPMOST);
373                  return E_FAIL;                  return E_FAIL;
374          }          }
375    
# Line 383  Line 379 
379          xvid_decore_func = NULL;          xvid_decore_func = NULL;
380          FreeLibrary(m_hdll);          FreeLibrary(m_hdll);
381          m_hdll = NULL;          m_hdll = NULL;
382                  MessageBox(0, "xvid_global() failed", "Error", MB_TOPMOST);                  MessageBox(0, TEXT("xvid_global() failed"), TEXT("Error"), MB_TOPMOST);
383                  return E_FAIL;                  return E_FAIL;
384          }          }
385    
# Line 393  Line 389 
389          xvid_decore_func = NULL;          xvid_decore_func = NULL;
390          FreeLibrary(m_hdll);          FreeLibrary(m_hdll);
391          m_hdll = NULL;          m_hdll = NULL;
392                  MessageBox(0, "xvid_global() failed", "Error", MB_TOPMOST);                  MessageBox(0, TEXT("xvid_global() failed"), TEXT("Error"), MB_TOPMOST);
393                  return E_FAIL;                  return E_FAIL;
394          }          }
395    
# Line 496  Line 492 
492  {  {
493      DPRINTF("Destructor");      DPRINTF("Destructor");
494    
 #ifdef XVID_USE_TRAYICON  
495          if (Tray_Icon) { /* Destroy tray icon */          if (Tray_Icon) { /* Destroy tray icon */
496                  NOTIFYICONDATA nid;                  NOTIFYICONDATA nid;
497                  ZeroMemory(&nid,sizeof(NOTIFYICONDATA));                  ZeroMemory(&nid,sizeof(NOTIFYICONDATA));
# Line 508  Line 503 
503                  Shell_NotifyIcon(NIM_DELETE, &nid);                  Shell_NotifyIcon(NIM_DELETE, &nid);
504                  Tray_Icon = 0;                  Tray_Icon = 0;
505          }          }
 #endif  
506    
507          /* Close xvidcore library */          /* Close xvidcore library */
508          CloseLib();          CloseLib();
# Line 935  Line 929 
929  {  {
930          DPRINTF("CompleteConnect");          DPRINTF("CompleteConnect");
931    
932  #ifdef XVID_USE_TRAYICON          if ((direction == PINDIR_OUTPUT) && (Tray_Icon == 0) && (g_config.bTrayIcon != 0))
         if ((direction == PINDIR_OUTPUT) && (Tray_Icon == 0))  
933          {          {
934                  WNDCLASSEX wc;                  WNDCLASSEX wc;
935    
# Line 948  Line 941 
941                  wc.hInstance = (HINSTANCE) g_xvid_hInst;                  wc.hInstance = (HINSTANCE) g_xvid_hInst;
942                  wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);                  wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);
943                  wc.lpszMenuName = NULL;                  wc.lpszMenuName = NULL;
944                  wc.lpszClassName = "XVID_MSG_WINDOW";                  wc.lpszClassName = TEXT("XVID_MSG_WINDOW");
945                  wc.hIcon = NULL;                  wc.hIcon = NULL;
946                  wc.hIconSm = NULL;                  wc.hIconSm = NULL;
947                  wc.hCursor = NULL;                  wc.hCursor = NULL;
948                  RegisterClassEx(&wc);                  RegisterClassEx(&wc);
949    
950                  MSG_hwnd = CreateWindowEx(0, "XVID_MSG_WINDOW", NULL, 0, CW_USEDEFAULT,                  MSG_hwnd = CreateWindowEx(0, TEXT("XVID_MSG_WINDOW"), NULL, 0, CW_USEDEFAULT,
951                                    CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL);                                    CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL);
952    
953                  /* display the tray icon */                  /* display the tray icon */
# Line 966  Line 959 
959                  nid.uID = 1456;                  nid.uID = 1456;
960                  nid.uCallbackMessage = WM_ICONMESSAGE;                  nid.uCallbackMessage = WM_ICONMESSAGE;
961                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));
962                  strcpy_s(nid.szTip, 19, "Xvid Video Decoder");                  lstrcpy(nid.szTip, TEXT("Xvid Video Decoder"));
963                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
964    
965                  Shell_NotifyIcon(NIM_ADD, &nid);                  Shell_NotifyIcon(NIM_ADD, &nid);
# Line 974  Line 967 
967                  DestroyIcon(nid.hIcon);                  DestroyIcon(nid.hIcon);
968                  Tray_Icon = 1;                  Tray_Icon = 1;
969          }          }
 #endif  
970    
971          return S_OK;          return S_OK;
972  }  }
# Line 1647  Line 1639 
1639                          hr = OnSetOutputType(pType);                          hr = OnSetOutputType(pType);
1640                  }                  }
1641          }          }
1642  #ifdef XVID_USE_TRAYICON  
1643          if (SUCCEEDED(hr) && Tray_Icon == 0) /* Create message passing window */          if (SUCCEEDED(hr) && (Tray_Icon == 0) && (g_config.bTrayIcon != 0)) /* Create message passing window */
1644          {          {
1645                  WNDCLASSEX wc;                  WNDCLASSEX wc;
1646    
# Line 1660  Line 1652 
1652                  wc.hInstance = (HINSTANCE) g_xvid_hInst;                  wc.hInstance = (HINSTANCE) g_xvid_hInst;
1653                  wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);                  wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);
1654                  wc.lpszMenuName = NULL;                  wc.lpszMenuName = NULL;
1655                  wc.lpszClassName = "XVID_MSG_WINDOW";                  wc.lpszClassName = TEXT("XVID_MSG_WINDOW");
1656                  wc.hIcon = NULL;                  wc.hIcon = NULL;
1657                  wc.hIconSm = NULL;                  wc.hIconSm = NULL;
1658                  wc.hCursor = NULL;                  wc.hCursor = NULL;
1659                  RegisterClassEx(&wc);                  RegisterClassEx(&wc);
1660    
1661                  MSG_hwnd = CreateWindowEx(0, "XVID_MSG_WINDOW", NULL, 0, CW_USEDEFAULT,                  MSG_hwnd = CreateWindowEx(0, TEXT("XVID_MSG_WINDOW"), NULL, 0, CW_USEDEFAULT,
1662                                    CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL);                                    CW_USEDEFAULT, 0, 0, HWND_MESSAGE, NULL, (HINSTANCE) g_xvid_hInst, NULL);
1663    
1664                  /* display the tray icon */                  /* display the tray icon */
# Line 1678  Line 1670 
1670                  nid.uID = 1456;                  nid.uID = 1456;
1671                  nid.uCallbackMessage = WM_ICONMESSAGE;                  nid.uCallbackMessage = WM_ICONMESSAGE;
1672                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));                  nid.hIcon = LoadIcon(g_xvid_hInst, MAKEINTRESOURCE(IDI_ICON));
1673                  strcpy_s(nid.szTip, 19, "Xvid Video Decoder");                  lstrcpy(nid.szTip, TEXT("Xvid Video Decoder"));
1674                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;                  nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
1675    
1676                  Shell_NotifyIcon(NIM_ADD, &nid);                  Shell_NotifyIcon(NIM_ADD, &nid);
# Line 1686  Line 1678 
1678                  DestroyIcon(nid.hIcon);                  DestroyIcon(nid.hIcon);
1679                  Tray_Icon = 1;                  Tray_Icon = 1;
1680          }          }
 #endif  
1681    
1682          LeaveCriticalSection(&m_mft_lock);          LeaveCriticalSection(&m_mft_lock);
1683          return hr;          return hr;
# Line 1907  Line 1898 
1898          EnterCriticalSection(&m_mft_lock);          EnterCriticalSection(&m_mft_lock);
1899    
1900          HRESULT hr = S_OK;          HRESULT hr = S_OK;
1901          IMFMediaBuffer *pBuffer;          IMFMediaBuffer *pBuffer = NULL;
1902    
1903          if (SUCCEEDED(hr)) {          if (SUCCEEDED(hr)) {
1904                  hr = pSample->ConvertToContiguousBuffer(&pBuffer);                  hr = pSample->ConvertToContiguousBuffer(&pBuffer);
# Line 2161  Line 2152 
2152          }          }
2153    
2154          if (m_hdll == NULL) {          if (m_hdll == NULL) {
2155                  HRESULT hr = OpenLib();                  HRESULT hr2 = OpenLib();
2156    
2157                  if (FAILED(hr) || (m_hdll == NULL)) // Paranoid checks.                  if (FAILED(hr2) || (m_hdll == NULL)) // Paranoid checks.
2158                          hr = MF_E_INVALIDTYPE;                          hr = MF_E_INVALIDTYPE;
2159          }          }
2160    

Legend:
Removed from v.2001  
changed lines
  Added in v.2022

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