annotate TOOLS/vfw2menc.c @ 24176:f6afc9bab149

warning fix: pullup.c: In function 'decide_frame_length': pullup.c:569: warning: unused variable 'f3'
author diego
date Sat, 25 Aug 2007 17:15:05 +0000
parents fa2b5e300c5a
children 6704a924d4aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
1 /*
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
2 * VFW Compressor Settings Tool
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
3 *
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
4 * Copyright (c) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
5 *
22295
e980b665f469 add original website url per al3x comment
compn
parents: 22254
diff changeset
6 * Official Website : http://oss.netfarm.it/mplayer-win32.php
e980b665f469 add original website url per al3x comment
compn
parents: 22254
diff changeset
7 *
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or
22253
389c91ead5b6 Fix license header.
diego
parents: 22252
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
22253
389c91ead5b6 Fix license header.
diego
parents: 22252
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
12 *
22253
389c91ead5b6 Fix license header.
diego
parents: 22252
diff changeset
13 * This program is distributed in the hope that it will be useful,
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22253
389c91ead5b6 Fix license header.
diego
parents: 22252
diff changeset
16 * Lesser General Public License for more details.
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
17 *
22253
389c91ead5b6 Fix license header.
diego
parents: 22252
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
22254
c9aaf1f83588 10l copy and paste bug in the license header
diego
parents: 22253
diff changeset
19 * License along with this program; if not, write to the the Free Software
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
21 */
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
22
22439
56518bb5e79c getopt is only needed on msvc, remove from mingw/linux compile info
compn
parents: 22296
diff changeset
23 /* On MinGW compile with: gcc vfw2menc.c -o vfw2menc.exe -lwinmm -lole32 */
56518bb5e79c getopt is only needed on msvc, remove from mingw/linux compile info
compn
parents: 22296
diff changeset
24 /* Using Wine: winegcc vfw2menc.c -o vfw2menc -lwinmm -lole32 */
56518bb5e79c getopt is only needed on msvc, remove from mingw/linux compile info
compn
parents: 22296
diff changeset
25 /* MSVC requires getopt.c and getopt.h available at the original website */
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
26
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
27 #ifdef _MSC_VER
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
28 #define _CRT_SECURE_NO_DEPRECATE
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
29 #pragma warning(disable: 4996)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
30 #endif
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
31
22460
fa2b5e300c5a __defines are reserved for gcc
compn
parents: 22439
diff changeset
32 #define VERSION "0.1"
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
33
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
34 #include <stdio.h>
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
35 #include <stdlib.h>
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
36 #include <sys/stat.h>
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
37 #include <getopt.h>
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
38 #include <windows.h>
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
39 #include <vfw.h>
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
40
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
41 #define BAIL(msg) { printf("%s: %s\n", argv[0], msg); ret = -1; goto cleanup; }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
42
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
43 typedef struct {
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
44 UINT uDriverSignature;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
45 HINSTANCE hDriverModule;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
46 DRIVERPROC DriverProc;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
47 DWORD dwDriverID;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
48 } DRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
49
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
50 typedef DRVR *PDRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
51 typedef DRVR *NPDRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
52 typedef DRVR *LPDRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
53
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
54 enum
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
55 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
56 MODE_NONE = 0,
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
57 MODE_CHECK,
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
58 MODE_SAVE,
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
59 MODE_VIEW
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
60 };
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
61
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
62 int save_settings(HDRVR hDriver, const char *filename)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
63 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
64 FILE *fd = NULL;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
65 DWORD cb = (DWORD) SendDriverMessage(hDriver, ICM_GETSTATE, 0, 0);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
66 char *pv = NULL;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
67
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
68 if (!cb)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
69 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
70 printf("ICM_GETSTATE returned 0 size\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
71 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
72 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
73
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
74 pv = (char *) malloc(cb);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
75 if (SendDriverMessage(hDriver, ICM_GETSTATE, (LPARAM) pv, (LPARAM) &cb) != ICERR_OK)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
76 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
77 printf("ICM_GETSTATE failed\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
78 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
79 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
80 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
81
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
82 fd = fopen(filename, "wb");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
83 if (!fd)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
84 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
85 printf("Cannot open file %s for writing\n", filename);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
86 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
87 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
88 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
89
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
90 if (fwrite(pv, cb, 1, fd) != 1)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
91 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
92 printf("fwrite() failed on %s\n", filename);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
93 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
94 fclose(fd);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
95 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
96 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
97 fclose(fd);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
98 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
99 return 0;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
100 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
101
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
102 int load_settings(HDRVR hDriver, const char *filename)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
103 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
104 struct stat info;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
105 FILE *fd = NULL;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
106 char *pv;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
107
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
108 if (stat(filename, &info) < 0)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
109 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
110 printf("stat() on %s failed\n", filename);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
111 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
112 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
113
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
114 pv = (char *) malloc(info.st_size);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
115 fd = fopen(filename, "rb");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
116
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
117 if (!fd)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
118 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
119 printf("Cannot open file %s for reading\n", filename);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
120 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
121 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
122 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
123
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
124 if (fread(pv, info.st_size, 1, fd) != 1)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
125 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
126 printf("fread() failed on %s\n", filename);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
127 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
128 fclose(fd);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
129 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
130 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
131 fclose(fd);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
132 if (!SendDriverMessage(hDriver, ICM_SETSTATE, (LPARAM) pv, (LPARAM) info.st_size))
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
133 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
134 printf("ICM_SETSTATE failed\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
135 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
136 return -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
137 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
138 free(pv);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
139 return 0;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
140 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
141
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
142 static struct option long_options[] =
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
143 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
144 { "help", no_argument, NULL, 'h' },
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
145 { "driver", required_argument, NULL, 'd' },
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
146 { "fourcc", required_argument, NULL, 'f' },
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
147 { "save", required_argument, NULL, 's' },
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
148 { "check", required_argument, NULL, 'c' },
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
149 { "view", no_argument, NULL, 'v' },
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
150 { 0, 0, 0, 0 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
151 };
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
152
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
153 void help(const char *progname)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
154 {
22460
fa2b5e300c5a __defines are reserved for gcc
compn
parents: 22439
diff changeset
155 printf("VFW to mencoder v"VERSION" - Copyright 2007 - Gianluigi Tiesi <sherpya@netfarm.it>\n");
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
156 printf("This program is Free Software\n\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
157 printf("Usage: %s\n", progname);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
158 printf(" -h|--help - displays this help\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
159 printf(" -d|--driver filename - dll or drv to load\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
160 printf(" -f|--fourcc fourcc - fourcc of selected driver (look at codecs.conf)\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
161 printf(" -s|--save filename - save settings to file\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
162 printf(" -c|--check filename - load and show setting in filename\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
163 printf(" -v|--view - displays the config dialog and do nothing\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
164 printf("\nExamples:\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
165 printf(" %s -f VP62 -d vp6vfw.dll -s firstpass.mcf\n", progname);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
166 printf(" %s -f VP62 -d vp6vfw.dll -c firstpass.mcf\n", progname);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
167 printf(" %s -f VP62 -d vp6vfw.dll -v\n", progname);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
168 printf("\nIf the driver dialog doesn't work, you can try without specifing a fourcc,\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
169 printf("but the compdata file will not work with mencoder.\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
170 printf("Driver option is required and you must specify at least -s, -c -o -v\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
171 printf("Usage with mencoder -ovc vfw -xvfwopts codec=vp6vfw.dll:compdata=settings.mcf\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
172 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
173
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
174 int main(int argc, char *argv[])
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
175 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
176 char *driver = NULL;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
177 char *fourcc = NULL;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
178 char *filename = NULL;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
179 unsigned char mode = 0;
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
180 DWORD dwFCC = 0;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
181 ICOPEN icopen;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
182 HRESULT coinit = S_FALSE;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
183 /* ICINFO icinfo; */
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
184
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
185 wchar_t drvfile[MAX_PATH];
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
186 HDRVR hDriver = NULL;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
187 int ret = 0;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
188 int c = -1, long_options_index = -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
189
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
190 if (argc < 2)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
191 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
192 help(argv[0]);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
193 ret = -1;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
194 goto cleanup;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
195 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
196
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
197 while ((c = getopt_long(argc, argv, "hd:f:s:c:v", long_options, &long_options_index)) != -1)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
198 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
199 switch (c)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
200 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
201 case 'h':
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
202 help(argv[0]);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
203 ret = 0;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
204 goto cleanup;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
205 case 'd':
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
206 driver = strdup(optarg);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
207 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
208 case 'f':
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
209 fourcc = strdup(optarg);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
210 if (strlen(optarg) != 4) BAIL("Fourcc must be exactly 4 chars");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
211 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
212 case 's':
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
213 if (mode != MODE_NONE) BAIL("Incompatible arguments");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
214 filename = strdup(optarg);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
215 mode = MODE_SAVE;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
216 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
217 case 'c':
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
218 if (mode != MODE_NONE) BAIL("Incompatible arguments");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
219 filename = strdup(optarg);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
220 mode = MODE_CHECK;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
221 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
222 case 'v':
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
223 if (mode != MODE_NONE) BAIL("Incompatible arguments");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
224 mode = MODE_VIEW;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
225 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
226 default:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
227 printf("Wrong arguments!\n");
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
228 help(argv[0]);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
229 goto cleanup;
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
230 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
231 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
232
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
233 if (!(argc == optind) && (mode != MODE_NONE) &&
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
234 driver && (filename || (mode == MODE_VIEW)))
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
235 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
236 help(argv[0]);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
237 goto cleanup;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
238 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
239
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
240 if (!MultiByteToWideChar(CP_ACP, 0, driver, -1, drvfile, MAX_PATH))
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
241 BAIL("MultiByteToWideChar() failed\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
242
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
243 if (fourcc) memcpy(&dwFCC, fourcc, 4);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
244 memset(&icopen, 0, sizeof(icopen));
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
245
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
246 icopen.dwSize = sizeof(icopen);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
247 icopen.fccType = ICTYPE_VIDEO; /* VIDC */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
248 icopen.fccHandler = dwFCC;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
249 icopen.dwVersion = 0x00001000; /* FIXME */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
250 icopen.dwFlags = ICMODE_COMPRESS;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
251 icopen.dwError = 0;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
252 icopen.pV1Reserved = NULL;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
253 icopen.pV2Reserved = NULL;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
254 icopen.dnDevNode = -1; /* FIXME */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
255
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
256 coinit = CoInitialize(NULL);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
257
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
258 if (!(hDriver = OpenDriver(drvfile, NULL, (LPARAM) &icopen)))
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
259 BAIL("OpenDriver() failed\n");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
260
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
261 /*
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
262 memset(&icinfo, 0, sizeof(ICINFO));
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
263 icinfo.dwSize = sizeof(ICINFO);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
264 SendDriverMessage(hDriver, ICM_GETINFO, (LPARAM) &icinfo, sizeof(ICINFO));
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
265 */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
266
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
267 if (SendDriverMessage(hDriver, ICM_CONFIGURE, -1, 0) != ICERR_OK)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
268 BAIL("The driver doesn't provide a configure dialog");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
269
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
270
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
271 switch(mode)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
272 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
273 case MODE_CHECK:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
274 if (load_settings(hDriver, filename))
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
275 BAIL("Cannot load settings from file");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
276 if (SendDriverMessage(hDriver, ICM_CONFIGURE, 0, 0) != ICERR_OK)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
277 BAIL("ICM_CONFIGURE failed");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
278 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
279 case MODE_SAVE:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
280 if (SendDriverMessage(hDriver, ICM_CONFIGURE, 0, 0) != ICERR_OK)
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
281 BAIL("ICM_CONFIGURE failed");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
282 if (save_settings(hDriver, filename))
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
283 BAIL("Cannot save settings to file");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
284 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
285 case MODE_VIEW:
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
286 {
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
287 HWND hwnd = GetDesktopWindow();
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
288 if (SendDriverMessage(hDriver, ICM_CONFIGURE, (LPARAM) hwnd, 0) != ICERR_OK)
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
289 BAIL("ICM_CONFIGURE failed");
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
290 }
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
291 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
292 default:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
293 BAIL("This should not happen :)");
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
294 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
295
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
296 cleanup:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
297 if (driver) free(driver);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
298 if (fourcc) free(fourcc);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
299 if (filename) free(filename);
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
300 if (hDriver) CloseDriver(hDriver, 0, 0);
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
301 if (coinit == S_OK) CoUninitialize();
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
302 return ret;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
303 }