Mercurial > mplayer.hg
annotate TOOLS/vfw2menc.c @ 34737:57e2929317bf
Fix -vo bl with slices.
Patch by Stefan Schuermans {stefan blinkenarea org}
author | reimar |
---|---|
date | Sat, 24 Mar 2012 19:07:26 +0000 |
parents | 8fa2f43cb760 |
children |
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 | 6 * Official Website : http://oss.netfarm.it/mplayer-win32.php |
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 | 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 | 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 | 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 | 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 | 18 * You should have received a copy of the GNU Lesser General Public |
22254 | 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 | 32 #define VERSION "0.1" |
22296 | 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> |
26579
647abf37a825
Add missing string.h #include to fix a bunch of implicit declaration warnings.
diego
parents:
26575
diff
changeset
|
36 #include <string.h> |
22252
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 <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
|
38 #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
|
39 #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
|
40 #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
|
41 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
42 #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
|
43 |
22296 | 44 typedef struct { |
45 UINT uDriverSignature; | |
46 HINSTANCE hDriverModule; | |
47 DRIVERPROC DriverProc; | |
48 DWORD dwDriverID; | |
49 } DRVR; | |
50 | |
51 typedef DRVR *PDRVR; | |
52 typedef DRVR *NPDRVR; | |
53 typedef DRVR *LPDRVR; | |
54 | |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
55 enum |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
56 { |
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_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
|
58 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
|
59 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
|
60 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
|
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 |
26575
1ca484e74f18
Mark all functions that are only used within the file as static.
diego
parents:
24769
diff
changeset
|
63 static int save_settings(HDRVR hDriver, const char *filename) |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
64 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
65 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
|
66 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
|
67 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
|
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 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
|
70 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
71 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
|
72 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
|
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 |
30702 | 75 pv = malloc(cb); |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
76 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
|
77 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
78 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
|
79 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
|
80 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
83 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
|
84 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
|
85 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
86 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
|
87 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
|
88 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
91 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
|
92 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
93 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
|
94 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
|
95 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
|
96 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
|
97 } |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
98 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
|
99 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
|
100 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
|
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 |
26575
1ca484e74f18
Mark all functions that are only used within the file as static.
diego
parents:
24769
diff
changeset
|
103 static int load_settings(HDRVR hDriver, const char *filename) |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
104 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
105 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
|
106 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
|
107 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
|
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 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
|
110 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
111 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
|
112 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
|
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 |
30702 | 115 pv = malloc(info.st_size); |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
116 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
|
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 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
|
119 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
120 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
|
121 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
|
122 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
125 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
|
126 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
127 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
|
128 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
|
129 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
|
130 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
|
131 } |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
132 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
|
133 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
|
134 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
135 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
|
136 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
|
137 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
|
138 } |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
139 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
|
140 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
143 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
|
144 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
145 { "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
|
146 { "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
|
147 { "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
|
148 { "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
|
149 { "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
|
150 { "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
|
151 { 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
|
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 |
26575
1ca484e74f18
Mark all functions that are only used within the file as static.
diego
parents:
24769
diff
changeset
|
154 static void help(const char *progname) |
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 { |
22460 | 156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
175 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
|
176 { |
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 *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
|
178 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
|
179 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
|
180 unsigned char mode = 0; |
22296 | 181 DWORD dwFCC = 0; |
182 ICOPEN icopen; | |
24769 | 183 HRESULT coinit = -1; |
22296 | 184 /* 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
|
185 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 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
|
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 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
|
192 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
193 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
|
194 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
|
195 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
198 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
|
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 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
|
201 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
202 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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
209 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
|
210 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
|
211 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
|
212 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 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
|
217 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
218 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
|
219 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
|
220 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
|
221 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
|
222 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
227 default: |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
228 printf("Wrong arguments!\n"); |
22296 | 229 help(argv[0]); |
230 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
234 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
|
235 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
|
236 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
237 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
|
238 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
241 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
|
242 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
|
243 |
22296 | 244 if (fourcc) memcpy(&dwFCC, fourcc, 4); |
245 memset(&icopen, 0, sizeof(icopen)); | |
246 | |
247 icopen.dwSize = sizeof(icopen); | |
248 icopen.fccType = ICTYPE_VIDEO; /* VIDC */ | |
249 icopen.fccHandler = dwFCC; | |
250 icopen.dwVersion = 0x00001000; /* FIXME */ | |
251 icopen.dwFlags = ICMODE_COMPRESS; | |
252 icopen.dwError = 0; | |
253 icopen.pV1Reserved = NULL; | |
254 icopen.pV2Reserved = NULL; | |
255 icopen.dnDevNode = -1; /* FIXME */ | |
256 | |
257 coinit = CoInitialize(NULL); | |
258 | |
259 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
|
260 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
|
261 |
22296 | 262 /* |
263 memset(&icinfo, 0, sizeof(ICINFO)); | |
264 icinfo.dwSize = sizeof(ICINFO); | |
265 SendDriverMessage(hDriver, ICM_GETINFO, (LPARAM) &icinfo, sizeof(ICINFO)); | |
266 */ | |
267 | |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
268 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
|
269 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
|
270 |
22296 | 271 |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
272 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
|
273 { |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
274 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
|
275 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
|
276 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
|
277 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
|
278 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
|
279 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
280 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
|
281 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
|
282 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
|
283 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
|
284 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
|
285 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
286 case MODE_VIEW: |
22296 | 287 { |
288 HWND hwnd = GetDesktopWindow(); | |
289 if (SendDriverMessage(hDriver, ICM_CONFIGURE, (LPARAM) hwnd, 0) != ICERR_OK) | |
290 BAIL("ICM_CONFIGURE failed"); | |
291 } | |
22252
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
292 break; |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
293 default: |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
294 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
|
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 |
c5a591c4a372
Controllable quality setting of VFW enconding, through the dumped state of the dialog box. Patch by Gianluigi Tiesi
alex
parents:
diff
changeset
|
297 cleanup: |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
30702
diff
changeset
|
298 free(driver); |
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
30702
diff
changeset
|
299 free(fourcc); |
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
30702
diff
changeset
|
300 free(filename); |
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 if (hDriver) CloseDriver(hDriver, 0, 0); |
24576
6704a924d4aa
According to MSDN a thread must call CoUninitialize once for each successful
diego
parents:
22460
diff
changeset
|
302 if ((coinit == S_OK) || coinit == S_FALSE) 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
|
303 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
|
304 } |