[cvs] / xvidcore / dshow / src / CAbout.cpp Repository:
ViewVC logotype

Diff of /xvidcore/dshow/src/CAbout.cpp

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

revision 1.1, Sat Feb 22 08:22:03 2003 UTC revision 1.1.2.7, Fri Jan 30 03:21:20 2004 UTC
# Line 0  Line 1 
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.nDeblock_Y);
62            REG_SET_N("Deblock_UV", PPSettings.nDeblock_UV);
63            REG_SET_N("Dering", PPSettings.nDering);
64            REG_SET_N("FilmEffect", PPSettings.nFilmEffect);
65            REG_SET_N("ForceColorspace", PPSettings.nForceColorspace);
66            REG_SET_N("FlipVideo", PPSettings.nFlipVideo);
67            REG_SET_N("Supported_4CC",  supported_4cc);
68    
69            RegCloseKey(hKey);
70    }
71    
72    CUnknown * WINAPI CAbout::CreateInstance(LPUNKNOWN punk, HRESULT *phr)
73    {
74        CAbout * pNewObject = new CAbout(punk, phr);
75        if (pNewObject == NULL)
76            {
77            *phr = E_OUTOFMEMORY;
78        }
79        return pNewObject;
80    }
81    
82    
83    CAbout::CAbout(LPUNKNOWN pUnk, HRESULT * phr) :
84            CBasePropertyPage(NAME("CAbout"), pUnk, IDD_ABOUT, IDS_ABOUT)
85    {
86        ASSERT(phr);
87    }
88    
89    
90    CAbout::~CAbout()
91    {
92    }
93    
94    
95    BOOL CAbout::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
96    {
97            HWND hBrightness;
98            switch ( uMsg )
99            {
100            case WM_DESTROY:
101                    int nForceColorspace;
102                    nForceColorspace = SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_GETCURSEL, 0, 0);
103                    if ( PPSettings.nForceColorspace != nForceColorspace )
104                    {
105                            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);
106                    }
107                    PPSettings.nForceColorspace = nForceColorspace;
108                    SaveRegistryInfo();
109                    break;
110    
111            case WM_INITDIALOG:
112    
113                    // Load Force Colorspace Box
114                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"No Force");
115                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YV12");
116                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"YUY2");
117                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB24");
118                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_ADDSTRING, 0, (LPARAM)"RGB32");
119    
120                    // Select Colorspace
121                    SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0);
122    
123                    hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
124                    SendMessage(hBrightness, TBM_SETRANGE, (WPARAM) (BOOL) TRUE, (LPARAM) MAKELONG(0, 50));
125                    SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness);
126    
127                    // Load Buttons
128                    SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, PPSettings.nDeblock_Y, 0);
129                    SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, PPSettings.nDeblock_UV, 0);
130                    SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, PPSettings.nDering, 0);
131                    SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, PPSettings.nFilmEffect, 0);
132                    SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, PPSettings.nFlipVideo, 0);
133    
134                    // 4CC checkbuttons
135                    SendMessage(GetDlgItem(hwnd, IDC_DIVX), BM_SETCHECK, supported_4cc & SUPPORT_DIVX, 0);
136                    SendMessage(GetDlgItem(hwnd, IDC_DX50), BM_SETCHECK, supported_4cc & SUPPORT_DX50, 0);
137                    SendMessage(GetDlgItem(hwnd, IDC_MP4V), BM_SETCHECK, supported_4cc & SUPPORT_MP4V, 0);
138    
139                    // Set Date & Time of Compilation
140                    DPRINTF("(%s %s)", __DATE__, __TIME__);
141                    break;
142    
143            case WM_COMMAND:
144                    switch ( wParam )
145                    {
146                    case IDC_RESET:
147                            ZeroMemory(&PPSettings, sizeof(PostProcessing_Settings));
148                            PPSettings.nBrightness = 25;
149                            hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
150                            SendMessage(hBrightness, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM) PPSettings.nBrightness);
151                            // Load Buttons
152                            SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_Y), BM_SETCHECK, PPSettings.nDeblock_Y, 0);
153                            SendMessage(GetDlgItem(hwnd, IDC_DEBLOCK_UV), BM_SETCHECK, PPSettings.nDeblock_UV, 0);
154                            SendMessage(GetDlgItem(hwnd, IDC_DERING), BM_SETCHECK, PPSettings.nDering, 0);
155                            SendMessage(GetDlgItem(hwnd, IDC_FILMEFFECT), BM_SETCHECK, PPSettings.nFilmEffect, 0);
156                            SendMessage(GetDlgItem(hwnd, IDC_FLIPVIDEO), BM_SETCHECK, PPSettings.nFlipVideo, 0);
157                            PPSettings.nForceColorspace = 0;
158                            SendMessage(GetDlgItem(hwnd, IDC_COLORSPACE), CB_SETCURSEL, PPSettings.nForceColorspace, 0);
159                            SaveRegistryInfo();
160    
161                            break;
162                    case IDC_DEBLOCK_Y:
163                            PPSettings.nDeblock_Y = !PPSettings.nDeblock_Y;
164                            SaveRegistryInfo();
165                            break;
166                    case IDC_DEBLOCK_UV:
167                            PPSettings.nDeblock_UV = !PPSettings.nDeblock_UV;
168                            SaveRegistryInfo();
169                            break;
170                    case IDC_DERING:
171                            PPSettings.nDering = !PPSettings.nDering;
172                            SaveRegistryInfo();
173                            break;
174                    case IDC_FILMEFFECT:
175                            PPSettings.nFilmEffect = !PPSettings.nFilmEffect;
176                            SaveRegistryInfo();
177                            break;
178                    case IDC_FLIPVIDEO:
179                            PPSettings.nFlipVideo = !PPSettings.nFlipVideo;
180                            SaveRegistryInfo();
181                            break;
182                    case IDC_DIVX:
183                            supported_4cc ^= SUPPORT_DIVX;
184                            SaveRegistryInfo();
185                            break;
186                    case IDC_DX50:
187                            supported_4cc ^= SUPPORT_DX50;
188                            SaveRegistryInfo();
189                            break;
190                    case IDC_MP4V:
191                            supported_4cc ^= SUPPORT_MP4V;
192                            SaveRegistryInfo();
193                            break;
194                    }
195                    break;
196            case WM_NOTIFY:
197                    hBrightness = GetDlgItem(hwnd, IDC_BRIGHTNESS);
198                    PPSettings.nBrightness = SendMessage(hBrightness, TBM_GETPOS, NULL, NULL);
199                    SaveRegistryInfo();
200                    break;
201            }
202            return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam);
203    }
204    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.7

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