A Fast Bresenham Type Algorithm For Drawing Ellipses by John Kennedy
[xy_vsfilter.git] / src / apps / mplayerc / mplayerc.h
blobade97548db05f17d8c290a51dee35feefd426317
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #pragma once
24 #ifndef __AFXWIN_H__
25 #error include 'stdafx.h' before including this file for PCH
26 #endif
28 #include "resource.h" // main symbols
29 #include <afxadv.h>
30 #include <atlsync.h>
31 #include "..\..\subtitles\STS.h"
32 #include "MediaFormats.h"
33 #include "fakefiltermapper2.h"
35 #ifdef UNICODE
36 #define MPC_WND_CLASS_NAME L"MediaPlayerClassicW"
37 #else
38 #define MPC_WND_CLASS_NAME "MediaPlayerClassicA"
39 #endif
41 enum
43 WM_GRAPHNOTIFY = WM_APP+1,
44 WM_REARRANGERENDERLESS,
45 WM_RESUMEFROMSTATE
48 #define WM_MYMOUSELAST WM_XBUTTONDBLCLK
50 ///////////////
52 extern void CorrectComboListWidth(CComboBox& box, CFont* pWndFont);
53 extern HICON LoadIcon(CString fn, bool fSmall);
54 extern bool LoadType(CString fn, CString& type);
55 extern bool LoadResource(UINT resid, CStringA& str, LPCTSTR restype);
56 extern CString GetContentType(CString fn, CAtlList<CString>* redir = NULL);
58 /////////////////////////////////////////////////////////////////////////////
59 // CMPlayerCApp:
60 // See mplayerc.cpp for the implementation of this class
63 // flags for AppSettings::nCS
64 enum
66 CS_NONE=0,
67 CS_SEEKBAR=1,
68 CS_TOOLBAR=CS_SEEKBAR<<1,
69 CS_INFOBAR=CS_TOOLBAR<<1,
70 CS_STATSBAR=CS_INFOBAR<<1,
71 CS_STATUSBAR=CS_STATSBAR<<1,
72 CS_LAST=CS_STATUSBAR
75 enum
77 CLSW_NONE=0,
78 CLSW_OPEN=1,
79 CLSW_PLAY=CLSW_OPEN<<1,
80 CLSW_CLOSE=CLSW_PLAY<<1,
81 CLSW_STANDBY=CLSW_CLOSE<<1,
82 CLSW_HIBERNATE=CLSW_STANDBY<<1,
83 CLSW_SHUTDOWN=CLSW_HIBERNATE<<1,
84 CLSW_LOGOFF=CLSW_SHUTDOWN<<1,
85 CLSW_AFTERPLAYBACK_MASK=CLSW_CLOSE|CLSW_STANDBY|CLSW_SHUTDOWN|CLSW_HIBERNATE|CLSW_LOGOFF,
86 CLSW_FULLSCREEN=CLSW_LOGOFF<<1,
87 CLSW_NEW=CLSW_FULLSCREEN<<1,
88 CLSW_HELP=CLSW_NEW<<1,
89 CLSW_DVD=CLSW_HELP<<1,
90 CLSW_CD=CLSW_DVD<<1,
91 CLSW_ADD=CLSW_CD<<1,
92 CLSW_MINIMIZED=CLSW_ADD<<1,
93 CLSW_REGEXTVID=CLSW_MINIMIZED<<1,
94 CLSW_REGEXTAUD=CLSW_REGEXTVID<<1,
95 CLSW_UNREGEXT=CLSW_REGEXTAUD<<1,
96 CLSW_STARTVALID=CLSW_UNREGEXT<<2,
97 CLSW_NOFOCUS=CLSW_STARTVALID<<1,
98 CLSW_FIXEDSIZE=CLSW_NOFOCUS<<1,
99 CLSW_MONITOR=CLSW_FIXEDSIZE<<1,
100 CLSW_UNRECOGNIZEDSWITCH=CLSW_MONITOR<<1
103 enum
105 VIDRNDT_DS_DEFAULT,
106 VIDRNDT_DS_OLDRENDERER,
107 VIDRNDT_DS_OVERLAYMIXER,
108 VIDRNDT_DS_VMR7WINDOWED,
109 VIDRNDT_DS_VMR9WINDOWED,
110 VIDRNDT_DS_VMR7RENDERLESS,
111 VIDRNDT_DS_VMR9RENDERLESS,
112 VIDRNDT_DS_DXR,
113 VIDRNDT_DS_NULL_COMP,
114 VIDRNDT_DS_NULL_UNCOMP,
117 enum
119 VIDRNDT_RM_DEFAULT,
120 VIDRNDT_RM_DX7,
121 VIDRNDT_RM_DX9,
124 enum
126 VIDRNDT_QT_DEFAULT,
127 VIDRNDT_QT_DX7,
128 VIDRNDT_QT_DX9,
131 enum
133 VIDRNDT_AP_SURFACE,
134 VIDRNDT_AP_TEXTURE2D,
135 VIDRNDT_AP_TEXTURE3D,
138 #define AUDRNDT_NULL_COMP _T("Null Audio Renderer (Any)")
139 #define AUDRNDT_NULL_UNCOMP _T("Null Audio Renderer (Uncompressed)")
141 enum
143 SRC_CDDA=1,
144 SRC_CDXA=SRC_CDDA<<1,
145 SRC_VTS=SRC_CDXA<<1,
146 SRC_FLIC=SRC_VTS<<1,
147 SRC_D2V=SRC_FLIC<<1,
148 SRC_DTSAC3=SRC_D2V<<1,
149 SRC_MATROSKA=SRC_DTSAC3<<1,
150 SRC_SHOUTCAST=SRC_MATROSKA<<1,
151 SRC_REALMEDIA=SRC_SHOUTCAST<<1,
152 SRC_AVI=SRC_REALMEDIA<<1,
153 SRC_RADGT=SRC_AVI<<1,
154 SRC_ROQ=SRC_RADGT<<1,
155 SRC_OGG=SRC_ROQ<<1,
156 SRC_NUT=SRC_OGG<<1,
157 SRC_MPEG=SRC_NUT<<1,
158 SRC_DIRAC=SRC_MPEG<<1,
159 SRC_MPA=SRC_DIRAC<<1,
160 SRC_DSM=SRC_MPA<<1,
161 SRC_SUBS=SRC_DSM<<1,
162 SRC_MP4=SRC_SUBS<<1,
163 SRC_FLV=SRC_MP4<<1,
164 SRC_LAST=SRC_FLV<<1
167 enum
169 TRA_MPEG1=1,
170 TRA_MPEG2=TRA_MPEG1<<1,
171 TRA_RV=TRA_MPEG2<<1,
172 TRA_RA=TRA_RV<<1,
173 TRA_MPA=TRA_RA<<1,
174 TRA_LPCM=TRA_MPA<<1,
175 TRA_AC3=TRA_LPCM<<1,
176 TRA_DTS=TRA_AC3<<1,
177 TRA_AAC=TRA_DTS<<1,
178 TRA_PS2AUD=TRA_AAC<<1,
179 TRA_DIRAC=TRA_PS2AUD<<1,
180 TRA_VORBIS=TRA_DIRAC<<1,
181 TRA_LAST=TRA_VORBIS<<1,
184 enum
186 DVS_HALF,
187 DVS_NORMAL,
188 DVS_DOUBLE,
189 DVS_STRETCH,
190 DVS_FROMINSIDE,
191 DVS_FROMOUTSIDE
194 typedef enum
196 FAV_FILE,
197 FAV_DVD,
198 FAV_DEVICE
199 } favtype;
201 #pragma pack(push, 1)
202 typedef struct
204 bool fValid;
205 CSize size;
206 int bpp, freq;
207 } dispmode;
209 class wmcmd : public ACCEL
211 ACCEL backup;
212 UINT appcmdorg;
213 UINT mouseorg;
214 public:
215 CString name;
216 UINT appcmd;
217 enum {NONE,LDOWN,LUP,LDBLCLK,MDOWN,MUP,MDBLCLK,RDOWN,RUP,RDBLCLK,X1DOWN,X1UP,X1DBLCLK,X2DOWN,X2UP,X2DBLCLK,WUP,WDOWN,LAST};
218 UINT mouse;
219 CStringA rmcmd;
220 int rmrepcnt;
221 wmcmd(WORD cmd = 0) {this->cmd = cmd;}
222 wmcmd(WORD cmd, WORD key, BYTE fVirt, LPCTSTR name, UINT appcmd = 0, UINT mouse = NONE, LPCSTR rmcmd = "", int rmrepcnt = 5)
224 this->cmd = cmd;
225 this->key = key;
226 this->fVirt = fVirt;
227 this->appcmd = appcmdorg = appcmd;
228 this->name = name;
229 this->mouse = mouseorg = mouse;
230 this->rmcmd = rmcmd;
231 this->rmrepcnt = rmrepcnt;
232 backup = *this;
234 bool operator == (const wmcmd& wc) const
236 return(cmd > 0 && cmd == wc.cmd);
238 void Restore() {*(ACCEL*)this = backup; appcmd = appcmdorg; mouse = mouseorg; rmcmd.Empty(); rmrepcnt = 5;}
239 bool IsModified() {return(memcmp((const ACCEL*)this, &backup, sizeof(ACCEL)) || appcmd != appcmdorg || mouse != mouseorg || !rmcmd.IsEmpty() || rmrepcnt != 5);}
241 #pragma pack(pop)
243 #include <afxsock.h>
245 class CRemoteCtrlClient : public CAsyncSocket
247 protected:
248 CCritSec m_csLock;
249 CWnd* m_pWnd;
250 enum {DISCONNECTED, CONNECTED, CONNECTING} m_nStatus;
251 CString m_addr;
253 virtual void OnConnect(int nErrorCode);
254 virtual void OnClose(int nErrorCode);
255 virtual void OnReceive(int nErrorCode);
257 virtual void OnCommand(CStringA str) = 0;
259 void ExecuteCommand(CStringA cmd, int repcnt);
261 public:
262 CRemoteCtrlClient();
263 void SetHWND(HWND hWnd);
264 void Connect(CString addr);
265 int GetStatus() {return(m_nStatus);}
268 class CWinLircClient : public CRemoteCtrlClient
270 protected:
271 virtual void OnCommand(CStringA str);
273 public:
274 CWinLircClient();
277 class CUIceClient : public CRemoteCtrlClient
279 protected:
280 virtual void OnCommand(CStringA str);
282 public:
283 CUIceClient();
286 extern void GetCurDispMode(dispmode& dm);
287 extern bool GetDispMode(int i, dispmode& dm);
288 extern void SetDispMode(dispmode& dm);
290 class CMPlayerCApp : public CWinApp
292 ATL::CMutex m_mutexOneInstance;
294 CAtlList<CString> m_cmdln;
295 void PreProcessCommandLine();
296 void SendCommandLine(HWND hWnd);
298 public:
299 CMPlayerCApp();
301 void ShowCmdlnSwitches();
303 bool StoreSettingsToIni();
304 bool StoreSettingsToRegistry();
305 CString GetIniPath();
306 bool IsIniValid();
308 bool GetAppDataPath(CString& path);
310 static bool IsVistaOrAbove();
311 static bool IsVSFilterInstalled();
313 // Overrides
314 // ClassWizard generated virtual function overrides
315 //{{AFX_VIRTUAL(CMPlayerCApp)
316 public:
317 virtual BOOL InitInstance();
318 virtual int ExitInstance();
319 //}}AFX_VIRTUAL
321 // Implementation
323 class Settings
325 friend class CMPlayerCApp;
327 bool fInitialized;
329 class CRecentFileAndURLList : public CRecentFileList
331 public:
332 CRecentFileAndURLList(UINT nStart, LPCTSTR lpszSection,
333 LPCTSTR lpszEntryFormat, int nSize,
334 int nMaxDispLen = AFX_ABBREV_FILENAME_LEN);
336 virtual void Add(LPCTSTR lpszPathName); // we have to override CRecentFileList::Add because the original version can't handle URLs
339 public:
340 // cmdline params
341 int nCLSwitches;
342 CAtlList<CString> slFiles, slDubs, slSubs, slFilters;
343 __int64 rtStart;
344 CSize fixedWindowSize;
345 bool HasFixedWindowSize() {return fixedWindowSize.cx > 0 || fixedWindowSize.cy > 0;}
346 // int iFixedWidth, iFixedHeight;
347 int iMonitor;
349 void ParseCommandLine(CAtlList<CString>& cmdln);
351 bool fXpOrBetter;
352 int iDXVer;
354 int nCS;
355 bool fHideCaptionMenu;
356 int iDefaultVideoSize;
357 bool fKeepAspectRatio;
358 bool fCompMonDeskARDiff;
360 CRecentFileAndURLList MRU;
361 CRecentFileAndURLList MRUDub;
363 CAutoPtrList<FilterOverride> filters;
365 int iDSVideoRendererType;
366 int iRMVideoRendererType;
367 int iQTVideoRendererType;
368 int iAPSurfaceUsage;
369 bool fVMRSyncFix;
370 int iDX9Resizer;
371 bool fVMR9MixerMode;
372 bool fVMR9MixerYUV;
374 int nVolume;
375 int nBalance;
376 bool fMute;
377 int nLoops;
378 bool fLoopForever;
379 bool fRewind;
380 int iZoomLevel;
381 // int iVideoRendererType;
382 CStringW AudioRendererDisplayName;
383 bool fAutoloadAudio;
384 bool fAutoloadSubtitles;
385 bool fBlockVSFilter;
386 bool fEnableWorkerThreadForOpening;
387 bool fReportFailedPins;
389 bool fAllowMultipleInst;
390 int iTitleBarTextStyle;
391 bool fTitleBarTextTitle;
392 int iOnTop;
393 bool fTrayIcon;
394 bool fRememberZoomLevel;
395 bool fShowBarsWhenFullScreen;
396 int nShowBarsWhenFullScreenTimeOut;
397 dispmode dmFullscreenRes;
398 bool fExitFullScreenAtTheEnd;
399 bool fRememberWindowPos;
400 bool fRememberWindowSize;
401 bool fSnapToDesktopEdges;
402 CRect rcLastWindowPos;
403 UINT lastWindowType;
404 CSize AspectRatio;
405 bool fKeepHistory;
407 CString sDVDPath;
408 bool fUseDVDPath;
409 LCID idMenuLang, idAudioLang, idSubtitlesLang;
410 bool fAutoSpeakerConf;
412 STSStyle subdefstyle;
413 bool fOverridePlacement;
414 int nHorPos, nVerPos;
415 int nSPCSize;
416 int nSPCMaxRes;
417 int nSubDelayInterval;
418 bool fSPCPow2Tex;
419 bool fEnableSubtitles;
421 bool fDisabeXPToolbars;
422 bool fUseWMASFReader;
423 int nJumpDistS;
424 int nJumpDistM;
425 int nJumpDistL;
426 bool fFreeWindowResizing;
427 bool fNotifyMSN;
428 bool fNotifyGTSdll;
430 bool fEnableAudioSwitcher;
431 bool fDownSampleTo441;
432 bool fAudioTimeShift;
433 int tAudioTimeShift;
434 bool fCustomChannelMapping;
435 DWORD pSpeakerToChannelMap[18][18];
436 bool fAudioNormalize;
437 bool fAudioNormalizeRecover;
438 float AudioBoost;
440 bool fIntRealMedia;
441 // bool fRealMediaRenderless;
442 int iQuickTimeRenderer;
443 float RealMediaQuickTimeFPS;
445 CStringArray m_pnspresets;
447 CList<wmcmd> wmcmds;
448 HACCEL hAccel;
450 bool fWinLirc;
451 CString WinLircAddr;
452 CWinLircClient WinLircClient;
453 bool fUIce;
454 CString UIceAddr;
455 CUIceClient UIceClient;
457 CMediaFormats Formats;
459 UINT SrcFilters, TraFilters;
461 CString logofn;
462 UINT logoid;
463 bool logoext;
465 bool fHideCDROMsSubMenu;
467 DWORD priority;
468 bool launchfullscreen;
470 BOOL fEnableWebServer;
471 int nWebServerPort;
472 bool fWebServerPrintDebugInfo;
473 bool fWebServerUseCompression;
474 bool fWebServerLocalhostOnly;
475 CString WebRoot, WebDefIndex;
476 CString WebServerCGI;
478 CString SnapShotPath, SnapShotExt;
479 int ThumbRows, ThumbCols, ThumbWidth;
481 CString ISDb;
483 struct Shader {CString label, target, srcdata;};
484 CAtlList<Shader> m_shaders;
485 CString m_shadercombine;
487 CString strShaderList;
489 public:
490 Settings();
491 virtual ~Settings();
492 void UpdateData(bool fSave);
494 void GetFav(favtype ft, CAtlList<CString>& sl);
495 void SetFav(favtype ft, CAtlList<CString>& sl);
496 void AddFav(favtype ft, CString s);
497 } m_s;
499 public:
500 DECLARE_MESSAGE_MAP()
501 afx_msg void OnAppAbout();
502 afx_msg void OnFileExit();
503 afx_msg void OnHelpShowcommandlineswitches();
506 #define AfxGetMyApp() ((CMPlayerCApp*)AfxGetApp())
507 #define AfxGetAppSettings() ((CMPlayerCApp*)AfxGetApp())->m_s
508 #define AppSettings CMPlayerCApp::Settings