annotate TOOLS/vfw2menc.c @ 22420:db8714b9cdb7

First half-working avisynth audio support
author reimar
date Sun, 04 Mar 2007 12:52:16 +0000
parents 4d8cf8ec86e4
children 56518bb5e79c
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
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
23 /* On mingw compile with: gcc getopt.c vfw2menc.c -o vfw2menc.exe -lwinmm -lole32 */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
24 /* Using wine: winegcc getopt.c vfw2menc.c -o vfw2menc -lwinmm -lole32 */
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
25
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
26 #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
27 #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
28 #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
29 #endif
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
30
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
31 #define __VERSION__ "0.1"
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
32
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
33 #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
34 #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
35 #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
36 #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
37 #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
38 #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
39
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
40 #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
41
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
42 typedef struct {
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
43 UINT uDriverSignature;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
44 HINSTANCE hDriverModule;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
45 DRIVERPROC DriverProc;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
46 DWORD dwDriverID;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
47 } DRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
48
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
49 typedef DRVR *PDRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
50 typedef DRVR *NPDRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
51 typedef DRVR *LPDRVR;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
52
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
53 enum
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
54 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
55 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
56 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
57 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
58 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
59 };
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 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
62 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
63 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
64 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
65 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
66
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
67 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
68 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
69 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
70 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
71 }
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 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
74 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
75 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
76 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
77 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
78 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
79 }
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 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
82 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
83 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
84 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
85 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
86 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
87 }
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 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
90 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
91 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
92 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
93 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
94 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
95 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
96 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
97 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
98 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
99 }
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 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
102 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
103 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
104 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
105 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
106
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
107 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
108 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
109 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
110 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
111 }
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 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
114 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
115
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
116 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
117 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
118 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
119 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
120 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
121 }
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 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
124 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
125 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
126 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
127 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
128 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
129 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
130 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
131 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
132 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
133 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
134 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
135 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
136 }
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
137 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
138 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
139 }
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 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
142 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
143 { "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
144 { "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
145 { "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
146 { "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
147 { "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
148 { "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
149 { 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
150 };
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 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
153 {
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
154 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
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 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
171 }
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 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
174 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
175 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
176 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
177 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
178 unsigned char mode = 0;
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
179 DWORD dwFCC = 0;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
180 ICOPEN icopen;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
181 HRESULT coinit = S_FALSE;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
182 /* 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
183
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
184 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
185 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
186 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
187 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
188
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
189 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
190 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
191 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
192 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
193 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
194 }
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 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
197 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
198 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
199 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
200 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
201 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
202 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
203 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
204 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
205 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
206 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
207 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
208 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
209 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
210 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
211 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
212 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
213 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
214 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
215 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
216 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
217 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
218 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
219 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
220 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
221 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
222 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
223 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
224 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
225 default:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
226 printf("Wrong arguments!\n");
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
227 help(argv[0]);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
228 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
229 }
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 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
233 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
234 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
235 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
236 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
237 }
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 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
240 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
241
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
242 if (fourcc) memcpy(&dwFCC, fourcc, 4);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
243 memset(&icopen, 0, sizeof(icopen));
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
244
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
245 icopen.dwSize = sizeof(icopen);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
246 icopen.fccType = ICTYPE_VIDEO; /* VIDC */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
247 icopen.fccHandler = dwFCC;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
248 icopen.dwVersion = 0x00001000; /* FIXME */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
249 icopen.dwFlags = ICMODE_COMPRESS;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
250 icopen.dwError = 0;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
251 icopen.pV1Reserved = NULL;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
252 icopen.pV2Reserved = NULL;
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
253 icopen.dnDevNode = -1; /* FIXME */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
254
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
255 coinit = CoInitialize(NULL);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
256
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
257 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
258 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
259
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
260 /*
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
261 memset(&icinfo, 0, sizeof(ICINFO));
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
262 icinfo.dwSize = sizeof(ICINFO);
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
263 SendDriverMessage(hDriver, ICM_GETINFO, (LPARAM) &icinfo, sizeof(ICINFO));
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
264 */
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
265
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
266 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
267 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
268
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
269
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
270 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
271 {
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
272 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
273 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
274 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
275 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
276 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
277 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
278 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
279 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
280 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
281 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
282 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
283 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
284 case MODE_VIEW:
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
285 {
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
286 HWND hwnd = GetDesktopWindow();
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
287 if (SendDriverMessage(hDriver, ICM_CONFIGURE, (LPARAM) hwnd, 0) != ICERR_OK)
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
288 BAIL("ICM_CONFIGURE failed");
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
289 }
22252
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
290 break;
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
291 default:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
292 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
293 }
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 cleanup:
c5a591c4a372 Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff changeset
296 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
297 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
298 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
299 if (hDriver) CloseDriver(hDriver, 0, 0);
22296
4d8cf8ec86e4 update to 0.1 version from website
compn
parents: 22295
diff changeset
300 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
301 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
302 }