1 |
/************************************************************************** |
/***************************************************************************** |
2 |
* |
* |
3 |
* XVID DIRECTSHOW FRONTEND -- about-box |
* XVID MPEG-4 VIDEO CODEC - DShow Front End |
4 |
* Copyright (c) 2002 Peter Ross <pross@xvid.org> |
* - 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 |
* 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 |
* it under the terms of the GNU General Public License as published by |
17 |
* |
* |
18 |
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* 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" |
#include "CAbout.h" |
35 |
#include "resource.h" |
#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("ForceColorspace", PPSettings.nForceColorspace); |
64 |
|
|
65 |
|
RegCloseKey(hKey); |
66 |
|
} |
67 |
|
|
68 |
CUnknown * WINAPI CAbout::CreateInstance(LPUNKNOWN punk, HRESULT *phr) |
CUnknown * WINAPI CAbout::CreateInstance(LPUNKNOWN punk, HRESULT *phr) |
69 |
{ |
{ |
90 |
|
|
91 |
BOOL CAbout::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CAbout::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
92 |
{ |
{ |
93 |
|
HWND hBrightness; |
94 |
|
switch ( uMsg ) |
95 |
|
{ |
96 |
|
case WM_DESTROY: |
97 |
|
int nForceColorspace; |
98 |
|
nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0); |
99 |
|
if ( PPSettings.nForceColorspace != nForceColorspace ) |
100 |
|
{ |
101 |
|
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); |
102 |
|
} |
103 |
|
PPSettings.nForceColorspace = nForceColorspace; |
104 |
|
SaveRegistryInfo(); |
105 |
|
break; |
106 |
|
|
107 |
|
case WM_INITDIALOG: |
108 |
|
|
109 |
|
// Load Force Colorspace Box |
110 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force"); |
111 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12"); |
112 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2"); |
113 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24"); |
114 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32"); |
115 |
|
|
116 |
|
// Select Colorspace |
117 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0); |
118 |
|
|
119 |
|
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
120 |
|
SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50)); |
121 |
|
SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness); |
122 |
|
|
123 |
|
// Load Buttons |
124 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, (BOOL)PPSettings.bDeblock_Y, 0); |
125 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, (BOOL)PPSettings.bDeblock_UV, 0); |
126 |
|
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, (BOOL)PPSettings.bFlipVideo, 0); |
127 |
|
|
128 |
|
// Set Date & Time of Compilation |
129 |
|
DPRINTF("(%s %s)", __DATE__, __TIME__); |
130 |
|
break; |
131 |
|
|
132 |
|
case WM_COMMAND: |
133 |
|
switch ( wParam ) |
134 |
|
{ |
135 |
|
case IDC_RESET: |
136 |
|
ZeroMemory(&PPSettings, sizeof(PostProcessing_Settings)); |
137 |
|
PPSettings.nBrightness = 25; |
138 |
|
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
139 |
|
SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness); |
140 |
|
// Load Buttons |
141 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, (BOOL)PPSettings.bDeblock_Y, 0); |
142 |
|
SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, (BOOL)PPSettings.bDeblock_UV, 0); |
143 |
|
SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, (BOOL)PPSettings.bFlipVideo, 0); |
144 |
|
PPSettings.nForceColorspace = 0; |
145 |
|
SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0); |
146 |
|
SaveRegistryInfo(); |
147 |
|
|
148 |
|
break; |
149 |
|
case IDC_DEBLOCK_Y: |
150 |
|
PPSettings.bDeblock_Y = !PPSettings.bDeblock_Y; |
151 |
|
SaveRegistryInfo(); |
152 |
|
break; |
153 |
|
case IDC_DEBLOCK_UV: |
154 |
|
PPSettings.bDeblock_UV = !PPSettings.bDeblock_UV; |
155 |
|
SaveRegistryInfo(); |
156 |
|
break; |
157 |
|
case IDC_FLIPVIDEO: |
158 |
|
PPSettings.bFlipVideo = !PPSettings.bFlipVideo; |
159 |
|
SaveRegistryInfo(); |
160 |
|
break; |
161 |
|
} |
162 |
|
break; |
163 |
|
case WM_NOTIFY: |
164 |
|
hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS); |
165 |
|
PPSettings.nBrightness = SendMessage(hBrightness, TBM_GETPOS, NULL, NULL); |
166 |
|
SaveRegistryInfo(); |
167 |
|
break; |
168 |
|
} |
169 |
return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam); |
return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam); |
170 |
} |
} |