r22314 - trunk/TOOLS/vfw2menc.c
Author: compn Date: Thu Feb 22 20:03:36 2007 New Revision: 22314 Modified: trunk/TOOLS/vfw2menc.c Log: update to 0.1 version from website Modified: trunk/TOOLS/vfw2menc.c ============================================================================== --- trunk/TOOLS/vfw2menc.c (original) +++ trunk/TOOLS/vfw2menc.c Thu Feb 22 20:03:36 2007 @@ -20,14 +20,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/* On mingw compile with: gcc getopt.c vfw2menc.c -o vfw2menc.exe -lwinmm */ -/* Using wine: winegcc getopt.c vfw2menc.c -o vfw2menc -lwinmm */ +/* On mingw compile with: gcc getopt.c vfw2menc.c -o vfw2menc.exe -lwinmm -lole32 */ +/* Using wine: winegcc getopt.c vfw2menc.c -o vfw2menc -lwinmm -lole32 */ #ifdef _MSC_VER #define _CRT_SECURE_NO_DEPRECATE #pragma warning(disable: 4996) #endif +#define __VERSION__ "0.1" + #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> @@ -37,6 +39,17 @@ #define BAIL(msg) { printf("%s: %s\n", argv[0], msg); ret = -1; goto cleanup; } +typedef struct { + UINT uDriverSignature; + HINSTANCE hDriverModule; + DRIVERPROC DriverProc; + DWORD dwDriverID; +} DRVR; + +typedef DRVR *PDRVR; +typedef DRVR *NPDRVR; +typedef DRVR *LPDRVR; + enum { MODE_NONE = 0, @@ -138,7 +151,7 @@ void help(const char *progname) { - printf("VFW to mencoder - Copyright 2006 - Gianluigi Tiesi <sherpya@netfarm.it>\n"); + printf("VFW to mencoder v"__VERSION__" - Copyright 2007 - Gianluigi Tiesi <sherpya@netfarm.it>\n"); printf("This program is Free Software\n\n"); printf("Usage: %s\n", progname); printf(" -h|--help - displays this help\n"); @@ -157,13 +170,16 @@ printf("Usage with mencoder -ovc vfw -xvfwopts codec=vp6vfw.dll:compdata=settings.mcf\n"); } - int main(int argc, char *argv[]) { char *driver = NULL; char *fourcc = NULL; char *filename = NULL; unsigned char mode = 0; + DWORD dwFCC = 0; + ICOPEN icopen; + HRESULT coinit = S_FALSE; + /* ICINFO icinfo; */ wchar_t drvfile[MAX_PATH]; HDRVR hDriver = NULL; @@ -208,10 +224,11 @@ break; default: printf("Wrong arguments!\n"); + help(argv[0]); + goto cleanup; } } - if (!(argc == optind) && (mode != MODE_NONE) && driver && (filename || (mode == MODE_VIEW))) { @@ -222,12 +239,34 @@ if (!MultiByteToWideChar(CP_ACP, 0, driver, -1, drvfile, MAX_PATH)) BAIL("MultiByteToWideChar() failed\n"); - if (!(hDriver = OpenDriver(drvfile, 0, (fourcc) ? ((LPARAM) fourcc) : 0))) + if (fourcc) memcpy(&dwFCC, fourcc, 4); + memset(&icopen, 0, sizeof(icopen)); + + icopen.dwSize = sizeof(icopen); + icopen.fccType = ICTYPE_VIDEO; /* VIDC */ + icopen.fccHandler = dwFCC; + icopen.dwVersion = 0x00001000; /* FIXME */ + icopen.dwFlags = ICMODE_COMPRESS; + icopen.dwError = 0; + icopen.pV1Reserved = NULL; + icopen.pV2Reserved = NULL; + icopen.dnDevNode = -1; /* FIXME */ + + coinit = CoInitialize(NULL); + + if (!(hDriver = OpenDriver(drvfile, NULL, (LPARAM) &icopen))) BAIL("OpenDriver() failed\n"); + /* + memset(&icinfo, 0, sizeof(ICINFO)); + icinfo.dwSize = sizeof(ICINFO); + SendDriverMessage(hDriver, ICM_GETINFO, (LPARAM) &icinfo, sizeof(ICINFO)); + */ + if (SendDriverMessage(hDriver, ICM_CONFIGURE, -1, 0) != ICERR_OK) BAIL("The driver doesn't provide a configure dialog"); + switch(mode) { case MODE_CHECK: @@ -243,8 +282,11 @@ BAIL("Cannot save settings to file"); break; case MODE_VIEW: - if (SendDriverMessage(hDriver, ICM_CONFIGURE, 0, 0) != ICERR_OK) - BAIL("ICM_CONFIGURE failed"); + { + HWND hwnd = GetDesktopWindow(); + if (SendDriverMessage(hDriver, ICM_CONFIGURE, (LPARAM) hwnd, 0) != ICERR_OK) + BAIL("ICM_CONFIGURE failed"); + } break; default: BAIL("This should not happen :)"); @@ -255,5 +297,6 @@ if (fourcc) free(fourcc); if (filename) free(filename); if (hDriver) CloseDriver(hDriver, 0, 0); + if (coinit == S_OK) CoUninitialize(); return ret; }
Hello, On Thu, Feb 22, 2007 at 08:03:36PM +0100, compn wrote: [...]
+#define __VERSION__ "0.1" +
Recent discussions said that defines starting with __ are reserved and might cause compilation to fail, so could this please be avoided? Greetings, Reimar Döffinger
On Thu, 22 Feb 2007 20:25:09 +0100, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de> scribed:
Hello, On Thu, Feb 22, 2007 at 08:03:36PM +0100, compn wrote: [...]
+#define __VERSION__ "0.1" +
Recent discussions said that defines starting with __ are reserved and might cause compilation to fail, so could this please be avoided?
i've asked gianluigi if he could maintain this. if no one responds, i'll change this. it still compiles for me and the TOOLS dir is not part of the makefile... i'm still trying to find someone to build this with/without getopt.c on linux to see if that file is needed. -compn
Hello, On Fri, Feb 23, 2007 at 03:25:59PM -0500, Compn wrote:
On Thu, 22 Feb 2007 20:25:09 +0100, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de> scribed:
On Thu, Feb 22, 2007 at 08:03:36PM +0100, compn wrote: [...]
+#define __VERSION__ "0.1" +
Recent discussions said that defines starting with __ are reserved and might cause compilation to fail, so could this please be avoided?
i've asked gianluigi if he could maintain this.
if no one responds, i'll change this. it still compiles for me and the TOOLS dir is not part of the makefile...
i'm still trying to find someone to build this with/without getopt.c on linux to see if that file is needed.
Any news? Greetings, Reimar Döffinger
On Tue, 06 Mar 2007 12:29:00 +0100, Reimar Döffinger scribed:
Hello, On Fri, Feb 23, 2007 at 03:25:59PM -0500, Compn wrote:
On Thu, 22 Feb 2007 20:25:09 +0100, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de> scribed:
On Thu, Feb 22, 2007 at 08:03:36PM +0100, compn wrote: [...]
+#define __VERSION__ "0.1" +
Recent discussions said that defines starting with __ are reserved and might cause compilation to fail, so could this please be avoided?
i've asked gianluigi if he could maintain this.
if no one responds, i'll change this. it still compiles for me and the TOOLS dir is not part of the makefile...
i'm still trying to find someone to build this with/without getopt.c on linux to see if that file is needed.
Any news?
what should __VERSION__ be changed to ? just vf2menc_version ? i'm lacking programming skills... -compn
Hello, On Tue, Mar 06, 2007 at 07:47:34AM -0500, Compn wrote:
On Tue, 06 Mar 2007 12:29:00 +0100, Reimar Döffinger scribed:
On Fri, Feb 23, 2007 at 03:25:59PM -0500, Compn wrote:
On Thu, 22 Feb 2007 20:25:09 +0100, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de> scribed:
On Thu, Feb 22, 2007 at 08:03:36PM +0100, compn wrote: [...]
+#define __VERSION__ "0.1" +
Recent discussions said that defines starting with __ are reserved and might cause compilation to fail, so could this please be avoided?
i've asked gianluigi if he could maintain this.
if no one responds, i'll change this. it still compiles for me and the TOOLS dir is not part of the makefile...
i'm still trying to find someone to build this with/without getopt.c on linux to see if that file is needed.
Any news?
what should __VERSION__ be changed to ? just vf2menc_version ? i'm lacking programming skills...
Well, just VERSION would probably be okay, but I don't know why it had the underscores in the first place, maybe there is a reason (e.g. because of MSVC?). Greetings, Reimar Döffinger
On Tue, 06 Mar 2007 14:09:32 +0100, Reimar Döffinger scribed:
Hello, On Tue, Mar 06, 2007 at 07:47:34AM -0500, Compn wrote:
On Tue, 06 Mar 2007 12:29:00 +0100, Reimar Döffinger scribed:
On Fri, Feb 23, 2007 at 03:25:59PM -0500, Compn wrote:
On Thu, 22 Feb 2007 20:25:09 +0100, Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de> scribed:
On Thu, Feb 22, 2007 at 08:03:36PM +0100, compn wrote: [...]
+#define __VERSION__ "0.1" +
Recent discussions said that defines starting with __ are reserved and might cause compilation to fail, so could this please be avoided?
i've asked gianluigi if he could maintain this.
if no one responds, i'll change this. it still compiles for me and the TOOLS dir is not part of the makefile...
i'm still trying to find someone to build this with/without getopt.c on linux to see if that file is needed.
Any news?
what should __VERSION__ be changed to ? just vf2menc_version ? i'm lacking programming skills...
Well, just VERSION would probably be okay, but I don't know why it had the underscores in the first place, maybe there is a reason (e.g. because of MSVC?).
thanks, fixed. the author said he needed to change __VERSION__ anyways. -compn
participants (3)
-
compn -
Compn -
Reimar Döffinger