1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC - DShow Front End |
4 |
|
* - About Window - |
5 |
|
* |
6 |
|
* Copyright(C) 2002-2003 Peter Ross <pross@xvid.org> |
7 |
|
* |
8 |
|
* This program is free software ; you can redistribute it and/or modify |
9 |
|
* it under the terms of the GNU General Public License as published by |
10 |
|
* the Free Software Foundation ; either version 2 of the License, or |
11 |
|
* (at your option) any later version. |
12 |
|
* |
13 |
|
* This program is distributed in the hope that it will be useful, |
14 |
|
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
15 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
* GNU General Public License for more details. |
17 |
|
* |
18 |
|
* You should have received a copy of the GNU General Public License |
19 |
|
* along with this program ; if not, write to the Free Software |
20 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
|
* |
22 |
|
* $Id$ |
23 |
|
* |
24 |
|
****************************************************************************/ |
25 |
|
|
26 |
|
/**************************************************************************** |
27 |
|
* |
28 |
|
* 2003/12/11 - added some additional options, mainly to make the deblocking |
29 |
|
* code from xvidcore available. Most of the new code is taken |
30 |
|
* from Nic's dshow filter, (C) Nic, http://nic.dnsalias.com |
31 |
|
* |
32 |
|
****************************************************************************/ |
33 |
|
|
34 |
|
#include "CAbout.h" |
35 |
|
#include "resource.h" |
36 |
|
#include <commdlg.h> |
37 |
|
#include <commctrl.h> |
38 |
|
#include "CXvidDecoder.h" |
39 |
|
|
40 |
|
void SaveRegistryInfo() |
41 |
|
{ |
42 |
|
HKEY hKey; |
43 |
|
DWORD dispo; |
44 |
|
|
45 |
|
if (RegCreateKeyEx( |
46 |
|
XVID_REG_KEY, |
47 |
|
XVID_REG_SUBKEY, |
48 |
|
0, |
49 |
|
XVID_REG_CLASS, |
50 |
|
REG_OPTION_NON_VOLATILE, |
51 |
|
KEY_WRITE, |
52 |
|
0, |
53 |
|
&hKey, |
54 |
|
&dispo) != ERROR_SUCCESS) |
55 |
|
{ |
56 |
|
OutputDebugString("Couldn't create XVID_REG_SUBKEY"); |
57 |
|
return; |
58 |
|
} |
59 |
|
|
60 |
|
REG_SET_N("Brightness", PPSettings.nBrightness); |
61 |
|
REG_SET_N("Deblock_Y", PPSettings.bDeblock_Y); |
62 |
|
REG_SET_N("Deblock_UV", PPSettings.bDeblock_UV); |
63 |
|
REG_SET_N("Dering", PPSettings.bDering); |
64 |
|
REG_SET_N("FilmEffect", PPSettings.bFilmEffect); |
65 |
|
REG_SET_N("ForceColorspace", PPSettings.nForceColorspace); |
66 |
|
|
67 |
|
RegCloseKey(hKey); |
68 |
|
} |
69 |
|
|
70 |
|
CUnknown * WINAPI CAbout::CreateInstance(LPUNKNOWN punk, HRESULT *phr) |
71 |
|
{ |
72 |
|
CAbout * pNewObject = new CAbout(punk, phr); |
73 |
|
if (pNewObject == NULL) |
74 |
|
{ |
75 |
|
*phr = E_OUTOFMEMORY; |
76 |
|
} |
77 |
|
return pNewObject; |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
CAbout::CAbout(LPUNKNOWN pUnk, HRESULT * phr) : |
82 |
|
CBasePropertyPage(NAME("CAbout"), pUnk, IDD_ABOUT, IDS_ABOUT) |
83 |
|
{ |
84 |
|
ASSERT(phr); |
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
|
CAbout::~CAbout() |
89 |
|
{ |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
BOOL CAbout::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
94 |
|
{ |
95 |
|
HWND hBrightness; |
96 |
|
switch ( uMsg ) |
97 |
|
{ |
98 |
|
case WM_DESTROY: |
99 |
|
int nForceColorspace; |
100 |
|
nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
101 |
|
if ( PPSettings.nForceColorspace != nForceColorspace ) |
102 |
|
{ |
103 |
|
MessageBox(0, "You have changed the output colorspace.\r\nClose the movie and open it for the new colorspace to take effect.", "XviD DShow", 0); |
104 |
|
} |
105 |
|
PPSettings.nForceColorspace = nForceColorspace; |
106 |
|
SaveRegistryInfo(); |
107 |
|
break; |
108 |
|
|
109 |
|
case WM_INITDIALOG: |
110 |
|
|
111 |
|
// Load Force Colorspace Box |
112 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); |
113 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12"); |
114 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2"); |
115 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24"); |
116 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32"); |
117 |
|
|
118 |
|
// Select Colorspace |
119 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0); |
120 |
|
|
121 |
|
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
122 |
|
SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50)); |
123 |
|
SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness); |
124 |
|
|
125 |
|
// Load Buttons |
126 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, (BOOL)PPSettings.bDeblock_Y, 0); |
127 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, (BOOL)PPSettings.bDeblock_UV, 0); |
128 |
|
SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, (BOOL)PPSettings.bDering, 0); |
129 |
|
SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, (BOOL)PPSettings.bFilmEffect, 0); |
130 |
|
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, (BOOL)PPSettings.bFlipVideo, 0); |
131 |
|
|
132 |
|
// Set Date & Time of Compilation |
133 |
|
DPRINTF("(%s %s)", __DATE__, __TIME__); |
134 |
|
break; |
135 |
|
|
136 |
|
case WM_COMMAND: |
137 |
|
switch ( wParam ) |
138 |
|
{ |
139 |
|
case IDC_RESET: |
140 |
|
ZeroMemory(&PPSettings, sizeof(PostProcessing_Settings)); |
141 |
|
PPSettings.nBrightness = 25; |
142 |
|
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
143 |
|
SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness); |
144 |
|
// Load Buttons |
145 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, (BOOL)PPSettings.bDeblock_Y, 0); |
146 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, (BOOL)PPSettings.bDeblock_UV, 0); |
147 |
|
SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, (BOOL)PPSettings.bDering, 0); |
148 |
|
SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, (BOOL)PPSettings.bFilmEffect, 0); |
149 |
|
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, (BOOL)PPSettings.bFlipVideo, 0); |
150 |
|
PPSettings.nForceColorspace = 0; |
151 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0); |
152 |
|
SaveRegistryInfo(); |
153 |
|
|
154 |
|
break; |
155 |
|
case IDC_DEBLOCK_Y: |
156 |
|
PPSettings.bDeblock_Y = !PPSettings.bDeblock_Y; |
157 |
|
SaveRegistryInfo(); |
158 |
|
break; |
159 |
|
case IDC_DEBLOCK_UV: |
160 |
|
PPSettings.bDeblock_UV = !PPSettings.bDeblock_UV; |
161 |
|
SaveRegistryInfo(); |
162 |
|
break; |
163 |
|
case IDC_DERING: |
164 |
|
PPSettings.bDering = !PPSettings.bDering; |
165 |
|
SaveRegistryInfo(); |
166 |
|
break; |
167 |
|
case IDC_FILMEFFECT: |
168 |
|
PPSettings.bFilmEffect = !PPSettings.bFilmEffect; |
169 |
|
SaveRegistryInfo(); |
170 |
|
break; |
171 |
|
case IDC_FLIPVIDEO: |
172 |
|
PPSettings.bFlipVideo = !PPSettings.bFlipVideo; |
173 |
|
SaveRegistryInfo(); |
174 |
|
break; |
175 |
|
} |
176 |
|
break; |
177 |
|
case WM_NOTIFY: |
178 |
|
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
179 |
|
PPSettings.nBrightness = SendMessage(hBrightness, TBM_GETPOS, NULL, NULL); |
180 |
|
SaveRegistryInfo(); |
181 |
|
break; |
182 |
|
} |
183 |
|
return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam); |
184 |
|
} |